Repository navigation
fix(attachments): Partition the acquired bucket instead of certifying unchecked claims - #5378
Conversation
`acquisition_status = 'acquired'` is a positive claim about durable state, not a measurement of it. Two routes still took it, or wrote it, on trust: - `scan_attachment_coverage` skipped an `acquired` row with a NULL `blob_hash` outright, so an acquisition claim with nothing to check it against counted as covered and left `ok` true. The `attachment-coverage` gate then reported "all 1 acquired attachment(s) have bytes and a live attachment reference" for an archive where it had checked nothing, while `corpus-attachment-fidelity` blocked on the same row. - `_surviving_blob_ref` gated the re-bind on `exists` -- "a file sits at that path" -- and then wrote `acquired`. A published object whose content no longer hashes to the recorded identity re-asserted acquisition of content the archive no longer held, with no provider request. The coverage report now partitions the `acquired` bucket into corroborated, contradicted and unverifiable terms rather than collapsing any of them into a boolean, and the re-bind re-hashes the object it binds: a contradicted survivor is reported and falls through to the provider, which either republishes real bytes or terminates the row `unavailable`. Measured at head before the change (synthetic, three acquired rows -- one with bytes, one with a hash the store lacks, one with no hash): `acquired_count=3, acquired_reachable_count=3, acquired_missing_blob_count=1` with the hashless row invisible; and a corrupted survivor re-bound to `acquired` with `byte_count=32` for a 31-byte object hashing to a different digest. Refs polylogue-o0uw5 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01ToWqpkXotr573DiQex5vcy
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. |
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Advanced Run ID: 📒 Files selected for processing (6)
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review. 📜 Recent review details🔇 Additional comments (6)
📝 WalkthroughWalkthroughChangesAttachment coverage now counts hashless acquired attachments as unverifiable debt. Convergence verifies retained blob contents before rebinding and retries provider acquisition when verification fails. Attachment evidence verification
Priority: ⬇️ Low Estimated code review effort: 3 (Moderate) | ~20 minutes Change: Bug fix · Severity of issue fixed: Low Sequence Diagram(s)sequenceDiagram
participant converge_drive_attachments
participant _surviving_blob_ref
participant BlobStore
participant Provider
converge_drive_attachments->>_surviving_blob_ref: probe retained attachment
_surviving_blob_ref->>BlobStore: verify recorded blob hash
BlobStore-->>_surviving_blob_ref: valid or contradicted content
_surviving_blob_ref->>Provider: fetch when verification fails
Provider-->>converge_drive_attachments: available or missing file
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
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. A rabbit checks each stored byte, Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f9284d2126
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
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".
|
Closing out open Codex review threads on this PR (evidence checked against master at ef10e59):
Resolving the fixed, stale and refuted threads; tracked threads stay open. |
|
Closing out open Codex review threads on this PR (evidence checked against master at 64a9bd0):
Resolving every thread listed; confirmed defects are fixed under the named bead. |
|
Closing out open Codex review threads on this PR (evidence checked against master at f88b4a6):
Resolving every thread listed; confirmed defects are fixed under the named bead. |
|
Historical Codex triage: evidence checked at 5ebcfe5. This records that source revision; it does not claim a fresh review of current master.
Only the rows listed above are dispositioned. Held findings remain open. |
Summary
Two coverage reads over
source_attachmentsdisagreed.corpus-attachment-fidelityalready partitioned theacquiredbucket correctly;scan_attachment_coverageand theattachment-coveragegate collapsed it into a boolean and certified rows they had not checked. This partitions the second read the same way and stops one write route from re-asserting acquisition on trust.Problem (evidence)
Measured at
158d1363eon a syntheticindex.dbwith threeacquisition_status='acquired'rows — one with bytes in the store, one naming a hash the store does not hold, one withblob_hashNULL:scan_attachment_coveragereturned{acquired_count: 3, acquired_reachable_count: 3, acquired_missing_blob_count: 1}— no term at all for the NULL-hash row, because ofif blob_hash is None: continue.attachment-coveragegate printedOutcomeStatus.OKwith the summaryall 1 acquired attachment(s) have bytes and a live attachment reference— a false sentence about an archive where it had checked nothing._surviving_blob_refgated the re-bind onblob_store.exists()("a file sits at that path") and then wroteacquisition_status='acquired'. A published blob corrupted in place produced{recorded_hash: 664656fb…, actual_hash_of_file: 4ca8451f…, byte_count_claimed: 32, actual_size: 31, downloads_attempted: []}— acquisition re-asserted with no provider request and no signal.The bead's other cited defect (
DriveNotFoundErrorrecorded asacquired) does not reproduce at head; it terminatesunavailableand has since #4873/#4908. That citation is stale.Solution
AttachmentCoverageReportpartitionsacquiredintoacquired_with_bytes_count(corroborated),acquired_missing_blob_count(contradicted) andacquired_unverifiable_count(nothing to check), published side by side into_dict(). Following fix: Separate unmeasured from measured zero across four red surfaces #5367'sraw_materialization_unmeasured_reason, an unmeasured claim gets its own term rather than folding into the nearest boolean.okis false for either non-corroborated term, so an unmeasured claim blocks exactly as a false one does — without the report ever asserting bytes are absent.blob_store.verify(), notexists(). A contradicted survivor is not evidence: it falls through to the provider, and emitsoperations.attachment_convergence.survivor_contradictedat WARNING/outcome=degradedso a decayed published blob is not silently erased by a re-download.Verification
Receipt
.cache/verify/runs/20260922T003420Z-focused-test-183221-b5c5388c/run.json.Inherited-red baseline at
158d1363ein this worktree:177 passed, exit 0 — no inherited reds in the touched scope.Anti-vacuity conditions were executed, not asserted. Restoring
if blob_hash is None: continue→ 3 failed, includingassert <OutcomeStatus.OK> is <OutcomeStatus.ERROR>with summaryall 1 acquired attachme…. Revertingdebt_counttomissing + unreachable→ 1 failed, whose evidence dict reads'unverifiable_count': 1beside that same summary — the exact claim/measurement split. Revertingverify()toexists()→assert [] == ['drive-file-1'], the corrupted survivor re-binding with no provider request.Schema identity
Does not move.
derived_schema_identityat158d1363eequals that at this head for both derived tiers (indexd5e285b3…, ops86866235…). All six changed files reportout;storage/blob_liveness.pyis the one IN-closure file in the area and was deliberately not touched. No DDL, no vocabulary member —acquisition_statuskeeps its existing three-value durable CHECK. Safe to land at any point relative to the build boundary.Residuals
gc_generationsinsource.dband the daemon event log, neither read here. The bead's own design marks it not dispatchable to a code worker.acquiredrows, 1446 distinct acquired hashes, 204 with bytes, 1242 contradicted — the bead's 1240/1446 still reproduces. 0 acquired rows with NULLblob_hash, so the unverifiable term guards a latent shape the live archive does not currently contain.unavailable, but for an oversize file the provider still has the bytes — the same overstated claim in the opposite direction. Out of scope; wants its own bead.demo/constructs.py:104claims stored bytes but its SQL never consults the store.daemon/webui_data.pycollapses six attachment states intomissing-blob.🤖 Generated with Claude Code
https://claude.ai/code/session_01ToWqpkXotr573DiQex5vcy
Summary by CodeRabbit
Bug Fixes
Tests