edge PPv2 idle: Astra review brief, round 1
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 file changed,
+46
−0
docs/superpowers/reviews/CODEX-REVIEW-BRIEF-edge-ppv2-idle.md+46 −0
CI passed — run details
Intent
diff --git a/docs/superpowers/reviews/CODEX-REVIEW-BRIEF-edge-ppv2-idle.md b/docs/superpowers/reviews/CODEX-REVIEW-BRIEF-edge-ppv2-idle.md| new file mode 100644 |
| index 000000000..b61bc5826 |
| --- /dev/null |
| +++ b/docs/superpowers/reviews/CODEX-REVIEW-BRIEF-edge-ppv2-idle.md |
| @@ -0,0 +1,46 @@ |
| +# Review brief: branch edge-ppv2-idle (edge PPv2 idle counter), round 1 of 3 |
| + |
| +Repo carlos/platform, branch `edge-ppv2-idle`, commit 86e28db6f273b459a145514fc2419398de8cb980. |
| +Under review: the diff `origin/main..86e28db6` (base 03ff5d17). |
| +Authorities: `docs/superpowers/specs/2026-11-12-edge-proxy-protocol-design.md` (rev 5.1 on main; this branch adds a rev 5.2 note in section 4.5), `docs/region-ha-runbook.md` section "PROXY protocol v2 on the region NLBs", both on main. |
| + |
| +You are an independent reviewer. Read the diff, then the code it touches, and check every claim against that code. |
| + |
| +## Background |
| + |
| +On 2026-11-17 the dev IE NLB cutover showed that the AWS NLB sends its PROXY protocol v2 header with the client's first bytes, not at connect. In S2 (preservation off, PPv2 on) an idle client connection (a browser preconnect) is trusted, waits for a header, reaches the 10 s header deadline and was counted `timeout`. Eight deliberate idle connections moved `timeout` by exactly 8. `timeout` is in `scripts/ppv2-step.py`'s STILL set, so B steps could not converge on a deployment with real browsers. |
| + |
| +The change: a trusted connection that sends no byte before the header deadline is counted `idle`, not `timeout`; a started header still counts `timeout`. `idle` is carried through the edge sum, the journal line, `trust-status` and its wire form (optional only for an older edge), and the step script (optional in a status line, never in STILL; a B step refuses a target whose edge does not report it). |
| + |
| +## Fixed: do not re-argue |
| + |
| +- 8a3d302's ruling (2026-11-17): an idle counter for "no bytes before the header deadline", outside the step script's must-stay-still set; `timeout` stays for a partial header; runbook updated. |
| +- The header deadline itself, the trust rule, the barrier and the S3 signals (`marker_trusted`, `no_client_refused`) are unchanged and out of scope except where this diff touches them. |
| + |
| +## What to check |
| + |
| +1. `internal/proxyproto/conn.go` `parse` and `sentAnything`: can anything that is a real header problem (a started header, a malformed one, a marker, a header that arrived after a late parse start, see `TestTrustedHeaderDeadlineFromAccept`) now be counted `idle` instead of `timeout`, `malformed` or `marker_trusted`? Can `sentAnything`'s extra 1-byte read with a 5 ms deadline block, race with `Close`, the barrier sweep (`CloseTrusted`), or the deferred `endHeaderDeadline`, or leave a deadline set on a connection that is handed back to the server? The connection is closed right after in both branches; verify that. |
| +2. Could an attacker on an untrusted path, or a client behind the NLB, use the idle path to hide anything the S3 detection (spec 6.4, 6.5) relies on? The trust-violation metric is `no_client_refused` + `marker_trusted` only. |
| +3. `internal/host/edgetrust.go`: `idle` is the one counter allowed absent on the wire (presence-aware parsing everywhere else). Check `counters()`, `add()`, `statusShape` and `validTrust` for any way an absent or inconsistent `idle` lets a malformed answer through, or makes a valid answer from an older edge refused. Root reads this answer through the drain call child; check that nothing root decides depends on `idle`. |
| +4. `scripts/ppv2-step.py`: `counter_keys`, `counts_ok`, `parse_trust`, `counts_of` and the new refusal in `collect_baseline`. Can a status line mixing idle-present and idle-absent parts pass? Does the restart detection (`restart_reasons`) still catch a reset? Is the B-step refusal reached for `apply` and for `reverify` of a B step, and not for A or R steps? Is anything in STILL or the S3 checks weakened? |
| +5. The census overlay (`internal/provision/testdata/plan14-root-reads-edge-ppv2-idle.tsv`, card `docs/superpowers/notes/census-proposal-edge-ppv2-idle.md`): give a verdict for `Conn.parse` (body) and the new `Conn.sentAnything`, and for the re-pinned envelopes `internal/edge`, `internal/host`, `internal/proxyproto`, under the rules in AGENTS.md "The census: the reviewer decides". |
| +6. Tests: do the new tests (`TestTrustedIdleBeforeHeader`, `TestTrustedHeaderTimeoutPartialSignature`, `TestUntrustedSilentIsNotIdle`, `TestTrustStatusIdleOptional`, the three new `ppv2_step_test.py` cases) actually fail without the change? Any timing flake risk under CI load (50 ms deadlines, the 5 ms read)? |
| +7. The runbook and spec text: anything wrong against the code. |
| + |
| +## 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). Then the census verdicts (approve or reject per unit and envelope, 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 ./internal/proxyproto/ ./internal/host/ -run <name>` and `python3 -m unittest` in `scripts/` are fine. |