carlos / platform Public

member backups: spec rev 6.1, §2b dispatch via the dbreads queue (#898)

Applies §2b Astra round 2 (READY AFTER FIXES): dispatch and completion
ride the existing db-reads request queue and result object, reconciled
by the console; RestoreLocal's own integrity check is the only one.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev 3b69c3c954c1b9671af7ecbd212b0e110ffe1ea3 parent 67605d7
2 files changed, +39 −10
  • docs/superpowers/notes/reviews/member-backups/CODEX-FINDINGS-member-backups-2b-R2.md +14 −0
  • docs/superpowers/specs/2026-11-11-member-backups-design.md +25 −10

CI failed — run details

diff --git a/docs/superpowers/notes/reviews/member-backups/CODEX-FINDINGS-member-backups-2b-R2.md b/docs/superpowers/notes/reviews/member-backups/CODEX-FINDINGS-member-backups-2b-R2.md
new file mode 100644
index 000000000..ff282e123
--- /dev/null
+++ b/docs/superpowers/notes/reviews/member-backups/CODEX-FINDINGS-member-backups-2b-R2.md
@@ -0,0 +1,14 @@
+| Round 1 | Disposition | Evidence and remaining work |
+|---|---|---|
+| 1 — Regional signing authority | **FIXED** | §2b refuses cross-region downloads. This matches the own-region object permissions in [main.tf:187](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/member-backups/infra/modules/region-host/main.tf:187); sibling permissions remain write-only under `moves/*` ([group_iam.tf:42](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/member-backups/infra/modules/region-host/group_iam.tf:42)). |
+| 2 — Job authorization | **FIXED** | §2b now requires immutable account/app/host/region/incarnation binding, current membership and identity checks on every request, server-derived keys, CSRF, and indistinguishable refusals. These preserve the authorization and identity boundaries in [apicli.go:39](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/member-backups/internal/console/apicli.go:39) and [agent.go:209](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/member-backups/internal/dbreads/agent.go:209). |
+| 3 — Worker reuse | **FIXED** | §2b explicitly adds an advertised `export` operation, keeps database processing inside the worker, and assigns upload to the agent. Existing workers accept only query/pull ([worker.go:136](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/member-backups/internal/dbreads/worker.go:136)); the network isolation remains appropriate ([carlos-dbread@.service:23](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/member-backups/internal/host/units/carlos-dbread@.service:23)). Unsupported workers, disabled reads and host claims are refused. |
+| 4 — Retention | **FIXED** | §2b separates logical expiry from asynchronous deletion and requires verified cleanup before enabling downloads. Both existing data-bucket configurations lack current-object expiry, so the specified additions are necessary: [deployment-buckets/main.tf:103](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/member-backups/infra/modules/deployment-buckets/main.tf:103), [region-remote-host/main.tf:45](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/member-backups/infra/modules/region-remote-host/main.tf:45). |
+| 5 — Durable job lifecycle | **PARTLY — P2 remains.** **Invariant: one admitted job reaches a terminal state independently of browser requests.** | The store, admission key, deadline and terminal rules are specified. **Dispatch and completion are still missing.** §2b’s Build paragraph claims an existing change-index scope, but `console.db` is local SQLite ([store.go:117](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/member-backups/internal/console/store.go:117)); `ChangeScope` has no download-job or `db-reads` arm ([changeindex.go:55](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/member-backups/internal/release/changeindex.go:55)). Existing agents discover requests by listing a regional bucket queue ([agent.go:360](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/member-backups/internal/dbreads/agent.go:360)). Polling “known job keys” cannot discover a new random ID. **Fix before plan:** specify one durable dispatch/completion protocol: persisted dispatch intent, authenticated request publication and discovery, single-owner election, and result reconciliation into `console.db` after restart. Preserve no takeover and late-result refusal. Check this invariant with crash, disconnect and missed-notification witnesses. This continues finding 5, rather than opening a new fault family. |
+| 6 — Resource and request bounds | **FIXED** | §2b adds input/restored/archive caps, streamed archives, planning limits, deadlines, no retries, account concurrency and daily start limits. Sharing the existing admission machinery preserves scratch reservations and orphan-worker refusal ([admission.go:36](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/member-backups/internal/dbreads/admission.go:36), [read.go:196](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/member-backups/internal/dbreads/read.go:196)). |
+| 7 — Download capability | **FIXED** | §2b requires a browser-reachable HTTPS endpoint, exact-object GET signing, attachment disposition, non-cacheable issuance, referrer protection, URL redaction and the membership-revocation caveat. These are explicit additions to the process-wide endpoint configuration ([s3compat.go:66](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/member-backups/internal/s3compat/s3compat.go:66)). The stated URL duration remains an upper bound: signing credentials can expire sooner. [https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-presigned-url.html](https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-presigned-url.html) |
+
+8. **P3 — §2b Build unnecessarily requires a second integrity check.**
+ **Invariant: one bounded restore and validation before releasing database bytes.** `RestoreLocal` already runs the database integrity check ([plan_from.go:146](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/member-backups/internal/dbdoor/plan_from.go:146), specifically line 157). Requiring another `integrity_check` after check B adds another database scan within the 20-minute budget. Existing sequencing restores and checks first, then performs check B before releasing output ([read.go:249](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/member-backups/internal/dbreads/read.go:249)). **Fix:** specify `RestoreLocal` → check B → stream the validated file; retain the existing check inside `RestoreLocal`.
+
+READY AFTER FIXES
\ No newline at end of file
diff --git a/docs/superpowers/specs/2026-11-11-member-backups-design.md b/docs/superpowers/specs/2026-11-11-member-backups-design.md
index 5e17e2cc0..b285b88db 100644
--- a/docs/superpowers/specs/2026-11-11-member-backups-design.md
+++ b/docs/superpowers/specs/2026-11-11-member-backups-design.md
@@ -1,6 +1,6 @@
# Backups owners can see and check
-Status: rev 6, 2026-11-11 (§2b rewritten after its Astra round 1, NOT READY, all 7 findings accepted; round 2 owed). Rev 5: D8 download job §2b, D9 UX pass and §2 layout. Rev 4.1: D7 recorded. Astra round 3 READY AFTER FIXES; its one fix (§9's backstop GETs) applied in rev 3.1. Fable 5.2's guidance (PROCEED WITH CHANGES, `FABLE-GUIDANCE-member-backups.md`) applied in rev 4, marked **(F-N)** (§17). Rev 4 changes product text and slicing, not the reviewed mechanisms. Paul's rulings D1-D5 (§11). Astra round 1
+Status: rev 6.1, 2026-11-11 (§2b: Astra round 2 READY AFTER FIXES, its dispatch/completion fix and P3 applied; no round 3). Rev 6: §2b rewritten after its Astra round 1 (NOT READY, all 7 accepted). Rev 5: D8 download job §2b, D9 UX pass and §2 layout. Rev 4.1: D7 recorded. Astra round 3 READY AFTER FIXES; its one fix (§9's backstop GETs) applied in rev 3.1. Fable 5.2's guidance (PROCEED WITH CHANGES, `FABLE-GUIDANCE-member-backups.md`) applied in rev 4, marked **(F-N)** (§17). Rev 4 changes product text and slicing, not the reviewed mechanisms. Paul's rulings D1-D5 (§11). Astra round 1
(`docs/superpowers/notes/reviews/member-backups/CODEX-FINDINGS-member-backups.md`)
was NOT READY with 3 P1s and 11 P2s; all 14 accepted (§14). Round 2
(`CODEX-FINDINGS-member-backups-R2.md`) was NOT READY with one new P1, two
@@ -253,14 +253,29 @@ shows the reason and the CLI command, never an enabled Download button.
the route's account/app/host against the job's binding and the
instance's current identity (a deleted or recreated instance makes the
job unusable). Unauthorised and not-found answer the same.
-- **Build (D-3).** A box in the region picks the job up through its
- existing change-index scope, with a bounded poll of known job keys only.
- The `dbreads` worker gets a new operation, `export`, advertised as a
- capability: it restores with `RestoreLocal`, runs `integrity_check`
- after check B, and streams the database plus `manifest.json` (TXID,
- header time, SHA-256, platform version, `"files": "not_included"`)
- over its existing socket. The worker keeps no network and no
- credentials; the trusted agent zips the stream and uploads it to
+- **Dispatch and completion (D-5, round 2).** The job rides the existing
+ `dbreads` protocol rather than a new channel. Starting a job writes the
+ `console.db` record first (the dispatch intent), then publishes a signed
+ request, `db-reads/<id>/request.json`, with a queue entry under
+ `db-reads/queue/<region>/<hour>/` (`internal/dbreads/ids.go:78`,
+ `envelope.go:17`), carrying the job's binding and an attempt id. Boxes
+ find it by the queue listing they already do (`agent.go:360`); the
+ existing per-request election makes one box the owner. The owner writes
+ `db-reads/<id>/result.json` (`result.go:41`) when the upload is confirmed
+ or the job fails. The console reconciles: on every status request for an
+ open job, and in a startup sweep of open jobs, it reads that job's
+ result object (a known key, no listing) and moves the record to `ready`
+ or `failed`; a result whose attempt id isn't the record's is refused.
+ No takeover: a job with no result by its deadline fails. Witnesses: the
+ console restarting mid-job, the browser disconnecting, a missed
+ notification, and an owner box dying each end in a terminal state.
+- **Build (D-3).** The owner's `dbreads` worker gets a new operation,
+ `export`, advertised as a capability: it runs `RestoreLocal` (which
+ already runs the integrity check, `dbdoor/plan_from.go:146`), then check
+ B, then streams the validated database plus `manifest.json` (TXID,
+ header time, SHA-256, platform version, `"files": "not_included"`) over
+ its existing socket. The worker keeps no network and no credentials; the
+ trusted agent zips the stream and uploads it to
`downloads/<job-id>.zip` in its own region's data bucket.
- **Caps (D-6).** Input, restored and archive bytes each capped (the
archive is streamed, so no third scratch file); the planner's file cap
@@ -294,7 +309,7 @@ shows the reason and the CLI command, never an enabled Download button.
expired (button back).
- **Shares with 3b.** The nightly export uses the same `export` worker
operation, with the owner's bucket as the destination.
-- **Review.** Rev 6 needs Astra's §2b round 2 before its plan.
+- **Review.** Round 2 (`CODEX-FINDINGS-member-backups-2b-R2.md`) READY AFTER FIXES; its two fixes are applied in rev 6.1. Ready for a plan.
### 3. Restore tests published per box (durability §5.2's tenant half)