Skip to content

fix: send readers only the alerts they can act on - #4

Merged
mrmcpowned merged 1 commit into
mainfrom
fix/trim-alerts-feed
Oct 27, 2026
Merged

mrmcpowned merged 1 commit into
mainfrom
fix/trim-alerts-feed

Conversation

@mrmcpowned

Copy link
Copy Markdown
Member

alerts.json carried every announcement ever written. Nothing that reads it shows a resolved incident — the dashboard and the overlay both check the window themselves — so the file every reader downloads grew with the archive for no one's benefit.

It would also have broken outright. MAX_ALERTS in the readers' schema is 50, and the whole file was validated as one array, so the 51st incident ever written would have failed it and taken every alert down with it. The gpv side now reads the feed entry by entry, which turns that into a truncation; this stops the file growing into it in the first place.

What changed

  • alerts.json now carries every incident still open or still to come, plus anything resolved in the last FEED_RESOLVED_DAYS (30) days.
  • The filter looks at endsAt, not startsAt, so an incident scheduled for next week still reaches readers before its window opens.
  • MAX_FEED_ALERTS mirrors the readers' cap. Past it the build warns and sends the newest 50 rather than failing, because that is not a moment to refuse to publish.
  • index.html and the per-incident pages are untouched: they keep the full history.

Verified

Seeded three throwaway announcements — one resolved in January, one resolved last week, one scheduled for 5 November — and built:

  • feed: tmp-scheduled, obs-33-background-input, tmp-recent-resolved
  • index page: all four, including the January one

With 55 open incidents the build warns 58 incidents are open or recent, over the 50 a reader will take. Sending the newest 50. and writes 50. The fixtures were removed afterwards.

The generated feed was also parsed against the real schema in gpv (alertsFileSchema and parseAlertsFile), and validates with no issues.

🤖 Generated with Claude Code

alerts.json carried every announcement ever written, so the file every
dashboard and overlay downloads grew with the archive while none of them
shows a resolved incident. Past 50 entries it would have stopped working
altogether: that is the cap the readers' schema enforces.

The feed is now everything open or still to come plus anything resolved in
the last 30 days, filtered on the end rather than the start so a scheduled
incident still reaches readers before its window opens. The index page is
untouched and keeps the whole history.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@mrmcpowned
mrmcpowned merged commit e7441b5 into main Oct 27, 2026
1 check passed
@mrmcpowned
mrmcpowned deleted the fix/trim-alerts-feed branch October 27, 2026 07:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant