SSE/WebSocket live score push for background enrichment #1
Labels
No labels
accessibility
backlog
bug
cloud
enhancement
feature
infra
paid-tier
ux
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: Circuit-Forge/snipe#1
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
Background seller enrichment (BTF
/itm/scrape +_ssncategory scrape + Shopping API age lookup) runs after each search in a daemon thread. Enriched data only appears on re-search — users see signal dots greyed out with "↻ Updating: age, categories" and have no way to get updated scores without manually repeating the search.Proposed Solution
Add a Server-Sent Events (SSE) endpoint:
GET /api/search/updates?query=...that streams trust score updates as background enrichment completes.Backend
_trigger_scraper_enrichmentemits events via an asyncioQueueas each seller enrichesdata: {listing_id, trust_score}JSON eventsFrontend
useSearchStoreopens SSE connection after search completestrust_scoreupdates intotrustScoresmap reactivelyListingCardupdate live without re-searchTier Gate
Free tier — this is a UX improvement for the existing data pipeline, not a new paid feature.
Alternatives Considered
GET /api/search/status?query=...every 5s): simpler but wastes requestsNotes
Currently mitigated by: signal dots on trust badge show which signals are pending, hover tooltip says "search again to update", score badge pulses while partial.
SSE live score push is fully implemented and working end-to-end:
/api/updates/{session_id}streams re-scored trust scores from the background enrichment thread via SimpleQueue → async generatorEventSourceafter search if any scores are partial and a session_id is presentevent: doneor after 90s timeoutClosing as shipped.
Implemented in feature/near-term-ux: SSE enrichment streaming via
_update_queues+GET /api/updates/{session_id}. Async search (#49) extends this to stream initial listings too.