You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
tests: two 'today' tests fail when the run crosses local midnight (store PracticedToday, demo-home ledger) #196
Found verifying dev855dc0c0: a make check run that straddled local midnight (finished 2026-09-01 00:21 EDT) failed two tests that pass 3/3 immediately afterwards and passed on the previous tip an hour earlier:
internal/store TestPracticedTodayCountsARunningRound (notebook_test.go, the PracticedToday family that "totals WALL CLOCK … and clamps to the day")
cmd/aforge-demo-home TestTheDemoHomeFillsEveryPlace (the seeder builds a fourteen-day spending ledger relative to now)
Both read the real clock for "today"; a run that starts before midnight and asserts after it sees a different day than the one it seeded. A nightly CI run is exactly the run most likely to cross midnight.
The mechanism
The code under test takes its clock from one injectable source (the store already has patterns for this — find the now seam and use it), and the tests pin a fixed instant well inside a day rather than reading time.Now().
Where a test deliberately exercises the day boundary, it does so with a chosen instant on both sides, not by luck.
Acceptance
Both tests pass with the process clock forced to 23:59:59 and to 00:00:01 local (a faketime-style injection in the test, or a loop over both instants).
No test in internal/store or cmd/aforge-demo-home derives "today" from the real clock; a grep in the PR body shows the remaining time.Now() calls in those test files and why each is safe.
Drafted with CodeAF · reviewed and owned by the author
Activity
tests: measure the thing, not the machine — four load- and midnight-o…
tests: measure the thing, not the machine — four load- and midnight-o…