Repository navigation
Harden blob authority and crash-safe reclamation - #4149
Conversation
|
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 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6e3713aca8
ℹ️ 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".
|
Addressed all four inline review findings on (a) Namespace marker not fsynced before GC intent commit — (b) (c) (d) Verification
Diffstat: 5 files changed, 191 insertions(+), 14 deletions(-) — Note on branch topology: This PR's |
- fsync the namespace marker file and its containing directory before its identity can be recorded in a durable gc_generations row, closing a power-loss window that could leave a pending generation pointing at a marker that never reached disk. - stop dry-run GC previews from creating the namespace marker; a read-only preview must not mutate the archive or fail against read-only backup media, and the namespace identity was never used on the dry-run path. - filter _candidate_blobs shortlist entries to exactly 64 lowercase-hex characters, so a foreign or partially-written shard entry can no longer reach _commit_gc_generation_intent and violate the blob_hash CHECK constraint; such entries are left for the integrity workflow instead. - catch RuntimeError (not just OSError/sqlite3.Error) in _blob_reference_debt_state so a blocked canonical blob liveness projection returns a typed blocked probe state instead of aborting the whole daemon workload probe. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_014BQsaB1NBY8mTR6yZByfMA
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5a82f34842
ℹ️ 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".
## Summary Crash-regression test for polylogue-piyqz: monkeypatched unlink failure mid-batch; durable generation/member intent rows survive and attribute the partial batch. The write-ahead implementation itself was found already present on master (landed via the #4149/#4152 line); this PR pins it against regression. ## Verification Focused: 49 passed. verify --quick clean. (Luna lane job b46dd19e.) 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_014BQsaB1NBY8mTR6yZByfMA
## Summary Corpus run 4 fix lane (surfaces/storage/daemon cluster): 3 real regressions fixed, 5 stale expectations updated, from the 18-failure residual set against frozen master `34ddfe09d`. ## Problem (evidence) - #4201's shared row projection dropped `terminal_state`/`total_cost_usd`/`relative_time` from the daemon list payload, breaking direct/daemon JSON parity and the summary display label (2 tests). - #4149 regressed `_repair_superseded_raw_snapshots` to open the index tier read-write even when absent — a destructive cleanup consulting a just-created empty authority instead of failing closed (1 test). - Stale expectations (5): synthetic-wire transport representation (#4184), readiness fixtures pinned at index v72 (now v74), protocol-message expectations (#4173), topic-caveat fixture (#4173). ## Solution - Daemon summary payload routes through the shared `session_row` projection; `display_label` joins the title fallback chain. - Destructive raw cleanup requires a readable existing index tier; otherwise returns a typed skipped-unsuccessful result naming the missing authority. ## Verification - The 9 target tests: 9 passed; full containing files: 335 passed. - `devtools verify --quick` + pre-push quick baseline: green. ## Residuals - `test_clock_guard` (in the corpus-18 set) passed at this lane's baseline and was left untouched; it fails under some collection orders and is being diagnosed separately by the overseer. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_014BQsaB1NBY8mTR6yZByfMA
) ## Summary Works the 15 unrecorded Codex P1 findings on `polylogue/maintenance` (bead polylogue-1tyq5.196). One real defect is fixed here; 13 are already fixed on master or cite deleted code; one is real but needs a durable owner-resolution reason and is tracked in its own bead. ## Problem `_source_exists` only understood the snapshot's `archive!member` coordinate. The ZIP readers (`decoder_zip.py:304-380`, `import_explain.py:648`) record `archive:member`, so a raw whose blob reference was absent was typed blocking `source_lost` while its archive and member were still on disk. ## Solution Resolve the colon form through `polylogue.core.raw_coordinates.zip_member_coordinate`, which tries each colon and accepts only a prefix that is a real ZIP, so a loose file with a colon in its name still resolves literally. ## Verification AgentCTL: `verify_quick` job 2727, `pytest_focused` job 2728 (passed). ## Self-review - **Sibling sites:** The other consumer of member coordinates in this module is the frontier join, which already builds `root:member` (source_conservation.py:895); `_source_exists` was the only `!`-only parser. - **Fail closed:** A colon prefix counts only when it is a real ZIP; a missing ZIP or member returns False, and an unreadable ZIP keeps the existing container-existence rule. - **Tests prove the production route:** The tests call `_source_exists`, the function `audit_source_conservation` uses; the first fails on master because the colon form returned False. - **Unbounded work / compatibility / identity:** No new I/O beyond one namelist per container (cached); no shim or dual path; no hashed or derived-identity file touched. ## Findings | Finding | Disposition | Evidence | Test | |---|---|---|---| | F001 | fixed-already | Already fixed on master: the blob-integrity owner passes `active_index_context` through to `_check_blob_integrity` (polylogue/maintenance/archive_verification.py:1047), introduced in #4149. | | | F002 | stale | The browser-capture export-denominator branch and `_iter_chatgpt_conversations` were removed when #4188 rebased ChatGPT conservation on the real denominator; nothing on master still runs this code. | | | F003 | stale | `polylogue/maintenance/assertion_transition.py` was deleted in #5079 (9d5a020, the durable-reference transition actuator). | | | F004 | stale | `polylogue/maintenance/assertion_transition.py` was deleted in #5079 (9d5a020), including the successor-manifest holdout path. | | | F005 | stale | The closure repair planner (`plan_blob_reference_closure`, `_acquired_attachment_ids`) was deleted with the generic repair product in #4698 (cfc4c73); blob_reference_closure.py is now a read-only law whose predicate excludes ref_count 0. | | | F006 | stale | `polylogue/maintenance/cursor_authority_reconcile.py` was deleted in #4618 (63f2043) with the historical source control planes. | | | F007 | fixed-already | Already fixed on master: a present parent with unresolved references is classified `materialized_unresolved` (parent_session_accounting.py:397-402) and those references count in `unresolved_reference_total`, which is part of `blocking_count` (:144, :493-498). | | | F008 | tracked | Still real: the writer stores a metadata-only attachment whose named owner message is absent with ref_count 0 and no ref, and conservation classifies every such row as the non-blocking `attachment_unowned`; the owner-resolution reason (`MESSAGE_MISSING` vs `OWNER_AMBIGUOUS`) is not durable, so the check cannot tell them apart. | polylogue-3ezec | | F009 | fixed-already | Already fixed on master: `acquired_attachment_missing_ref_predicate` requires `ref_count != 0` (polylogue/storage/blob_liveness.py:27-34), so typed-unowned rows (ref_count 0) no longer trip attachment-coverage or blob-reference-closure. | | | F010 | fixed-already | Already fixed on master: a raw at a configured path whose digest is not the member's current one is skipped as an ordinary historical revision (source_conservation.py:930-943). | | | F011 | fixed-already | Already fixed on master: the content witness is per membership, matched against any session the raw materialized, so sibling sessions of a grouped raw no longer report `content_mismatch` (source_conservation.py:947-970). | | | F012 | fixed-already | Already fixed on master: mutable-SQLite members compare the logical-revision digest; the path-only disjunct is gone (source_conservation.py:899-913). | | | F013 | fixed-already | Already fixed on master: raws are indexed by canonical source path once, making the member loop linear (source_conservation.py:863-872). | | | F014 | fixed | `_source_exists` now also resolves the `<container>:<member>` coordinate the ZIP readers record, through the shared `zip_member_coordinate` parser, so a present member of a present ZIP is conserved instead of reported `source_lost`. | tests/unit/maintenance/test_source_conservation_zip_coordinates.py::test_colon_member_coordinate_of_a_present_zip_is_conserved | | F015 | fixed-already | Already fixed on master: `build_wanted_source_receipt` raises when no source is declared (source_manifest_continuity.py:508-513). | | ## Residuals F008 stays open in its own bead: telling a missing owner message apart from an ambiguous owner needs the writer to persist the owner-resolution reason. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_015pdKaZWyGe6Ngvsz468dzg Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
|
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 5ebcfe5):
Resolving every thread listed; confirmed defects are fixed under the named bead. |
Summary
Problem
The live blob store contains historical residue and cannot serve as desired-state authority. Cleanup still needs to preserve every currently owned byte while safely concentrating unexplained residue. Existing GC paths could lose exact intent across crashes, omit ownership surfaces, infer absence from unreadable tiers, or redirect a delayed pathname unlink after a namespace swap. Several direct deletion routes duplicated that authority.
Solution
One liveness model now classifies canonical raw, attachment, hook, sidecar, reservation, and legacy references. Destructive GC commits exact members before unlink, rechecks source and index ownership under the writer window, binds the intent to a durable namespace marker, and performs final observation and unlink through no-follow directory handles. Interrupted intents resume idempotently or remain blocked for audited offline abandonment, which never unlinks or rebinds bytes. Durable source migrations 034 and 035 carry the intent and namespace fields. Backup verification handles historical schema generations and deliberately excludes an unbound marker from ordinary evidence copies.
Verification
ff598e05-c4de-48b7-9616-a10e8bdd8923No live archive cleanup or mutation was performed by this PR.