member backups: 2b plan rev 3 after Astra round 2 (#898)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
docs/superpowers/notes/reviews/member-backups/CODEX-FINDINGS-plan-2b-R2.md+26 −0docs/superpowers/plans/2026-11-12-member-backups-slice2b.md+30 −17
Intent
<task-notification> <task-id>bf3jnb0oo</task-id> <tool-use-id>toolu_01E6nmMYVd14RUVarTJCn8hG</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/ab362fc0-f177-4a7f-a92e-4a29ea210aad/tasks/bf3jnb0oo.output</output-file> <status>completed</status> <summary>Background command "Astra 2b plan review round 2" completed (exit code 0)</summary> </task-notification>
<task-notification> <task-id>a498d950348c587ef</task-id> <tool-use-id>toolu_011c2uE23ZnDePZihMDxfwBe</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/ab362fc0-f177-4a7f-a92e-4a29ea210aad/tasks/a498d950348c587ef.output</output-file> <status>completed</status> <summary>Agent "Write slice 2b plan (test line + operator view)" finished</summary> <note>A task-notification fires each time this agent stops with no live background children of its own. The user can send it another message and resume it, so the same task-id may notify more than once.</note> <result>Rev 3 still has 9 tasks. I declined nothing; `operators_alerted` stays, earned only by confirmed email connectors with a sender configured.</result> <usage><subagent_tokens>304986</subagent_tokens><tool_uses>4</tool_uses><duration_ms>66645</duration_ms></usage> </task-notification>
diff --git a/docs/superpowers/notes/reviews/member-backups/CODEX-FINDINGS-plan-2b-R2.md b/docs/superpowers/notes/reviews/member-backups/CODEX-FINDINGS-plan-2b-R2.md| new file mode 100644 |
| index 000000000..874649049 |
| --- /dev/null |
| +++ b/docs/superpowers/notes/reviews/member-backups/CODEX-FINDINGS-plan-2b-R2.md |
| @@ -0,0 +1,26 @@ |
| +- **R1-1 — resolved:** Task 7 now expects 401 anonymous, 403 service credential, 404 non-operator and 200 operator, matching `cliGateRefused`. |
| +- **R1-2 — resolved:** Task 2 adds independent retry scheduling, absent-generation tracking and counting tests. |
| +- **R1-3 — resolved:** Task 6 retains seven days of status objects and tests a 37-hour-dark box. |
| +- **R1-4 — resolved:** The unsupported “not reached last run” count is cut. |
| +- **R1-5 — partly (P2):** [Plan:146](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/member-backups/docs/superpowers/plans/2026-11-12-member-backups-slice2b.md:146) checks that a seal exists, but delivery also requires successful decryption ([alertnotify.go:708](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/member-backups/internal/console/alertnotify.go:708)); a wrong-key target can still earn the assurance. Second consecutive round in **truthful alert-delivery assurance**: recommend cutting the assurance for sealed connectors until one shared, read-only eligibility check has a wrong-key guard test. |
| +- **R1-6 — resolved:** Task 3 now inventories literals, whole-record assignments and record-writing entry points, with detection fixtures. |
| +- **R1-7 — resolved:** Reviews are scoped by risk and carry the stopping rules. |
| + |
| +1. **P1 — The acceptance rule rejects every home-region verdict.** |
| + [Plan:117](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/member-backups/docs/superpowers/plans/2026-11-12-member-backups-slice2b.md:117) rejects an identity with any empty field; the global acceptance rule repeats this. However, the home region is deliberately represented by `Region == ""` in both console configuration and instance records ([server.go:675](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/member-backups/internal/console/server.go:675)). The drill preserves that value in its identity ([drillidentity.go:68](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/member-backups/internal/ops/drillidentity.go:68)). Consequently, home-region owners never receive `last_test`, and operators count those instances as never tested. |
| + **Fix:** permit an empty region while requiring exact region equality; keep the other four identity fields nonempty. Add home-region witnesses through identity capture, acceptance, the real backups door and fleet counts. |
| + **Fault family:** identity vocabulary compatibility. |
| + |
| +2. **P2 — Task 6 omits the retained candidates used by owner views.** |
| + [Plan:180](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/member-backups/docs/superpowers/plans/2026-11-12-member-backups-slice2b.md:180) supplies `Boxes` and `Loaded` to fleet aggregation. Only `For(host)` includes the retained `seen` verdict ([plan:88](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/member-backups/docs/superpowers/plans/2026-11-12-member-backups-slice2b.md:88)). After box A drops a reassigned host and before B tests it, the owner can see A’s retained pass while the operator counts “never tested.” Sharing `pickTest` does not fix different candidate sets. |
| + **Fix:** use `acceptedTest`, or `For(host)` plus `pickTest`, for fleet counts; reserve `Boxes` for box diagnostics. Extend the reassignment test to compare owner evidence and fleet counts after rebuilding the memo. |
| + **Fault family:** consistent evidence across surfaces. |
| + |
| +3. **P2 — Reader initialization is published without synchronization.** |
| + [Plan:89](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/member-backups/docs/superpowers/plans/2026-11-12-member-backups-slice2b.md:89) assigns `s.verify` inside `RunVerifyReader`, launched as a goroutine in Step 3. Meanwhile, `acceptedTest` reads that pointer directly ([plan:121](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/member-backups/docs/superpowers/plans/2026-11-12-member-backups-slice2b.md:121)). The reader’s internal mutex does not synchronize publication of the pointer itself. |
| + **Fix:** initialize and assign the reader synchronously before starting workers or serving requests; let the goroutine update only its synchronized state. |
| + **Fault family:** safe publication of shared state. |
| + |
| +Static review only; no files changed or tests run. `GOCACHE` remains unset. Round 2 has one new P1, two new P2s and one unresolved P2. |
| + |
| +**NOT READY** |
| \ No newline at end of file |
diff --git a/docs/superpowers/plans/2026-11-12-member-backups-slice2b.md b/docs/superpowers/plans/2026-11-12-member-backups-slice2b.md| index d83b8a635..be6a75269 100644 |
| --- a/docs/superpowers/plans/2026-11-12-member-backups-slice2b.md |
| +++ b/docs/superpowers/plans/2026-11-12-member-backups-slice2b.md |
| @@ -4,7 +4,7 @@ |
| **Goal:** The console reads every box's `control/verify/<ref>.json`, shows an instance's last accepted restore test in the Backups section's third tile, in the door's `last_test` and in `carlos instances backups`, and gives operators `/fleet/backups` (and its JSON) with the fleet's restore-test evidence per region. |
| -**Plan rev 2** (2026-11-12): Astra plan round 1 (`docs/superpowers/notes/reviews/member-backups/CODEX-FINDINGS-plan-2b.md`, NOT READY, 1 P1 + 6 P2) applied; findings marked **(R1-N)**, dispositions at the end. Under AGENTS.md "Stopping rules", round 2 is the next and stops at the first round with no P1; its P2s are fixed without reopening. Opus implements. Per-task review (rule 3, R1-7) only for Tasks 2 and 6 (caches over production storage), 4 (a cache beside a door) and 7 (a security gate); the rest is covered by the whole-branch review. Every review brief carries the round history and the stopping rules. |
| +**Plan rev 3** (2026-11-12): Astra plan round 2 (`CODEX-FINDINGS-plan-2b-R2.md`, NOT READY, 1 P1 + 2 P2 + R1-5 partly) applied, marked **(R2-N)**; R1-5's family hit two rounds, so the controller ruled a cut (B-4). Round 3 is the last under AGENTS.md "Stopping rules"; its P2s are fixed without reopening and a fourth round needs Paul. **Rev 2**: Astra plan round 1 (`docs/superpowers/notes/reviews/member-backups/CODEX-FINDINGS-plan-2b.md`, NOT READY, 1 P1 + 6 P2) applied; findings marked **(R1-N)**. Dispositions for both rounds at the end. Opus implements. Per-task review (rule 3, R1-7) only for Tasks 2 and 6 (caches over production storage), 4 (a cache beside a door) and 7 (a security gate); the rest is covered by the whole-branch review. Every review brief carries the round history and the stopping rules. |
| **Architecture:** One in-memory reader in the console (`verifyReader`) lists `control/verify/` at start, then re-reads a box's record only when its change-index scope `control/verify/<ref>` moves, through a `release.ReadGate` with a 6-hour maximum age, and relists every 6 hours. One acceptance rule decides whether a verdict may be shown for an instance: the verdict's identity equals the instance's current identity, its bracket opened after the instance's `copy_since`, and its box hasn't left the roster for 7 days. The door, the instance page, the CLI and the operator view all go through that rule. Nothing on boxes changes. |
| @@ -17,7 +17,7 @@ |
| - **B-1 `copy_since` is derived from the record, not stamped.** Spec §3 says the console stamps it at restore, move landing and region change. Move closes are written by box-side provision transitions (`MoveClose`, `MoveRolledBackClose`, `MoveRevertClose`, `MoveGuardedAbortComplete`, `OfflineFinish`), so a console-only stamp can't see them, and a stored field would change root-binary code. Every case is already in the record: a completed move changes `Region` (moves refuse the same region), which changes the identity; every move close, done, rolled back or aborted, writes `LastMove.At`; a restore (#658) or recreate is a new record with a new `CreatedAt`, so a new incarnation. So `copySince(rec) = rec.LastMove.At` (zero when nil), and an instance with `rec.Move != nil` shows no verdict. Verdicts exist only from 2a on, and every move since then writes `LastMove`, so no backfill is needed. The spec's "test that fails when a new path appears" is Task 3's inventory of record-field writes. |
| - **B-2 The JSON door is gated by `apiSystemRoller`** (ops-account owners and `CARLOS_SYSTEM_OPERATORS`), the gate of `GET /api/cli/system/status`. The spec names `apiSystemOperator`, which is the storage-scanning gate (`CARLOS_STORE_OPERATORS`) and refuses with a scanning message. |
| - **B-3 Owners see passed or failed only.** `last_test` is the newest *decided* verdict the acceptance rule admits, from any box record or from the reader's memory of earlier reads. An `unverified` verdict never appears to owners; it is operator evidence. |
| -- **B-4 `last_test` gains `operators_alerted`** (true only for `failed` when the deployment would deliver `verify_failed`), so the CLI prints the page's "We've been alerted" line from the door alone. |
| +- **B-4 `last_test` gains `operators_alerted`** (true only for `failed` when the deployment would deliver `verify_failed`), so the CLI prints the page's "We've been alerted" line from the door alone. **Email connectors only (R2-2, controller ruling):** the assurance counts only a delivery path the console can prove configured without decrypting anything, which is a confirmed email connector (its target is stored in plain) with a sender configured. Slack and webhook connectors are sealed and never earn it, whatever the seal key's state; no shared eligibility check is added. A deployment whose only operator connectors are sealed shows no "We've been alerted". |
| - **B-5 The roster** is `status/boxes/<ref>.json` (the same label as the verify ref, `metricsBoxLabel`), read by one `ListMod` per relist. A box's last-seen time is the later of that object's modified time and its record's `CheckedAt`; a record whose box was last seen over 7 days ago is dropped. Fleet boxes, whose status lives under `fleets/<name>/`, fall back to `CheckedAt` alone. |
| - **B-6 Seeding (2a note F2-7)** is the reader's in-memory `seen` map: per host, the newest decided verdict it has read and the box it came from. It covers a group host reassigned to another box between the old box dropping it and the new box drilling it. It is re-checked by the acceptance rule on every use and is lost on restart (the new box drills a never-verified host first, so the gap is one night at most). The box-side coverage clock restarting on reassignment is not fixable from the console and stays as 2a left it. |
| - **B-7 Not reached is not shown (R1-4).** 2a's record has no run identifier, no completion marker and no "not reached" count, and `Merge` keeps an unreached host's earlier verdict unchanged, so the console can't tell which hosts the last run skipped. The operator view shows that figure as not available (Task 0 decides how; the JSON has no field). An exact count needs the drill to publish it (a run id and a reached count in the record), a follow-up for the producer. |
| @@ -29,7 +29,7 @@ |
| - The console only reads. No box, unit, provision transition or bucket record changes. No new per-box poll, no loop that lists replicas. |
| - Request budget (spec §9): at start one LIST of `control/verify/` and one GET per record; then one conditional GET per moved scope; every relist (at most every 6 hours) one LIST of `control/verify/`, one `ListMod` of `status/boxes/` and up to N conditional GETs (N = known records). With no change index (`CARLOS_CHANGE_INDEX` unset) or a watch that cannot vouch, only the start read and the relists run: never a per-minute read. **Failures back off to the maximum age (R1-2):** a failed start LIST is next tried at the next relist time; a failed record read is next tried 6 hours later (or at the relist, whichever is first), whatever the gate says; there is no fast retry. A ref found absent (a deleted record whose index scope stays, `changeindex.go:33-37`) is remembered with the generation it was absent at and read again only when that generation moves; the relist's LIST is its only other check. |
| - `ReadGate` maximum age: exactly 6 hours. Relist period: 6 hours minus up to 10% jitter (never more than 6 hours). |
| -- Acceptance (one function, `acceptVerdict`, used by every surface): `Result` is `passed` or `failed`; `Identity` equals the instance's current identity on all five fields, none empty; `BracketOpenedAt` is non-zero and strictly after `copySince(rec)`; `rec.Move == nil`; for an instance in the console's own region, `Prefix == activator.HibernatePrefix(s.cfg.HibernatePrefix, host)`; the box was last seen within 7 days; `VerifiedAt` no more than 5 minutes ahead of now. Among accepted verdicts the newest `VerifiedAt` wins; on a tie, `failed` wins. |
| +- Acceptance (one function, `acceptVerdict`, used by every surface): `Result` is `passed` or `failed`; `Identity` equals the instance's current identity on all five fields exactly, with `Account`, `App`, `Host` and `Incarnation` non-empty and `Region` allowed to be empty, because the home region is `""` in the console's config, in records and in the drill's identity (`server.go:675-678`, `drillidentity.go:68`) (R2-1); `BracketOpenedAt` is non-zero and strictly after `copySince(rec)`; `rec.Move == nil`; for an instance in the console's own region, `Prefix == activator.HibernatePrefix(s.cfg.HibernatePrefix, host)`; the box was last seen within 7 days; `VerifiedAt` no more than 5 minutes ahead of now. Among accepted verdicts the newest `VerifiedAt` wins; on a tie, `failed` wins. |
| - A record is ignored (logged once per etag) when it is over 4 MiB, does not parse, has `V != 2`, or its `Box` is not the ref in its key. |
| - Only instances whose intrinsic class is replicated (`replicaIntrinsic`) get `last_test`; pooled and fleet-placed stay "not shown", as in slice 1. |
| - Never "backed up", "up to date" or "current" in any shown string; ages and dates only, in UTC as the page's other times are. No ticks, no em dashes, no left-border accents. |
| @@ -86,7 +86,7 @@ The exports row (3b); a box-side inert flag (B-8); a not-reached count, which ne |
| - `func (r *verifyReader) tick(ctx context.Context, now time.Time)`: if not loaded and `now >= nextStart`, `start` (failure: `nextStart = nextRelist`); if the watch is non-nil and `Usable()`, for every known ref and every `control/verify/<ref>` scope in `watch.Observed()` not yet known, `gate.Due(scope, now)` and, when due, one conditional read (`GetIfChanged` with the held ETag; plain `Get` when the store isn't a `ConditionalGetter`), then `gate.Mark(scope, gen, now, ok)`; when the relist is due, `relist`. |
| - `func (r *verifyReader) relist(ctx context.Context, now time.Time)`: LIST, drop refs no longer listed, conditional-read every listed ref (marking the gate), refresh the roster, prune `seen` entries whose `VerifiedAt` is over 30 days old, draw the next relist time. |
| - `func (r *verifyReader) Loaded() bool`, `func (r *verifyReader) For(host string) []boxVerdict` (every box's verdict for host plus the `seen` entry, B-6), `func (r *verifyReader) Boxes() []verifyBox` (a copy, for the operator view). |
| - - `func (s *Server) RunVerifyReader(ctx context.Context, watch *release.ChangeWatch)`: no-op when `s.cfg.Releases == nil` or `s.cfg.HostClaim`; else sets `s.verify`, then `tick` every `verifyTick` under `instanceStoreTimeout` until ctx ends. |
| + - `Server.verify` is an `atomic.Pointer[verifyReader]` (R2-3). `func (s *Server) StartVerifyReader(ctx context.Context, watch *release.ChangeWatch)`: no-op when `s.cfg.Releases == nil` or `s.cfg.HostClaim`; else builds the reader, stores it in `s.verify` **synchronously**, then starts the goroutine that runs `tick` every `verifyTick` under `instanceStoreTimeout` until ctx ends. The goroutine touches only the reader's own mutex-guarded state; every user loads the pointer with `s.verify.Load()`. |
| - The host index (`host -> []boxVerdict`) and `seen` are rebuilt under the reader's mutex on every record change; `For` takes a read lock and copies. |
| - [ ] **Step 1: Failing tests** (a `release.NewDirStore(t.TempDir())` wrapped in a counting store; records written with `dbverify.Publish`; a fake clock): |
| @@ -97,14 +97,15 @@ The exports row (3b); a box-side inert flag (B-8); a not-reached count, which ne |
| - `TestVerifyReaderFindsNewBoxFromIndex`: a new box's first publish appears in `watch.Observed()`; it is read on the next tick, before any relist. |
| - `TestVerifyReaderDropsDeletedAndGoneBoxes`: a record deleted from the bucket leaves at the relist; a box whose status object and record are both over 7 days old has no verdicts in `For`; a fleet box with no status object but a fresh `CheckedAt` keeps them. |
| - `TestVerifyReaderSkipsBadRecords` (Review Focus 2): oversize, v1, unparseable, and `Box` mismatching the key: each skipped with `Err` set in `Boxes()`, the good records still served. |
| + - `TestVerifyReaderPublishedSafely` (R2-3, run with `-race`): `StartVerifyReader` while goroutines call the backups door and `acceptedTest` in a loop; no race report, and every call after `StartVerifyReader` returns sees a non-nil reader. |
| - `TestVerifyReaderSeedsReassignedHost` (B-6): box A's record has a pass for H; A's next record drops H; `For(H)` still returns A's pass from `seen`; after B publishes a newer verdict, B's wins in Task 3's selection. |
| - `TestVerifyReaderRelistNeverLaterThanSixHours`: 1,000 drawn relist periods all in (5h24m, 6h]. |
| - `TestVerifyReaderFailedStartBacksOff` (R1-2): the first LIST fails; 5 hours of one-minute ticks make no further request; the next relist time retries and loads. |
| - `TestVerifyReaderFailedGetBacksOff` (R1-2): one record's GET fails on every try while its scope keeps moving; over 12 hours of ticks it is tried at most three times (start, then 6-hour spacing), and other boxes' moved scopes are still read. |
| - `TestVerifyReaderDeletedScopeNotPolled` (R1-2): a record deleted after its scope was bumped (the index keeps the entry); one GET finds it absent; 12 hours of ticks with an unchanged generation make no GET for it; a later bump of that scope reads it once. |
| -- [ ] **Step 2:** `go test ./internal/console -run 'VerifyReader'` → FAIL. |
| -- [ ] **Step 3:** Implement. Wire `go srv.RunVerifyReader(context.Background(), edgesWatch)` in `cmd/console/main.go` after `RunRegionNames`. |
| -- [ ] **Step 4:** `go test ./internal/console ./cmd/console -run 'VerifyReader'` → PASS. |
| +- [ ] **Step 2:** `go test -race ./internal/console -run 'VerifyReader'` → FAIL. |
| +- [ ] **Step 3:** Implement. Wire `srv.StartVerifyReader(context.Background(), edgesWatch)` (not in a `go` statement) in `cmd/console/main.go` after `RunRegionNames` and before the server starts listening. |
| +- [ ] **Step 4:** `go test -race ./internal/console ./cmd/console -run 'VerifyReader'` → PASS. |
| - [ ] **Step 5:** Commit. |
| ### Task 3: Acceptance, `copy_since` and the path inventory |
| @@ -114,15 +115,15 @@ The exports row (3b); a box-side inert flag (B-8); a not-reached count, which ne |
| **Interfaces:** |
| - Consumes: `boxVerdict`, `verifyReader.For` (Task 2). |
| - Produces: |
| - - `func verifyIdentityOf(rec provision.Record) (dbverify.Identity, bool)`: `{rec.Account, rec.App, rec.Host, rec.Region, provision.Incarnation(rec.Account, rec.App, rec.Host, rec.CreatedAt)}`; false on an `Incarnation` error or any empty field. |
| + - `func verifyIdentityOf(rec provision.Record) (dbverify.Identity, bool)`: `{rec.Account, rec.App, rec.Host, rec.Region, provision.Incarnation(rec.Account, rec.App, rec.Host, rec.CreatedAt)}`; false on an `Incarnation` error or an empty `Account`, `App` or `Host`; `Region` may be `""` (home, R2-1). |
| - `func copySince(rec provision.Record) time.Time` (B-1). |
| - `func acceptVerdict(rec provision.Record, ownRegion, ownPrefix string, bv boxVerdict, now time.Time) bool` (the Global Constraints rule; `ownPrefix` is "" for another region's instance). |
| - `func pickTest(rec provision.Record, ownRegion, ownPrefix string, cands []boxVerdict, now time.Time) (dbverify.Verdict, string /*box*/, bool)`: newest accepted, failed on a tie. |
| - - `func (s *Server) acceptedTest(rec provision.Record, now time.Time) (dbverify.Verdict, bool)`: `pickTest` over `s.verify.For(rec.Host)`; false when `s.verify` is nil or not loaded. |
| + - `func (s *Server) acceptedTest(rec provision.Record, now time.Time) (dbverify.Verdict, bool)`: `pickTest` over `s.verify.Load().For(rec.Host)`; false when the reader is nil or not loaded. It is the **only** way any surface, the operator view included, picks an instance's test (R2-4). |
| - [ ] **Step 1: Failing tests:** |
| - - `TestVerifyIdentityMatchesBracket`: for a sleeping instance record in a `DirStore`, `verifyIdentityOf(rec)` equals `dbreads.CaptureIdentity(ctx, store, rec.Region, ...)`'s identity field for field. |
| - - `TestAcceptVerdictTable`: one row each, accepted or not: passed and failed accepted; unverified refused; another incarnation (recreate, same and other account); another region; empty identity; bracket equal to `LastMove.At` refused, one second after accepted; `rec.Move != nil` refused; own-region prefix mismatch refused, other-region prefix ignored; box last seen 7 days and one second ago refused; `VerifiedAt` 6 minutes ahead refused. |
| + - `TestVerifyIdentityMatchesBracket`: for a sleeping instance record in a `DirStore`, `verifyIdentityOf(rec)` equals `dbreads.CaptureIdentity(ctx, store, rec.Region, ...)`'s identity field for field, for a named region and for the home region (`Region: ""`, R2-1). |
| + - `TestAcceptVerdictTable`: one row each, accepted or not: passed and failed accepted; unverified refused; another incarnation (recreate, same and other account); another region; a home-region verdict (`Region: ""`) for a home-region record accepted (R2-1), and refused for a record in a named region and vice versa; an empty account, app, host or incarnation refused; bracket equal to `LastMove.At` refused, one second after accepted; `rec.Move != nil` refused; own-region prefix mismatch refused, other-region prefix ignored; box last seen 7 days and one second ago refused; `VerifiedAt` 6 minutes ahead refused. |
| - `TestCopySinceEveryMoveOutcome`: `LastMove` done, rolled_back and aborted each hide a verdict whose bracket opened before `At`. |
| - `TestMoveThereAndBackHidesOldVerdict` (Review Focus 4). |
| - `TestRestoreIsNewIdentity`: a record recreated through the create path's `CreatedAt = now` (#658) refuses the old incarnation's verdict. |
| @@ -143,14 +144,14 @@ The exports row (3b); a box-side inert flag (B-8); a not-reached count, which ne |
| - Produces: |
| - `type backupsTest struct { Result string; At time.Time; CopyWrittenAt *time.Time; OperatorsAlerted bool }`, JSON keys `result`, `at`, `copy_written_at` (omitempty), `operators_alerted` (omitempty); `backupsView.LastTest *backupsTest`, key `last_test` (omitempty). `At` is `VerifiedAt`, `CopyWrittenAt` is `WrittenAt` when non-zero. |
| - `backupsFor` fills `LastTest` after the memo load, never inside it (the memo keeps only the position), for every record `replicaIntrinsic` calls replicated, in any region. |
| - - `func (s *Server) verifyAlertsReach() bool` (R1-5): true only when the alert engine runs here (`!s.cfg.HostClaim`, `s.cfg.Releases != nil`), the `verify_failed` rule's effective setting in `alertScopeFleet` is enabled, and `alertRuleConnectors` leaves at least one connector that is also not suspended, not needing re-entry, not unsubscribed, **and deliverable**: an email connector only when a sender exists (`s.sendFederated != nil || s.consoleMail != nil`, the two paths `deliver` uses, `delivery.go:41-77`); a Slack or webhook connector only when `s.alertSeal.Load() != nil` (`alertTarget` holds it otherwise, `alertnotify.go:696-711`). No probe and no `alertTarget` call (it marks connectors). Any store error, or anything unknown, is false. Cached for one minute. |
| + - `func (s *Server) verifyAlertsReach() bool` (R1-5, R2-2): true only when the alert engine runs here (`!s.cfg.HostClaim`, `s.cfg.Releases != nil`), the `verify_failed` rule's effective setting in `alertScopeFleet` is enabled, and `alertRuleConnectors` leaves at least one connector of kind `alertConnectorEmail` that is also not suspended, not needing re-entry and not unsubscribed, while a sender exists (`s.sendFederated != nil || s.consoleMail != nil`, the two paths `deliver` uses, `delivery.go:41-77`). Sealed kinds (Slack, webhook) never count (B-4). No probe and no `alertTarget` call (it marks connectors). Any store error, or anything unknown, is false. Cached for one minute. Local to this feature; not a shared eligibility check. |
| - `backupswords.Input.Test *TestInput` with `type TestInput struct { Result string; At time.Time; CopyWrittenAt *time.Time; Alerted bool }`; `Display` gains `TestValue, TestDetail, TestNote string; TestGap bool` (TestGap: failed, warning tone). No test: `TestValue` is the unknown dash and `TestDetail` is `TestNone`, as today. Whether the tile shows without the other two is Task 0's decision, carried as a `Display` field Show sets. |
| - Constants for Task 1's `backups.test.*` strings in `words.go`. |
| - [ ] **Step 1: Failing tests:** |
| - - `TestVerifyAlertsReach` (R1-5): false with a confirmed email connector but no sender; false with only a webhook connector and no seal key; false with the rule disabled, with a suspended or unsubscribed connector, and on a store error; true with a confirmed email connector and `consoleMail` set. |
| + - `TestVerifyAlertsReach` (R1-5): false with a confirmed email connector but no sender; false with only a webhook or Slack connector, whether or not a seal key is loaded (R2-2); false with the rule disabled, with a suspended or unsubscribed connector, and on a store error; true with a confirmed email connector and `consoleMail` set. |
| - `TestShowRestoreTest` (backupswords): passed today, passed on an earlier date and an earlier year, failed with and without `Alerted`, no test; values, details, note and tone per Task 1; the forbidden-words loop of `TestShowEveryClassAndReason` extended to every new field. |
| - - `TestAPIInstanceBackupsLastTest` (console, through the real router and gate, spec §12): a published passing record gives `last_test` with `result`, `at`, `copy_written_at`; a failing one adds `operators_alerted` only with a deliverable connector; no record or an unaccepted verdict omits the key; pooled and fleet records never carry it. |
| + - `TestAPIInstanceBackupsLastTest` (console, through the real router and gate, spec §12): a published passing record gives `last_test` with `result`, `at`, `copy_written_at`; a failing one adds `operators_alerted` only with a deliverable connector; no record or an unaccepted verdict omits the key; pooled and fleet records never carry it; a home-region instance (`Region: ""` on the record and in the console's config) with a home-region verdict gets `last_test` (R2-1). |
| - `TestBackupsLastTestNotMemoised`: a door call, then a new record read by the reader, then a second call within 5 minutes: the second shows the new test. |
| - `TestInstancePageBackupsRestoreTest`: the rendered section shows each state; Review Focus 1's no-records case shows the slice-1 "not shown yet"; the section contains no forbidden word. |
| - [ ] **Step 2:** `go test ./internal/backupswords ./internal/console -run 'ShowRestoreTest|ShowEvery|APIInstanceBackups|BackupsLastTest|InstancePageBackups|VerifyAlertsReach'` → FAIL. |
| @@ -177,12 +178,12 @@ The exports row (3b); a box-side inert flag (B-8); a not-reached count, which ne |
| **Files:** Create `internal/console/fleetbackups.go`, `internal/console/fleetbackups_test.go`. |
| **Interfaces:** |
| -- Consumes: `replicaIntrinsic` (slice 1), `acceptVerdict`/`pickTest` (Task 3), `verifyReader.Boxes`/`Loaded` (Task 2), `s.recordWalkStore` + `provision.ListAllRecordsTolerant`, `release.ModLister` and `status.Box`/`status.BoxStale` (B-8), `regionlabel.ForCode`. |
| +- Consumes: `replicaIntrinsic` (slice 1), `s.acceptedTest` (Task 3) for every instance's test, so owner and operator views pick from the same candidates, `seen` included (R2-4); `verifyReader.Boxes`/`Loaded` (Task 2) for box diagnostics only (quiet and unreadable boxes, B-8), `s.recordWalkStore` + `provision.ListAllRecordsTolerant`, `release.ModLister` and `status.Box`/`status.BoxStale` (B-8), `regionlabel.ForCode`. |
| - Produces: |
| - `type fleetBackupsView struct { GeneratedAt time.Time; Loaded, Complete bool; Regions []fleetBackupsRegion }` |
| - `type fleetBackupsRegion struct { Region, Label string; Classes fleetBackupsClasses; Tests fleetBackupsTests; QuietBoxes []fleetBackupsBox; UnreadableBoxes []string; Offsite string /*"no_record", B-9*/ }` |
| - `type fleetBackupsClasses struct { Replicated int; NoCopy, NotShown map[string]int /*reason -> count*/ }` |
| - - `type fleetBackupsTests struct { PassedWeek, Failed, NeverTested int; OldestAt *time.Time }`, over replicated instances only; `Failed` and `PassedWeek` from each host's picked test; `NeverTested` is no picked test; `OldestAt` the oldest picked test's `VerifiedAt`. No not-reached count (B-7). |
| + - `type fleetBackupsTests struct { PassedWeek, Failed, NeverTested int; OldestAt *time.Time }`, over replicated instances only; `Failed` and `PassedWeek` from each host's `acceptedTest`; `NeverTested` is none; `OldestAt` the oldest accepted test's `VerifiedAt`. No not-reached count (B-7). |
| - `func loadBoxInventory(ctx context.Context, s release.Store, now time.Time) (boxes []status.Box, complete bool, err error)` (R1-3): `ListMod("status/boxes/")`, keep keys modified within 7 days, newest first, at most 200 (more: `complete` false), each body at most 1 MiB and parsed as `status.Box`; a failed or skipped read sets `complete` false. A store that isn't a `ModLister` falls back to `List` and keeps every key. |
| - `type fleetBackupsBox struct { Box, Name string; LastRecord *time.Time; StatusStale bool }`: B-8; `StatusStale` is `status.BoxStale(b, now, status.SnapshotPeriod)`. |
| - `func (s *Server) fleetBackups(ctx context.Context, now time.Time) (fleetBackupsView, error)`, memoised 5 minutes (one build in flight; the `backupsMemo` shape). |
| @@ -190,7 +191,8 @@ The exports row (3b); a box-side inert flag (B-8); a not-reached count, which ne |
| - Regions: an instance's `rec.Region`, a box's `status.Box.Region`, a verdict's `Identity.Region`; labels through `regionlabel.ForCode(code, s.regionHome(), s.regionNames())`. |
| - [ ] **Step 1: Failing tests:** |
| - - `TestFleetBackupsCountsPerRegion`: two regions; records of every class and reason; verdicts passed (3 days old), passed (9 days old), failed, unverified, and none; expect the counts and `OldestAt`; the JSON has no not-reached key. |
| + - `TestFleetBackupsCountsPerRegion`: two regions; records of every class and reason; verdicts passed (3 days old), passed (9 days old), failed, unverified, and none; expect the counts and `OldestAt`; the JSON has no not-reached key. One of the two regions is the home region (`Region: ""` on records, verdicts and the console's config) and its tested instances are counted as tested, not never tested (R2-1). |
| + - `TestFleetBackupsAgreesWithOwnerOnReassignedHost` (R2-4): box A passes host H, then A's next record drops H before B tests it; after the memo is rebuilt, the door's `last_test` for H is A's retained pass and `/fleet/backups` counts H as passed, not never tested; after B publishes a newer fail, both show the fail. |
| - `TestFleetBackupsQuietBoxes`: four boxes: sleeping instances and a 37-hour-old record; sleeping instances and no record; sleeping instances and a fresh record; no sleeping instances and no record. Only the first two are listed, with `LastRecord` set for the first and nil for the second. |
| - `TestFleetBackupsDarkBoxStillListed` (R1-3): a box whose status object and verify record are both 37 hours old, with sleeping instances, is listed with `StatusStale` true; one whose status object is 8 days old is not. |
| - `TestFleetBackupsNoRecordsYet` (Review Focus 1): reader loaded, no records: every replicated instance is never tested; `Loaded` true. |
| @@ -241,3 +243,14 @@ The exports row (3b); a box-side inert flag (B-8); a not-reached count, which ne |
| | R1-6 | P2 | The path inventory misses composite literals and whole-record writes (complete copy-change path coverage) | Accepted: `apiinstances.go:2165` confirmed. Inventory covers field writes, literals, whole-record assignments and the record-write entry points, with an overlay fixture proving each form is found (Task 3). | |
| | R1-7 | P2 | Per-task review of every task contradicts the stopping rules (bounded review process) | Accepted: AGENTS.md rules 1 and 3 applied. Per-task review only for Tasks 2, 4, 6 and 7; round history and stopping rules carried in every brief (header, Task 8). | |
| +## Astra plan round 2: dispositions |
| + |
| +`docs/superpowers/notes/reviews/member-backups/CODEX-FINDINGS-plan-2b-R2.md`, NOT READY. R1-1 to R1-4, R1-6 and R1-7 resolved. |
| + |
| +| # | Sev | Finding (fault family) | Disposition | |
| +|---|---|---|---| |
| +| R2-1 | P1 | Acceptance refuses every home-region verdict because the home region is `""` (identity vocabulary compatibility) | Accepted: `server.go:675-678` and `drillidentity.go:68` confirmed. `Region` may be empty with exact equality; the other four fields stay non-empty. Home-region witnesses in identity capture and acceptance (Task 3), the real door (Task 4) and fleet counts (Task 6). | |
| +| R2-2 (R1-5 partly) | P2 | A wrong-key sealed target can still earn "We've been alerted"; second round in truthful alert-delivery assurance | Accepted as a cut (AGENTS.md stopping rule 2; controller ruling, Astra's recommendation): `alertnotify.go:708` confirmed. Only confirmed email connectors with a sender configured earn the assurance; sealed connectors never do; no shared eligibility check (B-4, Task 4). `operators_alerted` stays, because the email path needs no decryption. | |
| +| R2-3 | P2 | `s.verify` published from a goroutine without synchronization (safe publication of shared state) | Accepted: `atomic.Pointer`, set synchronously by `StartVerifyReader` before the goroutine starts and before the server listens; `-race` test (Task 2). | |
| +| R2-4 | P2 | Fleet counts use different candidates from the owner view (consistent evidence across surfaces) | Accepted: the operator view picks each instance's test through `acceptedTest`; `Boxes` is for box diagnostics only; reassigned-host test compares both surfaces (Task 6). | |
| + |