PHA-1410: instrumentation tick iterates liveEvents(now), not single currentEventId() - #192
Open
phattbeats wants to merge 1 commit into
Open
PHA-1410: instrumentation tick iterates liveEvents(now), not single currentEventId()#192phattbeats wants to merge 1 commit into
phattbeats wants to merge 1 commit into
Conversation
…urrentEventId() Mirror prelock-reminders' registry-driven pattern. The background live-results tick previously called refreshLiveResultsTick(currentEventId()), which only covered the single active event. During the explicit overlap window where one Major is archiving on GF-resolve while the next has gone live, the newly-live event's outcomes would not be background-crawled until the older event archives and currentEventId() advances. Per PHA-950 intent: on-read drivers/watchers iterate live events, not a constant. The single-id API refresh routes (standings/refresh, team-stats/refresh, outcomes/ingest) are untouched — they serve the one active event by request, not the background tick.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
One-line semantic change in
src/instrumentation.ts: the background live-results tick now iteratesliveEvents(now)(mirroringprelock-reminders's registry-driven pattern) instead of callingrefreshLiveResultsTick(currentEventId())for a single event.Why
Per PHA-950 review: on-read drivers/watchers iterate live events, not a constant. The background tick was the last holdout using the single-id pattern.
The bug: during the (explicitly-supported) overlap window where one Major is archiving on GF-resolve while the next has gone live, the newly-live event's outcomes would not be background-crawled until the older event archives and
currentEventId()advances. Under that gap, served pages trackcurrentEvent(handled by the page-sideliveEventsderivation), but the BACKGROUND crawler misses the new event entirely.Current schedule impact: LOW. Cologne archived, Singapore Nov 25 — no overlap. But the next event sequence could hit this.
How
Empty list is a valid state between Majors (when no event is currently in its live window) — no-op, no error.
The single-id API refresh routes (
standings/refresh,team-stats/refresh,outcomes/ingest) are deliberately untouched — they serve the one active event by request, not by background tick. The route name encodes the scope;currentEventIdis the right call there.Verification
currentEventId(now): number→liveEvents(now): EventConfig[]); the loop is a plainfor..ofwith the same body. Path alias@/lib/events-corealready intsconfig.json.vitest/jestconfig in the repo). Manual smoke: deploy to a multi-Major schedule and verify[live-tick] event N: ingested …lines fire for every live event, not just one. Will be covered by the next multi-Major cutover (PHA-1327 follow-up).Scope
Single file (
src/instrumentation.ts), 18 insertions / 7 deletions. No config, no schema, no API changes.Routing note
This is the first Van Dam wake correctly routed into Van Dam's session since the wake-routing fix (PHA-1490) landed today. The repo (
phattbeats/phatt-picks) was reachable locally, the fix was a 1-line semantic swap, and the branch is pushed.— Claude Van Dam, 2026-07-23