Skip to content

refactor: Delete the raw-authority repair framework and its unfulfilled promise - #5350

Merged
Sinity merged 3 commits into
masterfrom
refactor/eliminate-repair-concept
Sep 21, 2026
Merged

Sinity merged 3 commits into
masterfrom
refactor/eliminate-repair-concept

Conversation

@Sinity

@Sinity Sinity commented Sep 21, 2026

Copy link
Copy Markdown
Owner

Summary

Deletes the raw-authority repair framework — a public break-glass route whose
entire ritual delivered no effect — and replaces the promise with a typed
permanent refusal. Three of eight acceptance criteria remain open and are stated
plainly below; this bead gates rebuild authorization, so it does not close.

What the bead said, and what was actually true

The bead's 2026-09-21 note said the surviving cull was two durably written
strings "with a migration question attached". That premise is false at head
and was not acted on: the two constants have exactly two hits repo-wide — their
own definitions — and no writer exists anywhere, not even in a test. A read-only
census of the live archive confirms zero rows carry either string. There were no
rows to strand, so there was no migration decision to make; the constants died
with their module.

What was actually there was worse. The apply half went in #5081, leaving a
residue that advertised a remedy it could not deliver: _APPLY_DISPATCHED_ACTUATORS
documented itself as mirroring _apply_raw_authority_plan and a guard test —
grep proves neither exists. So the census still classified every accepted head
into an "executable" plan, named an actuator for each, minted operator-judgment
assertions in user.db, published durable blockers advertising a remedy, and
promoted an accepted judgment into an "executable successor" — for a dispatcher
with zero implementations.
Read conflict → write judgment → resolve, and nothing
happened.

raw_reconciler.py 1,302 → 599 lines; raw_convergence.py (2,915) deleted whole.

ops maintenance operation-recovery --confirm: RETAINED, and why

Adjudicated rather than left unmentioned. Four reasons, each checked against code:

  1. It mutates audit.db only — it writes a recovery_adjudicated event,
    touches no source/index/user row, and can repair nothing.
  2. What it records is operator testimony about an unknowable: whether a crashed
    EXECUTE's durable effect landed is not derivable from durable evidence, so no
    convergence stage can own it. That is precisely the class CLAUDE.md's "derived
    read models converge from durable evidence" sentence does not cover.
  3. Its premise is a dead daemon and it enforces that premise — the guard raises
    while polylogued lives, proven by an existing production-route test.
  4. Routing it through the daemon is self-contradictory: it would make the record of
    the daemon's own interrupted operation permanently unclosable.

What did change: the guard's refusal string said "Stop polylogued for offline
repair" — the last place the product told an operator an offline repair mode
exists. It now names the two real options. The CLI's "Resolved" echo was
deliberately not renamed; that was tried and reverted, because it would split
CLI vocabulary from the durable resolved_at_ms column and the declared operation
id. The dishonesty was never the word "resolve" — it was the claim that resolution
feeds an apply.

The census is executed, not written down

tests/unit/storage/test_repair_concept_retirement.py (27 tests): an ast.parse
import census over every polylogue/**/*.py walking imports at any nesting
depth
, a module-name ratchet, and a maintenance-surface check reading the live
declarations. The nesting matters — every edge to the deleted module was a
function-local import
, which a top-level grep would have missed entirely.

572 → 459 case-insensitive repair hits survive, each family justified
individually: 95 FTS index convergence (contentless FTS5 re-synced from durable
evidence — correct concept, repair-flavoured name), 90 declaration/diagnostic
remedy pointers, 27 behavioural measurement about archived sessions, 25
derived-row convergence inside the write transaction, 13 false positives
(CapturePairing contains "rePair"), and 165 prose. Renaming the two large
families is a cross-surface lexical change owned by polylogue-z07nu, not a
deletion bead.

The worst "described as" survivor no grep of polylogue/ would find:
docs/architecture.md placement rule 5 instructed "Is it INTEGRITY REPAIR …
detecting and fixing rows that violate an invariant the write path should have
prevented? → maintenance/"
. That is the generic repair product institutionalized
in the repo's declared placement authority, contradicting CLAUDE.md — and nothing
in maintenance/ at head is that. Rule 5 now names the three owners a write-path
invariant violation can actually have. Its worked example is now answered
"nowhere — it has no subject", because that column is a cascading FK.

Seven production-route mutants, executed

Mutant Red
Reinstate "actuator": "refine_quarantine" in the plan payload caught in the durably stored expected_json, not just in memory
Reinstate executable_plan_count on the census assert 'executable_plan_count' not in {...}
Delete the quarantined branch from _classify_frontier 2 files red — PROVEN_CURRENT is UNRESOLVED_PROVENANCE: silently reclassifying a blocked head as healthy
Re-add an actuator enum with a function-local import of the deleted module the AST census caught the function-local import; 3 red
Re-add insert_reconstructed_raw_row the durable source-tier write bypassing admit_raw_observation
Declare a repair maintenance command assert ['repair'] == []
Create storage/repair.py with REPAIR_HANDLERS the original 7,534-line substrate returning under its own name

Producer fixes checked before deleting each strategy

Deleting a repair path over a live defect is the failure mode; each of the three
was checked against its current producer and none needed a new fix. Browser-origin
mismatch: the producer fix already landed at the write boundary, not as a
backfill. Duplicate raw identity: structurally unproducible by the converged
writers since polylogue-sjf6. Quarantined accepted head: not a defect — a
declared fail-closed arbitration outcome with its own conservation term.

Verification

  • devtools verify --quick — exit 0, 24/24 gates, re-run after rebase onto
    current master
  • devtools render all --check — exit 0, grep -c 'out of sync' = 0
  • Focused selection of 14 modules — 365 passed / 365 collected, exit 0
  • 11 inherited reds reproduce identically at origin/master with identical
    assertion text; none is new

Schema closure — stated loudly because this bead gates the rebuild

All three derived fingerprints move: lowering be4f1585 → 74fafc04,
materializer bc642357 → 9dc1287d, replay 5c8ede1c → eef8760e. Closure shrank
558 → 555 members. A full archive reconvergence is required, and this must land
before a rebuild starts, never during one
— a landing mid-run silently
invalidates the run and every seeded test archive keyed on that identity.

Residuals — three criteria NOT met

  • AC6 has no enforced deletion successor, and none was fabricated. The two
    finite durable-source actuators are correctly outside the generic framework and
    bound by subject to the fresh-start ruling, but nothing makes them die before
    source sealing — and "source sealing" has no head-side signal a test could key on
    without inventing one. This alone keeps the bead open.
  • AC5 raw retention is unproven. Blob GC, source-to-index materialization and
    aggregate insights each have a named single owner with bounded retry and focused
    evidence. Raw retention does not — storage/raw_retention.py is a
    frontier-integrity projection read by live acquisition and readiness, not a
    recurring owner. A green read-path test is not evidence of a bounded recurring
    owner.
  • AC3 residual: _archive_profile_rows_debt scans for session_profiles rows
    orphaned from sessions, which is schema-impossible under an ON DELETE CASCADE
    FK. It is a read-only report whose sibling half is a real derivation-lag measure,
    so it was left and reported rather than silently expanded into.

A behaviour change a reviewer must weigh before the rebuild

Quarantined accepted heads that the deleted strategy proved "eligible" used to
classify SAFELY_REKEYABLE, which published no blocker. They now classify
UNRESOLVED_PROVENANCE and do publish one. Measured magnitude: roughly 2,200
heads move from silently-clean to blocking. The new behaviour is the correct one —
"safely rekeyable" meant "an actuator could fix this" and no actuator existed, so
readiness was reporting clean behind a remedy that never ran. But if a fresh
archive produces quarantined heads at scale, each becomes a blocker an operator
must individually acknowledge: honest, but not a workable workflow. Readiness-gate
semantics for a decided-unresolved arbitration want their own owner.

Scope

The bead's declared write_scope names only
maintenance/source_manifest_continuity.py, which was not touched — it has no
connection to the repair framework. The real scope was established from the code.
Every path has a repair-elimination rationale; the one judgement call worth review
is the docs/architecture.md rule-5 fix, cleanly separable as its own hunk.

Advances polylogue-6kur. Does not close it — AC3, AC5 and AC6 are open.

🤖 Generated with Claude Code

https://claude.ai/code/session_015WCh9YW3cRfsg3CZBKU7Fq

Sinity and others added 3 commits September 21, 2026 14:02
The apply half of the raw-authority repair product was removed in #5081,
which left the worse residue: a census that still classified every accepted
head into an "executable" repair plan, named a RawAuthorityActuator for each,
minted operator-judgment assertions, and published durable blockers promising
a remedy no code in the tree could run. `_APPLY_DISPATCHED_ACTUATORS` even
documented itself as mirroring `_apply_raw_authority_plan` and a guard test,
neither of which exists.

Delete the promise rather than re-plumbing it:

- `polylogue/storage/raw_convergence.py` (2,915 lines): the three historical
  incident strategies (quarantined accepted raw, browser-capture origin
  mismatch, duplicate raw identity). They prove cohorts of the pre-2026-09-07
  archive, which the fresh-start ruling does not migrate; the duplicate-raw
  strategy is structurally unprovable post-#2729 because it requires a
  native-id-inclusive raw the current writer never emits.
- `RawAuthorityActuator`, `_EXECUTABLE_STATES`, `_APPLY_DISPATCHED_ACTUATORS`,
  `RawAuthorityFrontierItem.executable`, `executable_plan_count`, the
  strategy-override bridge, and the `safely_rekeyable` / `duplicate_alias` /
  `conflicting_authority_needs_judgment` states.
- The operator-judgment loop (`_record_judgment_candidate`,
  `_apply_judgment_dispositions`) and its `--assertion-id` /
  `--judgment-disposition` CLI, protocol, actuator and spec surface.
- `ReconstructedRawRow` / `insert_reconstructed_raw_row`: the one declared
  exemption from `admit_raw_observation`, whose only caller was the
  browser-origin copy-forward repair.

What survives is a read-only frontier census: every non-current state is an
explicit retryable obligation ordinary acquisition discharges, or a typed
permanent refusal. `raw_authority_blockers` and its readers are untouched.

`raw_convergence.py` was a declared materializer-fingerprint root, so this
moves the derived schema identity and must land before a rebuild starts.
Closure shrinks 558 -> 555 members.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_015WCh9YW3cRfsg3CZBKU7Fq
…romise

`docs/architecture.md` rule 5 told every future contributor to put "detect
and fix rows that violate an invariant the write path should have prevented"
in `maintenance/` -- the generic repair product, institutionalized in the
placement rules and in direct contradiction of CLAUDE.md. Nothing in
`maintenance/` at head is that: it holds conservation proofs, censuses, blob
disposition, embedding preservation and archive verification.

