Repository navigation
Conversation
The archive format marker exists to refuse a historical or foreign durable file transplanted into a marked archive. Its fingerprint check is bound to the tier's recorded birth version, so it switches itself off in exactly the case where the file is most suspicious: a live `user_version` *below* the birth version makes `version == versions[tier]` false and the fingerprint is never compared. Durable tiers only move forward, by numbered migration, so a tier standing below its own birth version is never this archive's own file. `assert_archive_format_lineage` is what `backup_attestation` and `execute_durable_change_train` consult before trusting a lineage, so the admission mattered beyond bootstrap -- where the tier initializer's version guard did still refuse startup, but with a message inviting the operator to run a durable migration against the transplanted file. Reproduced at 9f450db: a fresh archive records `source: 2`; replacing source.db with a version-1 database leaves `assert_archive_format_lineage` accepting it. Raised by PR #5369 review. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01ToWqpkXotr573DiQex5vcy
Session excision records every sibling attachment and sidecar hash, not just the session payload's. `write_source_raw_session` and `write_source_raw_session_blob_ref` checked only the primary hash, so a later ingest whose own payload is admissible could still carry a durably excised hash in `additional_blob_refs`: the loop inserted its `blob_refs` row and consumed its publication receipt, making the excised bytes reachable again under a new raw record. `write_source_blob_refs` was fixed for this exact class and its docstring already claimed the other two writers were gated. Both writers now validate every additional reference against the policy snapshot and the durable ledger before opening their transaction, so a refusal leaves no side effect, and it refuses per reference naming the hash like `write_source_blob_refs` does. Executed anti-vacuity at 9f450db: both writers accept the excised sibling and leave two `blob_refs` rows pointing at the excised hash; with the gate both refuse and leave zero, while an admissible sibling still writes. Raised by PR #4646 review. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01ToWqpkXotr573DiQex5vcy
`resolve_raw_authority_blocker` tombstones a blocker as an operator acknowledgement, but the acknowledgement is not the discharge -- the evidence is. `pass_id` is a content address over the frontier inventory, so a later pass over unchanged blocking evidence reconstructs the identical `blocker_id` and the insert-only reconciliation's `ON CONFLICT DO NOTHING` was a no-op against the tombstone. `raw_authority_blocker_count` therefore stayed zero and `raw_materialization_ready` reported a clean archive while the same missing, quarantined, or corrupt evidence still existed. Reconciliation now reopens a resolved row whose state it still observes, deferring to an open sibling so it cannot collide with the partial unique index on `plan_input_digest`. Executed anti-vacuity at 9f450db: after resolving a `missing_bytes_reacquire` obligation, a second pass over unchanged evidence leaves no open blocker; with the reopen it restores the same blocker id, and a pass that genuinely disproves the state still leaves it closed across repeats. Raised by PR #5350 review. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01ToWqpkXotr573DiQex5vcy
`query_names.watch` is durable user-tier state independent of the saved-view assertion. `save_view` registered only the new name on a rename and `delete_view` only tombstoned the assertion, so the previous or deleted name stayed at `watch = 1`: `list_watched_queries()` kept returning a definition the product no longer exposes and standing-query convergence kept evaluating it and persisting result sets. Both lifecycle routes now clear the prior binding in the same transaction that changes the assertion, through the `watch=False` path `register_query_watch` already has. Executed anti-vacuity at 9f450db: after saving `view-1` as `old` with a watch and re-saving it as `new`, both names are watched; after `delete_view` both are still watched and `list_watched_queries` still returns one object. With the retirement: `['old']`, then `['new']`, then none. Raised by PR #5375 and #5377 review. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01ToWqpkXotr573DiQex5vcy
An inactive candidate generation directory only carries read-through symlinks to the real archive's durable members, which is why the store already tracks `_write_lease_archive_root` separately and uses it for its index-tier check. `_ensure_source_conn()` and `delete_sessions()` still passed `self.archive_root` -- the candidate directory -- so `require_write_lease` compared two different resolved roots and refused a durable writer that held the correct lease, before the connection was even opened. Both now pass `_write_lease_archive_root`, the same value the store's other durable-writer check uses. No refusal is added or removed; the check simply compares the root the lease was acquired for. Raised by PR #5242 review. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01ToWqpkXotr573DiQex5vcy
`HTTPResponse.read` returns the available prefix and then `b""` when a server that advertised a `Content-Length` closes early -- no exception. The acquisition loop read that EOF as completion and persisted the truncated prefix with `acquisition_state='acquired'`, making bytes the server never sent authoritative retained evidence. A declared length is the only completion statement available at that point, so a short body takes the `partial`/retryable state this function already has for the over-size case. A missing, repeated-and-inconsistent, or unparseable `Content-Length` declares nothing and is left alone rather than guessed at. Executed anti-vacuity at 9f450db: a response declaring 1000 bytes and sending 7 is stored `acquired` with an empty diagnostic; with the check it is `partial`, retryable, and names both counts, while a correct length and an absent length both stay `acquired`. Raised by PR #4623 review. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01ToWqpkXotr573DiQex5vcy
The writer admits a parent chain up to `_CYCLE_WALK_BUDGET` (1024), but the topology classifier walked it with a recursive depth-first search, so a lineage the writer accepted raised `RecursionError` when any topology read classified it. Because the classifier runs over every link in scope, reading an unrelated session in the same scope failed with it. The traversal now carries its own stack. It is the same walk frame for frame: a node enters `visiting` on push and moves to `visited` on pop, a child already in `visiting` marks the whole current ancestry, and roots are still taken in sorted order. Executed anti-vacuity at 9f450db: `compose_session_topology` over a 1100-session accepted lineage raises `RecursionError: maximum recursion depth exceeded`; with the iterative walk it returns 1100 nodes and quarantines no edge. 3000 random graphs produce identical cycle sets under both implementations, and a real 3-cycle is still quarantined. Raised by PR #5007 review. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01ToWqpkXotr573DiQex5vcy
`resolve_block_anchor` returns `relocated_lineage` with a concrete message id and position when it finds the hash in a composed lineage view reached through a named inheritance edge. The public ref-resolution boundary classified only `ok` and the two `drifted_*` states as resolved, so it reported `resolved=false` with a caveat for an anchor that did resolve and clients could not consume the relocation at all. The finding is anchored in `storage/block_anchor.py`; the boundary that consumes it lives in `operations/ref_resolution.py`, so this is a one-line change outside `polylogue/storage/`. Anti-vacuity: the new assertions in the existing `relocated_lineage` fixture read `resolved=false` with a non-empty caveat when the state is dropped from the set again; the absent-hash case in the same test keeps `missing` unresolved. Raised by PR #5287 review. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01ToWqpkXotr573DiQex5vcy
`read_schema_identity` already reports an absent ledger as `None` -- the unstamped case skew is meant to refuse -- so a query that still raises is a lock, an I/O error, or a damaged page. `assert_derived_schema_identity` swallowed it into `found = None` and raised a non-transient `SchemaSkewError`, reporting a measurement that was never taken and telling the operator to rebuild a sound index over a transient fault. The call also sat outside `assert_readable_archive_layout`'s `except sqlite3.Error` handler, which already classifies exactly this class of failure as `retry`. The swallow is gone and the call moved inside that handler. A genuine identity mismatch is a `SchemaSkewError`, which is neither `sqlite3.Error` nor `RuntimeError`, so it still propagates unchanged. Executed anti-vacuity at 9f450db: a sound index whose identity SELECT alone raises `database is locked` reports `SchemaSkewError ... found None; stale derived tier; daemon convergence rebuilds it`; with the change it reports `SchemaVersionMismatchError` with `lifecycle_action='retry'`, and a clean read still refuses nothing. Raised by PR #4637 review. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01ToWqpkXotr573DiQex5vcy
Both failures were the tests, not the fixes. `test_a_real_cycle_is_still_quarantined` expected three quarantined edges. `compose_session_topology` returns the composed scope, which collapses to the target alone once its only inbound edge is quarantined, so one edge comes back. Verified identical at 9f450db and at head, so the scoping is pre-existing and untouched by the iterative walk. The assertion now says what it means: every edge in scope is quarantined as `cycle` and none is composable. `test_acknowledging_an_undischarged_obligation_does_not_survive_the_next_pass` asserted readiness stayed false immediately after the acknowledgement. It does not: readiness reads the open-blocker count, so a tombstoned blocker makes the archive look clean until a pass reopens it. That window is a separate live finding (readiness treats an absent blocker row as proof, PR #5301 review); the reopen is what closes it. The assertions now pin readiness false before the acknowledgement and false again after the reopening pass. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01ToWqpkXotr573DiQex5vcy
|
Warning Review limit reachedNext included review available in 24 minutes. View limit detailsLimit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Advanced Run ID: 📒 Files selected for processing (17)
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 |
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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3bde908078
ℹ️ 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".
| # identity mismatch is a ``SchemaSkewError``, which is neither | ||
| # ``sqlite3.Error`` nor ``RuntimeError``, so it still propagates | ||
| # unchanged through both handlers below. | ||
| assert_derived_schema_identity(conn, "index") |
There was a problem hiding this comment.
Route permanent identity read failures to reconvergence
If the schema_identity table's data page is corrupt while the catalog remains readable, this call can raise sqlite3.DatabaseError with SQLITE_CORRUPT; placing it inside the broad except sqlite3.Error converts that permanent failure into lifecycle_action="retry". Retrying cannot repair the rebuildable index, so reads remain refused indefinitely instead of daemon convergence replacing it. Restrict the retry path to transient errors such as SQLITE_BUSY/SQLITE_LOCKED, and route corruption or SQLITE_NOTADB to the typed rebuild path.
AGENTS.md reference: AGENTS.md:L102-L106
Useful? React with 👍 / 👎.
| AND NOT EXISTS ( | ||
| SELECT 1 FROM raw_authority_blockers AS open_row | ||
| WHERE open_row.plan_input_digest = ? | ||
| AND open_row.resolved_at_ms IS NULL | ||
| ) |
There was a problem hiding this comment.
Bind census items to the existing open blocker
When an unrelated frontier item changes the content-addressed pass_id while a blocking item's evidence stays unchanged, this item computes a new blocker_id, but its insert is rejected by the partial unique index because the previous pass's row is still open. The update here then affects no row (the newly computed ID does not exist), while published still returns that nonexistent ID, so the census item's evidence_ref cannot resolve to the durable blocker that actually carries its evidence. After an insert conflict or deferred reopen, select and publish the existing open sibling's blocker_id.
Useful? React with 👍 / 👎.
|
Superseded by #5408, which consolidates this lane with the parallel storage review lane. Two lanes were dispatched over overlapping finding sets and independently fixed three of the same defects (watch binding, birth version, frontier reopen) — my dispatch error, not duplicated work by either lane. All six non-overlapping fixes from this PR are cherry-picked into #5408 with One fix was deliberately not carried over. The two frontier-reopen implementations diverge semantically: this branch reopens the same row so the obligation keeps its original The 80-finding triage table from this lane is preserved in #5408's description. |
…tier (#5408) ## Summary Seventeen live P1 review findings closed across the storage tier, consolidating two review lanes that were dispatched over overlapping finding sets. Supersedes #5406, whose six non-overlapping fixes are cherry-picked here with `-x` attribution. ## Problem A `git blame` filter over the review backlog selected 80 storage P1 findings whose anchored line had not moved since review. Full triage at HEAD: **49 LIVE, 27 STALE, 4 WONTFIX** — the filter over-selects by ~34% in this area, with no detectable false negative. Its failure mode is exactly as predicted: heavy refactors move code without touching the anchored line (`bootstrap.py` was 6-for-6 stale after its rewrite), and the durable-lineage reset invalidated the whole v37/v40 migration family. Two lanes worked this set concurrently and independently fixed three of the same defects. Landing both would have meant a 12-commit rebase across three shared files, so they are consolidated here instead. ## Solution **Reads and cost** - `archive_query_reads.py` ranked the entire partition before applying `unit_rank <= ?`. Measured at base on seeded archives, one 201-row page: **427k / 813k / 1585k VDBE step units** over 2,000 / 4,000 / 8,000-message sessions — linear in partition size — against a flat 42k for the indexed read. `_bounded_partition_message_ids` now does one indexed `ORDER BY … LIMIT` per selected session over `idx_messages_session_position`, merges, orders and pages the candidates, then runs the expensive projection on the page alone. **After: flat 47k at all three sizes.** #5381's fairness contract is preserved — each session keeps the same allowance in its own transcript order — and its SKEWED fixture still passes. **Durable integrity** - The `additive-no-backup` marker was a self-declaration nothing checked: `_requires_migration_backup` read the header and never looked at the statements. The finding is **declined as filed** — that classification is operator-ratified from #2905 with its own authorization mode, and slot 002 is one `CREATE TABLE IF NOT EXISTS` that writes, reads and moves no row — but the unchecked claim is now proved: a file claiming the marker must contain only `CREATE TABLE/VIEW/INDEX`, refused by name otherwise. Slot 002 still loads `requires_backup=False`, so no shipped behaviour changed. - A durable tier below its recorded birth version was accepted. Bootstrap stamps `tier_versions.source = 2`; a transplanted version-1 database cleared the floor and skipped the fingerprint because `1 != 2`. The condition is now `version <= versions[tier]`, so the below-birth case is decided by the recorded fingerprint rather than bypassed. - `acquired_with_bytes_count` decided coverage with `BlobStore.exists`, so an object overwritten at the recorded hash's path counted as coverage with both debt counters zero and `ok` true. It now requires a re-hash, and a present-but-contradicted object lands in a new `acquired_corrupt_count` bucket kept **separate** from `acquired_missing_blob_count` — the object is present, so re-fetch is the wrong remedy. - `additional_blob_refs` bypassed the excision ledger. **Lineage** - `_record_lineage_prefix_debt` resolved `ops.db` via `PRAGMA database_list`, which SQLite answers with the *resolved* promotion symlink, so on a promoted generation it named a nonexistent file and returned silently. New `archive_root_for_index_path` unwinds the generation directory; `index_generation._is_generation_member` now delegates to it so the depth rule has one definition. - A witness-mismatched branch point was re-anchored onto different content. The re-anchor now applies only when the replacement's content address matches the stored witness; otherwise the edge stays dangling, is counted, and its child is named stranded with retryable debt. The repairable half still re-resolves in-write. - Recursive topology DFS hit `RecursionError` at the writer's own 1024 budget. The iterative walk handles an 1100-deep lineage, and **3000 random graphs produce identical cycle sets under both implementations**. - A relocated lineage anchor was not reported as resolved. **Saved views, frontier, misc** - View rename and delete both left `query_names.watch = 1`, so one saved view returned two watched definitions and a deleted view stayed watched. Both bindings are cleared in the same transaction as the upsert/tombstone. - A content-addressed `pass_id` made `INSERT … ON CONFLICT DO NOTHING` never reopen an acknowledged obligation whose evidence still reproduced. Reconciliation now mints a successor derived from the row it supersedes, so the operator's resolution receipt stays intact and repeated identical passes converge on the same successor. A chain beyond 64 is refused by name. - Source blob authority is earned from the catalog, not the stamp. The version-1 instance is stale (#5387 raised `SOURCE_TIER_VERSION` to 2), but the collision moved with the stamp: a pre-reset database stamped exactly 2 reproduces it today. - EOF after a short HTTP body persisted as `acquired` instead of `partial`; durable-writer lease checks used `self.archive_root` rather than the declared root; an unreadable schema identity became a non-transient skew instead of a retry. ## Conflict resolution The two lanes' frontier fixes **diverge semantically**. #5406 reopens the same row, keeping the original `blocker_id`; this branch mints a successor id. Its test asserting the id is unchanged is therefore true of its fix and false of this one, so it was deliberately **not** taken — only the topology half of that commit is cherry-picked, with the reasoning in the commit message. `tests/unit/storage/test_frontier_reopen.py` pins the behaviour that actually ships. ## Verification Rebased onto master `17566b048` and re-verified there. Two gate failures were found and fixed during the rebase, both described below. - `devtools verify --quick` → **25/25 gates green** at `03bc4b0f8` pre-rebase; re-run clean after each rebase fix. - `devtools gate layering` → **exit 0, 0 violations** (it was red mid-rebase; see below). - `devtools gate atlas` → **exit 0**, "Every atlas citation and declared owning gate resolves", 40 checkable symbol claims, **0 misaimed** (was 1). - `devtools render all --check` → exit 0, `grep -c 'out of sync'` = **0**, checked explicitly rather than inferred from the exit code. - Focused batch A (7 files) → **exit 0, 40/40**. Receipt `.cache/verify/runs/20260922T072851Z-focused-test-1387181-0795e112/`, `git_head dc2222cbb`, not dirty. - Focused batch B (7 files) → **exit 0, 62/62**. Receipt `.cache/verify/runs/20260922T072855Z-focused-test-1387396-15cfa190/`. - The delta from the tested SHA `dc2222cbb` to final head `9aa1a247b` is `docs/atlas/daemon.md` and `docs/plans/durable-write-census.yaml` only — both gate inputs that no test reads. Stated rather than claiming the receipts name the tip. - Pre-consolidation each lane established its own inherited-red baseline by detaching at `9f450db36` and diffing failing nodeid sets programmatically: `NEW = []`, `FIXED = []` on the durable-migration suites (44 inherited), and an identical two-nodeid inherited set on the daemon preflight suites. Neither absorbed nor fixed here. ### Two gates went red during the rebase **`gate layering`.** #5393 adjudicated the `query_names` watch entry to `lifecycle_transition` but kept the key on `register_query_watch`, which after this branch delegates rather than writing. The gate reported exactly that pair — `durable_write_census_stale` on the old key plus `durable_write_undeclared` on `clear_query_watch`. The key is moved to the owner that holds the statement; #5393's classification and reason are kept verbatim apart from naming that owner. Same statement, same guard `WHERE name = ? AND watch = 1`, one owner. **`gate atlas` is red on master, not on this branch.** Both cited files are byte-identical here to `17566b048`, and the gate reproduces the same single misaimed anchor at either head. #5407 moved `hook_carriers` in `intake_adapters.py` from the cited `1116-1132` to `1147-1165`, and the symbol check that notices this is recent enough that #5407's own verification predates it — a gate going red on master from two separately-green PRs. The prose is still true, so the anchor is re-aimed rather than rewritten: `FileIntakeAdapter(..., class_name="hook_carrier")` at `:1156` and the multiplexed registration at `:1165` still say what the sentence claims. ### Anti-vacuity, executed Every mutation was applied, run, and reverted — not asserted: - window rank → `allowance cost follows history: 330 -> 1199 step units for the same 201-row allowance` - watch bindings → `a deleted view's name is still watched` / `the previous name is still watched beside the new one` - ops.db root → the generation case went red while the plain-archive and no-ops-tier cases stayed green, proving the fix is not a blanket change - witness → `re-anchored onto a different message`, with `test_witness_agreement_still_repairs` green under the same mutation - attachment coverage → `a contradicted object was certified as coverage` - birth version → `DID NOT RAISE RuntimeError`, both opposite-direction cases green - source blob authority → only the `stamp_offset=0` parametrisation went red; the other two staying green **is** the evidence the finding as filed is stale - frontier reopen → `assert successor_id != original_id`, both opposite-direction cases green - additive claim → `DID NOT RAISE MigrationError` - excision ledger → both writers `ACCEPTED the excised sibling`, refs `0 → 4`; after, both refuse and an admissible sibling still writes - short body → `state=acquired retryable=False diag=''` → `state=partial retryable=True`; correct-length and undeclared-length stay `acquired` - topology → `RecursionError` over an 1100-deep accepted lineage - schema identity → `SchemaSkewError … found None` → `SchemaVersionMismatchError lifecycle_action=retry` Every test file also pins the opposite direction, so a blanket refusal or a no-op cannot pass. ## Schema closure Re-measured at the consolidated head, including the cherry-picked files the deeper lane never measured. **IN (13):** `archive_identity.py`, `index_generation.py`, `materials.py`, `derived/topology/derivation.py`, `sqlite/schema.py`, `sqlite/schema_bootstrap.py`, `sqlite/migration_runner.py`, `sqlite/query_watch.py`, `archive_tiers/{archive,archive_plan,archive_query_reads,source_write,write}.py` **out (4):** `maintenance/archive_verification.py`, `operations/ref_resolution.py`, `storage/blob_integrity.py`, `storage/raw_reconciler.py` Membership is unchanged, so `gate schema-closure` needed no `--update` and passes. - `DerivedTier.index`: `752d44b9ad5a2d0d08fdff7eababe6334575ea4223a44d60b05c41f9ea0eced2` (base `17566b048`, measured in a detached worktree at that exact SHA) → **`c284f2341743d8a8ac36009fe8281dfe206f04ad795c8221f3798ceb2bdd636b`** - `DerivedTier.ops`: `86866235…` **unchanged** The archive must reconverge. **This must land before a fresh rebuild starts, never during one.** Both values are measured at the current base rather than the stale one the lane first reported; re-measure again if master moves before merge. ## Scope expansion (declared) - `polylogue/maintenance/archive_verification.py` — the attachment-coverage fix is inert without it; the reviewer's complaint names the surface, so `acquired_corrupt_count` had to enter `debt_count`, `details` and the summary, and the green wording moved from "have bytes" to "re-hash to their recorded bytes". - `docs/plans/durable-write-census.yaml` — moving the `query_names` watch-clearing UPDATE into `clear_query_watch` made `gate layering` red with one `durable_write_undeclared` and one `durable_write_census_stale`. The commit renames exactly that one key (same statement, same table, one owner) and is isolated as `7e38022b6` so it can be reverted alone. - `tests/unit/storage/test_durable_change_train.py` — three rollback tests reached their mid-apply failure with `INSERT INTO table_that_does_not_exist` under an `additive-no-backup` header, which the new guard refuses at discovery. The fixture now fails additively (two conflicting `CREATE TABLE durable_items`), raising at the same point with an additive-only statement set and preserving every assertion. Isolated as `fa7965cf8`. - `polylogue/operations/ref_resolution.py` — the relocated-lineage finding is anchored in `storage/block_anchor.py`, but the resolver is correct; the consuming boundary that drops the state lives in `operations/`. ## Residuals - **Watch baseline** (#5375) reproduces and is **not** fixed. `save_view(watch=True)` writes `queries` + `query_names` only, and `_materialize_watch_evaluation` returns early when `baseline is None`, so the first archive change after creation is absorbed silently. The remedy needs scheduling the storage tier does not own: neither creation route carries a `CanonicalPlanEvaluator` (it is injected into the daemon stage by `make_standing_query_stage`), and calling a planner from the substrate is a substrate→surface import the ratchet forbids outright. `get_watched_query_baseline(...) is None` is already the durable "never evaluated" signal, so no migration is needed for the state — only something that drives an evaluation after creation. For the daemon/standing-query owner. - **FK-cascade deletion** — `_delete_sessions_without_fk_cascade` discovers only tables with a direct `REFERENCES sessions` FK. Five tables moved to `FOREIGN KEY(message_id, session_id) REFERENCES messages(...)`, so with FKs suspended during bulk ingest a session replacement commits orphaned attachment/paste/edit/web-content/action rows. Needs a transitive closure through `messages`/`blocks`; the fix site is in `pipeline/`. - **Readiness** still treats an absent blocker row as proof, and `inspect_raw_authority_frontier` has no daemon stage. This branch closes the reopen half only. - **Archive-root cluster** — root derived from the active index's physical directory rather than `archive_file_set_root` also affects blob GC, Drive catch-up, and two unleased bootstrap/adoption paths. Not fixed: each moves a refusal on a route not exercisable without a real daemon lease. - `scan_attachment_coverage` now re-hashes every acquired attachment blob on every call. `archive verify` already re-hashes the whole namespace, but other callers were not surveyed for a cost budget; a presence-only projection would need its own explicitly-named unverified term, never a silent fallback. - The `additive-no-backup` guard excludes `CREATE TRIGGER` deliberately — it destroys nothing at apply time but arms future writes against existing rows. A legitimately additive trigger migration is the decision to revisit; that is a judgement call, not a measurement. - `_iter_migration_statements` duplicates the statement-splitting logic of `_execute_migration_sql`; they should share one splitter, kept separate here to avoid touching the apply path in a review sweep. - `relink_orphaned_attachments` still has no production caller. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01ToWqpkXotr573DiQex5vcy <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Bug Fixes** - Attachment verification now detects corrupted content instead of treating it as valid. - Incomplete downloads are marked retryable when fewer bytes arrive than declared. - Relocated references now report as resolved when valid. - Saved-view watches are correctly retired during rename and deletion. - Excised attachments can no longer be reintroduced through session imports. - Schema read failures now receive retryable handling instead of incorrect rebuild guidance. - **Performance** - Large per-session message queries use bounded reads to reduce unnecessary database work. - Deep lineage processing no longer risks recursion-limit failures. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
|
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. |
|
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
Nine live P1 review findings closed from the storage triage of PRs #4502–#5387. All 80 anchored findings in that area were triaged first; this branch fixes the nine that reproduce, are uncontested by a live lane, and are behavioural (no DDL, no migration slot).
Problem
A
git blamefilter over the review backlog selected 80 storage P1 findings whose anchored line had not moved since review. Triage at HEAD: 49 LIVE, 27 STALE, 4 WONTFIX — the filter over-selects by ~34%, its failure mode being wholesale refactors (bootstrap.pywas 6-for-6 stale after its rewrite) and the durable-lineage reset invalidating the v37/v40 migration family.Of the 49 live, 18 sit in
archive_tiers/write.pyand other files owned by concurrent lanes; those were triaged read-only and are reported, not edited.Solution
f60eeb114ce5dadfeeadditional_blob_refsbypassed the excision ledger74da4eed7pass_idmadeON CONFLICT DO NOTHINGnever reopen a reproducing obligationd09292905query_names.watch = 184e59a5afself.archive_root, not the declared rootc74450f11acquiredinstead ofpartiala65dca56aRecursionErrorat the writer's own 1024 budgetf480e5cd9593674861polylogue/operations/ref_resolution.pyis a declared scope expansion: finding #58 is anchored instorage/block_anchor.py, but the resolver is correct and the consuming boundary that drops the state lives inoperations/.Verification
devtools verify --quick→ exit 0, 25/25 gates green.devtools render all --check→ exit 0,grep -c 'out of sync'= 0.devtools testbatch A (8 files, all new tests) → exit 0,{'passed': 99, 'total': 99}. Receipt.cache/verify/runs/20260922T065128Z-focused-test-1299357-7af240a2/.devtools testbatch B (12 neighbourhood files) → exit 1,{'passed': 201, 'failed': 2}. Inherited red:git checkout --detach 9f450db36reproduces the identical two nodeids (test_schema_preflight.py::test_ingest_files_short_circuits_when_degradedand its burst sibling). Attributed to base, not absorbed, not fixed — they assert ops-write-scope balance inLiveBatchProcessor; no daemon/live/cursor code is touched here.Anti-vacuity, executed
Each production edit was reverted, the test run, and the real output recorded:
assert_archive_format_lineage ACCEPTED the transplanted historical v1 source.db; after →RuntimeError source.db stands at version 1, below the version 2 this archive recorded at birth.ACCEPTED the excised sibling, refs0 → 4; after → both refuse,0 0, and an admissible sibling still writes.after second pass (unchanged evidence): []; after →['raw-authority-blocker:e4855efe…']; a disproving pass closes it in both.after rename: ['new', 'old'],watched query objects: 1; after →['old']/[]/0.state=acquired retryable=False diag=''; after →state=partial retryable=True diag='response declared 1000 bytes but the connection closed after…'; correct-length and undeclared-length stayacquired.RecursionErrorover an 1100-deep accepted lineage; after → 1100 nodes, 0 quarantined, and 3000 random graphs produce identical cycle sets under both implementations.SchemaSkewError … found None; after →SchemaVersionMismatchError lifecycle_action=retry.Two commits have no behavioural mutation harness:
84e59a5afremoves a spurious refusal (adds none), andf480e5cd9is pinned by the new assertions plus themissingcase in the same fixture.Schema closure
raw_reconciler.pyandref_resolution.pyare out; the other seven are IN, membership unchanged (gate schema-closuregreen, no--update).DerivedTier.index:ce86c236…→7787d196…DerivedTier.ops:86866235…(unchanged)Measured against base
9f450db36; concurrent lanes are moving it, so re-measure at merge. This must land before a fresh rebuild starts, never during one. All nine changes classify as metadata-only / behavioural.Residuals
_delete_sessions_without_fk_cascadediscovers only tables with a directREFERENCES sessionsFK. Five tables moved toFOREIGN KEY(message_id, session_id) REFERENCES messages(...), so with FKs suspended during bulk ingest a session replacement commits orphaned rows. Needs a transitive closure; fix site is inpipeline/, outside this write scope.inspect_raw_authority_frontierhas no daemon stage. This branch closes the reopen half only.archive_file_set_root. Not fixed; each moves a refusal on a route not exercisable without a real daemon lease.acquired_with_bytes_countis documented as "Corroborated" but only callsblob_store.exists().relink_orphaned_attachmentsstill has no production caller.🤖 Generated with Claude Code
https://claude.ai/code/session_01ToWqpkXotr573DiQex5vcy