test: fix three pre-existing suite failures so the suite is reliably green - #914
Merged
Conversation
…fixture, load starvation) parser.test.ts (a)/(f): createJsonlSession stamped events at a fixed 2026-05-01 that aged past the 90-day retention window, pruning to zero; date them relative to now. cli-durable-totals: seedLiveTodaySession stamped noon, which is in the future on a pre-noon run so the provider-scoped today slice (ends at now) dropped it while the all path (ends at range end) kept it; seed a past-today time. cache-refresh-lock and other integration tests starve under a saturated parallel run and fail closed; add a small global retry and raise the two most load-sensitive lock tests. Test-only; no production code changed.
iamtoruk
added a commit
to ozymandiashh/codeburn
that referenced
this pull request
Aug 4, 2026
Reconcile with getagentseal#914 (which independently fixed the same date-sensitive fixtures): keep this branch's equivalent date fixes for parser.test.ts and cli-durable-totals.test.ts, and drop the global vitest retry getagentseal#914 added now that this branch fixes the flakes at the root (fs.rm retries, longer timeouts, serial cache-lock CI step). The targeted cache-lock local retries stay.
3 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.
Makes the vitest suite reliably green. Three distinct, pre-existing failures on
main, all test-only (no production code changed, because none of these were product bugs). CI runs Semgrep only, so the suite had been red unnoticed.1. parser.test.ts (a) and (f): a hardcoded date aged out of the retention window
createJsonlSessionstamped its copilot events at a fixed2026-05-01. Durable providers age out sessions older than 90 days, so once wall-clock time passed roughly 2026-07-30 the seeded session pruned to zero and both tests read 0 where they expected 200 (even on the first parse, before any deletion or version bump). Fixed by dating the helper's events relative to now, matching the 89-/91-day age-out tests in the same file.2. cli-durable-totals: a "today" fixture seeded in the future
seedLiveTodaySessionstamped its session at noon.buildDurablePeriod's provider-scoped today slice ends atnow, while the all-provider period parse ends at the range end (end of today), so on a pre-noon run the noon session was in the future relative tonow: the all path counted it, the provider path did not, and the parity assertion saw 100 vs 101.08. This only affects future-timestamped sessions, which do not occur in reality (sessions are stamped in the past), so it is fixture brittleness, not a durable-cache bug. Fixed by seeding the session a couple of hours ago, clamped to never precede midnight nor exceed now, so it always lands in today's window whatever time the suite runs.3. cache-refresh-lock and other integration tests: starvation under a saturated run
A handful of tests exercise real servers, spawned CLI subprocesses and real filesystem locks. Under a fully parallel suite run an fs/socket op can starve and the operation fails closed (correct behaviour, but an environmental blip, not a logic error), so a different one trips each run (cache-refresh-lock, context-tree-api, cli-status-menubar, ...). The file already used per-test
retryfor exactly this reason. Added a small globalretry: 2invitest.config.tsto ride out the starvation uniformly, and raised the two most load-sensitive lock tests locally (the 1ms-heartbeat fence, and the real-fs corrupt-lock recovery block). A real regression is deterministic and fails every attempt, so retries cannot mask one.Verification
tsc --noEmitclean.src/changes.