carlos / platform Public

review: Astra brief for audit-console-shutdown, round 1

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev b0f70f0c311a61e46e29ac3c3688930ef3023baf parent b4e7a65
1 file changed, +50 −0
  • docs/superpowers/reviews/REVIEW-BRIEF-audit-console-shutdown.md +50 −0

CI failed — run details

diff --git a/docs/superpowers/reviews/REVIEW-BRIEF-audit-console-shutdown.md b/docs/superpowers/reviews/REVIEW-BRIEF-audit-console-shutdown.md
new file mode 100644
index 000000000..e47ee78c9
--- /dev/null
+++ b/docs/superpowers/reviews/REVIEW-BRIEF-audit-console-shutdown.md
@@ -0,0 +1,50 @@
+# Review brief: branch audit-console-shutdown, round 1 of 3
+
+Repo carlos/platform, branch `audit-console-shutdown`, commit b4e7a657072895e7ff63c5d4028d92b2a310453e.
+Under review: the diff `origin/main...b4e7a657072895e7ff63c5d4028d92b2a310453e` (base c4b44c34).
+Authorities: AGENTS.md on main ("Stopping rules"). Context: amadan #1123,
+batch 2. Outside the root census (cmd/console only).
+
+You are the independent reviewer. This changes the console's
+**termination** behaviour, which runs on every console roll on dev,
+flagship and Tito.
+
+## What to check
+
+1. Order on SIGTERM (cmd/console/stop.go): Shutdown with a 20 s drain,
+ WebSockets closed at once, stuck handlers logged and cut with 2 s
+ grace, worker context cancelled and workers given 10 s, policy writer
+ lease released only after the HA capacity observer has joined (the old
+ ordering guarantee). Any path where the lease is released while the
+ observer still runs, or released twice, or where the process never
+ exits?
+2. A second signal exits 1 without releasing the lease; a signal before
+ serving starts. Correct and race-free?
+3. Every background loop in main.go now runs on the worker context
+ (work.Go / startClaimWorker). Did any worker change behaviour when its
+ context is cancelled (half-written jobs, leases, outbox rows)? Name any
+ that now stop mid-step in a way that leaves state an operator must fix.
+4. The worst case is 37 s against systemd's default TimeoutStopSec of 90 s
+ (the console unit is hand-written on each box and not in git). Is 20 s
+ a good drain for what the console serves (db door, forwarded reads,
+ PDF, ship and import uploads)? Would a long upload in progress be cut
+ in a way the CLI reports clearly?
+5. The source-reading tests changed (claimworkers_started_test.go,
+ hacapacity_test.go, plansponsor_test.go, claim_sweep_test.go): do they
+ still enforce what they enforced?
+6. New tests in stop_test.go: would each fail on the old behaviour; any
+ timing that could flake on a loaded runner?
+
+## Severity
+
+- **P1**: unsafe, would not compile, a test fails, or it would not work.
+- **P2**: wrong or missing. Fixed without reopening this review (the
+ termination check still applies to the fix).
+- **P3**: clarity or polish. Follow-up list only.
+
+## Output
+
+Findings ranked P1, P2, P3 with file:line, failure scenario and fix, and
+the invariant each breaks. End with exactly one verdict: READY, READY
+AFTER FIXES, or NOT READY. Do not edit files, spawn reviewers or run full
+suites.