Skip to content

test: fix three pre-existing suite failures so the suite is reliably green - #914

Merged
iamtoruk merged 1 commit into
mainfrom
fix/green-suite
Aug 4, 2026
Merged

test: fix three pre-existing suite failures so the suite is reliably green#914
iamtoruk merged 1 commit into
mainfrom
fix/green-suite

Conversation

@iamtoruk

@iamtoruk iamtoruk commented Aug 4, 2026

Copy link
Copy Markdown
Member

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

createJsonlSession stamped its copilot events at a fixed 2026-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

seedLiveTodaySession stamped its session at noon. buildDurablePeriod's provider-scoped today slice ends at now, 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 to now: 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 retry for exactly this reason. Added a small global retry: 2 in vitest.config.ts to 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 --noEmit clean.
  • Full suite run three times consecutively: 2690 passed, 0 failed, 5 skipped each time.
  • Test-only diff; zero src/ changes.

…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
iamtoruk merged commit 0bd8863 into main Aug 4, 2026
3 checks passed
@iamtoruk
iamtoruk deleted the fix/green-suite branch August 4, 2026 09:45
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.
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