Repository navigation
fix(storage): restore the sidecar blob owner and legacy carrier - #4381
Merged
Merged
Conversation
history_sidecars is still a live source-tier relation and blob_refs still admits ref_type='sidecar', but the ledger map no longer resolved it: any archive holding a sidecar ref made liveness projection return BLOCKED, and referenced_blob_hashes omitted sidecar-owned hashes on a legacy archive carrying history_sidecars.blob_hash, making those blobs GC-eligible. A new proof couples the blob_refs CHECK vocabulary to the liveness join map so the two cannot drift apart again. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_014BQsaB1NBY8mTR6yZByfMA
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 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 |
Sinity
added a commit
that referenced
this pull request
Aug 28, 2026
## Summary #4339 removed the ledger entry that resolved `blob_refs.ref_type='sidecar'`, but nothing removed the relation it describes. `history_sidecars` is still a live source-tier table and the `blob_refs` CHECK still admits `sidecar`, so the writer remains entitled to create rows that the readers could no longer resolve. This restores the owner and the legacy carrier, and couples the two declarations so they cannot drift apart again. ## Problem Ten storage tests were red on master. Both consequences are real, and they point in opposite directions: - `validated_blob_ref_liveness_joins()` no longer resolved `sidecar`, so any archive holding such a row returned `BlobLiveness(state=BLOCKED, blockers=('unknown blob_refs ref_type(s): sidecar',))`. That fails closed — no over-deletion — but GC stalls on data the writer was entitled to write. - `referenced_blob_hashes` omitted sidecar-owned hashes on a legacy archive carrying `history_sidecars.blob_hash`, making those blobs GC-eligible. That one is a data-loss risk on a real archive, and it matters directly to the reindex campaign. Retiring the ref_type from the DDL CHECK instead would have stranded any archive already holding sidecar rows — the wrong direction while the table still exists. ## Solution - `storage/blob_liveness.py` — restored `BlobOwner("source", "history_sidecars", ref_type="sidecar", referent_column="sidecar_id")` - `storage/blob_integrity.py` — `history_sidecars` back in `_LEGACY_DIRECT_BLOB_CARRIERS`, guarded by the existing `_column_exists(conn, table, "blob_hash")` check, so it is inert on the current schema (which uses `content_hash`) and protective on older ones - new `test_blob_refs_check_vocabulary_and_liveness_join_map_agree` — nothing previously coupled the `blob_refs` CHECK vocabulary to the liveness join map, and they live in different files. That gap is what allowed the drift. No test was deleted or weakened; all nine failures were production defects. The `sessions_unenriched` assertion was vacuous — `_enrich_parsed_sessions` returns `False` on both paths, so it could not fail. Its real subject, that a worker never consults the ambient source tree, was still worth protecting, so it now asserts via a call recorder that `discover_sidecars` is never invoked. That is strictly stronger than the previous monkeypatched raise. ## Verification `devtools test` over the three bead-named files plus the ingest-worker file: **84 passed**, was 9 failed / 69 passed. Widened to every `BLOB_OWNERS` / `blob_gc` / `archive_verification` consumer — GC, excision, retention, migrations, maintenance, CLI, daemon — **265 passed**, and **118 passed** in a further run. `devtools verify --quick`: all 18 gates ok, zero `out of sync`. Anti-vacuity, verified by mutation rather than asserted: | Mutation | Red test | |---|---| | Delete the sidecar `BlobOwner` | `test_blob_refs_check_vocabulary_and_liveness_join_map_agree` | | Drop `history_sidecars` from `_LEGACY_DIRECT_BLOB_CARRIERS` | `test_source_capabilities_conserve_mixed_legacy_and_typed_references` | | Reintroduce on-demand `discover_sidecars` in the worker | `test_missing_snapshot_does_not_attempt_on_demand_enrichment` | The first mutation is exactly #4339's edit, so the new guard would have caught the original regression. ## Residual risk `devtools verify` (selected/affected) did not run: it exits 2 with `native_testmon_graph_unavailable` because the lane worktree has no testmon graph. That is the documented refusal, not a failure of this change; the targeted runs above are the compensating evidence and prove their selected scope only. The failure total measured here (9 failed / 69 passed) differs from the 10 / 93 recorded on the bead. Same failure signature and same root cause, measured at a different master point. Filed polylogue-mmf7c separately: `sessions_unenriched` is dead production surface, not just a dead assertion — it feeds a batch summary counter that can never be nonzero, so it reads as positive evidence of no degradation. Left out of scope because removing it touches `ingest_batch`. Closes polylogue-p9txi. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_014BQsaB1NBY8mTR6yZByfMA Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
Sinity
added a commit
that referenced
this pull request
Sep 1, 2026
## Summary #4339 removed the ledger entry that resolved `blob_refs.ref_type='sidecar'`, but nothing removed the relation it describes. `history_sidecars` is still a live source-tier table and the `blob_refs` CHECK still admits `sidecar`, so the writer remains entitled to create rows that the readers could no longer resolve. This restores the owner and the legacy carrier, and couples the two declarations so they cannot drift apart again. ## Problem Ten storage tests were red on master. Both consequences are real, and they point in opposite directions: - `validated_blob_ref_liveness_joins()` no longer resolved `sidecar`, so any archive holding such a row returned `BlobLiveness(state=BLOCKED, blockers=('unknown blob_refs ref_type(s): sidecar',))`. That fails closed — no over-deletion — but GC stalls on data the writer was entitled to write. - `referenced_blob_hashes` omitted sidecar-owned hashes on a legacy archive carrying `history_sidecars.blob_hash`, making those blobs GC-eligible. That one is a data-loss risk on a real archive, and it matters directly to the reindex campaign. Retiring the ref_type from the DDL CHECK instead would have stranded any archive already holding sidecar rows — the wrong direction while the table still exists. ## Solution - `storage/blob_liveness.py` — restored `BlobOwner("source", "history_sidecars", ref_type="sidecar", referent_column="sidecar_id")` - `storage/blob_integrity.py` — `history_sidecars` back in `_LEGACY_DIRECT_BLOB_CARRIERS`, guarded by the existing `_column_exists(conn, table, "blob_hash")` check, so it is inert on the current schema (which uses `content_hash`) and protective on older ones - new `test_blob_refs_check_vocabulary_and_liveness_join_map_agree` — nothing previously coupled the `blob_refs` CHECK vocabulary to the liveness join map, and they live in different files. That gap is what allowed the drift. No test was deleted or weakened; all nine failures were production defects. The `sessions_unenriched` assertion was vacuous — `_enrich_parsed_sessions` returns `False` on both paths, so it could not fail. Its real subject, that a worker never consults the ambient source tree, was still worth protecting, so it now asserts via a call recorder that `discover_sidecars` is never invoked. That is strictly stronger than the previous monkeypatched raise. ## Verification `devtools test` over the three bead-named files plus the ingest-worker file: **84 passed**, was 9 failed / 69 passed. Widened to every `BLOB_OWNERS` / `blob_gc` / `archive_verification` consumer — GC, excision, retention, migrations, maintenance, CLI, daemon — **265 passed**, and **118 passed** in a further run. `devtools verify --quick`: all 18 gates ok, zero `out of sync`. Anti-vacuity, verified by mutation rather than asserted: | Mutation | Red test | |---|---| | Delete the sidecar `BlobOwner` | `test_blob_refs_check_vocabulary_and_liveness_join_map_agree` | | Drop `history_sidecars` from `_LEGACY_DIRECT_BLOB_CARRIERS` | `test_source_capabilities_conserve_mixed_legacy_and_typed_references` | | Reintroduce on-demand `discover_sidecars` in the worker | `test_missing_snapshot_does_not_attempt_on_demand_enrichment` | The first mutation is exactly #4339's edit, so the new guard would have caught the original regression. ## Residual risk `devtools verify` (selected/affected) did not run: it exits 2 with `native_testmon_graph_unavailable` because the lane worktree has no testmon graph. That is the documented refusal, not a failure of this change; the targeted runs above are the compensating evidence and prove their selected scope only. The failure total measured here (9 failed / 69 passed) differs from the 10 / 93 recorded on the bead. Same failure signature and same root cause, measured at a different master point. Filed polylogue-mmf7c separately: `sessions_unenriched` is dead production surface, not just a dead assertion — it feeds a batch summary counter that can never be nonzero, so it reads as positive evidence of no degradation. Left out of scope because removing it touches `ingest_batch`. Closes polylogue-p9txi. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_014BQsaB1NBY8mTR6yZByfMA Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
#4339 removed the ledger entry that resolved
blob_refs.ref_type='sidecar', but nothing removed the relation it describes.history_sidecarsis still a live source-tier table and theblob_refsCHECK still admitssidecar, so the writer remains entitled to create rows that the readers could no longer resolve. This restores the owner and the legacy carrier, and couples the two declarations so they cannot drift apart again.Problem
Ten storage tests were red on master. Both consequences are real, and they point in opposite directions:
validated_blob_ref_liveness_joins()no longer resolvedsidecar, so any archive holding such a row returnedBlobLiveness(state=BLOCKED, blockers=('unknown blob_refs ref_type(s): sidecar',)). That fails closed — no over-deletion — but GC stalls on data the writer was entitled to write.referenced_blob_hashesomitted sidecar-owned hashes on a legacy archive carryinghistory_sidecars.blob_hash, making those blobs GC-eligible. That one is a data-loss risk on a real archive, and it matters directly to the reindex campaign.Retiring the ref_type from the DDL CHECK instead would have stranded any archive already holding sidecar rows — the wrong direction while the table still exists.
Solution
storage/blob_liveness.py— restoredBlobOwner("source", "history_sidecars", ref_type="sidecar", referent_column="sidecar_id")storage/blob_integrity.py—history_sidecarsback in_LEGACY_DIRECT_BLOB_CARRIERS, guarded by the existing_column_exists(conn, table, "blob_hash")check, so it is inert on the current schema (which usescontent_hash) and protective on older onestest_blob_refs_check_vocabulary_and_liveness_join_map_agree— nothing previously coupled theblob_refsCHECK vocabulary to the liveness join map, and they live in different files. That gap is what allowed the drift.No test was deleted or weakened; all nine failures were production defects.
The
sessions_unenrichedassertion was vacuous —_enrich_parsed_sessionsreturnsFalseon both paths, so it could not fail. Its real subject, that a worker never consults the ambient source tree, was still worth protecting, so it now asserts via a call recorder thatdiscover_sidecarsis never invoked. That is strictly stronger than the previous monkeypatched raise.Verification
devtools testover the three bead-named files plus the ingest-worker file: 84 passed, was 9 failed / 69 passed. Widened to everyBLOB_OWNERS/blob_gc/archive_verificationconsumer — GC, excision, retention, migrations, maintenance, CLI, daemon — 265 passed, and 118 passed in a further run.devtools verify --quick: all 18 gates ok, zeroout of sync.Anti-vacuity, verified by mutation rather than asserted:
BlobOwnertest_blob_refs_check_vocabulary_and_liveness_join_map_agreehistory_sidecarsfrom_LEGACY_DIRECT_BLOB_CARRIERStest_source_capabilities_conserve_mixed_legacy_and_typed_referencesdiscover_sidecarsin the workertest_missing_snapshot_does_not_attempt_on_demand_enrichmentThe first mutation is exactly #4339's edit, so the new guard would have caught the original regression.
Residual risk
devtools verify(selected/affected) did not run: it exits 2 withnative_testmon_graph_unavailablebecause the lane worktree has no testmon graph. That is the documented refusal, not a failure of this change; the targeted runs above are the compensating evidence and prove their selected scope only.The failure total measured here (9 failed / 69 passed) differs from the 10 / 93 recorded on the bead. Same failure signature and same root cause, measured at a different master point.
Filed polylogue-mmf7c separately:
sessions_unenrichedis dead production surface, not just a dead assertion — it feeds a batch summary counter that can never be nonzero, so it reads as positive evidence of no degradation. Left out of scope because removing it touchesingest_batch.Closes polylogue-p9txi.
🤖 Generated with Claude Code
https://claude.ai/code/session_014BQsaB1NBY8mTR6yZByfMA