Skip to content

chore: Fresh schema floor: retire historical chains without confusing o… - #5290

Merged
Sinity merged 3 commits into
masterfrom
batch/polylogue-20260920-133536-4f2a5bfa/integration
Sep 20, 2026
Merged

Sinity merged 3 commits into
masterfrom
batch/polylogue-20260920-133536-4f2a5bfa/integration

Conversation

@Sinity

@Sinity Sinity commented Sep 20, 2026 •

Copy link
Copy Markdown
Owner

Batch polylogue-20260920-133536-4f2a5bfa on base 8b16cd044e64.

polylogue-mbftz Fresh schema floor: retire historical chains without confusing old archives or losing user data

  • 1. Fresh archive creation produces the selected six-tier floor directly; old lineages, including an old version-1 file, are refused before writes rather than guessed compatible.
  1. User/audit/source p

Summary by CodeRabbit

  • New Features

    • Fresh archive lineages now start from the archive format floor, with durable tiers required to reset consistently.
    • Archive format validation now runs before durable changes are reconciled.
  • Bug Fixes

    • Schema verification now permits retiring predecessor migrations only during a complete, coordinated lineage reset.
    • Historical source lineages that lack the required archive marker are rejected earlier with clearer errors.
  • Documentation

    • Updated internal documentation to describe the current fresh source schema lineage and blob receipt verification behavior.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 20, 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-20T14:27:37.457326Z 2754653 PR opened
🔒 Security Review ✅ Completed 2026-09-20T14:25:43.854067Z 2754653 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.

@coderabbitai

coderabbitai Bot commented Sep 20, 2026 •

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 2ba625b0-a2c4-4ac1-af54-baa42d9395af

📥 Commits

Reviewing files that changed from the base of the PR and between 60fef7a and 2754653.

📒 Files selected for processing (79)
  • devtools/verify_schema_manifest.py
  • docs/internals.md
  • polylogue/storage/sqlite/archive_tiers/archive_plan.py
  • polylogue/storage/sqlite/archive_tiers/source.py
  • polylogue/storage/sqlite/durable_change_train.py
  • polylogue/storage/sqlite/migrations/audit/002.train.json
  • polylogue/storage/sqlite/migrations/audit/002_audit_continuity_head.sql
  • polylogue/storage/sqlite/migrations/audit/003.train.json
  • polylogue/storage/sqlite/migrations/audit/003_machine_requests.sql
  • polylogue/storage/sqlite/migrations/source/002_raw_capture_multimap.sql
  • polylogue/storage/sqlite/migrations/source/003_drop_pending_blob_refs.sql
  • polylogue/storage/sqlite/migrations/source/004_blob_publication_reservations.sql
  • polylogue/storage/sqlite/migrations/source/005_raw_revision_authority.sql
  • polylogue/storage/sqlite/migrations/source/006_append_predecessor_revision.sql
  • polylogue/storage/sqlite/migrations/source/007_raw_session_memberships.sql
  • polylogue/storage/sqlite/migrations/source/008_raw_session_capture_mode.sql
  • polylogue/storage/sqlite/migrations/source/009_expand_origin_vocabulary.sql
  • polylogue/storage/sqlite/migrations/source/010_sinex_publication_obligations.sql
  • polylogue/storage/sqlite/migrations/source/011_excised_content.sql
  • polylogue/storage/sqlite/migrations/source/012_sinex_publication_payloads_receipts.sql
  • polylogue/storage/sqlite/migrations/source/013_raw_authority_ledger.sql
  • polylogue/storage/sqlite/migrations/source/014_raw_sessions_blob_hash_index.sql
  • polylogue/storage/sqlite/migrations/source/015_raw_sessions_blob_hash_raw_id_index.sql
  • polylogue/storage/sqlite/migrations/source/016_raw_capture_observations.sql
  • polylogue/storage/sqlite/migrations/source/017_verified_blob_receipts.sql
  • polylogue/storage/sqlite/migrations/source/018_raw_live_source_reconciliation_receipts.sql
  • polylogue/storage/sqlite/migrations/source/019_raw_membership_writeback_receipts.sql
  • polylogue/storage/sqlite/migrations/source/020_raw_append_chain_backfill_receipts.sql
  • polylogue/storage/sqlite/migrations/source/021_widen_origin_check_claude_design.sql
  • polylogue/storage/sqlite/migrations/source/022_hook_payload_blob_refs.sql
  • polylogue/storage/sqlite/migrations/source/023_raw_byte_duplicate_supersession_receipts.sql
  • polylogue/storage/sqlite/migrations/source/024_raw_authority_verdicts_cache.sql
  • polylogue/storage/sqlite/migrations/source/025_raw_quarantine_group_dedup_receipts.sql
  • polylogue/storage/sqlite/migrations/source/026_raw_unknown_export_reclassification_receipts.sql
  • polylogue/storage/sqlite/migrations/source/027_raw_non_session_duplicate_exclusion_receipts.sql
  • polylogue/storage/sqlite/migrations/source/028_raw_hook_events_source_hash_index.sql
  • polylogue/storage/sqlite/migrations/source/029_raw_failure_disposition_receipts.sql
  • polylogue/storage/sqlite/migrations/source/030_raw_failure_coordinate_carriers.sql
  • polylogue/storage/sqlite/migrations/source/031_raw_authority_artifact_census_receipts.sql
  • polylogue/storage/sqlite/migrations/source/032_audit_continuity_control.sql
  • polylogue/storage/sqlite/migrations/source/033_detected_raw_provider.sql
  • polylogue/storage/sqlite/migrations/source/034_gc_generation_member_intent.sql
  • polylogue/storage/sqlite/migrations/source/035_gc_namespace_identity.sql
  • polylogue/storage/sqlite/migrations/source/036_hook_event_carriers.sql
  • polylogue/storage/sqlite/migrations/source/037_source_items.sql
  • polylogue/storage/sqlite/migrations/source/038.train.json
  • polylogue/storage/sqlite/migrations/source/038_material_observations.sql
  • polylogue/storage/sqlite/migrations/source/039.train.json
  • polylogue/storage/sqlite/migrations/source/039_source_attachments.sql
  • polylogue/storage/sqlite/migrations/source/040.train.json
  • polylogue/storage/sqlite/migrations/source/040_raw_legacy_append_resynthesis_receipts.sql
  • polylogue/storage/sqlite/migrations/source/041.train.json
  • polylogue/storage/sqlite/migrations/source/041_raw_acquisition_shape.sql
  • polylogue/storage/sqlite/migrations/source/042.train.json
  • polylogue/storage/sqlite/migrations/source/042_raw_container_addressing_mode.sql
  • polylogue/storage/sqlite/migrations/source/043.train.json
  • polylogue/storage/sqlite/migrations/source/043_source_item_enumeration.sql
  • polylogue/storage/sqlite/migrations/source/044.train.json
  • polylogue/storage/sqlite/migrations/source/044_raw_container_content_identity.sql
  • polylogue/storage/sqlite/migrations/source/045.train.json
  • polylogue/storage/sqlite/migrations/source/045_drop_raw_authority_artifact_census.sql
  • polylogue/storage/sqlite/migrations/source/046.train.json
  • polylogue/storage/sqlite/migrations/source/046_rekey_raw_authority_blockers.sql
  • polylogue/storage/sqlite/migrations/source/047.train.json
  • polylogue/storage/sqlite/migrations/source/047_source_item_member_dispositions.sql
  • polylogue/storage/sqlite/migrations/user/004_user_settings.sql
  • polylogue/storage/sqlite/migrations/user/005_context_deliveries.sql
  • polylogue/storage/sqlite/migrations/user/006_annotation_schemas_batches.sql
  • polylogue/storage/sqlite/migrations/user/007_query_objects.sql
  • polylogue/storage/sqlite/migrations/user/008_query_evaluation_contracts.sql
  • polylogue/storage/sqlite/migrations/user/009_result_set_holdouts.sql
  • polylogue/storage/sqlite/migrations/user/010_query_unit_frame.sql
  • polylogue/storage/sqlite/migrations/user/011.train.json
  • polylogue/storage/sqlite/migrations/user/011_query_privacy_excision.sql
  • polylogue/storage/sqlite/queries/raw_writes.py
  • tests/unit/devtools/test_verify_schema_manifest.py
  • tests/unit/storage/test_audit_continuity.py
  • tests/unit/storage/test_durable_change_train.py
  • tests/unit/storage/test_durable_migrations.py