Rule 5 now describes what `maintenance/` actually is and names the three
owners a write-path invariant violation can have -- the schema, the producer,
or a canonical derivation -- with the choice taking precedence over
placement. The worked examples follow: the orphaned-`messages` sweeper has no
subject, because `messages.session_id` is a cascading FK.

`docs/maintenance.md` claimed "the daemon selects only executable
proof-backed plans" for the raw-authority frontier. No apply route has
existed since #5081 and none exists now; the section describes the read-only
census and names who actually discharges each state.

`docs/design/raw-decision-authority.md` gets a status header: its
ledger-drop and blocker-re-keying decisions landed, its apply-side half now
describes deleted code, and its `raw_convergence.py:NNNN` citations resolved
to nothing even before the file was deleted.

Also drops the now-stale `raw_convergence` anchors from the layering-surface
and sqlite-degradation ratchets (both declare "removal only"), and corrects
`architecture-hotspots.md` row 3 and `sqlite-connection-policy.md`.

Adds `tests/unit/storage/test_repair_concept_retirement.py`: the executed
census for the retirement, including the module-name ratchet, the import
census over the whole product tree, and one production-route law over a
seeded archive proving a blocked head is still reported and published while
the payload carries no actuator and no executable plan count.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_015WCh9YW3cRfsg3CZBKU7Fq
`frontier_judgment` was a second blocker resolution contract -- an accepted
judgment assertion id plus `disposition=retain_canonical_authority` -- and
its only producer was the conflicting-authority frontier state deleted with
the repair framework. Its tests seeded the `judgment_assertion_id` key by
hand, so they certified a shape `_reconcile_frontier_obligations` can no
longer write.

Every frontier blocker now resolves through the one declared mutation;
`kind` describes only how the resolver reads the stored snapshot. The
obligation test keeps the real law (resolution needs no extra operator
authority) and names the mutant that reddens it.

Also asserts the frontier census payload carries no `executable_plan_count`,
and reverts a needless `Resolved` -> `Acknowledged` rename that would have
split CLI vocabulary from the `resolved_at_ms` column and the declared
`mutation.raw-authority-blocker.resolve` operation.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_015WCh9YW3cRfsg3CZBKU7Fq
@Sinity
Sinity enabled auto-merge (squash) September 21, 2026 12:08
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for security reviews. Please try again later.

@coderabbitai

coderabbitai Bot commented Sep 21, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 32 minutes.

Check out review usage here.

View limit details

Limit 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.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 3a599603-52fc-4f72-ad62-af3a3704b1b4

📥 Commits

Reviewing files that changed from the base of the PR and between d531c27 and 9de7807.

📒 Files selected for processing (43)
  • docs/architecture-hotspots.md
  • docs/architecture.md
  • docs/design/raw-decision-authority.md
  • docs/maintenance.md
  • docs/plans/layering-surface-baseline.json
  • docs/plans/rebuild-route-census.yaml
  • docs/plans/schema-closure-baseline.json
  • docs/plans/sqlite-degradation-baseline.json
  • docs/sqlite-connection-policy.md
  • polylogue/archive/raw_authority_verdict.py
  • polylogue/cli/commands/config.py
  • polylogue/cli/commands/maintenance/_raw_identity.py
  • polylogue/config.py
  • polylogue/maintenance/offline_guard.py
  • polylogue/operations/__init__.py
  • polylogue/operations/daemon_mutations.py
  • polylogue/operations/daemon_protocol.py
  • polylogue/operations/mutation_actuators.py
  • polylogue/operations/specs.py
  • polylogue/pipeline/ids.py
  • polylogue/sources/__init__.py
  • polylogue/sources/census_parse_stage.py
  • polylogue/sources/origin_specs.py
  • polylogue/sources/revision_backfill.py
  • polylogue/storage/derived/session/rebuild.py
  • polylogue/storage/raw_authority.py
  • polylogue/storage/raw_convergence.py
  • polylogue/storage/raw_reconciler.py
  • polylogue/storage/sqlite/archive_tiers/ingest_precedence.py
  • polylogue/storage/sqlite/archive_tiers/raw_admission.py
  • polylogue/storage/sqlite/archive_tiers/source_write.py
  • polylogue/storage/sqlite/durable_change_train.py
  • tests/unit/cli/test_archive_maintenance_cli.py
  • tests/unit/operations/test_mutation_actuators.py
  • tests/unit/storage/test_browser_capture_origin_repair.py
  • tests/unit/storage/test_duplicate_raw_identity_repair.py
  • tests/unit/storage/test_maintenance_read_profiles.py
  • tests/unit/storage/test_quarantine_repair_budget.py
  • tests/unit/storage/test_quarantined_accepted_raw_repair.py
  • tests/unit/storage/test_raw_admission.py
  • tests/unit/storage/test_raw_authority_ledger.py
  • tests/unit/storage/test_repair_concept_retirement.py
  • tests/unit/storage/test_vocabulary_write_boundary.py

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 21, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-21T12:20:24.530142Z 9de7807 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@Sinity
Sinity merged commit eac15d4 into master Sep 21, 2026
3 checks passed
@Sinity
Sinity deleted the refactor/eliminate-repair-concept branch September 21, 2026 12:18

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9de7807027

ℹ️ 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".

