Repository navigation
fix(storage): Make the legacy revision-governance marker read-only in fact - #5424
Conversation
… fact polylogue-sze30 (partial) and polylogue-cuxz.11 (append path). `LEGACY_FULL_REVISION_GOVERNANCE_DETAILS`' declaration has always said the pre-#3234 spelling is "read-compatibility only -- never write", and nothing enforced it: `replace_raw_membership_census` accepted the whole read vocabulary at its write boundary. Split the vocabulary into a writable set and a legacy read-only set, keep the read set as their union, and narrow the write boundary to the writable one. Until this, no query could tell a durable pre-#3234 census row from one written afterwards, which is exactly what makes the compat branch impossible to retire after the rebuild. The polylogue-hm2f fixture seeded its "durable legacy row" *through* the writer, so it was more permissive than production; it now retires under the writable marker and rewrites `raw_membership_census.detail` directly, which is what a pre-#3234 row actually is on disk. Also pins the polylogue-cuxz.11 value-change grain across a merge-append. `_last_agent_policy_values` reads the highest-position stored row so an appended chunk compares against stored state instead of starting a fresh run; no test covered that, and live sessions are appended to many times, so it is the half of the grain that the 402,869-row census actually measured. Derived schema identity (index tier) moves 96aca24d -> d947bd97; ops tier unchanged. No DDL changed -- both edited production files are closure members. Verification: devtools verify --quick 25/25 ok, exit 0 devtools render all --check exit 0, 0 "out of sync" devtools test tests/unit/storage/test_revision_replay.py tests/unit/pipeline/test_archive_write.py exit 0 Executed anti-vacuity: guard -> RETIRED_FULL_REVISION_GOVERNANCE_DETAILS test_legacy_governance_marker_is_never_writable E Failed: DID NOT RAISE ValueError _last_agent_policy_values -> return None test_agent_policy_interval_survives_a_merge_append E AssertionError: Left contains one more item: (1, 'on-request', 'read-only', 'restricted') 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 59 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 (4)
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. |
Summary
One real fix, plus four schema-shape beads reconciled against head — of which one AC is proven unperformable by executing it, one is already satisfied, and one is deliberately deferred by its own ruling.
Fixed
polylogue/archive/revision_authority.pynow splits the full-revision-governance detail markers intoWRITABLE_…(1 member) andLEGACY_…(the pre-#3234 spelling), withRETIRED_…as their union.revision_governance.py:2196narrows the write boundary from the read set to the writable set.Before this, the declaration's own comment said the legacy spelling was "read-only, never write" and nothing enforced it. A writer could mint it, after which no query could distinguish a durable pre-#3234 row from a new one — which is precisely what makes the compatibility branch unretireable after the rebuild.
Anti-vacuity executed: reverting the guard to the read vocabulary gives
Failed: DID NOT RAISE ValueErrorattest_revision_replay.py:1675. The opposite direction is pinned too — the writable marker must still apply, so a blanket refusal cannot pass.cuxz.11— already satisfied, plus a real gap nobody had namedThe dispatch said "nothing is done". Three of its four claims were wrong, and the lane refuted each at base
9ef655cb8:write.py:6519 if policy_values != last_agent_policy:emits a row only on genuine change, landed in refactor(storage): Trim dead derived-schema columns and render the embeddings tier from specs #5309, with a comment naming this bead.PRIMARY KEY(session_id, position)is not the forbidden grain —positionis the offset where a retained interval starts, so the PK constrains interval starts, not per-message rows.WHERE source_message_id IS NOT NULLatindex.py:1002and again atruntime_indexes.py:18. A NULL column costs zero index entries. The 100%-NULL census is historical, exactly as the 2026-09-07 note cautioned.What was missing is the append path:
_last_agent_policy_valuesnow reads the highest-position stored row so an appended chunk compares against stored state. No test covered it, and live sessions are appended to many times.Mutation (
return None):Left contains one more item: (1, 'on-request', 'read-only', 'restricted').AC4 (row count against the 402,869 baseline) is READY-AT-BUILD — a live-archive measurement, nothing in code blocks it.
3szyiAC2 — proven unperformable, by executing itThe AC asks for durable CHECK constraints generated from Python enum owners. A
PolylogueStrEnumcarryingaudit.destructive_class's six members was injected intoarchive_tiers/source.pyand the real gate run:Reverted → exit 0. Doing what the AC mandates makes
devtools verifyred.gate durable-enum-checksrefuses exactly this construct, because it pins an enum's evolution into a tier that only moves by numbered migration.42 of the 54 hand-written lists are on durable tiers. The correct durable remedy is delete-and-validate-at-the-write-boundary (
require_vocabulary), not generate. Exactly one durable list has an enum owner today (source.outcome_code), and it is an explicit grandfathered pre-policy waiver.Census measured with the gate's own classifier so it matches enforced policy: 54 typed value lists (source 26, audit 13, ops 7, user 3, specs 3, index 2 — the index pair are partial-INDEX predicates, not CHECKs). The bead's own raw grep of 76 counts f-string-rendered lists too.
The 12 non-durable lists have zero exact Python owners and are narrow storage-local vocabularies — their correct disposition is AC4 (STORAGE_LOCAL with a stated reason), a small real change nobody has made.
a7xr.27— deferred by its own ruling, and three records disagree on the countsThe sequencing note exists: label
timing:post-reindex, with a 2026-08-24 ruling that this is "worthwhile substrate completion but is not required to reconstruct the archive correctly." Nothing in this wave needed a tier's spec adoption, so nothing was landed.Re-measured at head, and the bead, its own scoping note, and the dispatch each carry a different wrong count:
So 80 hand-written across five tiers — not 89 (bead), not ~86 (dispatch), not 84 (its scoping). Embeddings is not "6/5 un-adopted"; the sixth match was a comment saying it is adopted.
bootstrap.pyhas zero CREATE TABLE.Also corrected: the scoping's claim that #5290 emptied the migration directories is false —
migrations/source/002andmigrations/user/002both exist with.train.jsonsidecars. Onlymigrations/audit/is bare, so the audit tier's route is declared-but-unexercised.Verification
devtools verify --quickat basedevtools verify --quickat rebased headdurable-enum-checks,schema-manifest,schema-closureall ok)devtools render all --checkout of sync= 0test_revision_replay.py+test_archive_write.pyInherited red proven at base in a detached checkout:
test_owned_nonempty_generation_refuses_cold_build_deferral, identical nodeid, 1 of 109.Schema closure — reconvergence required
Both changed files are IN.
DerivedTier.index:96aca24d…→d947bd97…;opsunchanged. No DDL changed — this is the AST-closure case CLAUDE.md describes.gate schema-closuregreen, membership unchanged,INDEX_SCHEMA_VERSIONuntouched at 107.Must land before a fresh rebuild starts, never during one.
Residuals
verify_durable_enum_checks.pyonly walksPolylogueStrEnumsubclasses, so a durable CHECK generated from atyping.Literalwould evade it while carrying the same durability cost. Latent, not live — the durable tiers have zero generator call sites today. The embeddings conversion this bead already landed usedLiteralowners.sze30full removal needsmigrations/source/003adding a typeddetail_codeplus a backfill, and re-pointing four producers, three outside this scope. The read/write split landed here is what makes the eventual drop provable: once the rebuilt archive contains no row carrying the legacy spelling,LEGACY_…can go.audit.required_confirmation/confirmation_strengthandaudit.principal_surface/surfaceare byte-identical member sets — real collapse candidates, both durable.🤖 Generated with Claude Code
https://claude.ai/code/session_01ToWqpkXotr573DiQex5vcy