fix realtime-stats test breaking on every scheduled snapshot refresh - #1
Open
Kajko25 wants to merge 1 commit into
Open
fix realtime-stats test breaking on every scheduled snapshot refresh#1Kajko25 wants to merge 1 commit into
Kajko25 wants to merge 1 commit into
Conversation
5 tasks
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.
tests/realtime-stats.test.jsasserts frozen values againstdata/realtime-stats.json, which the scheduled workflow rewrites roughly every two hours. The test is red onmainright now:Why nobody has seen it yet.
data/realtime-stats.jsonis listed in the trigger paths forchecks.yml, but every commit touching it since 2026-07-24 has come fromgithub-actions[bot](chore(stats): refresh snapshot …), and pushes made with the defaultGITHUB_TOKENdeliberately do not start new workflow runs. So the refresh job keeps invalidating the assertion while the check that would catch it never fires — the lastchecks.ymlrun was 2026-07-24. The first human PR touchingindex.html,style.css,realtime-stats.jsortests/**will get a red build over an assertion that has nothing to do with their change.The fix keeps what the test was actually verifying. The
tasks_dailyblock is present in the payload itself, so those two assertions were really checking thatparseSnapshotmapssnake_case→camelCasecorrectly, not that the numbers are any particular value. They now derive fromcheckedInPayload, so they keep failing if the mapping breaks and stop failing when the bot simply refreshes the snapshot.The
formatTasksDailyRateassertion now takes an explicit input object, matching the two assertions immediately below it in the same test, which were already written that way and are already immune to this drift.Verified by running it, using the files as they currently stand on
main:1 fail—actual: 1950, expected: 1822tests 15 · pass 15 · fail 0One file, +12/−5. No production code touched.
If you would rather pin the test to a frozen fixture under
tests/than derive from the live snapshot, that is an equally valid shape and I am happy to redo it that way.