Repository navigation
test: deterministic seam for bounded-read growth paths (HACK-1483) - #108
Conversation
…ACK-1483) Replace real file growth (hook-driven appends and a detached appending process) in the growth-path tests with injectable chunk-reader seams in loadVerifiedAuditReport, AuditSourceTracker, and setupCodexPlugin. The test reader reports one byte past EOF on the trailing sentinel read while the file stays unchanged, so only the growth branch can reject it and each test asserts that exact error. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. Swish! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
🎉 This PR is included in version 2.33.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Resolves HACK-1483. Follow-up to #97.
Problem
On
main, four bounded-read growth-path tests relied on real file growth during the read:report-persistence-adversarial.test.ts("growing files with bounded reads") and twosource-provenance.test.tscases appended to the file from abefore*ReadChunkhook. The append also changes size/mtime, so the metadata drift check could reject first. The tests accepted either message, so they never proved the growth branch ran.manage.test.ts("grows around bounded reads") spawned a detached process that appended in a loop while the reader ran. It accepted either the per-file error or the later "tree hash differs" fallback, because the outcome depended on timing.Seam
Each bounded reader now takes an injectable chunk reader, marked
@internal. The default behaves exactly as before:loadVerifiedAuditReport({ readEnvelopeChunk }),AuditEnvelopeChunkReader, sync andreadSync-shapednew AuditSourceTracker({ readFileChunk }),AuditFileChunkReader, used byreadandcaptureTreesetupCodexPlugin({ readPluginPayloadChunk }),CodexPluginPayloadChunkReader, passed intohashStrictDirectoryTreeThe tests pass real reads through, but report one extra byte on the trailing end-of-file read while the file stays unchanged. Only the growth check can reject that. Each test asserts:
The detached mutator process and its ready/stop files are gone.
Verification
bun test src/audit/report-persistence-adversarial.test.ts src/audit/source-provenance.test.ts src/manage.test.ts -t "growing|grows around bounded reads"gave 20 pass, 0 fail.if (false && …)), and every matching test failed:report-persistence.ts: the load resolved instead of rejecting.source-provenance.ts: both tests' reads resolved instead of rejecting.manage.ts: the error fell through to "installed tree hash differs". The old test accepted that error, so it would have passed this mutation.test/setup.ts, which points HOME, XDG_* and TMPDIR at a temp root. They write nothing outside it and never touch the host fclt runtime or AI index../scripts/test-safe.sh, run by the pre-commit hook, passed 1357/1357.bun run type-checkandbun run checkare clean.Note: on a heavily loaded host, the full suite often fails random unrelated subprocess tests on the 5s per-test timeout.
mainwithout this change failed the same way. Those failures are unrelated to this PR.@codex review
🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need.