💤 Files with no reviewable changes (70)
  • polylogue/storage/sqlite/migrations/source/014_raw_sessions_blob_hash_index.sql
  • polylogue/storage/sqlite/migrations/source/038.train.json
  • polylogue/storage/sqlite/migrations/source/003_drop_pending_blob_refs.sql
  • polylogue/storage/sqlite/migrations/source/041.train.json
  • polylogue/storage/sqlite/migrations/source/015_raw_sessions_blob_hash_raw_id_index.sql
  • polylogue/storage/sqlite/migrations/source/031_raw_authority_artifact_census_receipts.sql
  • polylogue/storage/sqlite/migrations/source/021_widen_origin_check_claude_design.sql
  • polylogue/storage/sqlite/migrations/user/011.train.json
  • polylogue/storage/sqlite/migrations/audit/002_audit_continuity_head.sql
  • polylogue/storage/sqlite/migrations/source/044.train.json
  • polylogue/storage/sqlite/migrations/user/004_user_settings.sql
  • polylogue/storage/sqlite/migrations/source/007_raw_session_memberships.sql
  • polylogue/storage/sqlite/migrations/source/026_raw_unknown_export_reclassification_receipts.sql
  • polylogue/storage/sqlite/migrations/source/032_audit_continuity_control.sql
  • polylogue/storage/sqlite/migrations/source/030_raw_failure_coordinate_carriers.sql
  • polylogue/storage/sqlite/migrations/source/017_verified_blob_receipts.sql
  • polylogue/storage/sqlite/migrations/source/042.train.json
  • polylogue/storage/sqlite/migrations/source/041_raw_acquisition_shape.sql
  • polylogue/storage/sqlite/migrations/source/011_excised_content.sql
  • polylogue/storage/sqlite/migrations/source/042_raw_container_addressing_mode.sql
  • polylogue/storage/sqlite/migrations/source/019_raw_membership_writeback_receipts.sql
  • polylogue/storage/sqlite/migrations/source/040_raw_legacy_append_resynthesis_receipts.sql
  • polylogue/storage/sqlite/migrations/source/004_blob_publication_reservations.sql
  • polylogue/storage/sqlite/migrations/user/010_query_unit_frame.sql
  • polylogue/storage/sqlite/migrations/source/040.train.json
  • polylogue/storage/sqlite/migrations/source/045_drop_raw_authority_artifact_census.sql
  • polylogue/storage/sqlite/migrations/user/006_annotation_schemas_batches.sql
  • polylogue/storage/sqlite/migrations/source/034_gc_generation_member_intent.sql
  • polylogue/storage/sqlite/migrations/user/008_query_evaluation_contracts.sql
  • polylogue/storage/sqlite/migrations/source/047.train.json
  • polylogue/storage/sqlite/migrations/user/007_query_objects.sql
  • polylogue/storage/sqlite/migrations/source/018_raw_live_source_reconciliation_receipts.sql
  • polylogue/storage/sqlite/migrations/user/005_context_deliveries.sql
  • polylogue/storage/sqlite/migrations/source/037_source_items.sql
  • polylogue/storage/sqlite/migrations/user/011_query_privacy_excision.sql
  • polylogue/storage/sqlite/migrations/audit/003.train.json
  • polylogue/storage/sqlite/migrations/source/046.train.json
  • polylogue/storage/sqlite/migrations/source/012_sinex_publication_payloads_receipts.sql
  • polylogue/storage/sqlite/migrations/source/039.train.json
  • polylogue/storage/sqlite/migrations/source/035_gc_namespace_identity.sql
  • polylogue/storage/sqlite/migrations/source/043_source_item_enumeration.sql
  • polylogue/storage/sqlite/migrations/source/027_raw_non_session_duplicate_exclusion_receipts.sql
  • polylogue/storage/sqlite/migrations/source/024_raw_authority_verdicts_cache.sql
  • polylogue/storage/sqlite/migrations/source/038_material_observations.sql
  • polylogue/storage/sqlite/migrations/source/044_raw_container_content_identity.sql
  • polylogue/storage/sqlite/migrations/source/029_raw_failure_disposition_receipts.sql
  • polylogue/storage/sqlite/migrations/source/008_raw_session_capture_mode.sql
  • polylogue/storage/sqlite/migrations/source/005_raw_revision_authority.sql
  • polylogue/storage/sqlite/migrations/source/020_raw_append_chain_backfill_receipts.sql
  • polylogue/storage/sqlite/migrations/source/013_raw_authority_ledger.sql
  • polylogue/storage/sqlite/migrations/source/023_raw_byte_duplicate_supersession_receipts.sql
  • polylogue/storage/sqlite/migrations/source/002_raw_capture_multimap.sql
  • polylogue/storage/sqlite/migrations/source/028_raw_hook_events_source_hash_index.sql
  • polylogue/storage/sqlite/migrations/source/036_hook_event_carriers.sql
  • polylogue/storage/sqlite/migrations/source/009_expand_origin_vocabulary.sql
  • polylogue/storage/sqlite/migrations/source/025_raw_quarantine_group_dedup_receipts.sql
  • polylogue/storage/sqlite/migrations/source/039_source_attachments.sql
  • polylogue/storage/sqlite/migrations/source/016_raw_capture_observations.sql
  • polylogue/storage/sqlite/migrations/source/010_sinex_publication_obligations.sql
  • polylogue/storage/sqlite/migrations/user/009_result_set_holdouts.sql
  • polylogue/storage/sqlite/migrations/source/043.train.json
  • polylogue/storage/sqlite/migrations/audit/002.train.json
  • tests/unit/storage/test_audit_continuity.py
  • polylogue/storage/sqlite/migrations/audit/003_machine_requests.sql
  • polylogue/storage/sqlite/migrations/source/033_detected_raw_provider.sql
  • polylogue/storage/sqlite/migrations/source/047_source_item_member_dispositions.sql
  • polylogue/storage/sqlite/migrations/source/046_rekey_raw_authority_blockers.sql
  • polylogue/storage/sqlite/migrations/source/045.train.json
  • polylogue/storage/sqlite/migrations/source/006_append_predecessor_revision.sql
  • polylogue/storage/sqlite/migrations/source/022_hook_payload_blob_refs.sql

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.

