carlos / platform Public

docs: member backups spec rev 6.1 and its reviews onto the branch

From origin/design-member-backups (3b69c3c9): the governing spec at rev
6.1 (the §2 layout and §2b this slice builds to) and the 2b review
briefs and findings. This branch's own census brief and findings stay.
Docs only (#898).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev 56d01f2467a20c38b0a681ceb3df9c9370112fa7 parent d28afa8
5 files changed, +206 −3
  • docs/superpowers/notes/reviews/member-backups/CODEX-FINDINGS-member-backups-2b-R2.md +14 −0
  • docs/superpowers/notes/reviews/member-backups/CODEX-FINDINGS-member-backups-2b.md +29 −0
  • docs/superpowers/notes/reviews/member-backups/CODEX-REVIEW-BRIEF-member-backups-2b-R2.md +29 −0
  • docs/superpowers/notes/reviews/member-backups/CODEX-REVIEW-BRIEF-member-backups-2b.md +24 −0
  • docs/superpowers/specs/2026-11-11-member-backups-design.md +110 −3

CI cancelled — superseded by a newer push — 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/notes/reviews/member-backups/CODEX-FINDINGS-member-backups-2b.md b/docs/superpowers/notes/reviews/member-backups/CODEX-FINDINGS-member-backups-2b.md
new file mode 100644
index 000000000..76951d5c8
--- /dev/null
+++ b/docs/superpowers/notes/reviews/member-backups/CODEX-FINDINGS-member-backups-2b.md
@@ -0,0 +1,29 @@
+1. **P1 — §2b Fetch / cross-region: the console lacks permission to sign the promised download.**
+ **Invariant: regional data authority.** The host role can read its own region’s data bucket; sibling-region grants cover writes to `moves/*`, not reads ([main.tf:172](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/member-backups/infra/modules/region-host/main.tf:172), [group_iam.tf:42](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/member-backups/infra/modules/region-host/group_iam.tf:42)). Existing forwarding returns sealed results through the deployment bucket; it does not delegate regional storage credentials ([apidbforward.go:617](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/member-backups/internal/console/apidbforward.go:617)). A usable presigned GET requires the signer’s permission to read that object: [https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-presigned-url.html](https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-presigned-url.html).
+ **Fix:** refuse cross-region browser downloads in slice 1b and retain the working CLI command. Supporting them requires an explicitly authorized regional signing protocol; do not silently broaden the console’s bucket access.
+
+2. **P1 — §2b Start / Fetch: the job-to-account authorization contract is missing.**
+ **Invariant: a member receives only their account’s database.** “Signed-in member” does not specify how a random job ID is bound to the authorized account, app, host and incarnation. Existing reads resolve membership and app ownership before reading the instance ([apicli.go:39](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/member-backups/internal/console/apicli.go:39), [apidb.go:203](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/member-backups/internal/console/apidb.go:203)); the worker checks the signed identity again ([agent.go:209](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/member-backups/internal/dbreads/agent.go:209)). That bracket ends during preparation, potentially hours before URL issuance.
+ **Fix:** persist the immutable account/app/host/incarnation/region binding with the job. Authorize status and URL issuance against that binding and current membership; refuse stale identity, deleted/recreated instances and mismatched route parameters. Derive the bucket/key server-side, never from browser input or an unrestricted result field. Preserve indistinguishable unauthorized/not-found responses. Require session and CSRF checks for start and URL-issuance POSTs; service credentials remain refused.
+
+3. **P2 — §2b Build / Shares: the reusable worker does not produce a restored-file stream.**
+ **Invariant: tenant database processing stays inside the sandbox.** The worker accepts only query and pull operations. Pull sends checked LTX files without restoring; query restores and emits SQL results ([worker.go:136](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/member-backups/internal/dbreads/worker.go:136), [worker.go:172](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/member-backups/internal/dbreads/worker.go:172), [worker.go:203](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/member-backups/internal/dbreads/worker.go:203)). Its network is disabled and its scratch is private ([carlos-dbread@.service:23](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/member-backups/internal/host/units/carlos-dbread@.service:23)).
+ **Fix:** specify a new operation and advertised capability. Reuse `RestoreLocal` and its integrity check, then release bounded database/archive bytes over the existing socket only after check B. A trusted agent uploads those bytes to its configured regional bucket. Keep credentials, networking and database decoding out of the opposite side of that boundary. Refuse old workers, disabled `dbreads` and host-claim configurations—the latter already cannot arm this runner ([dbreads.go:46](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/member-backups/internal/host/dbreads.go:46)).
+
+4. **P2 — §2b Hold / States: neither the expiry rule nor the 24-hour deletion guarantee exists.**
+ **Invariant: bounded retention of downloadable database copies.** Both regional bucket definitions enable versioning and expire noncurrent versions; current objects do not expire ([deployment-buckets/main.tf:90](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/member-backups/infra/modules/deployment-buckets/main.tf:90), [region-remote-host/main.tf:32](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/member-backups/infra/modules/region-remote-host/main.tf:32)). The existing one-day `db-reads/` rule is in the deployment bucket, not the data bucket. AWS expiration is asynchronous; versioned cleanup also requires noncurrent-version handling: [https://docs.aws.amazon.com/AmazonS3/latest/userguide/troubleshoot-lifecycle.html](https://docs.aws.amazon.com/AmazonS3/latest/userguide/troubleshoot-lifecycle.html). MinIO likewise requires explicit lifecycle configuration: [https://docs.min.io/aistor/reference/cli/mc-ilm-rule/mc-ilm-rule-add/](https://docs.min.io/aistor/reference/cli/mc-ilm-rule/mc-ilm-rule-add/).
+ **Fix:** define a logical `expires_at`, stop issuing URLs then, and cap each URL at the remaining lifetime. Describe physical deletion as asynchronous. Add prefix-scoped current-version, noncurrent-version, delete-marker and incomplete-upload cleanup to both AWS modules and the MinIO setup contract. Refuse enabling downloads without verified cleanup configuration.
+
+5. **P2 — §2b Start / States: request-scoped forwarding is not a durable background job.**
+ **Invariant: one bounded job survives browser disconnects and reaches a terminal state.** Current admission slots are released when the HTTP handler returns ([apidbforward.go:194](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/member-backups/internal/console/apidbforward.go:194)); disconnects cancel work ([apidbforward.go:617](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/member-backups/internal/console/apidbforward.go:617)). Worker election is keyed by request ID, so it does not prevent two different requests for the same instance ([agent.go:236](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/member-backups/internal/dbreads/agent.go:236)).
+ **Fix:** name the durable job store, atomic per-instance admission key, owner deadline and terminal-state rules. Make duplicate starts return the existing job. For slice 1b, prefer no automatic takeover: an unpicked or interrupted job expires into failure and requires a fresh attempt. Publish `ready` only after confirmed upload completion; reject late completion from an obsolete attempt. Specify state retention and failed-upload cleanup independently of archive expiry.
+
+6. **P2 — §2b Build / Refusals: existing caps do not bound archive generation or repeated-job cost.**
+ **Invariant: downloads cannot exhaust shared disk, workers or storage-request budgets.** Current reservations cover LTX input plus restored bytes, or LTX alone for pulls ([read.go:186](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/member-backups/internal/dbreads/read.go:186)). They reserve no additional archive file. Limits distinguish restored size, pull bytes and output bytes ([limits.go:46](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/member-backups/internal/dbreads/limits.go:46)). Planning accumulates listings without a file-count bound ([plan_from.go:30](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/member-backups/internal/dbdoor/plan_from.go:30)). One concurrent job per instance still permits repeated restores and jobs across many instances.
+ **Fix:** specify input, restored and archive byte caps; reserve every simultaneous scratch file or stream the archive. Bound planning files/pages, total job time, retries, account concurrency and start frequency. Share worker admission with CLI reads and exports. Poll known job keys at a bounded rate and stop at terminal state; do not list the downloads prefix for browser status.
+
+7. **P2 — §2b Fetch / §2 layout: the delivery contract assumes too much about presigned URLs.**
+ **Invariant: the download capability stays narrowly scoped and usable.** Existing database downloads deliberately avoid presigned URLs ([apidb.go:333](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/member-backups/internal/console/apidb.go:333)). The configured S3 endpoint is a process-wide storage endpoint, with no browser-reachability or HTTPS gate ([s3compat.go:37](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/member-backups/internal/s3compat/s3compat.go:37), [s3compat.go:66](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/member-backups/internal/s3compat/s3compat.go:66)). Presigned URLs are reusable bearer capabilities and can expire before 15 minutes when their signing credentials expire; membership revocation does not itself revoke an issued URL.
+ **Fix:** require a tested browser-reachable HTTPS endpoint and refuse unsupported configurations before starting work. Sign only the job’s exact GET, with attachment disposition; return the link through a non-cacheable response. Exclude signed URLs from logs, audit details, persistent status, analytics and email, and specify referrer protection. Document the bounded bearer-access window and audit URL issuance rather than claiming a completed download. Show an unavailable reason and the CLI command instead of an enabled primary download action when these requirements fail.
+
+NOT READY
\ No newline at end of file
diff --git a/docs/superpowers/notes/reviews/member-backups/CODEX-REVIEW-BRIEF-member-backups-2b-R2.md b/docs/superpowers/notes/reviews/member-backups/CODEX-REVIEW-BRIEF-member-backups-2b-R2.md
new file mode 100644
index 000000000..672e4d284
--- /dev/null
+++ b/docs/superpowers/notes/reviews/member-backups/CODEX-REVIEW-BRIEF-member-backups-2b-R2.md
@@ -0,0 +1,29 @@
+# Review brief, round 2: §2b, Download a copy (spec rev 6)
+
+Spec: `docs/superpowers/specs/2026-11-11-member-backups-design.md` rev 6,
+section §2b only (and the §2 layout bullet it relies on). The rest of the
+spec passed three rounds; don't re-review it.
+
+Check §2b against the code, verifying every citation you rely on:
+1. Security: who can start a job and fetch the zip; presigned URL scope,
+ lifetime and leakage (logs, referrers, email); cross-account or
+ cross-app access; the zip's place in the region bucket and its IAM;
+ CSRF; the console never holding a restored database.
+2. Correctness of reuse: can the `dbreads` restore path (identity
+ bracket, sandboxed worker, caps) produce a file into the bucket
+ instead of streaming to a CLI? What has to change? Cross-region jobs.
+3. Lifecycle: job state storage, one job per instance, failures,
+ expiry, the 24-hour delete (lifecycle on a prefix: is it there or
+ must it be added, on AWS and on MinIO?).
+4. Provider neutrality and request cost.
+5. Anything to refuse up front instead of handling.
+
+Output: numbered findings (P1 blocks, P2 must fix before plan, P3 worth
+fixing) with section, code evidence file:line, concrete fix; then one
+line: READY, READY AFTER FIXES, or NOT READY. One round only. Prefer
+cuts and refusals. Do not spawn other models or reviewers.
+
+Round 2: first a disposition table for round 1's findings 1-7
+(`CODEX-FINDINGS-member-backups-2b.md`): FIXED, PARTLY (what's missing)
+or NOT FIXED. Then only new findings in rev 6's §2b. Round 2 of at most
+three.
diff --git a/docs/superpowers/notes/reviews/member-backups/CODEX-REVIEW-BRIEF-member-backups-2b.md b/docs/superpowers/notes/reviews/member-backups/CODEX-REVIEW-BRIEF-member-backups-2b.md
new file mode 100644
index 000000000..ed5498a3f
--- /dev/null
+++ b/docs/superpowers/notes/reviews/member-backups/CODEX-REVIEW-BRIEF-member-backups-2b.md
@@ -0,0 +1,24 @@
+# Review brief: §2b, Download a copy (spec rev 5)
+
+Spec: `docs/superpowers/specs/2026-11-11-member-backups-design.md` rev 5,
+section §2b only (and the §2 layout bullet it relies on). The rest of the
+spec passed three rounds; don't re-review it.
+
+Check §2b against the code, verifying every citation you rely on:
+1. Security: who can start a job and fetch the zip; presigned URL scope,
+ lifetime and leakage (logs, referrers, email); cross-account or
+ cross-app access; the zip's place in the region bucket and its IAM;
+ CSRF; the console never holding a restored database.
+2. Correctness of reuse: can the `dbreads` restore path (identity
+ bracket, sandboxed worker, caps) produce a file into the bucket
+ instead of streaming to a CLI? What has to change? Cross-region jobs.
+3. Lifecycle: job state storage, one job per instance, failures,
+ expiry, the 24-hour delete (lifecycle on a prefix: is it there or
+ must it be added, on AWS and on MinIO?).
+4. Provider neutrality and request cost.
+5. Anything to refuse up front instead of handling.
+
+Output: numbered findings (P1 blocks, P2 must fix before plan, P3 worth
+fixing) with section, code evidence file:line, concrete fix; then one
+line: READY, READY AFTER FIXES, or NOT READY. One round only. Prefer
+cuts and refusals. Do not spawn other models or reviewers.
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 b66bf714c..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 4.1, 2026-11-11 (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
@@ -94,8 +94,8 @@ later loses data.
## Non-goals
- Restoring a live instance in place (#894).
-- A browser download of a restored database. The console never holds one
- (`apidb.go:1-5`). The panel shows the CLI command instead.
+- (Rev 5: a browser download is now in scope, §2b, without the console
+ ever holding a restored database.)
- The operator-side durability work itself (inventories, offsite copier,
restore-box). This design builds only the drill-verdict piece (§3),
because the panel needs it first.
@@ -208,6 +208,108 @@ restore point) is covered. `db query` and `db pull` gates are unchanged.
- **Get a copy:** the tab shows `carlos db pull --app shop --instance
<host>` ready to copy, plus an `--at` example inside the history.
- One line per field, each with its time. Draft copy in §8.
+- **Layout (rev 5, Paul's UX pass, 2026-11-11):** a section head
+ "Backups" with **Download a copy** as its one primary action (slice 1b);
+ three stat tiles (last change saved, go back as far as, restore test);
+ a two-row "What we keep" table (Database, Files on disk) with a chip
+ each (Copied, Not copied, Not shown here); one short line under the
+ table only when a row needs a reason; the CLI commands inside a "Use
+ the command line" disclosure. Every instance shows the same shape, so
+ a gap is visible at a glance. Mockup:
+ `mb-copy/copy-review/preview/index.html` on branch member-backups-1
+ (untracked review folder); approved copy replaces §8's drafts.
+
+### 2b. Download a copy (slice 1b; Paul, 2026-11-11)
+
+Paul: "Is there a case for offering a download via the web console? This
+would be via a background job that would have a 'preparing' state and I
+guess sent a zip file?" Yes: the CLI command only helps people with a
+terminal, and holding the file is the strongest proof the copy exists.
+Rev 6 applies Astra's §2b round 1 (`CODEX-FINDINGS-member-backups-2b.md`,
+NOT READY, 2 P1 + 5 P2, all accepted, marked **(D-N)**).
+
+**Refused up front in 1b:** instances in another region (the console can
+sign only for its own region's bucket, D-1; the CLI command stays);
+fleet-placed and pooled instances (as `db pull`); classes with no copy;
+deployments with host claims on, `dbreads` disabled, or workers older
+than the new operation (D-3); and any deployment whose download
+requirements below aren't verified (D-4, D-7). In each case the section
+shows the reason and the CLI command, never an enabled Download button.
+
+- **The job is a durable record (D-2, D-5).** The console stores it in
+ `console.db`: job id (random), account, app, host, region, the
+ instance's incarnation, who started it, state, `expires_at`, the
+ object key (derived server-side from the job id, never from browser
+ input), size, and a failure reason. One open job per instance, by an
+ atomic unique key; a second start returns the existing job. States:
+ `queued`, `preparing`, `ready`, `failed`, `expired`. A job not picked
+ up, or whose owner misses its deadline (20 minutes), fails; there is no
+ automatic takeover, and a fresh press starts a new job. `ready` is
+ written only after the upload is confirmed; a late completion from an
+ obsolete attempt is refused. Records are kept 7 days, then deleted.
+- **Who (D-2).** Start (POST), status (GET) and link issuance (POST) are
+ person-only, session plus CSRF, admitted for current members of the
+ job's account; service credentials are refused. Every request checks
+ 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.
+- **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
+ (§1); 20 minutes per job; no retries; at most 2 open jobs per account
+ and 10 starts per instance per day; worker slots shared with CLI reads
+ and the nightly export. Over a cap: `failed` with the reason, and the
+ CLI pointer.
+- **Expiry (D-4).** `expires_at` is 24 hours after `ready`; after it the
+ console issues no link and the job shows `expired`. Physical deletion is
+ asynchronous: a lifecycle rule on `downloads/` (current versions after 1
+ day, noncurrent versions and delete markers after 1 day, incomplete
+ multipart uploads after 1 day) is added to both AWS data-bucket modules
+ and to the MinIO setup contract. Downloads stay off until the
+ deployment reports the rule verified.
+- **Fetch (D-7).** Pressing the ready button POSTs for a link. The
+ console presigns only that job's exact GET, with
+ `response-content-disposition=attachment`, valid for the lesser of 15
+ minutes and the time left before `expires_at`, and returns it in a
+ `Cache-Control: no-store` response that the page follows with
+ `Referrer-Policy: no-referrer`. Signed URLs never appear in logs, audit
+ details, stored job state, analytics or email. The audit records the
+ issuance (`db-download-link`), not a completed download. A link is a
+ bearer capability for its lifetime and isn't revoked by a membership
+ change; the docs say so. Downloads need the storage endpoint to be
+ HTTPS and reachable by browsers, checked when the feature is enabled;
+ otherwise the section shows the CLI command.
+- **States on the page:** none (Download a copy), preparing (button
+ disabled; "usually a minute or two"; the page polls the job's status
+ at a bounded rate and stops at a terminal state), ready (Download
+ <file> (<size>), until `expires_at`), failed (the reason, button back),
+ expired (button back).
+- **Shares with 3b.** The nightly export uses the same `export` worker
+ operation, with the owner's bucket as the destination.
+- **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)
@@ -425,6 +527,7 @@ Not in this design's slices.
| Slice | What | Needs | Size |
|---|---|---|---|
| 1 | §1 door (with #893), §2 tab and CLI, the "get a copy" command; the test line reads "not shown yet" | nothing | small |
+| 1b | §2b download job (durable job, export worker operation, 24-hour hold with lifecycle rule, presigned fetch, own region only) | slice 1, §2b review rounds | medium-large |
| 2a | §3 per-box records, the identity bracket, arming, the coverage target, operator alerts. Fixes today's fault where boxes erase each other's verdicts (F-4) | nothing | small-medium |
| 2b | §3 `copy_since` and the console reader, the test line, §4 operator view | 2a | medium |
| 3a | a narrow pull credential (§5a; D7) | nothing | small |
@@ -521,6 +624,10 @@ nothing in this design.
- **D7.** Yes: the narrow pull credential (§5a) ships as slice 3a, before
the managed export. It is new authority over database contents, so its
plan gets Fable as a second reviewer beside Astra.
+- **D8.** A console download of a copy, as a background job with a
+ preparing state and a zip (§2b, slice 1b). Paul asked for it, 2026-11-11.
+- **D9.** Every UI change gets a UX pass before copy review (AGENTS.md,
+ Paul 2026-11-11); §2's layout is the result for this section.
## 12. Test plan (for the builder)