Repository navigation
fix: send readers only the alerts they can act on - #4
Merged
Merged
Conversation
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>
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.
alerts.jsoncarried 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_ALERTSin 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. Thegpvside 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.jsonnow carries every incident still open or still to come, plus anything resolved in the lastFEED_RESOLVED_DAYS(30) days.endsAt, notstartsAt, so an incident scheduled for next week still reaches readers before its window opens.MAX_FEED_ALERTSmirrors 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.htmland 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:
tmp-scheduled,obs-33-background-input,tmp-recent-resolvedWith 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(alertsFileSchemaandparseAlertsFile), and validates with no issues.🤖 Generated with Claude Code