📜 Recent review details
🔇 Additional comments (8)
docs/internals.md (1)

254-255: LGTM!

polylogue/storage/sqlite/archive_tiers/source.py (1)

896-898: LGTM!

polylogue/storage/sqlite/queries/raw_writes.py (1)

360-361: LGTM!

devtools/verify_schema_manifest.py (1)

228-242: LGTM!

Also applies to: 327-334

tests/unit/devtools/test_verify_schema_manifest.py (1)

218-222: LGTM!

Also applies to: 239-280

polylogue/storage/sqlite/archive_tiers/archive_plan.py (1)

152-156: LGTM!

polylogue/storage/sqlite/durable_change_train.py (1)

27-27: LGTM!

Also applies to: 70-75, 2400-2405

tests/unit/storage/test_durable_change_train.py (1)

109-133: LGTM!

Also applies to: 553-561, 622-622, 647-647, 661-661


📝 Walkthrough

Walkthrough

The change resets durable migration lineage to the archive format floor. It validates archive markers before change trains, permits coordinated predecessor retirement, removes historical migration artifacts, updates selected fresh-lineage migrations, and adjusts tests and documentation.

Changes

Archive lineage reset

Layer / File(s) Summary
Coordinated predecessor retirement
devtools/verify_schema_manifest.py, tests/unit/devtools/test_verify_schema_manifest.py
Migration checks allow deleted predecessors only when all durable tiers reset to the archive format floor. Tests cover complete and partial resets.
Archive marker and change-train enforcement
polylogue/storage/sqlite/archive_tiers/*, polylogue/storage/sqlite/durable_change_train.py, tests/unit/storage/test_durable_change_train.py
Archive validation requires all tier keys and durable versions at the shared floor. Change-train execution validates the archive marker before writes and wraps lineage errors.
Migration catalog reset
polylogue/storage/sqlite/migrations/audit/*, polylogue/storage/sqlite/migrations/source/*, polylogue/storage/sqlite/migrations/user/*
Historical migration manifests and SQL files are removed or replaced for the reset lineage. Selected source migrations remain as fresh-lineage definitions.
Lineage documentation and supporting tests
docs/internals.md, polylogue/storage/sqlite/archive_tiers/source.py, polylogue/storage/sqlite/queries/raw_writes.py, tests/unit/storage/test_audit_continuity.py
Documentation and comments describe the current lineage and receipt checks. Obsolete audit continuity tests are removed.

Priority: ⬇️ Low

Estimated code review effort: 4 (Complex) | ~60 minutes

Change: Other

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description is incomplete. It contains only a partial summary and does not provide the required Problem, Solution, Verification, Changelog, or Risks and Follow-ups sections. Complete the PR description using the repository template. Add the Problem, Solution, Verification, Changelog, and Risks and Follow-ups sections. Include exact verification commands and explain any migration or rollout risks.
Docstring Coverage ⚠️ Warning Docstring coverage is 69.23% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 13 functions across 7 files. (1 skipped: … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main change: establishing a fresh schema floor and retiring historical migration chains.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 69.23% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 13 functions across 7 files. (1 skipped: 1 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

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

A rabbit checks the archive seal,
Then resets trails beneath the wheel.
Old migration paths fade from sight,
Fresh tiers stand at the format height.
The change-train hops only when markers glow.
Safe lineage now tells it where to go.

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

@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: 2754653b88

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

@Sinity
Sinity merged commit 232c436 into master Sep 20, 2026
3 checks passed
@Sinity
Sinity deleted the batch/polylogue-20260920-133536-4f2a5bfa/integration branch September 20, 2026 14:34
Sinity added a commit that referenced this pull request Sep 20, 2026
## Summary

Drops the raw-authority census ledger and every live consumer that read
it. One object was the entire remaining scope of two beads:
`polylogue-6kur` AC6 and `polylogue-6kur.3` AC10.

34 files, +446 / −5,063.

## Schema classification

**Retirement-only durable DDL omission** — not additive-durable, not
semantic-reparse. Evidence:

- `migrations/source/` holds only `__init__.py`; the numbered chains
were retired in #5290 (`232c43689`).
- `SOURCE_SCHEMA_VERSION` stays **47**. A bump was structurally
impossible — `_durable_ddl_evolution_violations` demands a contiguous
added-migration chain for any bump, and migrations are retired.
- `devtools/verify_schema_manifest.py::_is_retirement_only` is the rule
that admits exactly this shape, requiring the removed refs to be in
`RETIRED_SOURCE_SCHEMA_OBJECTS`. All six are declared there.
- No existing database is touched; this is a fresh-generation omission.
`devtools gate schema-manifest` → `durable-schema-evolution: PASS`.

Dropped: `raw_authority_censuses`, `raw_authority_plans`,
`raw_authority_census_plans`, `raw_authority_census_post_plans`, and two
indexes. The sequencing predecessor (v46 blocker re-key off
`plan_input_digest`, #5214) was verified landed at base before the drop.

## Consumers removed or given a successor

Every site was re-verified at base; several line anchors had drifted
from the brief.

- **Startup census recovery** — `daemon/cli.py`
`_run_startup_raw_census_recovery` and its call site deleted, plus
`maintenance/raw_authority.py` recovery helpers.
- **Readiness projection** — both census blocks in
`archive_readiness.py` deleted. The successor is the blocker read, which
the old code returned as a *zeroed payload* whenever
`raw_authority_censuses` was absent — the silent-empty regression, now
covered by
`test_readiness_still_reads_blockers_after_the_census_tables_are_gone`.
- **`daemon/status.py`** — five census keys removed;
`raw_authority_ledger_counts` had no producer even before this change.
- **MCP resources** + their registry declarations deleted; agent manual
regenerated.
- **Maintenance commands** — `raw-authority-census` and
`raw-authority-detail` deleted; `raw-authority-frontier`,
`raw-authority-blockers` and `raw-authority-blocker-resolve`
**retained** (they read/write only retained tables).
- **Inspect half** — `inspect_raw_authority_frontier` now publishes only
durable blockers and names its pass by a content address over the
inspected inventory, so an unchanged pass writes nothing.

**6kur AC1 decision — `raw-authority-blocker-resolve` KEPT, with
evidence.** It is not a generic repair route: it resolves exactly one
durable `raw_authority_blockers` row (the *retained* table), requires
`--yes` plus, for a judgment blocker, an explicitly accepted `user.db`
assertion id and `disposition=retain_canonical_authority`. Deleting it
would strand retained durable blockers with no resolution route while
`raw_materialization_ready` counts them as refuting.

## Preservation audit

No durable evidence class lost its only owner. Every
`raw_authority_censuses` field is recomputed by
`inspect_raw_authority_frontier` from current durable evidence;
`build_raw_replay_plan` recomputes the byte-identical plan snapshot and
the `plan_id` **is** its content digest; any blocked plan is
additionally stored verbatim in `raw_authority_blockers.expected_json`.
Only the multi-pass *history* has no successor — and that history is
what `polylogue-gen6d` recorded as rejected (99.98% of rows carried
`carried_forward`).

Verified the plan table was never a retention authority — the dependency
ran the other way, so the drop cannot strand or free any blob.

**One finding reported rather than routed around:**
`raw_authority_census_plans.outcome_status` was the only durable home of
the "no-progress" decision class. Its reader
`raw_replay_plan_no_progress_plan_ids` had **zero production callers**
at base, so this removes the storage of a value nothing read.
`docs/design/raw-decision-authority.md:90` already schedules its
replacement; that work is not done here.

## Deletion accounting

Every deleted test exercised an object that no longer exists; **none was
deleted because it failed**. The 29 tests dropped from
`test_raw_authority_ledger.py` are each enumerated against their retired
object in the bead notes.

**One deletion carried live behaviour and was restored after review:**
`test_frontier_plan_v1_identity_survives_historical_and_current_witnesses`
asserted both that `_plan` builds a witness with no top-level `raw_id`
(live) *and* that the census table stored it that way (retired). The
live half is back as
`test_frontier_plan_witness_carries_no_top_level_raw_id`.

## Verification

`devtools verify --quick` — all 22 gates ok, exit 0.
`devtools render all --check` — exit 0, `out of sync` count 0 (agent
manual regenerated after the MCP resource removal).
Focused: `49 passed` on the retirement/ledger/duplicate-identity files;
`491 passed, 1 failed` across all ten touched test files — the single
failure proven **inherited** against a clean `origin/master` worktree.

All other reds encountered were proven inherited by the same method: 7
migrate-tier/schema-skew failures (#5290 fallout), 7 daemon
fd-leak/tier-version failures, 5 MCP failures, 1 snapshot failure. Three
failures **were** mine — a leftover `patch.object(daemon_cli,
'_run_startup_raw_census_recovery')` in a shared fixture — and are fixed
in `572ebcdf1`.

## Needs a reviewer's eye

**Behaviour change in `readiness/claim_guard.py`.**
`raw_materialization_unmeasured_reason` no longer requires
`raw_authority_frontier.lifecycle_status == 'completed'`, and
`raw_materialization_ready` drops two census keys, keeping
`raw_authority_blocker_count` as the successor refutation.

Justification: that frontier row was written **only** by the
`raw-authority-frontier` maintenance command —
`inspect_raw_authority_frontier` has exactly one production entry and no
daemon stage — so on any archive where an operator never ran it by hand,
the claim guard reported raw materialization permanently indeterminate.
Visible consequence: `ops status` JSON now shows `raw_materialization`
state `ready` where it previously could not. The ruling did not
adjudicate this consumer.

**Scope judgment.** Three dormant functions were deleted beyond the
strictly-reached set because each could only give a misleading answer
once the ledger was gone: two would raise (they `UPDATE` a dropped
table) or build malformed SQL from a now-empty `IN (...)`; the third,
`unresolved_raw_replay_blockers`, could only ever return 0 and had zero
production callers — that one is closest to tidiness rather than an
active conflicting path, and is a clean one-function revert if
preferred.

## Residuals

- **Five touched files are IN the derived schema closure** (`source.py`,
`raw_authority.py`, `archive_readiness.py`, `raw_retention.py`,
`core/enums.py`). The identity moves: the archive must reconverge and
this must land **before** any rebuild starts, never during one.
- `test_plain_cli_snapshots.ambr` still contains census blocks. Not
hand-edited: its consumer is red on clean master for an unrelated reason
and fails *before* the snapshot comparison, so `--snapshot-update`
cannot regenerate it and a hand edit could not be verified. It
regenerates when that inherited failure is fixed.
- Two design/decision docs still cite the table historically;
`docs/maintenance.md`, which described the deleted commands as live
operator routes, was rewritten.

🤖 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 21, 2026
## Summary

Nine commits closing harness-honesty gaps: a gate that blamed the code
for an
unprovisioned environment, a verify receipt that proved nothing about
which tree
it tested, a scheduled run whose killer was discarded, and two inherited
reds
answered rather than re-recorded.

## Problem

- **`gate layering` blamed the code for a pruned environment.** Without
the audit
group, `grimp` is absent and the gate emitted findings-shaped output,
sending
readers to investigate code that was never inspected.
`verify_patterns.py`
carried the same trap in its remediation string: `uv sync --group audit`
  prunes the dev extra and lands you in a *second* broken checkout.
- **A verify receipt was not bound to a tree.**
`[operations.verify_all]`
declared `checkout = "default"`, which does not select a tree —
`projects.py`
validates against `{"any","default"}` and `launch.py` refuses any
workspace
other than `project.root` — so the corpus run executed on the operator's
  working branch and its receipt could be read as candidate evidence.
- **A killed run reported an undifferentiated abandonment.**
`_adopt_outcome`
kept only AgentCTL's coarse bucket, in which an OOM kill and an ordinary
  non-zero exit are both "failed", discarding the `systemd_result` the
`.outcome` file already held — so `devtools why` sent readers to
`journalctl`
  for a fact the receipt contained.
- Two reds on master were unattributed: three `test_cli_acceptance.py`
reflow
baselines, and `grok-export` reporting `partial (schema_package is
missing)`.

## Solution

`audit_checker_unavailable()` probes before any import is read, so a
refusal
cannot emit a partial finding list. Exit **3**
(`ENVIRONMENT_REFUSAL_EXIT`) is
distinct from the 1 that means a violation, with a new
`gate_missing_analysis_dependency` diagnosis. `AUDIT_GROUP_SYNC_COMMAND`
is one
shared constant naming the whole correct command, fixing both sites.

`verify_receipt_check.py` gains `candidate_tree_refusal()` and
`--candidate`,
with four refusals each naming both SHAs — including *no tested SHA
recorded*,
so the field cannot be removed to opt out. The tree check runs
**before** the
test-evidence check, so a flawless green run on another tree does not
read as
evidence. CI passes `--candidate ${{ github.sha }}`.

The reflow raise was **attributed, not guessed**: a detached worktree at
44c5f86 (#5191, which recorded the baselines) reproduced the gallery,
and the
diff shows 100% of the raise is f8a63f0 (#5249). The arithmetic closes
exactly
(156+3=159, 100+1=101, 9+1=10, 54+1=55, 2+1=3). The help text does not
reflow at
all, so "narrowing" would mean deleting words — recorded with its reason
beside
the table.

`grok-export` is answered by refutation: `schemas/providers/grok` was
deleted by
d7d3dda (#5224) because its element schemas carried
`$id polylogue://schemas/claude-ai/v2/session_document` — verified by
decompressing the deleted bytes, which are Claude.ai's shape. A
withdrawn
package is correct, so `partial` is **truthful**.

## Verification

- `devtools verify --quick` — all 23 gates, 23,547 collected
- `devtools test` over 13 devtools modules — **287 selected, 287
passed**,
  `terminal_green true`, `git_dirty false`
- Red reproduced *before* fixing: 4 failed / 21 passed at f6f899c; 27
passed after
- `devtools render all --check` — exit 0, `grep -c 'out of sync'` = 0
- `devtools schema closure` on **all 25 changed files — every one
reports `out`.**
  No commit here moves the derived identity.

## Residuals

- **`016xl` criterion 1 is further away than when filed**: 581.3 MiB
over 23,547
tests against a 430 MiB target, up from 533 MiB over 20,681. Per-item
cost is
flat; the total tracked corpus growth. Neither named lever pays — a
one-file
selection collects in 1.9 s / 112 MiB, and `-X importtime` shows 1.20 s
of
  2.68 s is `readline` via pytest's own pdb. Re-measure with the new
  `devtools bench collection --budget-mib 430`.
- **A 4.6% admission margin.** `charge_mib(3)` is 11,725 MiB against a
12,288 MiB
`memory.high` — exactly the condition the 2026-09-17 run stalled in. The
corrected charge model fills a ceiling whose 1.2x safety margin was
computed
under the superseded anonymous-RSS model. `WORKER_PEAK_CACHE_MIB =
2,850` is
~80% of a worker's charge, driven by 47-55 GB of scratch SQLite writes.
- `p2mbi` AC4 and `k1o3t` AC4 are **not satisfiable in this
repository**:
agentctl's operation vocabulary has no key naming a candidate tree and
no
memory/admission key. Recorded rather than faked; both need a sinnix
change.
- `origin_specs.py:3210` still declares `schema_paths` to a path #5224
deleted.
Not fixed here — that file is **IN** the derived closure, so correcting
it
  forces a reconvergence and belongs at the rebuild boundary.
- The larger inherited storage/schema red cluster is untouched and
outside this
packet; one owner should confirm #5290 is the single cause before anyone
fixes
  it test-by-test.

Advances polylogue-mkucv, 1khzy, p2mbi, yk0zz, 016xl, 62j1f, k1o3t.

🤖 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 21, 2026
Every durable tier carried two versions. `ARCHIVE_VERSION_BY_TIER` stamped
`ARCHIVE_FORMAT_FLOOR_VERSION = 1` for source, user and audit, while the tier
modules still declared `SOURCE_SCHEMA_VERSION = 47`, `USER_SCHEMA_VERSION = 11`
and `AUDIT_SCHEMA_VERSION = 3` -- the pre-reset lineage numbers. #5275 stopped
consuming them and #5290 deleted every numbered migration behind them, but
neither deleted the constants, so `blob_integrity._source_schema_capabilities`
went on reading `user_version >= 47` as its authority threshold. No source tier
this runtime writes reaches that number, so a fresh, fully current source tier
classified as `current_unversioned` forever.

Delete the three constants and point every reader at the one declaration.
`blob_integrity` compares for equality with the stamped version, because
`user_version` was renumbered from one and no longer orders across lineages: a
pre-floor 29 is not "newer" than a current 1, and its legacy blob carriers must
still be scanned.

Separately, `assert_archive_format_lineage` required each durable entry in the
marker's `tier_versions` to equal the floor exactly. That record is the version
a tier was *born* at, so the first numbered migration -- which the floor comment
and `DURABLE_MIGRATION_ADOPTION_FLOORS` both plan for -- would make every
freshly bootstrapped archive refuse the marker it had just written. Treat the
floor as the lower bound it is, and bind the birth-version fingerprint check to
the recorded birth version so the historical-lineage discrimination survives the
target moving above the floor.

No migration is required: nothing stamped the deleted numbers, so no archive in
any lineage carries them and no durable file changes shape.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_015WCh9YW3cRfsg3CZBKU7Fq
Sinity added a commit that referenced this pull request Sep 21, 2026
…e floor (#5369)

## Summary

**The floor is the design; the three constants are vestigial.** Deletes
`SOURCE_SCHEMA_VERSION = 47`, `USER_SCHEMA_VERSION = 11` and
`AUDIT_SCHEMA_VERSION = 3`, fixes the production defect that still
consumed one of
them, and relaxes a format-marker predicate that made the **declared
durable-migration regime unexecutable for every freshly bootstrapped
archive**.

Nine reds cleared, zero newly red.

## Which side is the defect — settled by history, not inference

`git show b56699c` (#5275): `ARCHIVE_VERSION_BY_TIER` was literally
`ArchiveTier.SOURCE: SOURCE_SCHEMA_VERSION` before that commit, which
deliberately
replaced all three durable entries with `ARCHIVE_FORMAT_FLOOR_VERSION`
**and removed
the three imports** — leaving the constants defined but orphaned.

`git show 232c436` (#5290) then deleted every numbered
source/user/audit migration
and reset the adoption floors, with the reason stated in-diff:
*"Numbering was reset
for the marker-identified archive lineage. A future train starts
directly above this
floor; historical chains are not a bridge into the new format."*

So #5275 stopped consuming the constants and #5290 deleted the
migrations backing
them; **neither deleted the constants themselves.**
`AUDIT_SCHEMA_VERSION` had the
identical split and the bead did not mention it — leaving it would have
made the
reconciliation two-thirds done and the anti-vacuity test unable to say
"per durable
tier".

## The production defect

`blob_integrity.py` compared `user_version >= SOURCE_SCHEMA_VERSION` —
against **47**,
while every source tier this runtime writes stamps **1**. The version
clause was dead,
so **a fully current fresh source tier classified as
`current_unversioned` forever.**

Now compares for **equality** against the stamped version. Equality
rather than `>=`
because `user_version` was renumbered from one by the format floor and
**no longer
orders across lineages**: a pre-floor 29 is not "newer" than a current
1, and `>=`
would grant authority to a foreign-lineage file with an incomplete
catalog and
**silently drop its legacy blob carriers**. The mutation proves it —
restoring `>=`
admits a `user_version=47` foreign tier as `current_versioned` with
`legacy_carriers=('raw_sessions',)` unscanned.

## What this unblocks for polylogue-37t.2.4 — and the boundary,
precisely

The probe showed the refusal was **not** "no durable migration can ever
land".
`assert_archive_format_lineage` already admitted a live tier *above* the
floor, so
forward-migrating an **existing** archive always worked.

The refusal was at the line requiring the marker's recorded
`tier_versions` to
**equal** the floor. That field is the archive's **birth record**,
written from
`ARCHIVE_VERSION_BY_TIER` — so the moment a migration raises the durable
target,
**every freshly bootstrapped archive records `source=2` and refuses the
marker it
just wrote.** Fatal for every new archive, every test fixture, and the
final rebuild.

Fixed: the floor is a **lower bound**, and the birth-version fingerprint
check binds
to `versions[tier]` rather than to the floor — so the historical-lineage
discrimination **survives the target moving** instead of silently
switching off.

**Executable proof**:
`test_migrate_tier_cli_executes_and_persists_a_future_change_train`
— the repo's only test driving a real numbered source migration `002`
from floor 1 to
2 through the production `ops maintenance migrate-tier` CLI — **was red
at base and is
now green.**

`37t.2.4` remains blocked for reasons it names itself: two undecided
design questions,
`verification_commands` naming a file that does not exist, and the user
tier's own
migration test path still red.

## Anti-vacuity — six mutations executed, tree verified clean after each

Reinstating the constants → *"`…archive_tiers.source` declares
`{'SOURCE_SCHEMA_VERSION': 47}`, but the source tier stamps and compares
1"* (×3).
Restoring the threshold → the pre-existing baseline red reproduced
exactly,
`assert 'current_unversioned' == 'current_versioned'`. Relaxing to `>=`
→ the foreign
lineage admitted. Re-pinning `tier_versions` → *"archive format marker
has an
incomplete six-tier floor"* from a fresh archive refusing its own
marker. Rebinding
the fingerprint to the floor → `DID NOT RAISE` on a transplanted foreign
tier. And
stamping from 47 → `assert 47 == 1`, **proving the stamps test is not
circular against
the map alone.**

## Measured cluster movement

**22 → 13 failures. Nine cleared, zero newly red, zero green→red.**
Before/after both
measured in this worktree (before, by checking out base content in
place):
534 passed → 553 passed, and the arithmetic checks: `534 + 9 cleared +
10 new tests = 553`.

Five of the nine had a **different root** from the constants split and
are classified
honestly: tests building a "stale" tier as
`ARCHIVE_VERSION_BY_TIER[tier] - 1`, which
for a durable tier at the floor **collapses onto 0** — the
deliberately-admitted
never-provisioned sentinel, not a skew. Fixed by stepping *above*
instead, the pattern
already documented in a sibling test.

## Landing window

`source.py`, `user.py`, `audit.py`, `__init__.py`, `archive_plan.py` all
**IN**;
`blob_integrity.py` `out`. All three AST fingerprints move, index
identity
`231dfa77 → a0620e74`; **ops unchanged**. **Must land before a fresh
rebuild starts,
never during one.**

**No migration required, with proof rather than assertion**: nothing
ever stamped
47/11/3 in this format lineage, no DDL byte changed in the three tier
modules (only a
constant and an `__all__` entry), and the `archive_plan` change **only
relaxes an
admission predicate for marker values nothing currently produces**.
Classification:
metadata-only. An existing archive is not stranded — its `user_version`
stays 1, its
marker stays `{'source': 1, …}`, and the relaxed lower bound still
admits it.

## Verification

`devtools verify --quick` exit 0 (22 static gates, zero FAILED) ·
`render all --check`
exit 0, `grep -c 'out of sync'` = 0 · new
`test_durable_tier_version_authority.py`
10/10 · `test_durable_change_train.py` 57 passed / 42 failed **identical
before and
after**, proving that family inherited and untouched.

Also corrected the same staleness in `docs/schema.md` (its table cited
`SOURCE_SCHEMA_VERSION = 29`, already wrong before this change),
`docs/archive-backup.md`, `docs/data-model.md`, and `docs/security.md`
(which cited a
deleted migration file).

## Residuals

- **The `>=` → `==` narrowing is a deliberate semantic change, not a
retarget.** Under
the old single monotone lineage `>=` read as "at least as new as this
runtime";
post-reset that reading is unavailable. A tier sitting mid-chain (at 2
while the
runtime targets 3) now reports `current_unversioned` and falls back to
the catalog
probe — conservative, not wrong, but a future migration author should
know.
- **The largest remaining coherent red group is the pre-floor-fixture
family**, sharing
one root with the 42 in `test_durable_change_train.py`: tests seeding
durable tiers
at pre-floor versions and driving chains #5290 deleted. They need
rewriting against
the reset floor, **not test-by-test patching**, so that was deliberately
not mixed in
  here. One retarget is flagged rather than hidden:
`list(range(11, ARCHIVE_VERSION_BY_TIER[USER] + 1))` now evaluates to
the empty list —
nonsense under the reset floor, red either way, and it should be
rewritten.
- 13 inherited reds remain in the cluster, each with its cause compared
before and
after: the daemon `TimeoutError`/fd-leak family, the pre-floor
`_create_user_v3`
fixtures, the known `-wal`/`-shm` sidecar cause, and one ontology-grain
mismatch with
  a version-shaped name.
- No full-corpus run, per the targeted-verification rule.

Closes polylogue-rwcq2. Partially unblocks polylogue-37t.2.4.

🤖 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 22, 2026
…es audit.db

The archive-format marker guard added with the lineage floor (#5290) inspects
every durable tier file before bootstrap reaches the established-archive
barrier. An archive that belongs to the current lineage and has lost only
audit.db therefore reported "archive format marker names a missing durable
tier" -- true, and naming no action -- instead of the adoption route that
recovers it.

Prove the surviving source/user pair against the marker first, so a forged
marker, a foreign source schema, a symlinked tier or a second missing durable
tier still refuses on the stronger finding, then raise the adoption refusal.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01ToWqpkXotr573DiQex5vcy
Sinity added a commit that referenced this pull request Sep 22, 2026
…es audit.db (#5404)

## Summary

**The dispatch premise this lane was given is refuted.** There is no
fixture/bootstrap seam failing to write `.polylogue-format.json`, and no
single fix greens 42 + 65 tests. What the lane found instead is one real
production defect in the marker guard, fixed here.

I wrote that premise. It was wrong, and the measurement below is why.

## The premise, measured and refuted

Classified **every** failure at branch base `0df0f6a00` across the 10
named files: **84 failed / 334 passed / 418 collected.**

| cause | count |
|---|---|
| WAL `-shm` sidecar in `BackupResult` (**`iv19g`**) | **28** |
| `missing durable migration train sidecar: 002.train.json`
(**`klxla`**) | 13 |
| `SchemaSkewError` from pre-reset version literals (**`jgesp`**) | 7 |
| mention the archive format marker | **5** |
| **missing marker on a fresh fixture root** | **0** |

`tests/infra/archive_templates.py:bootstrap_archive_root` already takes
the production route or reflink-clones a production-built template with
`cp -a`, which carries the marker. **The shared seam already does the
right thing.** The 5 marker failures are correctly-bootstrapped roots
that later lost a durable tier, or hand-built partial roots — which
production refuses by design.

The collision attribution was also backwards: `iv19g`'s cause is the
**largest** cluster here (28 of 84), not a minority. `test_backup.py` is
32 failures of which 28 are that.

The receipt my premise came from is at `a2df1fc5d`, which **predates
#5387** — at that commit `migrations/source/` held only `__init__.py`,
which is why 12 of those 42 were sidecar-discovery failures. Re-measured
at `0df0f6a00` the same file shows 39 with a different distribution.

## What was actually wrong, and is fixed

Since #5290, the lineage assertion inspects every durable tier file
*before* bootstrap reaches the established-archive barrier. So an
archive of current lineage that has lost **only** `audit.db` is refused
with a message naming no action.

Reproduced with production code only, no fixture:

```
base:  RuntimeError: archive format marker names a missing durable tier: .../audit.db
fixed: RuntimeError: established archive is missing audit.db; use
       maintenance migrate-tier audit --adopt-established-audit
       with a verified full_evidence backup
```

…and `audit.db` is still not recreated. The `tiers` parameter narrows
**only the per-tier file proof** — every marker payload check stays full
strength, so the surviving source/user pair is still proven to belong to
the lineage before the recovery route is named.

Two previously-red tests go green with byte-identical nodeids from the
baseline.

## Anti-vacuity — and four opposite-direction pins

Reverting the production edit: `Expected regex:
'adopt-established-audit'` / `Actual: 'archive format marker names a
missing durable tier'`. **The four opposite-direction cases stayed green
under the mutation** — a missing marker, a forged marker, a foreign
source schema and a second missing tier all still refuse on the stronger
finding, so this cannot be satisfied by weakening the guard.

## Verification

```
devtools test -k missing_audit          2 passed / 97 deselected
devtools test test_audit_adoption_route  5 passed (1 new + 4 opposite-direction)
devtools verify --quick                  exit 0, 25/25
devtools render all --check              exit 0, 'out of sync' 0
```

Closure: both edited files **IN**; index `8a971a53… → c98df42d…`, ops
unchanged. DDL-wise metadata-only — no table, column, index or
`user_version` change — but **closure-moving, so land before a fresh
rebuild.**

## Found, not fixed

- **A dead shared fixture**: `tests/infra/durable_schema_reset.py` (380
lines) reasons over source migration slots 18–46 that no longer exist.
Against a chain with only slot 002,
`reset_source_fixture_to_version(conn, 31)` drops nothing and then
**CREATEs eight retired tables** plus a pre-v46 shape into a current-DDL
fixture — it now *corrupts* rather than ages. Its only caller is
`test_durable_change_train.py:2450`.
- `klxla` and `jgesp` remain open with their real causes named. Both
live in files this lane was told are `iv19g`'s territory; the collision
instruction was held.
- **Two of five queued pytest jobs were SIGKILLed at exactly 15 s**
(exit 137, `pytest_no_report`, `event_count 0`, no slot log) while
`pytest-quick` had 2 running / 20+ queued. Identical selection passed on
resubmission.
- **Process hazard**: `git checkout origin/master -- <path>` inside a
lane worktree pulls from a *moved* master, not the branch base,
producing an inconsistent tree. Use `git checkout HEAD -- <path>`.

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

https://claude.ai/code/session_01ToWqpkXotr573DiQex5vcy

---------

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

## 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.py` now splits the
full-revision-governance detail markers into `WRITABLE_…` (1 member) and
`LEGACY_…` (the pre-#3234 spelling), with `RETIRED_…` as their union.
`revision_governance.py:2196` narrows 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 ValueError` at `test_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 named

The dispatch said "nothing is done". **Three of its four claims were
wrong**, and the lane refuted each at base `9ef655cb8`:

- **AC1 was already satisfied** — `write.py:6519 if policy_values !=
last_agent_policy:` emits a row only on genuine change, landed in #5309,
with a comment naming this bead.
- **`PRIMARY KEY(session_id, position)` is not the forbidden grain** —
`position` is the offset where a retained *interval starts*, so the PK
constrains interval starts, not per-message rows.
- **The "100%-NULL index" is partial** — `WHERE source_message_id IS NOT
NULL` at `index.py:1002` and again at `runtime_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_values`
now 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.

## `3szyi` AC2 — proven unperformable, by executing it

The AC asks for durable CHECK constraints generated from Python enum
owners. A `PolylogueStrEnum` carrying `audit.destructive_class`'s six
members was injected into `archive_tiers/source.py` and the real gate
run:

```
Enum-derived membership CHECKs found in durable tiers: 1
  audit: destructive_class matches _TempDestructiveClass
GATE_EXIT=1
```

Reverted → exit 0. **Doing what the AC mandates makes `devtools verify`
red.** `gate durable-enum-checks` refuses 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 counts

The 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**:

| tier | CREATE TABLE | spec-rendered |
|---|---|---|
| index | 36 | 35 |
| embeddings | 5 | **5 — fully adopted** |
| source | 32 | 0 |
| ops | 17 | 0 |
| user | 17 | 0 |
| audit | 14 | 0 |
| bootstrap | **0** | 0 |

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.py` has zero CREATE TABLE.

Also corrected: the scoping's claim that #5290 emptied the migration
directories is **false** — `migrations/source/002` and
`migrations/user/002` both exist with `.train.json` sidecars. Only
`migrations/audit/` is bare, so the audit tier's route is
declared-but-unexercised.

## Verification

| command | exit |
|---|---|
| `devtools verify --quick` at base | 0, 25/25 |
| `devtools verify --quick` at rebased head | **0, 25/25**
(`durable-enum-checks`, `schema-manifest`, `schema-closure` all ok) |
| `devtools render all --check` | 0, `out of sync` = **0** |
| `test_revision_replay.py` + `test_archive_write.py` | 0 |
| downstream consumers (169 tests) | 1 non-passing — **inherited** |

Inherited 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…`**; `ops` unchanged. **No DDL changed** — this is the
AST-closure case CLAUDE.md describes. `gate schema-closure` green,
membership unchanged, `INDEX_SCHEMA_VERSION` untouched at 107.

**Must land before a fresh rebuild starts, never during one.**

## Residuals

- **Latent gate gap:** `verify_durable_enum_checks.py` only walks
`PolylogueStrEnum` subclasses, so a durable CHECK generated from a
`typing.Literal` would 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 used `Literal`
owners.
- **`sze30` full removal** needs `migrations/source/003` adding a typed
`detail_code` plus 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_strength` and
`audit.principal_surface`/`surface` are byte-identical member sets —
real collapse candidates, both durable.

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

https://claude.ai/code/session_01ToWqpkXotr573DiQex5vcy

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
@Sinity

Sinity commented Sep 29, 2026

Copy link
Copy Markdown
Owner Author

Closing out open Codex review threads on this PR (evidence checked against master at 64a9bd0):

Resolving every thread listed; confirmed defects are fixed under the named bead.

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