Repository navigation
Description
Finding
PR #988 added project-budget enforcement to put_backup(), but the accounting it enforces against never counts backup bytes — so the cumulative backup stream can cross the 3 TiB project budget without ever being refused, and status's within_budget verdict has the same blind spot.
Evidence (verified on current main 76672b97df023607d8469d462f21420604fe92d5, via gh pr diff 988 and the local clone)
pkgs/cold-store-reaper/cold_store.py:
_upload_accounting()(lines ~459–482) definescold_bytesas verified bundles only:SELECT coalesce(sum(bytes),0) n FROM bundles WHERE state='verified'
_check_upload_limits()(lines ~485–507) refuses whencold_bytes + nbytes > project_budget_bytes.put_backup()(lines ~933–960) calls_check_upload_limits(conn, size, …)before uploading, then records the backup only in the transfer ledger (ledger_add(conn, "upload", size, "backup-upload", name)). Backups are unbundled Drive files (db-backups/<db>/); they never enter thebundlestable.
Consequences:
- For a
put_backupcall, the budget side of the check compares bundle bytes + this one backup against the budget. Yesterday's backups contribute 0. A backup stream of any cumulative size passes as long as each individual file fits underbudget − bundle_bytesand the rolling-24h hard stop (the only cumulative accounting backups do get, and it forgets after 24h). - This is now the main growth path:
backup-d1andbackup-supabasego throughput_backup, and PR cold-store: nightly Turso exports via HTTP APIs #993 added a nightly Turso export through the same path. Retention (prune-backups) bounds count by age class, but nothing bounds total backup bytes against the budget the PR claims to enforce. status_data()reuses the same accounting, so itscold_bytes/within_budgetreadout also excludes every DB backup sitting in Drive.
PR #988's tests cover a single put_backup against a tiny budget (cold = 0 bundles + one file) and the bundle-path refusals, but no sequence of backups accumulating past the budget.
Deduped 2026-10-26: gh issue list --search 'put-backup project budget' returns only #938 (closed by PR #988 — this is a remainder of that enforcement, not a re-file of the original "never enforced" report) and #939 (retention, unrelated mechanism).
Why it matters
#938 was filed because the limits were "reported but never enforced". After PR #988 the daily hard stop is genuinely enforced for all paths, but the project budget is still effectively unenforced for the backup class — the class that grows every night — while the README ("Upload guardrails (enforced, not just reported)") and status both present it as enforced. A silent Drive blow-out past 3 TiB is the failure the budget exists to prevent.
Acceptance criteria
- Triage decides the correct cumulative accounting for backups (e.g. a backups total tracked in the manifest/meta, Drive folder totals, or ledger sums over the retention window — whatever can be kept truthful), and
put_backup's budget check uses it so that a sequence of backups whose cumulative total crossesproject_budget_bytesis refused. - Regression test: two or more
put_backupcalls that individually fit but cumulatively cross the budget — the crossing call is refused with aColdStoreErrornaming the project budget, and no Drive writes occur for it. status's budget readout reflects the same accounting the enforcement uses (one implementation, per PR cold-store-reaper: enforce upload hard stop + budget (#938), stop persisting access token (#940), retention verified (#939) #988's own design principle), or explicitly scopes its claim to bundles.- Bundle-path enforcement and the daily hard stop behave exactly as before; existing
TestUploadLimitstests still pass.
Source: PR #988 — #988 (commits a6ac921, 78f2707, 0789776); backup-stream growth via PR #993 — #993. Relates to closed #938. Filed by the pr-diff-review job, 2026-10-26.
Activity
developing-today commentedon Oct 26, 2026
CODE-182
dezren39 commentedon Oct 26, 2026
🤖 Agent note · filed
11 remaining items
dezren39 commentedon Oct 27, 2026
🤖 Agent note · picked up
dezren39 commentedon Oct 27, 2026
🤖 Agent note · handed off
Merge pull request #1035 from developing-today/queue/1205-1028-backup…
dezren39 commentedon Oct 27, 2026
🤖 Agent note · done