Skip to content

fix realtime-stats test breaking on every scheduled snapshot refresh - #1

Open
Kajko25 wants to merge 1 commit into
AxisAIOrg:mainfrom
Kajko25:fix-stats-test-drift
Open

fix realtime-stats test breaking on every scheduled snapshot refresh#1
Kajko25 wants to merge 1 commit into
AxisAIOrg:mainfrom
Kajko25:fix-stats-test-drift

Conversation

@Kajko25

@Kajko25 Kajko25 commented Jul 27, 2026

Copy link
Copy Markdown

tests/realtime-stats.test.js asserts frozen values against data/realtime-stats.json, which the scheduled workflow rewrites roughly every two hours. The test is red on main right now:

assert.equal(value.totals.tasks, 1822);
      actual: 1950
    expected: 1822

Why nobody has seen it yet. data/realtime-stats.json is listed in the trigger paths for checks.yml, but every commit touching it since 2026-07-24 has come from github-actions[bot] (chore(stats): refresh snapshot …), and pushes made with the default GITHUB_TOKEN deliberately do not start new workflow runs. So the refresh job keeps invalidating the assertion while the check that would catch it never fires — the last checks.yml run was 2026-07-24. The first human PR touching index.html, style.css, realtime-stats.js or tests/** 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_daily block is present in the payload itself, so those two assertions were really checking that parseSnapshot maps snake_casecamelCase correctly, not that the numbers are any particular value. They now derive from checkedInPayload, so they keep failing if the mapping breaks and stop failing when the bot simply refreshes the snapshot.

The formatTasksDailyRate assertion 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:

  • before: 1 failactual: 1950, expected: 1822
  • after: tests 15 · pass 15 · fail 0

One 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.

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