Deferred non-blocking finding from the round-2 review of #683 (LLP 0204). Filed at the maintainer's request so #683 can merge; lands with it.
The gap
#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_MS window, un-seeding every session whose first exchange landed in it. The fix makes scanCommittedSessionIds return undefined on a discovery failure, distinct from the empty Set a genuine empty scan returns:
hypaware-core/plugins-workspace/ai-gateway/src/message_projector.js:408
} catch (err) {
log?.warn?.('aigw.session_index_scan_failed', { ... })
return undefined // <- the fix
}
That fix has zero regression coverage. Reverting return undefined to return ids, which re-introduces exactly the defect the review found, leaves the entire suite green:
npm test with the fix reverted -> 3857 pass / 0 fail
The existing "a throwing storage degrades to not-seeded" test passes either way, because it only asserts that rows are not dropped, never that the index retries rather than trusting a failed build. Behaviour added in response to a review finding should be pinned, or it silently regresses.
The fix
Add a regression test in test/plugins/ai-gateway-message-projector.test.js:
- storage whose
discoverCachePartitions throws on call 1 and succeeds afterwards
- project one exchange, then project a second for a different session
- assert the second projection rebuilds the index rather than trusting the failed build (count
discoverCachePartitions calls, or assert the per-session fallback scan runs)
Gate
The test must fail against return ids and pass against return undefined. Verify that both ways round before opening the PR; a test that passes in both directions does not close this issue.
Deferred non-blocking finding from the round-2 review of #683 (LLP 0204). Filed at the maintainer's request so #683 can merge; lands with it.
The gap
#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, distinct from the emptySeta genuine empty scan returns:hypaware-core/plugins-workspace/ai-gateway/src/message_projector.js:408That fix has zero regression coverage. Reverting
return undefinedtoreturn ids, which re-introduces exactly the defect the review found, leaves the entire suite green:The existing "a throwing storage degrades to not-seeded" test passes either way, because it only asserts that rows are not dropped, never that the index retries rather than trusting a failed build. Behaviour added in response to a review finding should be pinned, or it silently regresses.
The fix
Add a regression test in
test/plugins/ai-gateway-message-projector.test.js:discoverCachePartitionsthrows on call 1 and succeeds afterwardsdiscoverCachePartitionscalls, or assert the per-session fallback scan runs)Gate
The test must fail against
return idsand pass againstreturn undefined. Verify that both ways round before opening the PR; a test that passes in both directions does not close this issue.