Repository navigation
feat(devtools): fast-forward v32 indexes without raw replay (#2804) - #2804
Conversation
Add a clone-first, pressure-gated derived-index actuator that applies the exact v33-v35 schema and FTS deltas, validates the inactive clone, and activates or rolls back through an atomic generation symlink. Receipts are fsynced, self-verifying, and retain source identity, phase timings, counts, DDL hashes, and restart outcomes.\n\nRef polylogue-5ucz.\n\nCo-Authored-By: Claude <[email protected]>
Problem: activation repeated the full exact clone validator even though a hash-verified clone_ready receipt already recorded that proof. On the live 32 GB index this adds an unnecessary hour-scale scan before and after the symlink swap. Reuse the receipt proof only when both source and clone file identities remain exact, run a fresh read-only quick_check before swapping, and reduce post-restart validation to service readiness plus v35/object sanity. Automatic v32 rollback remains intact. Ref polylogue-5ucz. Co-Authored-By: Claude <[email protected]>
Problem: SQLite can checkpoint and remove WAL/SHM sidecars as the final validator connection closes. Capturing file identity before that lifecycle completes makes a valid clone fail the exact activation identity guard. Explicitly truncate the clone WAL after final validation, require a non-busy checkpoint, and only then bind the stable file identity into the receipt. The activation guard remains exact. Ref polylogue-5ucz. Co-Authored-By: Claude <[email protected]>
SQLite may leave an empty WAL or shared-memory file until process exit even after a successful truncate checkpoint. Remove those quiescent sidecars before binding the final clone identity so activation sees a stable exact proof. Ref polylogue-5ucz. Co-Authored-By: Claude <[email protected]>
Problem: systemd can report a newly restarted daemon active briefly before a bind or startup failure exits it. A single active sample allowed a later crash loop to escape automatic rollback. Require the same active MainPID to remain healthy across a five-second window before activation succeeds. The rollback regression now exercises a late stability failure. Ref polylogue-5ucz. Co-Authored-By: Claude <[email protected]>
|
Warning Review limit reached
Next review available in: 17 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (4)
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 62ad0b3f99
ℹ️ 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".
## Summary Reconciles the declared fast-forward plan layer onto the live-proven v32→v35 executor deployed by #2804/#2805. The deployed executor remains the only implementation of clone, activation, rollback, and recovery behavior. ## Problem PR #2788 was based before the executor landed and independently implemented the same operational surface. The merge conductor correctly held it: replacing a live-archive-proven executor would be unsafe and would create two competing recovery mechanisms. ## Solution - Keep the declarative layer in `polylogue/storage/sqlite/lifecycle.py`: versioned delta classes, clone-safe operation metadata, policy coverage, and explicit semantic-reparse routing. - Drive the deployed executor’s canonical objects, receipt delta classes, and exact stage order from the declared v32→v35 plan. Its live-proven SQL, pressure checks, reflink handling, receipts, symlink activation, rollback, and service checks are retained unchanged. - Declare v36 as `semantic-reparse`: it is a source-origin vocabulary change and is rebuild/reprocess-only, not clone SQL. - Keep ma2’s v34 `idx_web_constructs_message` as the first `index-only` plan operation and assert that the deployed executor receipt records that declaration. - Delete the branch’s competing executor/activation/rollback implementation and its conflicting executor tests; no parallel entry point remains. - Retain the schema-version policy gate and generated docs/topology projection. ## Acceptance criteria | Bead | Status | Evidence | | --- | --- | --- | | `polylogue-9rw0` | partially satisfied; replay equivalence deferred to `polylogue-p5r4` | Every current index bump is classified (v33–v35 clone-safe; v36 semantic reparse); policy rejects gaps; the deployed v32→v35 executor consumes the plan and records stages/classes; semantic deltas route away from executor SQL. Independent replay of sampled raw bytes and hash comparison remains explicitly deferred. | | `polylogue-ma2` | satisfied | v34 declares the FK-supporting index as `index-only`; the deployed executor’s v32 fixture runs the canonical index DDL and asserts `EXPLAIN QUERY PLAN` uses `idx_web_constructs_message` without a table scan. No in-place migration helper was added. | ## Verification - `POLYLOGUE_PYTEST_BASETEMP_ROOT=/realm/tmp/polylogue-pytest POLYLOGUE_PYTEST_WORKERS=0 nix develop --command devtools test tests/unit/storage/test_index_fast_forward_lifecycle.py tests/unit/devtools/test_index_fast_forward.py` → **13 passed**. - `nix develop --command devtools lab policy schema-versioning` → **Schema evolution policy intact**. - `nix develop --command devtools verify --quick` → passed; the subsequent pre-push hook reported `HEAD already verified (7527883)`. - Executor census: `rg -l "def create_and_fast_forward_generation|def fast_forward_clone" devtools polylogue tests -g '*.py'` → only `devtools/index_fast_forward.py`. Anti-vacuity: the executor integration test calls the deployed clone path and checks receipt stages/classes against the production lifecycle plan; removing that plan consumption or ma2’s operation fails it. The policy test invokes the real schema-version lab command. The pre-existing deployed executor tests still cover clone failure, activation identity proof, rollback, tamper rejection, sibling links, and restart rollback. Ref polylogue-9rw0. Ref polylogue-ma2. Ref polylogue-p5r4. --------- Co-authored-by: Codex <[email protected]> Co-authored-by: Claude Fable 5 <[email protected]>
|
Historical Codex triage: evidence checked at 5ebcfe5. This records that source revision; it does not claim a fresh review of current master.
Only the rows listed above are dispositioned. Held findings remain open. |
Summary
Add a clone-first operator actuator that advances a quiesced derived
index.dbfrom v32 to v35 without parsing raw exports. The live 32 GiB archive was upgraded through this path and atomically activated with its v32 generation retained as the rollback target.Ref polylogue-5ucz.
Problem
The healthy live index was at schema v32 while current code requires v35. Ordinary recovery would rebuild from raw material, although the intervening changes are derived-only: one CHECK widening, one index/view change, and three FTS tokenizer/folding rebuilds. A raw replay would add hours of avoidable work and expose the archive to the already-observed resource/rate-limit hazards.
Solution
devtools workspace index-fast-forwardwith plan, clone-upgrade, validate, activate, and rollback operations.user_versionat 32 until exact structural, DDL, FK, FTS, fold, and integrity gates pass.raw_reparse=falseevidence.quick_checkbefore the atomic symlink swap.Acceptance criteria
/realm/db/polylogue/.index-generations/gen-1783732901896-284abd9a/index.db.raw_reparse=false, and only normalized derived tables fed FTS rebuilds.quick_check=ok, exact FTS parity, folded-query smoke green, v35 final validation ready.Verification
devtools test tests/unit/devtools/test_index_fast_forward.py6 passed in 19.24sdevtools verify --quick20260712T225217Z-quick-1722344-c0ec918b, 15/15 steps green in 68.1sdevtools verify --quick20260712T225454Z-quick-1736683-eb31b5e9, 15/15 steps green in 49.86s/realm/staging/polylogue-sqlite/recovery/v35-fast-forward-20260712/receipt.jsonJaroslawlive hits 41;tlumaczlive hits 245;PRAGMA user_version=35The default testmon gate was not available in the fresh worktree because it had no seed; the complete owning test file and quick static/generated gates were run instead.
Follow-up
The installed Nix-store daemon package predates current v35 code and reports
schema mismatch index; update the deployed package after merge, then repeat runtime status/journal postflight before closing polylogue-5ucz.