Repository navigation
feat(backups): deterministic class-B cohort planner for the Turso mesh (#13456) - #13505
Conversation
#13456) Slice 1: a pure planner that takes a runtime Turso inventory, excludes the class-A databases (fleet-queue, fleet-platform, atlas), assigns every remaining database to exactly one stable 14-day cohort (sha256(name)[:8] % 14), and emits the cohort due for a supplied date (days-since-epoch % 14) as a machine-readable JSON dry-run plan. No exports, R2 writes, credentials, retries, or schedule — those are follow-up slices. Property-style tests (stdlib-only, fixed seed) prove in-range, unique, order-independent assignments; examples cover the class-A exclusions and date-to-cohort selection. Test: python3 -m unittest discover -s pkgs/cold-store-reaper/tests -v (also runnable as: python3 -m pytest pkgs/cold-store-reaper/tests/test_turso_mesh_cohort.py)
|
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 6 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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8ce855c898
ℹ️ 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".
| parser = argparse.ArgumentParser( | ||
| description="Plan the class-B Turso mesh cohort due on a date (#13456)." | ||
| ) |
There was a problem hiding this comment.
Disable abbreviated options in the strict argument parser
When an operator supplies an undeclared prefix such as --al, argparse's default allow_abbrev=True silently interprets it as --all, emitting every cohort instead of rejecting the argument with exit 2. This violates the repository's operator-script contract requiring undeclared and typo'd flags to be usage errors. Set allow_abbrev=False when constructing the parser.
AGENTS.md reference: AGENTS.md:L44-L48
Useful? React with 👍 / 👎.
| ``turso db list`` at run time — never hard-code the inventory here. | ||
|
|
||
| Usage: | ||
| turso db list | python3 scripts/turso-mesh-cohorts.py --date 2026-11-24 |
There was a problem hiding this comment.
Extract database names in the documented inventory pipeline
Running this documented pipeline supplies a table rather than the required one-name-per-line inventory: Turso's noninteractive listing calls the same renderer that emits the NAME, TYPE, GROUP, and URL columns, including their header (upstream implementation). Since read_inventory() only strips surrounding whitespace, the planner hashes whole table rows and even treats the header as a database; class-A rows also fail the exact-name exclusion. Update the example to extract only database names and discard the header before piping into the planner.
Useful? React with 👍 / 👎.
Slice 1 of #13456 (queue task 21384): a pure, testable planner for the class-B 14-day rotation.
What it does
pkgs/cold-store-reaper/scripts/turso-mesh-cohorts.py: takes a runtime Turso inventory (one name per line, stdin or--inventory) and a date, and emits the due cohort as a machine-readable JSON dry-run plan.fleet-queue,fleet-platform,atlas) and reports them in the plan, never silently dropped (design §4, leg impl(backups): mesh leg — Turso platform DBs (fleet-queue, fleet-platform, atlas) → R2 restic deltas #13455).sha256(name)[:8] % 14— stable across runs and inventory growth, so new databases join automatically and none moves cohort.--allemits all 14 cohorts;--cohort Nselects one. Strict argument contract per Design: unknown means stop — one strict argument contract for the repo's operator scripts #3352 (unknown args are a usage error, exit 2).Tests
pkgs/cold-store-reaper/tests/test_turso_mesh_cohort.py: 12 tests, stdlib-only (unittest + fixed-seed random, per this package's convention). Property-style invariants: cohort indices in range, every class-B database in exactly one cohort, inventory permutation changes nothing. Examples: class-A exclusions, date-to-cohort selection, determinism, empty inventory, usage errors.Verification (remote dispatch; no local test runs)
fleet queue dispatchis blocked by the TLS defect (fleet: repo-queue dispatch fails with TLS UnknownIssuer behind the egress proxy (Rust TLS ignores SSL_CERT_FILE) #13185:invalid peer certificate: UnknownIssuer), so verification used thefleet-command.ymlworkflow fallback.python3 -m unittest discover -s pkgs/cold-store-reaper/tests -p "test_turso_mesh_cohort.py" -v).test_cold_store.py(the runner image has nozstdbinary:zstd binary not found), untouched by this change.python3 -m pytest pkgs/cold-store-reaper/tests/test_turso_mesh_cohort.py(unittest-style tests; pytest was not installed on the fallback runner).Refs #13456
{ "direct_parent": null, "links": [], "lineage": { "design": null, "roadmap_item": null, "priority": null }, "pm_meta": 1, "provenance": { "queue_id": null, "scheduled_start": null, "picked_up_at": null, "work_started_at": null, "created_at": "2026-11-23T17:11:38Z", "session_id": null, "lane": null, "host": "htch-runtime", "worktree": "/home/hatch/workspace/github-work/code-13456", "model": null, "lane_start_issues": [], "workspace_ref": { "kind": "worktree", "id": "/home/hatch/workspace/github-work/code-13456", "repo": "developing-today/code", "branch": "xaltha/13456-cohort-planner", "sha": "8ce855c8985a7e3bb88d0d9359d19f4ef8b1e29c" }, "auth_subject": "xaltha", "stamped_by": "fleet 0.1.0 (native)" } }Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.