Repository navigation
feat(queue-backup): Turso-to-D1 export and restore drill for the queue store (#8584) - #12685
Merged
Merged
Conversation
…e store (#8584) Leg 3 of the fleet unification backups slice: the tooling half. - bin/export_d1.py: queue-store SQLite file -> D1-loadable SQL dump + manifest (per-table counts, schema fingerprint, dump SHA-256). The export is written only after the dump loads into a fresh vanilla SQLite database with identical counts and schema. - bin/restore_drill.py: verifies dump/manifest integrity, loads the D1 copy, restores into a scratch store, re-checks counts and schema, then claims exactly the first claimable task using the claim shape of turso_queue/claim.rs (queued branch) plus its leases row. - tests: fixture built from the queue DDL of record (turso_queue core.rs SCHEMA + merge_intent DDL); export 4/4, drill 4/4, plus an end-to-end CLI drill (10 tables, 12 rows, task 1 claimed). - docs/RUNBOOK.md: the operating path and the production wiring that remains (D1 creation in the existing Cloudflare account, scheduled export + registry entry, broker-mediated claim against a scratch Turso database) as an operator session. No live infrastructure is changed by this PR. Refs #8584.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 48 minutes. View limit details
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. |
Codex Review Summary: ✅ CompletedThis 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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Leg 3 (Turso -> D1) of #8584, the tooling half. Refs #8584 — the issue stays open on the remaining legs.
What lands
infra/queue-backup/, sibling toinfra/github-backup:bin/export_d1.py— a queue-store SQLite file (local replica / scratch copy of the Turso store, opened read-only) -> a D1-loadable SQL dump + manifest (per-table counts, schema fingerprint, dump SHA-256). Nothing is written until the dump loads into a fresh vanilla SQLite database with identical counts and schema; that load is the D1-fidelity check.bin/restore_drill.py— the restore drill: dump/manifest integrity, D1-copy load, restore into a scratch store, count + schema re-checks, then a claim check running the queue's claim shape (the conditional UPDATE ofturso_queue/claim.rs, queued branch, plus its leases row): exactly the first claimable task, exactly once.bin/queue_backup_common.py— shared counts / schema-fingerprint / dump helpers.docs/RUNBOOK.md— the operating path and the production wiring that remains.Verification
python3 -I infra/queue-backup/tests/test_export_d1.py— 4/4 OK. Fixture is built from the queue DDL of record (turso_queue/core.rsSCHEMA +merge_intent.rsDDL); oracles: identical counts + schema fingerprint after a vanilla-SQLite load, manifest hashes match the written bytes, no-clobber without--force, non-database source rejected.python3 -I infra/queue-backup/tests/test_restore_drill.py— 4/4 OK. Oracles: the priority-90 queued task is the one claimed (attempts 0 -> 1, worker + lease stamped, other tasks untouched); tampered manifest and tampered dump are both rejected; a store with no claimable task fails unless--allow-empty."ok": true).py_compileclean on all six Python files.Deliberately not in this PR (named remainders on #8584)
cftool; the scheduled export + itsdoc/fleet-schedule-registry.mdentry; and the production-form drill — a broker claiming against a real scratch Turso database loaded from the real D1 copy. Those are live writes to Cloudflare/Turso and belong to an operator session.Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.