Skip to content

Restore resident storage after retired secondary indexes reappear - #6151

Merged
joelteply merged 3 commits into
codex/native-storage-recovery-20261117from
codex/declared-index-recovery-20261118
Nov 19, 2026
Merged

joelteply merged 3 commits into
codex/native-storage-recovery-20261117from
codex/declared-index-recovery-20261118

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

BigMama's resident chat replay stopped when the earlier SQLite writer left five retired nonunique indexes beside an otherwise exact ORM receipt. Both the main and node stores refused to open. This change reconciles those five specific prior index definitions during transactional admission and restore. It compares all remaining catalog rows against the existing receipt before issuing DDL. An index included by the receipt stays in place.

I deployed the uncommitted integrated source on the BigMama 5090. Core PID 31228 (SHA256 F33CA76DB33FAAC2497B4DA1536BB57D19470486DD4990A87120387B56B347A2) adopted the existing pinned CUDA engine, PID 15124. The actual main store grew from 132416 to 132446 chat rows, and both databases retired the five indexes.

On the independent 10 GB main backup the real storage owner opened in 457 ms and reopened in 38 ms. Digests of every chat row, memory row, declaration and sequence head matched before and after on both backups. An unexpected index in a third copy caused admission to refuse and rolled back the prior collection's index removal. The earlier local deployment without this change recorded zero turns across 15 minutes.

This is the storage slice stacked on #6109. The local integration also included the serving stack on #6150. Resident scheduling and end-to-end learning remain separate outcomes under observation.

@joelteply

Copy link
Copy Markdown
Contributor Author

Review at 01ccb41 (Fable). Correct, but it needs one automated test before merge.

What I checked, and how:

  • Ordering. reconcile runs only on a verify_physical mismatch. It partitions out only rows whose catalog SQL is byte-exact to the five retired CREATE INDEX definitions and are not named by the receipt. It then re-verifies the retained rows exactly before any DROP. An unexpected index, column or trigger still refuses. Read in retired_indexes.rs.
  • Atomicity. In admit and in restore, the DDL runs in a transaction: relational.rs:93, catalog_read = db.begin() → restore → catalog_read.commit() at ~:143. A refusal rolls back, which matches the third-copy rollback in your receipts. One nit: catalog_read now also writes, so the name could become catalog.

Blocking: no automated test of reconcile. The only test is #[ignore], gated on CONTINUUM_INDEX_REPLAY_COPY. That's a receipt harness: CI never runs it, and it has no // what this catches:. A migration that drops DDL needs two cases on a tempdir SQLite store, in the existing test mod:

  1. A store with an exact receipt plus the five retired indexes opens, and the indexes are gone.
  2. The same store plus one unexpected index refuses, with all five retired indexes still present (rollback proven).

Your live receipts (10 GB backup, digests equal, 457 ms / 38 ms) are good evidence for the deploy. They don't guard against a regression.

@joelteply

Copy link
Copy Markdown
Contributor Author

Re-review at e40b63e (Fable). Approve. The blocking test is in: I read the +72-line diff in retired_indexes.rs.

  • reopen_drops_only_the_five_retired_indexes reopens a legacy catalog and asserts no retired index survives.
  • unexpected_index_rolls_back_retired_indexes_across_tables asserts the reopen refuses and all five retired indexes remain across both tables, so the rollback is proven.

Both always run; neither is #[ignore]. Nit, not blocking: each test needs a one-line // what this catches: per the test rule.

@joelteply

Copy link
Copy Markdown
Contributor Author

Final head 343ea23 (Fable): approve. I read the diff since e40b63e: the fixture's room_id/persona_id change from String to uuid::Uuid, and both tests gain their What this catches lines. No logic change.

@joelteply
joelteply merged commit e2eae37 into codex/native-storage-recovery-20261117 Nov 19, 2026
37 checks passed
@joelteply
joelteply deleted the codex/declared-index-recovery-20261118 branch November 19, 2026 00:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant