carlos / platform Public

review: Astra brief for ha-1192, round 1

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev d3eb89cc99cbb2845a9f96868566856f9f8c7319 parent d6295e8
1 file changed, +117 −0
  • docs/superpowers/reviews/CODEX-REVIEW-BRIEF-ha-1192.md +117 −0

CI cancelled — superseded by a newer push — run details

diff --git a/docs/superpowers/reviews/CODEX-REVIEW-BRIEF-ha-1192.md b/docs/superpowers/reviews/CODEX-REVIEW-BRIEF-ha-1192.md
new file mode 100644
index 000000000..cd8c6c7c3
--- /dev/null
+++ b/docs/superpowers/reviews/CODEX-REVIEW-BRIEF-ha-1192.md
@@ -0,0 +1,117 @@
+# Review brief: branch ha-1192-close-lost-edges (#1192), round 1 of 3
+
+Repo carlos/platform, branch `ha-1192-close-lost-edges`, tip as named in
+your prompt. Under review: the diff `03ff5d17..<tip>` (base is
+origin/main 03ff5d17). Authorities on main: region HA DR-5 (merged
+3d71df18, `internal/host/hadepartures*.go`, spec §7.5 as cited in code),
+the group roll verb spec
+`docs/superpowers/specs/2026-11-09-group-roll-verb-design.md`, the drain
+driver `internal/host/hadrain.go` (§25.4), and the fleet drain trash rule
+from #1008 T9 (`internal/console/fleetrelabel.go` trashRetired).
+
+You are an independent reviewer. Read the diff, then the code it names,
+and check every claim against that code. This one round covers four
+tasks; give a verdict per task and one overall, plus the census verdicts.
+
+## The incident (dev IE, 2026-11-17)
+
+App bab/g6x was trashed on 11-14 (apps/bab/g6x/deleted.json), but its
+instance record and its lock, a clean release marker naming group member
+g-03152630, stayed. When g-03152630 was terminated by a group replace,
+every box's departure scan matched the host and adoption deferred it on
+every pass (no route: a trashed app is never minted), so the departure
+never reached authority_complete and the member's edges record stayed
+published (admitted, draining). The next drain listed the dead member
+and failed after 2 minutes waiting for its acknowledgement. Box journals
+showed `ha_departure_transfer host=g6x... result=deferred` 20 times on
+three boxes over 25 minutes.
+
+## Fixed: do not re-argue
+
+- Agent manager 8a3d302 (2026-11-17): close-lost reports and names a
+ still-published edges record and never deletes it; the boxes'
+ termination recovery owns retirement. Also: the fleet drain and the
+ departure must share ONE trash rule ("a trashed app's records never
+ hold HA or fleet work").
+- DR-5's rules (unserved discharge, proven-departed group refs only,
+ fixed refs never proven, the finalization gate) are merged and not
+ under review except where this diff changes them.
+
+## What to check
+
+1. **Task 1, the shared rule** (`internal/release/trash.go`
+ TrashRetired, ProductionClear; `internal/console/fleetrelabel.go`;
+ `internal/provision/reconcile.go` productionClear). Is TrashRetired
+ exactly the reconcile's `removable` (marker positively present AND
+ production flag positively clear, nil key = clear)? The console's old
+ trashRetired errored on a present flag with a nil key; it now answers
+ clear like the reconcile. Is that safe for the fleet drain?
+2. **Task 2, departure scan** (`internal/host/hadepartures_scan.go`
+ ScanPass, trashed, unservedRevoked, complete; wiring in
+ `hadepartures_wiring.go`). Can a host be discharged while some box
+ could still serve or wake it (production app, restore, route still
+ minted somewhere, a marker that is not a clean release, a lock still
+ held)? Rule 1 (release marker or passed expiry) must still apply.
+ Does the gate on "no local route" let a host whose app is trashed but
+ whose route this box still holds go the adopt path harmlessly? Is the
+ finalization gate's recheck correct after a restore? Any new S3
+ request on the normal (non-trashed) path?
+3. **Task 3, drain ack** (`internal/host/hadrain.go` publishAndAck,
+ `Controller.PeerDeparted`, `armedPeerDeparted`, `agent.go`). Is
+ skipping a peer whose departure this box enrolled safe for §25.4's
+ guarantee (every live box has seen the drain state before the move)?
+ Can a live box be skipped: a fixed ref, a ref reused, an enrolled
+ departure for an instance that is not terminated, a departure record
+ left after completion while the ref publishes again? Races between
+ the drain goroutine and the departure controller arming late.
+4. **Task 4, close-lost** (`internal/grouproll/roll.go` closeLost,
+ lostEdgesPublished, text key `lost_edges_published`, spec row V20).
+ The listing is journaled before `lost-member-closed`; a failed
+ listing refuses and leaves the transaction open. Any path where
+ close-lost now fails to close a transaction it closed before, beyond
+ a failed listing?
+5. **Witnesses** (`internal/host/hadepartures_trash_test.go`,
+ `hadrain_departed_test.go`, `internal/release/trashretired_test.go`,
+ `internal/grouproll/roll_test.go` close-lost tests). Do they go
+ through production wiring and prove the claim (the before-1192 test
+ shows the stall)? Deterministic?
+6. **Census**: `docs/superpowers/notes/census-proposal-ha-1192.md` and
+ the claims beside it. AGENTS.md "The census: the reviewer decides":
+ give a verdict for every unit and every re-pinned envelope. Reject if
+ root now opens, runs, queries or follows anything from a path or
+ input a tenant, app or box agent can create, write or name, or a
+ check is weakened. Note: the new trash reads take account/app from
+ an instance record and read `apps/<account>/<app>/deleted.json` and
+ the root-signed production flag in the deployment bucket, the same
+ reads the reconcile already makes for the same records.
+
+## Severity
+
+- **P1**: unsafe, would not compile, a test fails, or it would not work.
+ Blocks merge.
+- **P2**: wrong or missing. Fixed without reopening this review. (The
+ census, and review of any newly changed security, root, termination
+ or production-storage behaviour, still check the fix; see AGENTS.md,
+ "Stopping rules".)
+- **P3**: clarity or polish. Goes on a follow-up list; never a reason for
+ another round.
+
+A P1 states its failure scenario and the evidence (file:line). Do not
+raise a P2 to P1 to keep the review open.
+
+## Output
+
+Findings ranked P1, P2, P3. Each gives the task, the problem, the
+evidence (file:line, verified), the failure scenario, a concrete fix and
+the invariant or trust boundary it breaks (that is its fault family).
+Then the census verdict per unit and envelope (approve or reject, citing
+the lines read). End with exactly one verdict:
+
+- **READY**: no P1 and no P2.
+- **READY AFTER FIXES**: no P1. The listed P2s are fixed without another
+ round.
+- **NOT READY**: one or more P1s, listed.
+
+Do not edit files. Do not spawn Anthropic-model reviewers or subagents of
+your own. Do not run the full test suites; targeted `go test -run` on the
+changed packages is fine (socket tests may need TMPDIR=/home/paulca/t).