Repository navigation
test(history): corrupt the health index through a cold connection - #8000
Conversation
The routing-health case read the index before corrupting it and relied on PRAGMA shrink_memory to evict the cached pages. macOS's system SQLite kept them, so the read after corruption was served from cache (macOS 2/4 of lane=all run 41056253802, after #7995). Reopen the index after the pre-check so the corruption lands on a connection that has not cached it, like the other corruption cases.
|
✅ Deterministic PR hygiene checks passed. |
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Reopen the index before corruption setup tests/usage/request-history-integrity.test.ts:426-430 |
The test closes and reopens the request-history index before corruption setup. Comments note that some SQLite builds may retain cached pages after shrink_memory. |
Priority:
Estimated code review effort: 1 (Trivial) | ~3 minutes
Change: Bug fix
Merge Risk: 
Minimal · up to 53ff3
-
The test now exercises corruption through a fresh connection without disrupting its recovery checks.
Pre-merge checks: 
5
-
Full details: Docstring Coverage
-
Explanation
No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 1 files.
-
Finishing Touches
-
📝 Generate docstrings
-
- Commit to this branch
- Create a new PR
🧪 Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands.
|
Maintainer integration (lane L1, cross-platform CI). Squash-merging into dev under the maintainer-integration exception in MAINTAINERS.md. This records the decision; it is not a self-approval. Exact head: |
Summary
Fixes the macOS failure that remained after #7995:
request-history integrity lifecycle (#7966) > routing health marks query corruption for repair and recovers current historical evidencestill failed on macOS 2/4 of lane=all run 41056253802 (devd9e0c0578, which includes #7995), attests/usage/request-history-integrity.test.ts:429. As before, it expected{}and received live evidence.This corrects #7995's diagnosis. Planner choice was not what kept macOS from seeing the corruption. The difference is that this case is the only corruption case that reads through the same connection before corrupting. The pre-check
healthEvidenceForCandidate(input).sampleCount === 1pulls the index pages into that connection's page cache. The helper then overwrites the index root page on disk and relies onPRAGMA shrink_memoryto evict those cached pages. SQLite doesn't detect a raw file write, so if the build keeps the pages cached, the next read is served from the cache. That happened on macOS, where Bun uses the system SQLite. Every corruption case that passes on macOS corrupts a connection that has not yet read the index.The test now closes and reopens the index after the pre-check, so it corrupts through a fresh connection, the same way the other cases do. The assertions are unchanged. The EXPLAIN-based index selection from #7995 stays: it is harmless and still guards against a planner difference.
Verification
PRAGMA shrink_memoryreplaced by a no-op to mimic a build that keeps the pages cached, the previous body fails with the CI signature (- Expected -1 / + Received +6) and the new body passes.bun test tests/usage/request-history-integrity.test.tson Windows: 20 pass / 0 fail.lane=alldispatch on dev after merge confirms it. Full local suite not run: the host is shared with other lanes.Checklist
Summary by CodeRabbit