Uh oh!
There was an error while loading. Please reload this page.
Pin the committed-session-index failed-build fallback with a regression test - #688
Conversation
…on test (#684) A failed `scanCommittedSessionIds` build returns `undefined`, distinct from the empty Set a genuine empty scan returns, so `mightHaveCommittedRows` errs toward the per-session seed scan and the failed build clears itself instead of standing in as "no committed rows" for the whole rebuild window. That fix had no coverage: reverting `return undefined` to `return ids` left the suite green. The new test drives a storage whose `discoverCachePartitions` throws on call 1 and succeeds after, and asserts both halves of the fallback: the failing build falls through to the per-session scan, and the next session rebuilds the index rather than trusting the failed one, so its already-committed row is seeded and deduped instead of re-emitted as a duplicate. Co-Authored-By: Claude <noreply@anthropic.com>
philcunliffe
commented
Aug 9, 2026
Neutral review round: PR #688 (issue #684)Verdict: APPROVE. No actionable findings. Coverage-only, one test added, no source touched. The test is a real gate, deterministic, and consistent with LLP 0204. What I checkedFull diff ( The gate the issue demanded (mutation-verified, both ways round)Issue #684 required the test to fail against
Both halves of the fallback are pinned, and in each case the new test is the sole survivor-killer: no pre-existing test moved. That is exactly the gap #684 described ("reverting the fix left the suite green"). DeterminismNo flake surface. Specifically:
Does it assert the right behaviour, or merely pass?The right behaviour. It is not a vacuous "did not throw" assertion (which is precisely what the existing test at
Design-doc consistencyNothing locked in that the docs contradict. LLP 0204 ConventionsClean. No semicolons in the added block, no U+2014 anywhere in the diff (grepped), no TypeScript, no inline Nits (recorded, NOT acted on)
Checks run
Nothing was changed or pushed. Reviewed in a detached worktree at |
Uh oh!
There was an error while loading. Please reload this page.
Both sides appended a new test at the same point in test/plugins/ai-gateway-message-projector.test.js: - master (#688) added 'committed-session index: a build that could not scan is not cached as "no committed rows"' - this branch added 'seed failure: a storage that breaks its discover contract loses no rows and does not poison the session memo' The tests cover different defects and neither is redundant, so both are kept. master's test is placed first, directly after the test its own comment refers to ('a throwing storage degrades to not-seeded'). message_projector.js merged without conflict: #689 reworked rebuild() in the committed-session index, this branch changed seedSeenMessagesForSession and scanCommittedMessageIds, and the regions are disjoint. Co-Authored-By: Claude <noreply@anthropic.com>
What was uncovered
#683's round-1 review found that a failed committed-session-index build was cached as "no committed rows" for the full
SESSION_INDEX_REBUILD_MSwindow, un-seeding every session whose first exchange landed in it. The fix makesscanCommittedSessionIdsreturnundefinedon a discovery failure (message_projector.js:408), distinct from the emptySeta genuine empty scan returns, somightHaveCommittedRowserrs toward the per-session seed scan and the failed build clears itself out ofbuiltrather than standing in as authoritative.That fix had zero coverage. The existing
restart replay: a throwing storage degrades to not-seeded and never drops rowstest passes either way, because it only asserts rows are not dropped, never that the index retries rather than trusting a failed build.The new test
test/plugins/ai-gateway-message-projector.test.js->committed-session index: a build that could not scan is not cached as "no committed rows"A storage whose
discoverCachePartitionsthrows on call 1 (the index build) and succeeds afterwards, holding one committed row forsess-committed. One listener, two projections:sess-fresh(no committed rows): asserts the row is still emitted, and thatdiscoverCachePartitionswas called twice, i.e. the failed build fell through to the per-session scan instead of skipping it.sess-committed(already committed), same rebuild window: asserts the index is rebuilt (call 3) and the session scans its own committed rows (call 4), so the committed row is seeded and deduped rather than re-emitted as a duplicate.No source change: this is a coverage-only PR.
Evidence that it genuinely exercises the fallback
Broke the fallback in place by reverting
return undefinedtoreturn idsinscanCommittedSessionIds, exactly the defect round 1 found:The second, behavioural half was confirmed separately (same broken source, with the call-count assert neutralised in a scratch copy so execution reaches it):
So the broken code re-emits a duplicate
part_idrow for the committed session, which is the defect itself, not just a call-count difference.Restoring
return undefined:Verification
npm test: 3858 pass / 0 fail / 6 skipped, exit 0.npm run typecheck: clean, exit 0.Fixes#684