Tunnel WebSockets (#471): Astra spec review brief, round 3
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 file changed,
+60
−0
docs/superpowers/reviews/CODEX-REVIEW-BRIEF-tunnel-websockets-R3.md+60 −0
CI passed — run details
Intent
Attributed to this commit: 48.3 g CO₂e (6,280,700 tokens). This is an attribution, not a measurement — usage counted from this commit's own marker forward to the next one on design-tunnel-websockets-471, never backward from it. A turn that produced more than one commit books all of its tokens to the last one, and a concurrent session on this branch can add to the same figure. Some of it was priced using the shared default rate, because no model-specific factor row exists yet for at least one model involved. The Carbon view has the repo total, which is never derived from this attribution.
diff --git a/docs/superpowers/reviews/CODEX-REVIEW-BRIEF-tunnel-websockets-R3.md b/docs/superpowers/reviews/CODEX-REVIEW-BRIEF-tunnel-websockets-R3.md| new file mode 100644 |
| index 000000000..215551acc |
| --- /dev/null |
| +++ b/docs/superpowers/reviews/CODEX-REVIEW-BRIEF-tunnel-websockets-R3.md |
| @@ -0,0 +1,60 @@ |
| +# Review brief: tunnel WebSockets design (#471), round 3 of 3 |
| + |
| +Repo carlos/platform, branch `design-tunnel-websockets-471`, commit 54105d75188edd8d3fd1ecba9acf243dd6410ffc. |
| +Under review: `docs/superpowers/specs/2026-10-30-tunnel-websockets-design.md` (rev 3). |
| +Authorities: main's code (origin/main 65fd8060, fleet public routes merged and live in v0.32.0), docs/superpowers/specs/2026-10-29-fleet-public-routes-design.md (forward rows, one enforcement point at the hub), AGENTS.md (census, request budget, provider-neutral core, production-wired witnesses, stopping rules). Do not review against unmerged branches; if this work needs one, say so as a P1 and stop. |
| + |
| +You are an independent reviewer. Read the document, then the code it names, and check every claim against that code (file:line). Library code is golang.org/x/net v0.60.0 and the Go 1.26.10 standard library. |
| + |
| +This is the last round. A fourth needs Paul. |
| + |
| +## Fixed: do not re-argue |
| + |
| +- Goal (Paul via #471): WebSocket upgrades to fleet apps work through the hub's fleet tunnel (Action Cable on dev shop), keeping one enforcement point at the hub. |
| +- Controller's calls on the spec's open questions (platform-60), recorded in spec §11: option B (the upgrade carried unchanged in one HTTP/2 stream); Q1 cap 128 open upgrades per fleet box in v1; Q2 do not shrink the hub's per-stream window now; Q3 -tunnel hand rows get WebSockets too; Q4 add an Action Cable channel to examples/rails-shop as the last task; Q5 file the client-address finding as its own discussion (#476). Report only mechanisms that fail these. |
| +- Controller's rulings on round 1 (platform-60): every upgraded socket records the tenancy that admitted it; a registry of open upgrades by host; one sweep after every Reload's map swap, synchronised with admission, closes any socket whose host is no longer served by the shared decision for the same account, app and fleet, including accounts outside plan tracking; one reservation object with exactly-once release on every terminal path; a hub-restart witness that kills established connections and brings the hub back with the box re-registering; prove the maximum-load guarantee rather than narrow it; §10.2 withdrawn after re-verification. |
| +- Controller's rulings on round 2 (platform-60): ONE reload mutex held from the registry read through the map swap and the upgrade sweep, taken by every Reload caller; Watch records a fingerprint as handled only after its own serialised Reload has swapped and swept; the lock order stated against the upgrade-registry lock, the admission path and existing edge locks; admission never takes the reload mutex; a deterministic two-Reload witness with hooks, asserting the fingerprint bookkeeping too; the `ModifyResponse` classification corrected and the backstop exercised on a genuine unclosed-body path, keeping a `ModifyResponse` case that asserts release through the body. Report only mechanisms that fail these. |
| + |
| +## What to check |
| + |
| +1. The reload mutex (§4.6.1, §4.6.3): with `reloadMu` inside `Reload` (first statement, held to return), can any interleaving of the callers listed in §4.6.3 (verify the list against `grep -rn '\.Reload()'`) still publish a map older than one already swept, or leave the watcher's recorded fingerprint ahead of the published map? Are the registry reads that decide tenancy fresh, as claimed (`registry.go:1092-1115`, `fleets.go:286`, `:631`)? Is the `ListRegional` staleness argument (§4.6.3) right? |
| +2. Lock order and deadlock: check the stated order against the code: `TunnelHub.mu`, the prober and activator locks `Reload` already takes, `openUpgrades.mu`, `e.upgradesMu`, the layout pass's serialisation. Is there any path that holds a lock `Reload` needs while waiting on `reloadMu`, or holds `openUpgrades.mu` and `TunnelHub.mu` together? Does the off-lock, per-goroutine release in the sweep keep the invariant and the bound? |
| +3. The witnesses: would §8.2 case 18 fail on rev 2's design and pass on rev 3's, deterministically? Does case 19's guard actually pin the one publication site and the lock? Does case 12 now exercise the backstop on a path that really leaves the body open (`reverseproxy.go:854-857`), and is the claim that `:842-851` is unreachable from this transport correct? |
| +4. The §4.6.2 terminal-path table after the correction against `reverseproxy.go:395-397`. |
| +5. Anything rev 3 broke that earlier rounds did not flag. |
| + |
| +## Round 3 |
| + |
| +Earlier rounds: `docs/superpowers/reviews/CODEX-FINDINGS-tunnel-websockets-R1.md` (round 1, NOT READY, 1 P1 and 4 P2) and `docs/superpowers/reviews/CODEX-FINDINGS-tunnel-websockets-R2.md` (round 2, NOT READY, 1 P1 and 1 P2). The round number counts every earlier review of this design, under any file name or reviewer. |
| + |
| +Dispositions so far, and where rev 3 answers what is open: |
| + |
| +- R1-1 (P1, an open socket cannot outlive its admitting tenancy): partly resolved in round 2; carried as R2-1. |
| +- R1-2 (P2, reservation cleanup): resolved in round 2. Rev 3 corrects one table row under R2-2. |
| +- R1-3 (P2, hub-restart witness): resolved in round 2. |
| +- R1-4 (P2, maximum-load witness): resolved in round 2. |
| +- R1-5 (P2, §10.2 TLS claim): resolved in round 2 (withdrawn). |
| +- R2-1 (P1, concurrent Reloads skip a revoking map; same fault family as R1-1, so stopping rule 2 has triggered and the controller chose "state the invariant, enforce it in one place, check it with a guard test or simulation"): §4.6.1 "One place: the reload mutex", "Synchronised with admission", "The watcher's bookkeeping", "Lock order"; §4.6.3 (every path that publishes or reads the map); §4.10 and §7 (code and census); tests §8.2 case 18 (deterministic two-Reload interleaving, both orders, with the watcher's fingerprint bookkeeping) and case 19 (go/ast guard). |
| +- R2-2 (P2, `ModifyResponse` failure closes the body): §3.5 evidence and §4.6.2 table corrected; §8.2 case 12 asserts release through the body for `ModifyResponse` and through the backstop for a non-hijacking writer. |
| + |
| +First give one line per P1 and P2 from rounds 1 and 2: resolved, partly, or not. Carry every unresolved or partly resolved finding forward at its current severity, then add new findings. The verdict covers everything outstanding, earlier rounds included. |
| + |
| +## 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 section or 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). 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. |
| + |
| +This is round 3: a NOT READY also says whether its P1s share one cause, and whether refusing the case up front or cutting the feature would remove them. |
| + |
| +Do not edit files. Do not spawn Anthropic-model reviewers or subagents of your own. Do not run the full test suites. |