Home's clear-out countdown was asserting on the clock (#727) #755
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/home-countdown-flake"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
A one-line test fix, with its reasoning, because it turned a green tree red on an unrelated PR and would have kept doing it.
What happened
Home.test.jsx's bin fixture setpurge_atto exactlyDate.now() + 5 days + 3 hours, evaluated once, when the module loads. The page then reads the clock floored to the minute (useMinute,Home.jsx:80) andgap()floors again to whole hours.So
"gone for good in 5 days, 3 hours"was true only while the render happened in the same minute the fixture was built. The moment the suite crossed a minute boundary on its way to that test — which depends on nothing but where in the minute the run started and how long the preceding thirty tests took — the remaining gap became5d 2h 59mand the text became "5 days, 2 hours".It did exactly that on #754, a backend-only PR, while the identical frontend code was green on
mainin run 10208. That is what a flaky test looks like from the outside: a red job on a change that cannot have caused it, and a re-run that probably goes green.The fix
A 30-minute cushion on the fixture, so the floored hour is the same answer for any drift this suite could plausibly have.
Nothing is loosened. The assertion still names the exact words — the point of the test is that the countdown says the right thing, and a test that matched
/gone for good/would stop checking the thing it exists to check.The sibling fixture at line 96 has an hour of slack and an assertion that reads only the days, so it is not exposed; I looked rather than assuming.
Checks
npx vitest run src/pages/Home.test.jsxinnode:24-alpine: 31 passed.🤖 Generated with Claude Code