Comment thread polylogue/storage/raw_authority.py Resolved
Comment thread polylogue/storage/raw_reconciler.py Resolved
Comment thread polylogue/storage/raw_reconciler.py Resolved
Sinity added a commit that referenced this pull request Sep 21, 2026
…reads (#5354)

## Summary

Moves `read --view messages` onto the daemon, and makes the
controlled-read
boundary an **executable gate** rather than prose.

## The bead's design was not implementable as written

`fko9.3` says to lower the messages view onto `session.read`'s
**transcript**
kind. Doing that would have:

- replaced the rich `MessageRowEnvelope` rows (tokens, model, timestamp,
attachment refs, ~32 fields) with the transcript kind's **5-field
identity
  projection** — a silent output regression on `--format json`; and
- minted continuations in a *different vocabulary*
(`operation="session.read"`,
  projection `session-read-v1`) than the one this view belongs to
  (`sessions.read` / `session-owner-v1`), **breaking
`test_continuation_surface_parity.py`**, which requires a token minted
by
  `read_transcript_window` to resume on the CLI.

Built instead: `session.read` gains a **`messages` kind** whose handler
is framed
by `operations/transcript_window.py::read_transcript_window_sync` — the
shared
window owner — so both the continuation family and the rich row
vocabulary are
preserved. It **refuses a filtered window by name** rather than
answering with
unfiltered rows, because the pinned page reader has no filter
vocabulary.

Two further bead claims did not hold: `run_read_messages` did not
compute via
`api.iter_messages` (that was only the `--to file` writer path), and the
sibling
`--view summary` does **not** print `served-by:` on the cited input —
line 924 is
the ordinary find/list page path, and `--id <sid> read --view summary`
returns
through `_emit_session_result` well before it. **No read view printed
`served-by:`
at the base.**

## t46.11: the claimed defect does not reproduce, and the rule already
half-existed

`vclez`'s "six production `ArchiveStore.open_existing()` reads outside
the
controlled boundary" **cannot be reproduced at any head measured — there
are
zero.** The guard that did exist licensed *any* `read_only=False` open
with no
stated reason, which is exactly why the survivors could not be audited
and why a
count of "six" could be asserted without contradiction.

### The rule, now a gate in the quick set

> A direct `ArchiveStore.open_existing` is exactly one of three things.
> **read_boundary** — a read-only open installing the read control plane
> (admission, pinned tier snapshot, cancellation/progress guard,
receipt). There
> are **two** owners, not one, because read parity is an equivalence
between two
> declared executors, not convergence on one route.
> **writer** — an explicit `read_only=False` open taking the writer
lease, with a
> named role. The write-owner rule governs it.
> **violation** — anything else.

**The load-bearing check is not "is this open read-only".** It is that a
site
*declared a writer* still passes `read_only=False` — the realistic
silent
regression is a declared writer losing its explicit write mode and
becoming an
uncontrolled read while its census row still reads "writer". Which
module may own
the boundary is **policy** (`read_boundary_owners`), so a new
uncontrolled read
cannot license itself by claiming to be the boundary.

### Census — every survivor classified

26 direct opens: **3 read-boundary owners, 23 licensed writers, 0
uncontrolled
reads, 5 recorded debt.** Reproduce with `devtools gate controlled-read
--json`.

| Classification | n |
| --- | --- |
| read_boundary | 3 |
| writer / daemon_write | 8 |
| writer / facade_mutation | 5 |
| writer / ingest_write | 5 |
| writer / generation_lifecycle | 2 |
| writer / durable_probe | 2 |
| writer / fixture_seeding | 1 |
| **violation** | **0** |

Debt named rather than licensed: four `api/archive.py` facade mutations
taking the
writer lease in-process instead of admitting through the daemon write
coordinator
(sole-writer completion work, not an alternate write policy), and
`cold_build.py::active_index_generation_is_empty`, which **takes the
writer lease
to answer a question that is a read** — its writable open is deliberate
because it
bootstraps the durable tiers, but separating the bootstrap from the
question would
let the question go through the read boundary.

**Deleted** `tests/unit/archive/query/test_read_surface_control.py`: the
gate
enforces its rule and more, so keeping it would be a second, weaker
restatement.

The doctrine sheet's open question "process-level sole writership is not
proven by
the writer gate" is updated — the census is the evidence that question
asked for,
while staying explicit that it **records rather than enforces**.

## Two defects found and fixed on the way, both outside the bead text

- **`RootModeRequest` had no owner for "which configuration am I
reading".**
Routes read `request.params["_config"]` directly, which is `None` for
every
invocation the root callback does not pin — i.e. **every real `polylogue
read`**.
  `run_read_hooks` carried the same latent bug.
- **A typed refusal lost its declared code in *both* executors.**
  `operation_kernel._execute_directly` flattened every `ValueError` to
`"invalid_request"`; `daemon_execution` used `code=str(exc)` — the whole
message
  as the code. A stale continuation therefore could not be reported as
  `query_continuation_stale` through the operation route.

## Anti-vacuity — executed against the real tree

| Mutation | Red |
| --- | --- |
| Never ask the daemon (`daemon_disabled = True`) | `AssertionError:
served-by: direct (23ms)` |
| Falsify the `served-by` identity | `AssertionError: served-by: daemon
(uds, 28ms)` — reds two tests |
| Add an unlicensed `open_existing` to an unlisted file |
`controlled_read_site_undeclared`, **gate exit 1** |
| Remove `read_only=False` from one declared writer |
`controlled_read_writer_is_not_explicit (declared a writer but opens
without read_only=False, so it is an uncontrolled read)`, **gate exit
1** |

Five more are encoded as unit tests over synthetic trees (self-declared
boundary,
stale declaration, no boundary at all, unknown role, renamed owner
path). **Nothing
is reasoned-not-executed.**

## Schema closure — all 25 changed files `out`, measured at the real
base

`polylogue/surfaces/payloads.py` is **IN** and was deliberately not
touched —
`read_contracts.py` exists precisely so a new operation declaration does
not move
the identity, and the new kind lives there. `archive_tiers/archive.py`
and
`write.py` are **IN** and were avoided by discovering that
`ArchiveSessionEnvelope` **already** carries `lineage_complete` /
`lineage_truncation_reason` through `read_archive_session_page`, so the
truncation
signal survives the move with no storage edit. **That is what kept this
leaf off
the rebuild boundary.**

## Verification

- `devtools verify --quick` — **exit 0, 25/25 gates**, including the new
  `gate controlled-read ... ok (4.4s)`
- `devtools render all --check` — exit 0, `grep -c "out of sync"` = 0
- `devtools gate controlled-read` — exit 0, 26 observed, 0 violations
- `test_daemon_golden_parity.py` 5 passed (incl. the new messages parity
test
  **against a real UDS daemon**), `test_messages.py` 18,
  `test_verify_controlled_read.py` 11, `test_archive_query.py` 111
- `devtools test tests/unit/cli` — 3166 passed / 37 failed, **all
inherited**,
proven by a detached checkout at the branch base inside the same
worktree (406
passed / 38 failed, identical node-id set; the 38th is outside
`tests/unit/cli`)

**Two reds were mine and are fixed, not excused**: a pinned read-view
partition
that moved by design, and two `test_archive_query.py` tests that
appeared *after*
the rebase (new from #5350–#5353) monkeypatching a symbol this branch
renamed.
That is why the post-rebase full-directory rerun mattered.

## Residuals

- **`--format json` block payloads narrow slightly.** `content_blocks`
entries
  lose explicit-null keys. Cause: the daemon route hydrates through
`archive_block_to_domain`, which *deliberately* drops `None` so an
absent field
stays absent rather than becoming an explicit null in every public block
payload;
the old async decode path emitted them. Measured empirically as the
**only**
field difference between the two projections, and `render all --check`
is clean
so no committed schema changed. Strictly narrowing and consistent with
declared
  policy — named rather than buried.
- **The 8 MiB operation bound now applies to this view.** A single
window wider
than the bound is a typed refusal naming the limit, where the in-process
reader
had none. `--full` and any `--limit` above 200 compose from bounded
windows, so
realistic cases are unaffected; a single `--limit 1500` on very large
messages
  could now refuse.
- **The gate observes AST over literal
`ArchiveStore.open_existing(...)`.** An open
reached through `getattr`, an alias, or a stored callable is not
resolved —
  stated in the module docstring, not hidden.
- `tests/unit/cli/test_messages.py` lost its `_FakeApi` message-path
tests: they
mocked `Polylogue.open`, which the route no longer uses, so a double
could not
have proven the route. Replaced with seeded real archives via
`SessionBuilder`,
including a genuine prefix-sharing fork with a hard-deleted parent
branch point.

Closes polylogue-fko9.3, polylogue-t46.11.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_015WCh9YW3cRfsg3CZBKU7Fq


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **New Features**
* Added support for viewing messages through the session read operation.
* Added message pagination, continuation tokens, full transcript output,
and lineage metadata.
* Added consistent JSON and NDJSON message output across direct and
daemon execution.
  * Added executor authority details to read results.

* **Bug Fixes**
* Preserved specific error codes for invalid, stale, or expired
continuation requests.
* Improved handling and reporting of missing sessions and read failures.

* **Documentation**
* Documented controlled archive-read boundaries and associated
verification rules.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
Sinity added a commit that referenced this pull request Sep 21, 2026
…status (#5371)

## Summary

Closes the three `polylogue-6kur` residuals — AC3, AC5 and AC6 — and
fixes a **live
product defect on the primary health command** found while clearing the
stale
snapshot behind them.

## The defect nobody was looking for

**`polylogue ops status` reported `ok: false` and exited 1 on any
archive.**

#5285 broadened `_component_readiness_ok`'s unknown rule from `name in
required_known` to `(name in required_known or name in
required_missing)` and made
`tier_count_unavailable` a verdict refutation. That turned two stale
operands into a
**permanent refusal**:

1. `transforms` was published UNKNOWN because an exact archive-readiness
probe was
skipped — though the component is a function of the transform-registry
size and the
session count, and that probe contributes **neither**. Direct status
already counts
   sessions for `archive_stats`.
2. `_TIER_STATUS_TABLES` named a user-tier relation `settings` that the
user DDL has
**never** declared — it is `user_settings` — so the tier reported an
inexact
   declared-relation count.

Only the two operands are fixed here. `_component_readiness_ok`'s
broadened clause is
untouched: **polylogue-20d.17 owns that rule and is still open.** Worth
that lane's
attention — the clause contradicts `overall_status_ok`'s own docstring,
*"Absence of
evidence never refutes the verdict here — refuting on it would make
every
direct/pinned read permanently not-ok."*

## AC6 — the declaration, and why it lives where it does

`CAMPAIGN_ACTUATOR_RETIREMENTS` in `maintenance/declarations.py`,
enforced by the
**existing** `declaration-bindings` gate through the maintenance
family's `domain`
hook — the declared seam for "bindings the shared kernel cannot
resolve", previously
unused for this family. **No gate name added, no `docs/plans` file
added.**

It sits beside the thing it retires: the two actuators exist only to
back four
`ops maintenance blob-reference-*` commands this module already
declares. The record
names dotted symbols and tracked owner paths, which is what the check
must resolve; a
YAML would have needed a new parser and a new gate.

**Both directions executed**, which is what makes it a successor rather
than a
deletion test:
- `condition_met=True` with the actuators present → **exit 1**, two
`actuator-retirement-overdue` lines naming each actuator and quoting the
condition
  and the commands it backs.
- `condition_met=False` with one actuator renamed away → **exit 1**, one
  `actuator-retirement-premature` line.
- A wiring mutant removing the `domain` hook reddens the gate-ownership
test while the
  diagnostics' own tests stay green.

The AC6 work reads `maintenance_actuators.py` as **source text rather
than importing
it**, so nothing new reaches `blob_integrity.py`.

## AC5 — the owner existed; the retry did not

`LiveBatchProcessor._compact_superseded_raw_snapshots` is a real
recurring owner:
once per live-ingest pass, through the daemon write coordinator, under
`ActiveWriterLease` plus an explicit `require_write_lease`, bounded to
25 superseded
snapshots per source path. **The previous lane was right not to assert
an owner it had
not verified — but the owner is there. What was missing is bounded
retry.**

Three outcomes were a `logger.warning` and nothing else: a safety
refusal returned
immediately, a filled bound **reported a finished answer it had not
computed**, and
neither left any record the work was still owed.

Unfinished paths now land in the ordinary `convergence_debt` ledger
under stage
`raw_retention` — `deferred` for a hit bound with **the bound named in
the row**,
`failed` for a refusal — reusing the existing attempts and exponential
backoff. Each
pass drains up to 25 retry-due paths through the same authority
resolution, so the
backlog costs no extra writer hold.

Blob-unlink errors are deliberately **not** residual: their subjects are
already
unreferenced and belong to blob GC, and filing them here would leave a
row no
retention pass could ever clear — found by hitting exactly that while
building it.

The one-authority-call-per-page cost contract is preserved and asserted,
because the
backlog extension is empty when there is no debt.

## AC3 — and the `foreign_keys` question answered properly

**Yes, foreign keys are off on exactly one production route, and it is
compensated.**
The bulk-ingest window runs `PRAGMA foreign_keys = OFF`, but before
committing it runs
`_foreign_key_violations_for_sessions` over a plan derived from
`PRAGMA foreign_key_list` **on the live schema** — not a written-down
list — and raises
rather than committing anything that window admitted. `session_profiles`
carries
`session_id`, so it lands in the **scoped** half of that plan.

Every write profile reaching `index.db` sets `foreign_keys=ON`, and a
full
session-insight rebuild unconditionally prunes orphan per-session rows —
so even a
hypothetical orphan has a recurring owner.

So the orphan half was a **permanently-zero count with no actuator
behind it**:
repair-shaped, not a measure. Deleted. The missing half is real
derivation lag and is
kept, with the detail text and `issue_count` naming only it. The
`derived_repair`
category token is deliberately **not** renamed — it is a public filter
shared with
`archive_messages_fts` and belongs to the vocabulary pass.

## The snapshot, and why the order mattered

`test_json_status_snapshot` was red — **but not on a snapshot
mismatch.** It failed
asserting `ops status --format json` exits 0, so the `.ambr` block was
never compared
and `--snapshot-update` **could not have regenerated it**. Fixing the
underlying red
made the command exit 0; only then was `--snapshot-update` run, scoped
to that single
node id. The regenerated block drops five `raw_authority_*` keys — all
verified to have
zero producers repo-wide — and picks up tier `state` fields. One hunk
group, nothing
else in the file.

## Landing window

`archive.py`, `live/batch.py`, `live/cursor.py`, `raw_retention.py`
**IN**; the rest
`out`. All three fingerprints move; closure size **555 → 555**, `added:
[]`,
`removed: []`. **Must land before a rebuild starts, never during one.**
Both known
traps are IN and neither was touched.

## Verification

`devtools verify --quick` exit 0 (25 gates, read as `$?` directly) ·
`render all
--check` exit 0, zero `out of sync` · `gate declaration-bindings` exit 0
clean and
exit 1 under each condition mutant · `gate atlas` exit 0 after
re-anchoring ·
`gate mypy` clean over 2963 files · focused part 1 exit 0 · focused part
2 469 passed
/ 13 failed.

**14 failures at base → 13 at head**, proven in a detached worktree at
the exact base
with its own venv: the base set **minus** the snapshot test this branch
fixes. **No new
failure.**

## Residuals

- **AC4 has no evidence at this head from any lane** — neither this one
nor #5350
audited current writer defects and their producer fixes. Treat as
unknown.
- **AC8 is unsatisfiable as written**: it demands a net-LOC figure
against a deleted
baseline, which is not checkable at a SHA. The bead records a drafted
replacement
  that needs applying.
- `6kur` also still depends on the open `bp12n.1` and closes from its
members, so the
  gate cannot close on this branch alone regardless.
- Raw-retention backlog drains on the next ingest pass with a succeeded
path, not a
standalone timer. Coherent — superseded snapshots are produced by ingest
— and
strictly better than vanishing into a log line, but a permanently
dormant source with
>25 superseded snapshots keeps a visible `convergence_debt` row until it
is ingested
  again.
- Two design docs still describe the retired raw-authority census ledger
as live.

Closes polylogue-rtgmi. Advances polylogue-6kur (AC3, AC5, AC6).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_015WCh9YW3cRfsg3CZBKU7Fq

---------

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
Sinity added a commit that referenced this pull request Sep 29, 2026
…#5785)

## Summary

This PR salvages ChatGPT fleet worker 12's Codex-debt batch (beads
`polylogue-1tyq5.55`, `.56`, `.60`, `.62`; 72 findings) and turns it
into verified changes. Five fixes land with regression tests that fail
on master. The worker's sixth fix (a negative completion cache) was
dropped, and its health-check fix was replaced with a stricter version.

## Problem

- **55.05** `health_check()` raises `SchemaSkew` when a tier is on
another version. The tier probe opened the file with schema admission
but caught only `sqlite3.Error`, so the probe crashed instead of
reporting an error check.
- **55.10** `list_assertion_candidate_reviews(limit=10)` computed
`total` with a second, unbounded review read. That read ran the
per-candidate judgment lookup (N+1) across the whole candidate history.
- **60.01** `--stream --limit N` followed continuations with no limit.
The final page could therefore fetch rows past N, and the resulting
`result_too_large` refusal was re-raised for continuations instead of
narrowing the page.
- **60.20** `raw-authority-frontier` printed the all-state `plan_count`
as `obligations=`, including terminal `superseded` plans.
- **62.01** Named `analyze postmortem|portfolio|cost-outlook` computed
the inherited root format but rendered from the local `None` format, so
they printed text when JSON was requested.

## Solution

- `_archive_tier_readiness_check` keeps admission, passes `tier=`, and
reports any `SchemaRefusalError` as an ERROR check. The worker's
`validate_schema=False` version was replaced because it compared only
`user_version`, so a derived tier with a stale identity at the right
version was reported OK.
`test_health_check_reports_derived_identity_skew` fails on the worker's
version.
- `_archive_list_assertion_candidate_reviews` returns `(page, count)`
from one read transaction. The count comes from
`count_assertion_claims`, which now accepts `target_ref` and
`statuses=None`. The count includes expired claims, matching the review
read model.
- `_read_session_windows` sends the remaining bound with every
continuation. An oversized resumed page halves in place, and later pages
keep the narrowed bound, because `session.read` refuses a continuation
that widens its window.
- The plain frontier line says `plans=` (the neutral label the finding
offered).
- `analyze_verb` renders every branch from the effective format: the
local format if given, otherwise the root format, normalized with
`normalize_output_dialect`. An explicit local `--format` still wins.
- **62.16 dropped.** The deleted-candidate case was already fixed on
master in 8cb1133 (#5722): each successful answer, empty or not,
removes the cached matches for the refreshed prefix. The worker added a
cache of empty answers that offline completion would treat as
authoritative. Nothing invalidated it except a later contradicting
daemon answer or the 24h TTL, and an offline reader cannot tell whether
the archive changed without opening it. The cold-cache message on a miss
is displayed rather than inserted, and it is accurate.
- Two stale tests in `test_archive_query.py` expected `_emit_stats` to
exit 0 over a converging archive. #5700 made that outcome degraded with
a nonzero exit, so the tests now expect that. They failed on master
before this PR.

## Verification

- `agentctl job start polylogue verify_quick --workspace
/realm/worktrees/salvage-w12 --wait` → job 2374: `verify: PASSED exit=0`
(head 331a204ddd, pre-rebase; the rebase onto 4501f13 touched none of
these files). Earlier job 2368 failed on format and mypy in the worker's
commit; commit 3561647 fixes both.
- `agentctl job start polylogue pytest_focused --workspace
/realm/worktrees/salvage-w12 --wait --
tests/unit/api/test_archive_health_tier_skew.py
tests/unit/api/test_assertion_candidate_review_count.py
tests/unit/cli/test_analyze_named_projection_format.py
tests/unit/cli/test_raw_authority_frontier_output.py
tests/unit/cli/test_session_window_continuation_bounds.py
tests/unit/cli/test_analyze_projections.py
tests/unit/cli/test_archive_query.py
tests/unit/cli/test_completion_daemon_boundary.py
tests/unit/api/test_assertion_candidate_queue_health.py` → job 2405 at
head 3561647: `devtools test: PASSED exit=0 diagnosis=pytest_passed`,
168 passed.
- Anti-vacuity: the new tests were run on an origin/master checkout (job
2351). Every fix test failed there (11 failures, plus the 2 stale stats
tests). The one exception is
`test_named_analysis_local_format_overrides_inherited_json`, a
precedence guard that should pass on both. Job 2355 ran the health tests
against the worker's `validate_schema=False` variant, and the
derived-identity case failed (status OK instead of ERROR).
- Inherited, not addressed here:
`tests/unit/api/test_facade_contracts.py::test_archive_facet_buckets_count_unique_sessions_for_duplicate_hits`
and `::test_no_undiscovered_async_methods` fail identically on master
4501f13 (job 2401).

## Self-review

- **Sibling sites.** The review count had one caller, and `judge.py`
consumes the facade's `total`. The daemon health endpoint has its own
tier checks and is out of scope. The other `validate_schema=False` opens
are reset, paths and export tools, not health reporting.
- **Cancellation and loops.** The window retry loop is bounded by
halving to 1 and then re-raising. No new loop reads without a bound.
- **Unbounded reads.** This PR removes one, the unbounded review read,
and adds none.
- **Fail-open fallbacks.** The health probe now reports refusals instead
of hiding them. The dropped completion change would have turned a cache
miss into an authoritative empty answer.
- **Compatibility shims.** None. `count_assertion_claims` gained
optional parameters, and its existing `annotations/join.py` callers are
unchanged.
- **Removed symbols.** No production symbol was removed. The
`test_codex_debt_w12.py` files were renamed by behaviour.
- **Production route.** The API tests go through
`Polylogue.health_check` and `list_assertion_candidate_reviews` on
bootstrapped archives. The CLI tests go through `cli` or the real
command with a mocked transport (`dispatch_read`) and the real
`lower_session_read`.

## Derived-identity closure

`polylogue/storage/sqlite/archive_tiers/user_write.py` is a member of
`docs/plans/schema-closure-baseline.json`, so this PR moves the
candidate derived identity. Closure membership does not grow (the
`schema-closure` gate passed). No other changed production file is a
member.

## Per-finding dispositions

Counts: 5 fixed, 60 fixed-already, 2 stale, 1 refuted, 4 not reached.
The not-reached findings (55.18, 55.22, 60.12, 62.08) stay open on their
beads.

| key | disposition | evidence | test |
| --- | --- | --- | --- |
| 55.01 #4326 `polylogue/api/__init__.py:51` | refuted |
`polylogue/api/parity.py:472–491`: The explicit context-pack exclusion
includes topic_pack; composed builders do not own a separate operation
identity under this contract. | — |
| 55.02 #5381 `polylogue/api/archive.py:410` | fixed-already |
`polylogue/api/archive.py::_read_session_transcript_page`: The
normalized offset is used for both the read and returned page
coordinates. | — |
| 55.03 #4287 `polylogue/api/archive.py:818` | fixed-already |
`polylogue/api/archive.py::_archive_list_summaries_with_post_filters`:
Effective specification pagination is restored after content filtering.
| — |
| 55.04 #4295 `polylogue/api/archive.py:871` | fixed-already |
`polylogue/api/archive.py::_archive_aggregate_facet_families / keyed`:
Repeated facet bucket counts are added across chunks rather than
overwritten. | — |
| 55.05 #4871 `polylogue/api/archive.py:1114` | fixed |
`_archive_tier_readiness_check` keeps admission and reports
`SchemaRefusalError` as ERROR | `api/test_archive_health_tier_skew.py` |
| 55.06 #4192 `polylogue/api/archive.py:1152` | fixed-already |
`polylogue/api/archive.py::_archive_list_assertion_claims`: Uses
_readable_user_tier rather than an index-backed query runner. | — |
| 55.07 #4794 `polylogue/api/archive.py:1546` | fixed-already |
`polylogue/storage/sqlite/connection_profile.py::_install_progress_handler`:
Read frames install an expiry/cancellation-aware SQLite progress
handler, including work using the bound connection. | — |
| 55.08 #4552 `polylogue/api/archive.py:1691` | fixed-already |
`polylogue/api/archive.py::_archive_list_assertion_candidates`: Calls
the canonical actionable queue reader rather than the expiry-retaining
review reader. | — |
| 55.09 #4295 `polylogue/api/archive.py:3066` | fixed-already |
`polylogue/api/archive.py::pathology_report`: replace(spec, limit=None,
offset=0) removes query pagination from the scope denominator. | — |
| 55.10 #4295 `polylogue/api/archive.py:3448` | fixed | one read
transaction; scalar `count_assertion_claims` replaces the second
unbounded review read | `api/test_assertion_candidate_review_count.py` |
| 55.11 #4552 `polylogue/api/archive.py:3453` | fixed-already |
`polylogue/api/archive.py::_readable_user_tier`: Missing/non-file and
unreadable durable-tier failures retain typed unavailability rather than
returning an empty list. | — |
| 55.12 #4295 `polylogue/api/archive.py:3503` | fixed-already |
`polylogue/cli/commands/judge.py::judge_command`: Preserves
authoritative review totals; additional client-side time filtering reads
the complete selection before recounting. | — |
| 55.13 #5302 `polylogue/api/archive.py:4021` | fixed-already |
`polylogue/operations/facade_writers.py::record_manual_continuation_product`:
Invokes _resolve_session_graph before committing the manual link,
refreshing topology projections. | — |
| 55.14 #5302 `polylogue/api/archive.py:4021` | fixed-already |
`polylogue/operations/facade_writers.py::record_manual_continuation_product`:
Invokes the canonical cycle/quarantine pass instead of leaving the
direct insert unchecked. | — |
| 55.15 #4180 `polylogue/api/archive.py:5081` | fixed-already |
`polylogue/api/archive.py::search_session_hits`: Passes unresolved
spec.to_plan() to failure-classifying search_hits_for_plan. | — |
| 55.16 #4180 `polylogue/api/archive.py:5512` | fixed-already |
`polylogue/api/archive.py::filter`: Constructs SessionFilter without
vector-provider initialization. | — |
| 55.17 #5362 `polylogue/api/archive.py:5557` | fixed-already |
`polylogue/api/archive.py::query_sessions`: Includes
title_is_synthesized from display_label_source. | — |
| 55.18 #5370 `polylogue/api/archive.py:5561` | not reached |
`polylogue/api/archive.py::read_transcript_window`: Anchor lookup and
transcript-window reading still have separate read lifetimes.
Single-snapshot implementation remains necessary; no fix written. | — |
| 55.19 #5370 `polylogue/api/archive.py:5563` | fixed-already |
`polylogue/api/archive.py::read_transcript_window`: Explicitly rejects
around combined with transcript filters. | — |
| 55.20 #4357 `polylogue/api/archive.py:6330` | fixed-already |
`polylogue/api/archive.py::get_effective_context`: Canonical ID
resolution plus read_summary replaces full transcript hydration for the
existence check. | — |
| 55.21 #4261 `polylogue/api/insights.py:753` | fixed-already |
`polylogue/api/insights.py::cost_outlook`: Restricts the cost query to
the selected cycle's since/until rather than the whole archive. | — |
| 55.22 #5007 `polylogue/api/insights.py:916` | not reached |
`polylogue/api/insights.py::get_ancestors/get_descendants/get_siblings/get_thread/get_logical_session`:
Exhaustive relationship helpers still consume the default topology page
without exhaustion. No implementation written. | — |
| 55.23 #5007 `polylogue/api/insights.py:927` | fixed-already |
`polylogue/api/insights.py::_resolve_for_topology`: Uses canonical
archive resolve_session_id, preserving native-ID resolution. | — |
| 55.24 #4799 `polylogue/api/insights.py:1030` | fixed-already |
`polylogue/api/insights.py::compact_lineage`: Both public page defaults
use DEFAULT_LINEAGE_PAGE_LIMIT. | — |
| 55.25 #4539 `polylogue/api/search_envelope_builder.py:138` |
fixed-already |
`polylogue/api/search_envelope_builder.py::build_search_envelope_for_spec;
polylogue/operations/authority.py::authority_for_config`: The envelope
delegates authority resolution to the owner that resolves the active
archive root. | — |
| 56.01 #4603 `polylogue/api/search_envelope_builder.py:148` |
fixed-already |
`polylogue/api/search_envelope_builder.py::build_search_envelope_for_spec`:
Reports matched=total and analyzed=len(hits). | — |
| 60.01 #5337 `polylogue/cli/archive_query.py:360` | fixed |
continuations carry the remaining bound; resumed pages halve in place,
never widen | `cli/test_session_window_continuation_bounds.py` |
| 60.02 #4402 `polylogue/cli/archive_query.py:390` | fixed-already |
`polylogue/surfaces/cursor_identity.py::search_cursor_request_identity`:
Presentation-only parameters are excluded from cursor identity. | — |
| 60.03 #4987 `polylogue/cli/archive_query.py:1913` | fixed-already |
`polylogue/cli/render/rows.py::project_payload`: Outcome is preserved
independently of selected result fields. | — |
| 60.04 #5249 `polylogue/cli/click_app.py:479` | fixed-already |
`polylogue/cli/query_contracts.py::QueryOutputSpec.from_params`:
Explicit file destination and path retain typed FILE identity even for
reserved-looking filenames. | — |
| 60.05 #4337 `polylogue/cli/click_app.py:554` | fixed-already |
`polylogue/cli/query_group.py::_asks_for_query_workflow_help`: The
advertised find help route is handled while respecting option arity. | —
|
| 60.06 #4340 `polylogue/cli/click_app.py:628` | fixed-already |
`polylogue/cli/click_app.py::main`: Runtime checks run inside
guarded_entry passed to run_machine_entry. | — |
| 60.07 #4651 `polylogue/cli/click_command_registration.py:192` |
fixed-already | `polylogue/cli/commands/insights_alias.py`: The existing
root group exposes only Fable, not the entire operational group. No
alias is introduced by this batch. | — |
| 60.08 #4580 `polylogue/cli/click_command_registration.py:192` |
fixed-already | `polylogue/cli/commands/insights_alias.py`: The existing
narrow route preserves the promised Fable-packet command. No alias is
introduced by this batch. | — |
| 60.09 #4550 `polylogue/cli/click_command_registration.py:192` |
fixed-already |
`polylogue/cli/commands/insights_alias.py::_register_fable_packet`:
Registers only the intended Fable command rather than the entire
operational group. | — |
| 60.10 #4698 `polylogue/cli/commands/check.py:41` | fixed-already |
`polylogue/scenarios/operational_surfaces.py`: Authored doctor scenarios
use current routes without the retired repair flags. | — |
| 60.11 #5349 `polylogue/cli/commands/diagnostics.py:992` |
fixed-already |
`polylogue/cli/commands/diagnostics.py::latency_command`: The
empty-bucket branch still renders incomplete-drop accounting. | — |
| 60.12 #5639 `polylogue/cli/commands/import_command.py:117` | not
reached |
`polylogue/cli/commands/import_command.py::_wait_for_demo_ingest`: Owner
completion accounting improved, but a degraded receipt still causes
immediate failure instead of waiting through the remaining convergence
budget. No implementation written. | — |
| 60.13 #5314 `polylogue/cli/commands/insights.py:147` | fixed-already |
`polylogue/scenarios/insight_surfaces.py;
tests/unit/cli/test_stdout_stderr_split.py`: Inventories use current
rather than retired commands. | — |
| 60.14 #4678 `polylogue/cli/commands/insights.py:224` | fixed-already |
`polylogue/cli/commands/insights.py::_render_status_plain`: Plain output
includes degraded counts and fallback reasons. | — |
| 60.15 #4292 `polylogue/cli/commands/insights.py:450` | fixed-already |
`polylogue/cli/commands/insights.py::_packet_json_document`: Dataclass
tuples are lowered to JSON-native arrays. | — |
| 60.16 #5311 `polylogue/cli/commands/judge.py:417` | fixed-already |
`polylogue/cli/commands/judge.py::judge_command`: Interactive approval
forwards the evidence digest and checks failed counts before printing
success. | — |
| 60.17 #4133 `polylogue/cli/commands/maintenance/_blob_gc.py:81` |
fixed-already |
`polylogue/cli/commands/maintenance/_blob_gc.py::blob_gc_command`:
Blocked previews set ok=false and exit nonzero in both formats. | — |
| 60.18 #4955 `polylogue/cli/commands/maintenance/_blob_gc.py:211` |
stale | `polylogue/cli/commands/maintenance/_blob_gc.py`:
gc_recover_command is gone; the remaining command is preview-only. | — |
| 60.19 #5345 `polylogue/cli/commands/maintenance/_blob_integrity.py:52`
| stale | `polylogue/cli/commands/maintenance/_blob_integrity.py`:
_submit_replace_from_source and its cited relative-output forwarding
route are gone. | — |
| 60.20 #5350 `polylogue/cli/commands/maintenance/_raw_identity.py:47` |
fixed | plain line labels the all-state count `plans=` |
`cli/test_raw_authority_frontier_output.py` |
| 60.21 #5301 `polylogue/cli/commands/maintenance/_raw_identity.py:59` |
fixed-already |
`polylogue/cli/commands/maintenance/_raw_identity.py::raw_authority_blockers_command`:
Paginated public blocker inspection exposes expected/observed evidence.
| — |
| 60.22 #4955 `polylogue/cli/commands/maintenance/_raw_identity.py:247`
| fixed-already |
`polylogue/cli/commands/maintenance/_raw_identity.py::raw_authority_blocker_resolve_command`:
Checks the affected count rather than presenting no-op resolution as an
applied mutation. | — |
| 60.23 #4824 `polylogue/cli/commands/maintenance/_verify_archive.py:85`
| fixed-already |
`polylogue/cli/commands/maintenance/_verify_archive.py::verify_archive_command`:
Source-frontier construction is conditional on selected
source-conservation work. | — |
| 60.24 #5491 `polylogue/cli/commands/paths.py:75` | fixed-already |
`polylogue/cli/commands/paths.py::_raw_materialization_readiness`:
Propagates the selected index path through
archive_debt_list(index_db_path=...). | — |
| 60.25 #5353 `polylogue/cli/commands/status.py:342` | fixed-already |
`polylogue/operations/daemon_status.py::produce_operation_status`:
Merges runtime collection metadata into pinned readiness components. | —
|
| 62.01 #5422 `polylogue/cli/query_verbs.py:2434` | fixed |
`analyze_verb` renders from the effective (normalized, inherited) format
| `cli/test_analyze_named_projection_format.py` |
| 62.02 #5007 `polylogue/cli/read_views/lineage.py:78` | fixed-already |
`polylogue/cli/read_views/lineage.py`: The replacement operation-backed
route uses the resolved target; the old _run path is gone. | — |
| 62.03 #5407 `polylogue/cli/read_views/messages.py:226` | fixed-already
| `polylogue/cli/read_views/messages.py::_write_messages_file`: Resolves
symlink output before choosing the staging sibling. | — |
| 62.04 #5407 `polylogue/cli/read_views/messages.py:227` | fixed-already
| `polylogue/cli/read_views/messages.py::_write_messages_file`: Flushes
and fsyncs the staged descriptor before replacement and synchronizes the
directory. | — |
| 62.05 #4291 `polylogue/cli/read_views/query_set.py:196` |
fixed-already |
`polylogue/cli/read_views/correlation.py::run_read_correlation`: Renders
a string and delivers it through deliver_content instead of an
uncaptured console-only renderer. | — |
| 62.06 #5374 `polylogue/cli/read_views/session_evidence.py:180` |
fixed-already |
`polylogue/cli/read_views/session_evidence.py::_read_evidence_window`:
Projection body coordinates take precedence before operation lowering. |
— |
| 62.07 #5520 `polylogue/cli/read_views/standard.py:99` | fixed-already
| `polylogue/cli/query_output.py::deliver_query_output`: File delivery
retains secret-candidate scanning. | — |
| 62.08 #5520 `polylogue/cli/read_views/standard.py:99` | not reached |
`polylogue/cli/read_views/standard.py::run_read_summary_or_transcript;
polylogue/cli/archive_query.py::_read_session_windows`: The standard
file path still accumulates the transcript and buffers its rendered
document. End-to-end operation-backed streaming is not implemented. | —
|
| 62.09 #5520 `polylogue/cli/read_views/standard.py:99` | fixed-already
|
`polylogue/cli/read_views/standard.py::run_read_summary_or_transcript`:
Forwards a typed FILE QueryDeliveryTarget, preserving reserved-looking
filenames. | — |
| 62.10 #5520 `polylogue/cli/read_views/standard.py:99` | fixed-already
| `polylogue/operations/daemon_reads.py::_session_identity_projection;
polylogue/cli/archive_query.py::_session_message_text`: The operation
preserves tool_input; rendering includes structured tool input and omits
reasoning blocks. | — |
| 62.11 #5520 `polylogue/cli/read_views/standard.py:99` | fixed-already
| `polylogue/cli/archive_query.py::_read_session_windows`: Initial
oversized pages already halve their bound at the inspected base. This
batch additionally fixes resumed-page narrowing under 60.01. | — |
| 62.12 #5266 `polylogue/cli/session_rows.py:141` | fixed-already |
`polylogue/cli/session_rows.py::_query_page_with_authority`: Synthetic
missing-session selections explicitly include next_offset=None. | — |
| 62.13 #5426 `polylogue/cli/shared/machine_errors.py:233` |
fixed-already |
`polylogue/cli/shared/machine_errors.py::error_archive_writer_ownership`:
Undecidable ownership has a separate remedy that does not assert an
observed resident daemon. | — |
| 62.14 #5426 `polylogue/cli/shared/machine_errors.py:285` |
fixed-already |
`polylogue/cli/shared/machine_errors.py::extract_command`: Recognizes
--output-format as a value-bearing option. | — |
| 62.15 #5545 `polylogue/cli/shell_completion_values.py:117` |
fixed-already |
`polylogue/cli/shell_completion_values.py::_cached_value_matches`:
Session IDs match native-ID and title substrings. | — |
| 62.16 #5545 `polylogue/cli/shell_completion_values.py:135` |
fixed-already | deleted-candidate case fixed by 8cb1133 (#5722):
every successful answer prunes the refreshed prefix; negative-answer
cache declined (see Solution) | — |
| 62.17 #5545 `polylogue/cli/shell_completion_values.py:145` |
fixed-already |
`polylogue/cli/shell_completion_values.py::_remember_completion_values`:
A per-archive map retains more than the most recent archive. | — |
| 62.18 #5545 `polylogue/cli/shell_completion_values.py:157` |
fixed-already |
`polylogue/cli/shell_completion_values.py::_remember_completion_values`:
Removes an existing value before reinsertion at the retention tail. | —
|
| 62.19 #5545 `polylogue/cli/shell_completion_values.py:178` |
fixed-already |
`polylogue/cli/shell_completion_values.py::_remember_completion_values`:
Global serialized-byte eviction precedes publication. This batch
includes new empty observations in that accounting. | — |
| 62.20 #5545 `polylogue/cli/shell_completion_values.py:181` |
fixed-already |
`polylogue/cli/shell_completion_values.py::_remember_completion_values`:
flock serializes the full cache read-modify-write sequence. | — |
| 62.21 #5382 `polylogue/cli/write_authority.py:104` | fixed-already |
`polylogue/storage/sqlite/write_lease.py::arm_write_lease_enforcement`:
Locked process-wide user/suppressor counts make arming overlap-safe. | —
|

## Residuals

- The four not-reached findings remain open.
- Changing `user_write.py` moves the derived identity, so this PR has to
land before a rebuild starts.
- The two `test_facade_contracts.py` failures are inherited from master.

🤖 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]>
Sinity added a commit that referenced this pull request Sep 29, 2026
## Summary

Lands 24 verified storage fixes from the worker-6 Codex-debt batch
(beads polylogue-1tyq5.101, .102, .103). Each fix was rechecked against
current master and has a regression test on its production route. One
worker fix was dropped because it contradicts documented policy
(103-09). The other 50 findings are recorded below as fixed-already,
stale, refuted or not reached.

## Problem

The worker could not run tests. Its draft (ca8dbff) was based on
e1a2f75, and master has moved on since then. Each "fixed" claim
therefore had to be checked again on current master. The defects that
remain on master:

- **Material admission** (`storage/materials.py`)
  - A valid JSON document larger than 2 MB was marked `malformed`.
- Multi-record NDJSON was marked `malformed` too, because it is not a
single JSON value.
- ZIP entry names were copied without a bound into durable manifest
metadata.
- Readmitting a material returned the caller's arguments rather than the
stored row.
- An idempotent retry matched its own row and was rewritten as
`duplicate`.
- A malformed URL raised out of the API before any durable claim was
recorded.
  - A material linked twice to one evidence ref was listed twice.
- A chunked response carrying a stale `Content-Length` was stored as
`partial`.
  - A redirected HTTP failure did not record which hop failed.
  - A relative file path raised in `Path.as_uri`.
- **Raw frontier** (`storage/raw_retention.py`)
- The integrity projection and the selected-frontier admission helpers
opened `source.db` with `validate_schema=False`. A source tier at an
unadmitted schema version could then report healthy frontier evidence.
- A pinned operation read with no ops handle fell back to opening the
live `ops.db` path.
- **Index tier and reads**
- Trigger-maintained action pairs copied the stale outcome cached on the
tool_use block. Pair outcomes now come from the paired result block.
- A work-event payload could override the validated
`event_id`/`summary`.
- Reviving or re-deleting a displaced saved view cleared another view's
watch.
- A NaN or infinite metadata value was accepted on first write, after
which the key could not be changed.
  - An empty aggregate page reported `total_groups=0`.
  - Session timestamps dropped their milliseconds.
- The observed-tool rollup and the observed-event relation, including
its status pushdown, reinterpreted a retained exit code 0 as success
even when the canonical outcome was a deliberate `unknown`.
- Changing an attachment ref's target or position did not invalidate the
profile binding.
- `list_embedding_catchup_runs` rejected the `completed_with_failures`
status that its writer accepts.
- **Bootstrap** (`archive_tiers/bootstrap.py`)
  - The OPS same-digest shortcut returned without enabling foreign keys.
- A failure after `.bootstrap` was published, but before the format
marker, left an archive that could not be recovered.

## Solution

Most fixes are the worker's patch, with these changes:

- **101-02:** JSON documents are validated as a stream with
`ijson.basic_parse`, so a large material is never loaded as Python
objects. NDJSON is parsed line by line.
- **101-04:** readmission returns the persisted row and does not
overwrite stored filename, media type, privacy or supersession metadata.
The worker's version replaced them with the new call's arguments,
including `None`.
- **101-05:** the extra "never mark malformed as duplicate" condition is
dropped. Only the self-match is fixed.
- **101-21:** the siblings are fixed too:
`raw_frontier_blocked_raw_ids`, `_raw_frontier_blocked_selected_paths`
and `raw_frontier_blocked_source_paths` open `source.db` with schema
admission and report `SchemaSkew` as unavailable.
- **101-23:** the ops-unavailable branch is typed and explicit.
- **103-15:** the finding's cited route (evidence summary) already reads
`result_state` on master. The same defect is fixed in the two remaining
readers: the rollup and `run_projection_relations` (projection and
pushdown).
- **103-09 dropped:** see the table.

## Verification

- `agentctl job start polylogue pytest_focused --workspace
/realm/worktrees/salvage-w6 -- <28 files>` (job 2539): 631 passed, 12
failed, 1 error. The same 9 failures and 1 error occur on base (job
2601: `test_user_state_contracts` FacadeDaemonRequiredError x7,
`test_session_partition_convergence` x2,
`test_frontier_admission::test_changed_keys_beyond_one_batch_are_all_checked`
timeout). The other 3 were test defects in the new file (DSL `AND`,
source-tier raw lookup), fixed and rerun in job 2603: 43 passed, 1
failed (the same base timeout).
- Revert proof: the production files restored from origin/master, with
the new tests kept (job 2540): 35 failed. Every new test fails, each on
the defect it names (for example `ValueError: relative paths can't be
expressed as file URIs`, `DID NOT RAISE`, `KeyError:
'uncompressed_bytes'`, and assertion failures).
- `agentctl job start polylogue verify_quick --workspace
/realm/worktrees/salvage-w6` (job 2639): `verify: PASSED exit=0` at
2fcacb6 (the first run, job 2559, failed on a moved
sqlite-degradation anchor; the anchor was updated in the baseline).

## Self-review

**Sibling sites.** Each defect class was searched across the codebase.
- Unchecked durable-tier opens: three sibling source opens in
`raw_retention.py` were fixed. The two `ops.db` opens keep
`validate_schema=False`, because OPS is a disposable tier whose identity
converges in place.
- Exit-code success reinterpretation: the rollup and both observed-event
sites were fixed. `archive.py` still has error-count columns that count
error signals; they make no success claim, so they were left unchanged.
`archive/actions/parsing.py` and `rendering/semantic_cards.py` are
presentation-layer and out of scope.
- The watch-clearing fix covers both `save_view` and `delete_view`.

**Cancellation and shutdown.** No loops or long-running work were added.

**Unbounded reads.** JSON validation now streams rather than
materializing a whole document. The ZIP manifest no longer copies names.
`admit_material_file` still reads the whole file (103-13, not reached).

**Fail-open fallbacks.** Removed rather than added: the pinned read no
longer falls back to the live ops path. Schema skew now blocks admission
instead of passing silently.

**Compatibility shims.** None added.

**Removed symbols.** The unused `require_operation_lifecycle_status`
import is gone. No monkeypatch targets or fakes reference anything
removed.

**Tests prove the production route.** Every test goes through
`admit_material`/`acquire_material`, `ArchiveStore`,
`initialize_active_archive_root`, the trigger DDL, or the query route
(`query_unit_counts`). The revert run shows they fail on master's code.

## Per-finding table

| key | disposition | evidence | test |
|---|---|---|---|
| 101-01 #5249 `polylogue/storage/index_generation.py:1599` |
fixed-already | `polylogue/daemon/cli.py:3376`: Shutdown discard is
submitted through write_coordinator.run_sync before coordinator drain. |
— |
| 101-02 #4241 `polylogue/storage/materials.py:73` | fixed | Validates
the whole document as a stream (ijson) and NDJSON record by record;
trailing garbage stays malformed. |
test_material_json_admission_validates_the_complete_document,
test_material_ndjson_admission_parses_each_record. |
| 101-03 #4241 `polylogue/storage/materials.py:80` | fixed | Manifest
keeps entry_count and uncompressed_bytes only; names stay in the
retained CAS bytes. |
test_material_zip_manifest_does_not_copy_entry_names. |
| 101-04 #4241 `polylogue/storage/materials.py:139` | fixed |
admit_material returns the persisted row (get_material) instead of its
arguments; stored filename/media/privacy/creation time are not
overwritten on readmission. |
test_material_readmission_returns_the_persisted_row. |
| 101-05 #4320 `polylogue/storage/materials.py:150` | fixed | Duplicate
detection excludes the admitted material_id. |
test_material_readmission_does_not_duplicate_itself (a distinct
observation of the same bytes is still 'duplicate'). |
| 101-06 #4320 `polylogue/storage/materials.py:236` | fixed-already |
`polylogue/storage/materials.py:662-674;
polylogue/storage/materials.py:715-720`: List extracts IDs from tuple
rows or sqlite3.Row; get_material maps cursor.description for tuples. |
— |
| 101-07 #4623 `polylogue/storage/materials.py:240` | fixed | URL
parsing and InvalidURL/ValueError from connection construction become a
durable non-retryable 'malformed' claim. |
test_material_invalid_url_is_a_durable_malformed_claim,
test_material_invalid_http_target_is_a_durable_claim. |
| 101-08 #4241 `polylogue/storage/materials.py:240` | fixed | Evidence
filter uses EXISTS, one row per material. |
test_material_evidence_listing_returns_one_observation_per_identity. |
| 101-09 #5408 `polylogue/storage/materials.py:262` | fixed |
Content-Length is ignored when Transfer-Encoding frames the response. |
test_material_chunked_response_ignores_stale_content_length. |
| 101-10 #4623 `polylogue/storage/materials.py:315` | fixed | HTTP
failure diagnostic carries the failing hop URL when it differs from
source_uri. | test_material_http_error_retains_redirect_destination. |
| 101-11 #4623 `polylogue/storage/materials.py:345` | fixed |
admit_material_file uses Path.absolute() before as_uri(). |
test_material_relative_file_admission_retains_success_or_absence. |
| 101-12 #4623 `polylogue/storage/materials.py:345` | fixed | Same fix
as the sibling comment on this line (Path.absolute()). |
test_material_relative_file_admission_retains_success_or_absence. |
| 101-13 #4623 `polylogue/storage/materials.py:347` | not reached |
`polylogue/storage/materials.py:591-594`: Local material admission reads
the entire file into memory. | — |
| 101-14 #5626 `polylogue/storage/materials.py:741` | not reached |
`polylogue/storage/materials.py:739-752`: Timestamp/hash keyset cursor
can miss subsequent inserts sorting before the cursor at the same
timestamp. | — |
| 101-15 #4039
`polylogue/storage/raw_authority_verdict_projection.py:103` | not
reached |
`polylogue/storage/raw_authority_verdict_projection.py:86-148`:
Projection promotes every byte-proven append leaf independently of
accepted-chain ambiguity. | — |
| 101-16 #4556 `polylogue/storage/raw_failure_lifecycle.py:111` |
fixed-already | `polylogue/storage/raw_failure_lifecycle.py:124-139`:
Ordinary source open performs admission and reports SchemaSkewError as
unavailable. | — |
| 101-17 #5301 `polylogue/storage/raw_reconciler.py:213` | not reached |
`polylogue/storage/raw_reconciler.py:108-127`: Renamed pass_id payload
still advertises the previous census.v1 schema. | — |
| 101-18 #5350 `polylogue/storage/raw_reconciler.py:324` | refuted |
`polylogue/storage/raw_reconciler.py:314-381`: Explicitly requires an
archive predating the raw-ID change; current assignment is fresh v1 with
no carry-forward of that state. | — |
| 101-19 #5350 `polylogue/storage/raw_reconciler.py:549` | refuted |
`polylogue/storage/raw_reconciler.py:564-615`: Requests migration of
durable candidate assertions from a deleted framework; outside the
fresh-v1/no-carry-forward contract. | — |
| 101-20 #5301 `polylogue/storage/raw_reconciler.py:1049` | not reached
| `polylogue/storage/raw_reconciler.py:394-473`: Blocker ID selection
only searches its proposed ID; a unique open plan conflict can suppress
the insert while returning a nonexistent ID. | — |
| 101-21 #4556 `polylogue/storage/raw_retention.py:1231` | fixed |
Frontier projection opens source.db with schema admission and reports
SchemaSkew as unavailable; the selected-frontier admission helpers
(raw_frontier_blocked_raw_ids, _raw_frontier_blocked_selected_paths,
raw_frontier_blocked_source_paths) do the same. |
test_frontier_projection_refuses_a_source_from_a_newer_schema. |
| 101-22 #4683 `polylogue/storage/raw_retention.py:1302` | not reached |
`polylogue/storage/raw_retention.py:1387-1420`: Admission attributes a
sampled million-row projection without refusing truncated populations. |
— |
| 101-23 #5020 `polylogue/storage/raw_retention.py:1688` | fixed | With
ops_conn=None the pinned snapshot reports cursor status 'unknown' and
never opens ops_db_path. |
test_pinned_frontier_does_not_substitute_a_live_ops_file_for_missing_reader.
|
| 101-24 #5371 `polylogue/storage/raw_retention.py:2350` | not reached |
`polylogue/storage/raw_retention.py:2478-2491`: Residual test uses
post-filter candidate count, which cannot prove the SQL selection was
exhausted. | — |
| 101-25 #4538
`polylogue/storage/search_providers/sqlite_vec_runtime.py:98` |
fixed-already |
`polylogue/storage/search_providers/sqlite_vec_runtime.py:239-249`:
Managed provider rejects missing active index before attempting
attachment; pinned snapshot uses read-only attachment at 120-133. | — |
| 102-01 #4538
`polylogue/storage/search_providers/sqlite_vec_runtime.py:115` | not
reached |
`polylogue/storage/search_providers/sqlite_vec_runtime.py:34-108;251-256`:
Managed connections rebuild and hash the complete eligible-message TEMP
projection on each acquisition. | — |
| 102-02 #5274 `polylogue/storage/source_generation_receipts.py:252` |
not reached | `polylogue/operations/daemon_ingest.py:881-999`:
Historical receipt serializes raw identities/completeness but not
source-item blockers and member dispositions. | — |
| 102-03 #4719 `polylogue/storage/sqlite/action_pairs.py:44` | fixed |
Action pairs take the outcome from the paired result block, 'no_result'
when absent, matching _reconcile_tool_use_outcomes. |
test_action_pairs_follow_paired_result_updates_and_deletes. |
| 102-04 #5275 `polylogue/storage/sqlite/archive_tiers/__init__.py:43` |
fixed-already |
`polylogue/storage/sqlite/archive_tiers/__init__.py:21-26;42-49`:
Exported durable tier constants and ARCHIVE_VERSION_BY_TIER all use
version one. | — |
| 102-05 #4201 `polylogue/storage/sqlite/archive_tiers/archive.py:416` |
fixed-already | `polylogue/mcp/archive_support.py:165-179;
polylogue/surfaces/payloads.py:1311-1315`: MCP delegates to canonical
hydration and the shared summary envelope explicitly supplies
terminal_state, total_cost_usd, cost_provenance and relative_time. | — |
| 102-06 #4353 `polylogue/storage/sqlite/archive_tiers/archive.py:1085`
| not reached |
`polylogue/storage/sqlite/archive_tiers/archive.py:1622-1629`:
Work-event append reverses public Origin into guessed Provider. | — |
| 102-07 #4353 `polylogue/storage/sqlite/archive_tiers/archive.py:1086`
| fixed | Validated event_id and summary are merged after the caller
payload. | test_work_event_payload_cannot_override_validated_identity. |
| 102-08 #4816 `polylogue/storage/sqlite/archive_tiers/archive.py:2459`
| stale | `polylogue/storage/sqlite/archive_tiers/archive.py:4492-4513`:
Named list_session_work_event_insights LIKE implementation is gone;
current insight dispatch is elsewhere. No claim of testing successor
search. | — |
| 102-09 #4225 `polylogue/storage/sqlite/archive_tiers/archive.py:2542`
| not reached | `polylogue/storage/sqlite/archive_tiers/archive.py:3168;
polylogue/storage/sqlite/archive_tiers/archive.py:3952`: Full catalog
coverage sets cost_is_estimated=0, confusing completeness with monetary
authority. | — |
| 102-10 #4293 `polylogue/storage/sqlite/archive_tiers/archive.py:2681`
| not reached |
`polylogue/storage/sqlite/archive_tiers/archive.py:3351-3360;3400-3419`:
Outer cohort dedup count is reused for raw-model breakdown and status
classification. | — |
| 102-11 #4395 `polylogue/storage/sqlite/archive_tiers/archive.py:2957`
| fixed-already |
`polylogue/storage/sqlite/archive_tiers/archive.py:3280;3311;3351`:
Session populations use json_group_array and lossless
_decode_session_id_set instead of comma splitting. | — |
| 102-12 #4692 `polylogue/storage/sqlite/archive_tiers/archive.py:3380`
| fixed-already |
`polylogue/storage/sqlite/archive_tiers/archive.py:3971;8398`: Profile
SELECT and domain mapper both carry input_content_hash. | — |
| 102-13 #5408 `polylogue/storage/sqlite/archive_tiers/archive.py:5215`
| fixed | save_view clears the previous name's watch only when this view
still owns that name. |
test_resurrected_view_rename_does_not_clear_another_views_watch. |
| 102-14 #5408 `polylogue/storage/sqlite/archive_tiers/archive.py:5284`
| fixed | delete_view clears the watch only on a successful delete of
the name's active owner. |
test_redeleting_view_does_not_clear_reassigned_name_watch. |
| 102-15 #5307 `polylogue/storage/sqlite/archive_tiers/archive.py:6193`
| not reached |
`polylogue/storage/sqlite/archive_tiers/archive.py:6222-6229`: Provider
usage readiness takes archive-global status counters, not the requested
origin/time scope. | — |
| 102-16 #5307 `polylogue/storage/sqlite/archive_tiers/archive.py:6195`
| not reached |
`polylogue/storage/sqlite/archive_tiers/archive.py:6222-6229`: Provider
usage readiness hardcodes stale count zero and only compares row
coverage. | — |
| 102-17 #4238 `polylogue/storage/sqlite/archive_tiers/archive.py:6730`
| not reached |
`polylogue/storage/sqlite/archive_tiers/archive.py:7688-7699`: Display
duration subtracts normalized session endpoints, including synthesized
endpoints. | — |
| 102-18 #4649 `polylogue/storage/sqlite/archive_tiers/archive.py:7271`
| not reached |
`polylogue/storage/sqlite/archive_tiers/archive.py:8140-8146`: Missing
persisted provenance is labeled with current materializer version. | — |
| 102-19 #5362 `polylogue/storage/sqlite/archive_tiers/archive.py:7408`
| not reached |
`polylogue/storage/sqlite/archive_tiers/archive.py:7672-7679`: All
heuristic titles are suppressed, not only prompt echoes. | — |
| 102-20 #4221 `polylogue/storage/sqlite/archive_tiers/archive.py:7539`
| stale | `polylogue/storage/sqlite/archive_tiers/archive.py:8454-8504`:
Former profile-cost fallback was removed; current cost insight uses
canonical usage authority and reports no_tokens explicitly rather than
labeling fallback as catalog-priced. | — |
| 102-21 #4804 `polylogue/storage/sqlite/archive_tiers/archive.py:7839`
| fixed | set_user_metadata canonicalizes every value before the first
write, so NaN/inf are refused inside the transaction. |
test_metadata_first_write_refuses_nonfinite_json_atomically. |
| 102-22 #5275
`polylogue/storage/sqlite/archive_tiers/archive_plan.py:189` |
fixed-already |
`polylogue/storage/sqlite/archive_tiers/archive_plan.py:181-213`: Schema
fingerprint and version readers now use canonical
open_readonly_connection URI construction. | — |
| 102-23 #5275
`polylogue/storage/sqlite/archive_tiers/archive_plan.py:261` | stale |
`polylogue/storage/sqlite/archive_tiers/archive_plan.py:181-223;bootstrap.py:877-924`:
initialize_archive_tier_files_from_plan is deleted; ordinary fresh root
bootstrap now records and admits pending intent. | — |
| 102-24 #5356
`polylogue/storage/sqlite/archive_tiers/archive_query_reads.py:3424` |
fixed | The aggregate page selects a count row over all groups joined to
the requested page, so an empty page keeps total_groups. |
test_empty_aggregate_page_preserves_total_group_count. |
| 102-25 #5514
`polylogue/storage/sqlite/archive_tiers/archive_tiers_specs.py:48` |
fixed-already |
`polylogue/storage/sqlite/archive_tiers/vocabulary_inventory.py:138-153`:
core_types is scanned before consumer re-exports, retaining declaration
ownership. | — |
| 103-01 #5521
`polylogue/storage/sqlite/archive_tiers/archive_tiers_specs.py:49` | not
reached | `docs/atlas/00-core.md:59-67;docs/atlas/storage.md:35-40`:
Identity anchors no longer point at their generated-key declarations. |
— |
| 103-02 #4678
`polylogue/storage/sqlite/archive_tiers/archive_tiers_specs.py:729` |
fixed | Session created_at/updated_at project
strftime('%Y-%m-%dT%H:%M:%fZ', ms/1000.0). |
test_session_record_reads_preserve_milliseconds. |
| 103-03 #4177
`polylogue/storage/sqlite/archive_tiers/archive_tiers_specs.py:885` |
not reached | `polylogue/maintenance/archive_verification.py:1443-1467`:
Lineage sanity checks message existence but not branch-point content
address agreement. | — |
| 103-04 #5476
`polylogue/storage/sqlite/archive_tiers/archive_tiers_specs.py:1217` |
not reached | `docs/atlas/storage.md:79-87`: Session-link/branch-point
explanation anchors shifted away from their declarations. | — |
| 103-05 #4302 `polylogue/storage/sqlite/archive_tiers/bootstrap.py:249`
| not reached |
`polylogue/storage/sqlite/archive_tiers/bootstrap.py:435-451;501-561`:
OPS sentinel fast path neither recreates nor refuses missing canonical
objects. | — |
| 103-06 #4302 `polylogue/storage/sqlite/archive_tiers/bootstrap.py:249`
| fixed | _materialize_archive_tier enables foreign keys before the OPS
same-digest shortcut. |
test_cached_ops_initialization_enables_connection_foreign_keys. |
| 103-07 #4560 `polylogue/storage/sqlite/archive_tiers/bootstrap.py:254`
| fixed-already |
`polylogue/storage/sqlite/archive_tiers/bootstrap.py:407-417`: Derived
identity stamp is followed by conn.commit(). | — |
| 103-08 #4560 `polylogue/storage/sqlite/archive_tiers/bootstrap.py:845`
| fixed-already |
`polylogue/storage/sqlite/archive_tiers/bootstrap.py:1159-1178`: Stored
user_version is admitted before materialization; skew raises SchemaSkew.
| — |
| 103-09 #4560 `polylogue/storage/sqlite/archive_tiers/bootstrap.py:846`
| dropped (not a defect) | ops.db identity converges in place by
documented policy (`initialize_archive_database`); worker's refusal
reverted | — |
| 103-10 #5275 `polylogue/storage/sqlite/archive_tiers/bootstrap.py:848`
| fixed-already |
`polylogue/storage/sqlite/archive_tiers/bootstrap.py:877-905`: Pending
fresh bootstrap intent is validated and exempts incomplete first
creation from completed-marker admission. | — |
| 103-11 #5275 `polylogue/storage/sqlite/archive_tiers/bootstrap.py:883`
| fixed-already |
`polylogue/storage/sqlite/archive_tiers/bootstrap.py:888-920`: Marker
admission and fresh-bootstrap classification are keyed to durable tier
files, not replaceable-only tiers. | — |
| 103-12 #5275 `polylogue/storage/sqlite/archive_tiers/bootstrap.py:959`
| fixed | Fresh bootstrap publishes (or validates an already published)
format marker before the completed bootstrap marker, so the pending
intent survives until both exist. |
test_fresh_bootstrap_format_publication_failure_is_resumable. |
| 103-13 #4323 `polylogue/storage/sqlite/archive_tiers/embeddings.py:20`
| refuted |
`polylogue/storage/sqlite/archive_tiers/embeddings.py:7;26-31`: Finding
requires opening the pre-v1 version-five vector table; this assignment
starts fresh with embeddings version one and canonical model column, no
prior archives. | — |
| 103-14 #4719 `polylogue/storage/sqlite/archive_tiers/index.py:868` |
not reached |
`polylogue/storage/sqlite/archive_tiers/archive_query_reads.py:121-143;1066-1088`:
Public action row and selected column list omit canonical
unknown-outcome reason. | — |
| 103-15 #4719 `polylogue/storage/sqlite/archive_tiers/index.py:877` |
fixed | The cited evidence-summary route already reads result_state on
master (operations/http_read_models.py read_session_evidence). The same
exit-code reinterpretation remained in
list_tool_observed_event_count_rows and the observed-event relation and
its status pushdown (run_projection_relations.py); all three now map
only the canonical tool_outcome. |
test_observed_tool_rollup_respects_canonical_outcome_over_exit_code. |
| 103-16 #4630 `polylogue/storage/sqlite/archive_tiers/index.py:1090` |
not reached |
`polylogue/storage/sqlite/archive_tiers/index.py:1319-1320`: Thread
search projection only includes thread ID, repo and session IDs;
evidence-kind/support terms are absent. | — |
| 103-17 #5312 `polylogue/storage/sqlite/archive_tiers/index.py:1257` |
fixed-already | `tests/infra/reindex_differential.py:95-98`:
session_usage_rollup_bindings now has an explicit exact deterministic
census classification. | — |
| 103-18 #5410 `polylogue/storage/sqlite/archive_tiers/index.py:1499` |
fixed | session_profile_binding_refs_au now fires on attachment_id and
position updates. |
test_attachment_reference_identity_and_order_invalidate_profile_binding.
|
| 103-19 #4630 `polylogue/storage/sqlite/archive_tiers/index.py:1786` |
not reached |
`polylogue/storage/sqlite/archive_tiers/index.py:2150-2158`: Child
monetary amount may use provider evidence while its estimated flag is
derived from catalog coverage. | — |
| 103-20 #4630 `polylogue/storage/sqlite/archive_tiers/index.py:1919` |
not reached | `polylogue/storage/sqlite/archive_tiers/index.py:2289`:
Tag-rollup materialized_at is literal query-time rather than an ISO
timestamp or missing value. | — |
| 103-21 #5373 `polylogue/storage/sqlite/archive_tiers/ops.py:209` |
refuted |
`polylogue/storage/sqlite/archive_tiers/ops.py:1-220;bootstrap.py:888-909`:
Finding asks to carry and drop objects in archives from the prior OPS
schema. Fresh-v1/no-prior-state assignment excludes that upgrade. | — |
| 103-22 #5521
`polylogue/storage/sqlite/archive_tiers/ops_write.py:1237` | fixed |
list_embedding_catchup_runs validates the filter with
OperationRunStatus, the writer's vocabulary. |
test_embedding_catchup_filter_accepts_completed_with_failures. |
| 103-23 #4324
`polylogue/storage/sqlite/archive_tiers/read_insights.py:28` |
fixed-already |
`polylogue/storage/sqlite/archive_tiers/read_insights.py:27-36`:
Date-window parser delegates to shared parse_query_date. | — |
| 103-24 #4354
`polylogue/storage/sqlite/archive_tiers/read_insights.py:82` | not
reached |
`polylogue/storage/sqlite/archive_tiers/read_insights.py:123-145`:
Episode context scans only physical session messages and misses composed
inherited prefix. | — |
| 103-25 #4354
`polylogue/storage/sqlite/archive_tiers/read_insights.py:83` |
fixed-already |
`polylogue/storage/sqlite/archive_tiers/read_insights.py:115-136`: LIMIT
3 is inside the row-producing subqueries consumed by GROUP_CONCAT. | — |

## Derived-identity closure

All ten changed production files are members of the checked-in
`docs/plans/schema-closure-baseline.json`:

`storage/materials.py`, `storage/raw_retention.py`,
`storage/sqlite/action_pairs.py`,
`storage/sqlite/run_projection_relations.py`, and in
`storage/sqlite/archive_tiers/`: `archive.py`, `archive_query_reads.py`,
`archive_tiers_specs.py`, `bootstrap.py`, `index.py`, `ops_write.py`.

The index trigger DDL, the session timestamp projection and the
action-pair lowering all change, so the derived identity moves. This
must land before the fresh rebuild. `devtools schema closure` could not
run in this checkout because its environment is not provisioned, so
membership was read from the committed baseline.

## Residuals

- 26 findings are not reached, and they stay open in their beads. Among
them are 101-13 (local file admission reads the whole file into memory)
and 101-14 (keyset cursor).
- Session `created_at`/`updated_at` strings change format from
`YYYY-MM-DD HH:MM:SS` to ISO-8601 `...T...sssZ`. No reader in this
repository parses the old format; `annotations/join.py` slices the first
10 characters, which is unaffected.

🤖 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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant