carlos / platform Public

spec: PPv2 rev 5, Astra round 3 P2s; barrier proposed

Round 3 (the last) found one P1 in F1: a one-shot close-trusted misses
half-parsed and later trusted connections. Rev 5 proposes a persistent
trust barrier, pending a go; port-80 gate, own trust-alarm input and a
direct health dispatch fixed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev 0c380bd294b63f6c3e0e224d519e94ef239d8ec5 parent b06da7a
2 files changed, +115 −22
  • docs/superpowers/specs/2026-11-12-edge-proxy-protocol-design.md +46 −22
  • docs/superpowers/specs/ASTRA-FINDINGS-edge-ppv2-R3.md +69 −0

CI cancelled — superseded by a newer push — run details

diff --git a/docs/superpowers/specs/2026-11-12-edge-proxy-protocol-design.md b/docs/superpowers/specs/2026-11-12-edge-proxy-protocol-design.md
index 46653a36d..580b6479d 100644
--- a/docs/superpowers/specs/2026-11-12-edge-proxy-protocol-design.md
+++ b/docs/superpowers/specs/2026-11-12-edge-proxy-protocol-design.md
@@ -1,6 +1,6 @@
# PROXY protocol v2 on the region HA load balancers
-Design, 2026-11-12, **rev 4** (Astra rounds 1 and 2 applied, §12 and §13; round 2 repeated fault family F1, so under stopping rule 2 the choice went to Paul: **option A, one-way PROXY protocol, decided 2026-11-12** by agent manager 8a3d302 on Paul's standing acceptance of recommendations, Paul informed and free to override; §14). Rev 4 writes A in, with the alarm and the close-all action; Astra round 3 is the last. Agent manager 8a3d302 asked for it on 2026-11-12 with Paul's approval: client IP preservation off and PROXY protocol v2 on, on both target groups of each region NLB, before G6 opens the NLBs to customers. Design only; the build is a separate GO. Review budget: at most three Astra rounds (AGENTS.md stopping rules); rounds 1 and 2 each found one P1 in fault family F1, so two rounds are spent and the third waits on §14.
+Design, 2026-11-12, **rev 5** (Astra rounds 1 to 3 applied, §12, §13 and §15. **Round 3, the last, was NOT READY with one P1 in F1: the round limit is reached and §15's fix needs 8a3d302's go; no fourth round.** Earlier: round 2 repeated fault family F1, so under stopping rule 2 the choice went to Paul: **option A, one-way PROXY protocol, decided 2026-11-12** by agent manager 8a3d302 on Paul's standing acceptance of recommendations, Paul informed and free to override; §14). Rev 4 wrote A in; rev 5 applies round 3's P2s and proposes the barrier for its P1 (§4.7, §15). Agent manager 8a3d302 asked for it on 2026-11-12 with Paul's approval: client IP preservation off and PROXY protocol v2 on, on both target groups of each region NLB, before G6 opens the NLBs to customers. Design only; the build is a separate GO. Review budget: at most three Astra rounds (AGENTS.md stopping rules); all three rounds are spent.
Line citations are to `origin/main` at ae1b8cca. AWS facts quote "Edit target group attributes for your Network Load Balancer" (docs.aws.amazon.com/elasticloadbalancing/latest/network/edit-target-group-attributes.html, read 2026-11-12) unless another page is named.
@@ -24,11 +24,11 @@ Today on both NLBs (read 2026-11-12, `~/.cache/ppv2/aws/`):
## 2. What changes, in one paragraph
-Each target group stops preserving the client address and sends a PROXY protocol v2 header instead. The target then sees every NLB connection coming from one of the NLB's own private addresses, on a source port the NLB chose, so two client connections can never share a 4-tuple at the target. The edge learns the client address from the header. It reads a header as identity only on connections whose socket peer is one of its region NLB's private addresses, listed in a new host-env key; it rewrites the connection's remote address to the header's source before net/http sees it, so every reader of `r.RemoteAddr` downstream (rate limits, protection, geo, records, analytics, `X-Forwarded-For`) sees the client exactly as today. A header from any other peer is consumed and ignored. A trusted connection without a client address may only answer the health check. The cutover flips one attribute on one target group per step, through states where every target handles every new connection correctly, each forward step proven converged on every NLB node before the next. PROXY protocol is one-way: once on, it never goes off, so the one unsafe state (preservation off with PROXY protocol off) is never a step. The tooling refuses it, an alarm detects it for the whole armed lifetime, and one root action closes every connection it could have touched. The price is stated in §7.3: once a target group has PROXY protocol on, no edge older than this release can run behind it again.
+Each target group stops preserving the client address and sends a PROXY protocol v2 header instead. The target then sees every NLB connection coming from one of the NLB's own private addresses, on a source port the NLB chose, so two client connections can never share a 4-tuple at the target. The edge learns the client address from the header. It reads a header as identity only on connections whose socket peer is one of its region NLB's private addresses, listed in a new host-env key; it rewrites the connection's remote address to the header's source before net/http sees it, so every reader of `r.RemoteAddr` downstream (rate limits, protection, geo, records, analytics, `X-Forwarded-For`) sees the client exactly as today. A header from any other peer is consumed and ignored. A trusted connection without a client address may only answer the health check. The cutover flips one attribute on one target group per step, through states where every target handles every new connection correctly, each forward step proven converged on every NLB node before the next. PROXY protocol is one-way: once on, it never goes off, so the one unsafe state (preservation off with PROXY protocol off) is never a step. The tooling refuses it, an alarm detects it for the whole armed lifetime, and a root barrier takes identity away from every connection it could have touched (proposed in rev 5, §15). The price is stated in §7.3: once a target group has PROXY protocol on, no edge older than this release can run behind it again.
## 3. Guarantee and invariant
-**The trust invariant.** A node address grants trust to the first header on a connection only because the NLB writes that header. That holds only while the target group has PROXY protocol on. With preservation off and PROXY protocol off (S3, §6.2) the node address still arrives as the peer, the NLB writes nothing, and a client's own header would be read as the NLB's: any client could choose its address, and that address reaches limits and the signed `X-Forwarded-For` (`homemap.go:1684-1718`, `forwardproof.go:44-51`). So **S3 is a security state, not a degraded one**. It is kept out by making PROXY protocol one-way: the only moves are S0 to S1, S1 to S2 and S2 to S1 (§6.2), none of which can pass through S3 however the NLB nodes disagree mid-change, and the step tooling refuses every other move (§6.3). S3 then needs someone to turn PROXY protocol off outside the tooling. That is detected for the whole armed lifetime, not only in a window, by the edge's trust-violation metric and its alarm (§4.5): in S3 every client that sends no header of its own is refused, so the metric is loud. The incident (§6.5) restores preservation and closes every trusted connection at once with a root action (§4.7).
+**The trust invariant.** A node address grants trust to the first header on a connection only because the NLB writes that header. That holds only while the target group has PROXY protocol on. With preservation off and PROXY protocol off (S3, §6.2) the node address still arrives as the peer, the NLB writes nothing, and a client's own header would be read as the NLB's: any client could choose its address, and that address reaches limits and the signed `X-Forwarded-For` (`homemap.go:1684-1718`, `forwardproof.go:44-51`). So **S3 is a security state, not a degraded one**. It is kept out by making PROXY protocol one-way: the only moves are S0 to S1, S1 to S2 and S2 to S1 (§6.2), none of which can pass through S3 however the NLB nodes disagree mid-change, and the step tooling refuses every other move (§6.3). S3 then needs someone to turn PROXY protocol off outside the tooling. That is detected for the whole armed lifetime, not only in a window, by the edge's trust-violation metric and its alarm (§4.5): in S3 every client that sends no header of its own is refused, so the metric is loud. The incident (§6.5) raises a trust barrier on every target, which closes trusted connections and keeps any later or half-parsed one from carrying an identity (§4.7), and then restores preservation.
**Fixed:** with preservation off, two client connections through the NLB never share a 4-tuple at a target: the NLB allocates the source address and port toward each target, so the documented collision cannot happen. Hairpin connections through the NLB work too (AWS: "you can also prevent this type of connection error by disabling client IP preservation"), which removes the A21 limit (region HA spec 2026-10-26 §12.4).
@@ -98,15 +98,17 @@ Per listener and, for trusted connections, per node address, since start: `proxi
### 4.6 A trusted connection without a client address answers the health check only
-A `no-client` connection has an NLB node as its socket peer and no client to key limits on, and outside the health check it exists only in S3 (§4.4). So a request on it is served only when it is a `GET` or `HEAD` of `/.carlos/lb-health` on `:80`, the path `lbHealthAnswer` already answers first (`internal/edge/edge.go:3795-3799`, `internal/edge/lbhealth.go:34-48`). Every other request on such a connection, on either listener, is answered `503` with `Connection: close`, before any routing, rate limit, analytics or forwarding, and counted `no_client_refused`. The check is one wrapper around each public server's handler that reads the parse state (§4.3).
+A `no-client` connection has an NLB node as its socket peer and no client to key limits on, and outside the health check it exists only in S3 (§4.4). So a request on it is served only when it is a `GET` or `HEAD` of `/.carlos/lb-health` on `:80`, and then the outer wrapper calls `lbHealthAnswer` (`internal/edge/lbhealth.go:34-48`) directly, never entering the ordinary handler chain: in that chain `redirectDemoRequest` runs before the health branch (`internal/edge/edge.go:3788-3799`, `demo.go:94`), so a demo `Host` would otherwise escape. If `lbHealthAnswer` declines (region HA off), the answer is 503. Every other request on such a connection, on either listener, is answered `503` with `Connection: close`, before any routing, rate limit, analytics or forwarding, and counted `no_client_refused`. The check is one wrapper around each public server's handler that reads the parse state (§4.3). Tests cover ordinary, demo and unknown `Host` values.
So no request ever reaches a client-address reader without a client address: `clientIP(r)` (`internal/edge/analytics.go:100-115`) always answers a real client, nothing is forwarded with a node address in `X-Forwarded-For`, and analytics never sees an empty address (`internal/analytics/meter.go:68`, `:191` would otherwise hash it into one shared visitor).
In S3, ordinary clients (no header of their own) are refused loudly by this rule. A client that sends its own header is still believed; only §6 prevents that.
-### 4.7 Closing every trusted connection
+### 4.7 The trust barrier (rev 5, **proposed, pending 8a3d302's go**; replaces rev 4's one-shot `close-trusted`, see §15)
-A root action on the box, `carlos system edge close-trusted`, makes the edge close at once, without a drain, every open public connection whose parse state is `proxied` or `no-client`, and report how many. It goes through the root-only drain socket that W6's and §25's root verbs already use (`internal/host/hadrain_socket.go`; the agent holds the edge in-process, `internal/host/ingressdrain.go:87-88`), served on every armed box, not through any public listener. The wrapper keeps the set of live trusted connections for it (added when the state resolves, removed on close). New connections are not refused: the action is for after preservation is back on (§6.5), when new connections are untrusted and safe. In-flight requests on the closed connections fail and clients reconnect; nothing else on the box changes. The action is the incident's containment step, so it does not depend on a drain, a roll or the target group finishing anything.
+A root command on the box, `carlos system edge trust-barrier`, raises a barrier in the edge. While it is up, a trusted connection's header grants no identity: **every** connection from a node address, whether open, still parsing its header, or accepted later, is treated as `no-client` (§4.6) once its state resolves, so it can answer the health check and nothing else. Raising the barrier sets it before it closes anything: first the flag, then it closes every open connection from a node address, pending ones included. The wrapper tracks trusted connections from accept, not from parse, for this. A connection that finishes a forged header after the flag is up is still `no-client`; a node still in S3 that sends new connections meets the same rule. Health checks keep passing, so targets stay in service, and in S0 or S1 every client connection is untrusted and served as normal.
+
+The barrier is written to a file in the agent's state directory and read at edge start, so a restart does not lower it. Only `carlos system edge trust-resume` lowers it, run after the target group is verified back in S1 or S2 by the marker probe (§6.4). The step script refuses a forward step while any target's barrier is up. The commands are root CLI verbs that reach the agent the way W6's and §25's verbs do: a child that drops to the agent's user and calls the drain socket (`internal/host/hadrain_call.go`, `hadrain_socket_linux.go:23`, which admits only the agent's UID). The agent holds the edge in-process (`internal/host/ingressdrain.go:87-88`). Each reports how many connections it closed and the barrier state; the state also goes in the §4.5 journal line.
## 5. Client IP everywhere it is used
@@ -139,7 +141,7 @@ In this order:
2. **The bootstrap object at vN or later.** Members run the separately seeded bootstrap binary (`group-init.sh.tftpl:200-215`) for `host-env write` (`:332`), and it refuses a key outside its compiled allowlist (`internal/hostenv/group.go:112`). So the region's `boot/bootstrap-object` and `boot/bootstrap-sha256` name a vN build, checked from SSM and the object's hash, **before** the key is published.
3. **The key.** `CARLOS_INGRESS_PROXY_SOURCES` equal to the module output (§8.1): in the region's host-env parameters, then a group roll so every member is launched with it (members write host.env only at launch, `hostenv.go:144-150`), and in each fixed box's host.env with a drained restart, as W6 delivered `CARLOS_INGRESS_TARGET_GROUPS`. Each target's journal shows the §4.5 armed line with exactly the module's addresses.
4. **The group module at vN**, whose precondition accepts the new states (§8.2). A group plan with the old module would refuse once the TGs change.
-5. **Metrics and alarm.** `CARLOS_HOST_METRICS=cloudwatch` on every target; the module's `IngressProxyTrustViolations` alarm applied and in OK (§4.5, §8.1).
+5. **Metrics and alarm.** `CARLOS_HOST_METRICS=cloudwatch` on every target; the module's `proxy_trust_alarm` input set, both alarms applied, in OK, and notification delivery seen (§4.5, §8.1, §8.3).
Arming changes nothing on the wire: until step A80 no connection carries a header, and trusted peers are only health checks, which §4.6 serves.
@@ -189,12 +191,12 @@ What each state answers, per NLB address. On `:443` the request goes to the echo
| S0 | 200, probe's address | 200, probe's address (client header ignored, §4.4) | 302 | 302 |
| S1 | 200, probe's address | fails: the NLB's header is first, the marker is payload (TLS error) | 302 | fails: 400 |
| S2 | 200, probe's address | fails, the same way | 302 | fails: 400 |
-| S3 | 503, refused (§4.6) | **200 with 192.0.2.1: forgery** | 503 | **302: forgery, invisible from outside** |
+| S3 | 503, refused (§4.6) | connection closed by the edge; `marker_trusted` counts it | 503 | the same |
-Because `:80` cannot show the forged address, the edge itself counts it: a trusted `proxied` header whose source is in 192.0.2.0/24 (TEST-NET-1, never a real client) closes the connection and increments `marker_trusted`, logged at warning level. That counter above zero means S3 on that target's port, whatever the probe saw.
+The edge catches the forged marker itself: a trusted `proxied` header whose source is in 192.0.2.0/24 (TEST-NET-1, never a real client) closes the connection before any response and increments `marker_trusted`, logged at warning level. So the probe never sees a forged echo; `marker_trusted` above zero means S3 on that target's port. (A marker that fails in S1 or S2 fails with an answer, 400 or a TLS alert; a marker closed in S3 gets none. The probe records which, but the counter is the verdict.)
Convergence of a step, per TG port, needs all of:
-- after A: the marker fails on **both** NLB addresses for 30 consecutive attempts (60 s); plain stays 200 with the probe's address;
+- after A: the marker fails on **both** NLB addresses for 30 consecutive attempts (60 s); plain stays at its port's answer on both addresses (`:443`: 200 with the probe's address; `:80`: 302, not followed);
- after B: the same, plus every target's counters show `proxied` rising from **both** node addresses and `no_client_refused` at 0;
- all the time: `malformed`, `timeout`, `ignored_private` and `marker_trusted` at 0.
@@ -202,17 +204,17 @@ Convergence of a step, per TG port, needs all of:
The script writes the record (times, counts, per-address results) that the next step requires.
-**Any marker answer echoing 192.0.2.1, any `marker_trusted`, or any `no_client_refused` is S3 on some node: §6.5 at once.** The probe runs for the whole window, not only between steps; outside windows the alarm (§4.5) carries the watch.
+**Any `marker_trusted` or any `no_client_refused` is S3 on some node: §6.5 at once.** The probe runs for the whole window, not only between steps; outside windows the alarm (§4.5) carries the watch.
### 6.5 Rollback and the S3 incident
**Rollback ends at S1.** B443 then B80 back, each preservation **on**, by the step script or, in an abort, the direct command. S1 is today's client addresses through the NLB and today's collision behaviour, which is everything a rollback needs to restore; the edge stays armed and keeps ignoring the NLB's header as in S1. A80 and A443 are never reversed (§6.2, §7.3). No convergence proof is needed for S2 to S1, because every node is in S1 or S2 throughout and neither trusts a client header.
-**S3 incident** (the alarm, any `marker_trusted`, or a marker answer echoing 192.0.2.1):
-1. Preservation **on** for the affected TG with the direct command (§6.3). New connections land in S0 (if PPv2 was turned off) or S1; neither trusts a client header.
-2. On every target in that TG, `carlos system edge close-trusted` (§4.7), run over SSM on all of them at once. Every connection that could carry a forged address is gone within seconds, without waiting for a drain or a roll. Clients reconnect as untrusted.
-3. Find who turned PPv2 off. Then go forward again with the step script (S0 to S1 to S2) in a window.
-4. Report to 8a3d302 with the alarm, the counters and the close-trusted counts.
+**S3 incident** (the alarm, any `marker_trusted`, or any `no_client_refused`):
+1. `carlos system edge trust-barrier` (§4.7) on every target in that TG, over SSM on all of them at once. From that moment no connection from a node address carries an identity, open, pending or new, and the forged ones are closed. Health checks keep passing.
+2. Preservation **on** for the affected TG with the direct command (§6.3). New client connections become untrusted (S0 or S1) and are served normally behind the barrier.
+3. Find who turned PPv2 off. Verify the TG is in S1 with the marker probe on both addresses, then `trust-resume` on every target, then go forward with the step script (S1 to S2) in a window.
+4. Report to 8a3d302 with the alarm, the counters and the barrier's close counts.
### 6.6 Order across NLBs
@@ -266,8 +268,9 @@ Unchanged. Targets already admit 80 and 443 from the NLB's security group (`grou
- `aws_lb_target_group.target` (`ingress/main.tf:97-126`): `preserve_client_ip` and `proxy_protocol_v2` from two map variables keyed by port (`{ "80" = ..., "443" = ... }`), defaults `true` and `false`, so a root can flip one TG at a time and re-pinning to vN plans no TG change. A validation refuses any port with preservation off and PPv2 off (S3).
- Output `proxy_protocol_sources`: the node private addresses, sorted. One singular `data "aws_network_interface"` per zone in `var.zones` (keys known at plan time), filtered on `description = "ELB ${aws_lb.nlb.arn_suffix}"` and that zone's `subnet-id`, each yielding exactly one interface and its `private_ip`. (The plural `aws_network_interfaces` returns only IDs.)
-- Alarm on `PortAllocationErrorCount` Sum > 0 over 5 minutes, beside the module's existing alarms (`ingress/alarms.tf`), on the module's topic.
-- Alarm `<name>-proxy-trust` on `Carlos/Host` `IngressProxyTrustViolations` (§4.5), Maximum > 0 for one 60 s period, `treat_missing_data = "notBreaching"`, gated on `var.regional_metrics` and dimensioned like the clock and admission alarms (`ingress/alarms.tf:49-90`).
+- A new input, `proxy_trust_alarm = object({ deployment = string, region = string, topic_arn = string })`, default null, separate from `regional_metrics` (`ingress/variables.tf:68`) so that setting it does not also switch on the clock and admission alarms. A precondition on the target groups refuses any port with PPv2 on while it is null: no TG gets PPv2 without its alarm.
+- Alarm `<name>-proxy-trust` on `Carlos/Host` `IngressProxyTrustViolations` (§4.5), dimensions `Deployment` and `Region` from that input, Maximum > 0 for one 60 s period, `treat_missing_data = "notBreaching"`, actions and OK actions on its `topic_arn`.
+- Alarm `<name>-port-allocation` on `AWS/NetworkELB` `PortAllocationErrorCount`, Sum > 0 over 5 minutes, on the same topic. Both alarms exist only when the input is set.
### 8.2 This repo, `infra/modules/region-host/group.tf` (rides vN)
@@ -275,7 +278,9 @@ The existing-target-group precondition (`group.tf:182-187`) requires `preserve_c
### 8.3 Roots
-- **dev, platform-infrastructure:** re-pin `dev/region-ha-ingress.tf` and `dev/region-ha-group.tf` to vN (no TG change; one new alarm); bootstrap object to vN; `CARLOS_INGRESS_PROXY_SOURCES` into `/carlos/dev/ie/` and into leo's and sophie's host.env; group roll; then the four steps through `scripts/ppv2-step.sh`.
+Neither root sets `regional_metrics` on the ingress module today (pinfra `dev/region-ha-ingress.tf:24` has it commented out with no topic; carloku-infrastructure `region-ha-us.tf:5` has a topic and no `regional_metrics`), so the trust alarm cannot ride it; that is why it has its own input. Each root sets `proxy_trust_alarm` with its deployment bucket and region code (the `Carlos/Host` dimensions its boxes publish) and a confirmed topic: on the flagship, the topic the module already uses; on dev, the region HA alert topic the dev root already publishes to (the plan quotes its ARN). The re-pin to vN then plans **2 to add** (the two alarms), 0 to change, 0 to destroy. Delivery is verified on the card with one test datapoint and the notification seen (§10 row 11).
+
+- **dev, platform-infrastructure:** re-pin `dev/region-ha-ingress.tf` (with `proxy_trust_alarm`) and `dev/region-ha-group.tf` to vN; bootstrap object to vN; `CARLOS_INGRESS_PROXY_SOURCES` into `/carlos/dev/ie/` and into leo's and sophie's host.env; group roll; then the four steps through `scripts/ppv2-step.sh`.
- **flagship, carloku-infrastructure:** push vN to the GitHub mirror, bump `?ref=` on `region-ha-us.tf` and `region-ha-us-group.tf`, the same sequence with adi.
First-of-kind applies need 8a3d302's GO; later NLBs' identical steps fall under the standing approval for counted applies when the plan and the step script's record match the card exactly.
@@ -288,7 +293,7 @@ First-of-kind applies need 8a3d302's GO; later NLBs' identical steps fall under
- hostenv: the key's validation (private IPv4, 1-16, no duplicates), in both `Assemble` and the group `write` path.
- Tofu: `ingress` tests for the defaults (S0), each per-port step, the S3 refusal and the output with one interface per zone; `group.tf` test for the precondition in all four states.
- The step script: a dry-run mode tested against recorded `describe-target-group-attributes` outputs for every allowed and refused move, PPv2 off refused from every state.
-- `close-trusted` (§4.7): closes `proxied` and `no-client` connections, leaves `plain` ones, reports the count, and is reachable only on the drain socket.
+- The trust barrier (§4.7): raised, it closes open and pending trusted connections and leaves `plain` ones; a partial header completed after it is raised resolves to `no-client`; a trusted connection accepted after it answers only the health check; it survives an edge restart; only `trust-resume` lowers it; it is reachable only through the drain socket's caller path.
- The activation guard (§7.3): with the key set, a staged binary without the `ingress-proxy-v2` feature (including one with no `version --json`) is refused by `apply`, `rollback` and `install-channel`, and the running binary stays; without the key, nothing changes.
- The trust-violation metric: the agent publishes the per-minute increase of `no_client_refused` plus `marker_trusted`, and nothing on an unarmed box.
- `go vet` and cross-builds (darwin, windows) for the new package.
@@ -308,7 +313,7 @@ Dev rows, all in one window:
8. **Collision row:** from one host, 200 pairs of connections with the same source port to both NLB addresses (the lost-post repro), in S0 and then S2. In S2, target-side `ss` shows the pairs as distinct 4-tuples from the node addresses. S0 is expected to pass too (the repro never failed); the row shows the mechanism, not a before and after.
9. **Rollback drill:** B443 then B80 back to S1 through the script, under the probe and the held connections, 0 errors; then forward to S2 again with convergence records.
10. **Refusals, dry:** the step script refuses S0 to S2, S2 to S0 and S1 to S0 against the live TG, and the module refuses an S3 plan. S3 itself is never entered.
-11. **Containment and alarm, safely:** on one target in S2, `close-trusted` closes its NLB connections (the held connections of row 3 reconnect through the NLB, 0 failed probe requests beyond the closed in-flight ones), and the trust-violation alarm is shown to fire by publishing one test datapoint, then returns to OK.
+11. **Containment and alarm, safely:** with the TG back in S1 (row 9), raise the barrier on one target: its health checks keep passing, the probe's plain requests keep answering (in S1 they are untrusted), the barrier survives one drained edge restart, then `trust-resume`. The races (a pending header completed after the barrier, a trusted accept after it) are covered by §9's tests, since only the NLB can open a trusted connection. Separately, publish one test datapoint and see the trust alarm fire, notify (the message received) and return to OK.
12. **The activation guard:** on one armed fixed box, `carlos system apply` of a build below vN is refused with the reason and the box keeps serving.
Flagship rows: 1, 2, 3 (one held connection of each kind), 4 (echo and burst), 5 (2 adi restarts), 8 in S2 only, 11 (the alarm datapoint only).
@@ -317,7 +322,7 @@ Flagship rows: 1, 2, 3 (one held connection of each kind), 4 (echo and burst), 5
1. **Hairpin redirect (§7.4):** kept; retiring it is a later, separate change.
2. **Direct rollback command (§6.3):** allowed for preservation **on** only, in an abort or S3 incident, reconciled by a no-change tofu plan after.
-3. **S3 containment (§6.5):** `close-trusted` on every target (§4.7) replaced rev 3's drained restarts and member roll.
+3. **S3 containment (§6.5):** a root action on every target replaced rev 3's drained restarts and member roll; rev 5 proposes the barrier form of it (§4.7, §15).
4. **When:** build after this is approved; dev window on the first dev roll after vN; flagship before G6. The dormant code's switch-on date is that dev window.
## 12. Astra round 1 and where it went
@@ -357,3 +362,22 @@ F1 is "client bytes becoming trusted identity". It lives in one AWS state the ed
**C. Stop the work.** Keep preservation on. Clients behind port-preserving NAT keep the rare 20-30 s connect hang on HA-pool names (§1). G6 opens with the known limit.
Recommendation was **A**: it removes the unprovable transition rather than proving it, and costs nothing a rollback needs. Astra round 3 reviews rev 4, as the last round.
+
+## 15. Astra round 3 (the last) and the open P1
+
+`docs/superpowers/specs/ASTRA-FINDINGS-edge-ppv2-R3.md`, NOT READY. Round 2 dispositions: R2.1 (F1) partly (one-way PPv2 removed the unsafe rollback; containment still leaks), R2.2 partly, R2.3 resolved. Astra recommends no further round.
+
+| Finding | Fault family | Disposition |
+|---|---|---|
+| P1: rev 4's one-shot `close-trusted` misses a connection still parsing its header (it completes a forged header afterwards) and connections a node still in S3 opens after the action | **F1, third round** | **Open; fix proposed in rev 5 §4.7 (the trust barrier), needs 8a3d302's go.** |
+| P2: the convergence gate demanded 200 on `:80`; the S3 marker row contradicted the edge's own close | rollout evidence | Fixed: per-port expectations (302 not followed on `:80`), S3 marker row is "closed, `marker_trusted`" (§6.4). |
+| P2: neither root sets `regional_metrics`, so the trust alarm would not exist; setting it would also switch on clock and admission alarms | detection config | Fixed: own input `proxy_trust_alarm`, required before any TG gets PPv2, both roots set it, delivery checked (§8.1, §8.3). |
+| P2: a `no-client` health request with a demo `Host` would hit `redirectDemoRequest` before the health branch | health-only boundary | Fixed: the wrapper calls `lbHealthAnswer` directly (§4.6). |
+| P3: the drain socket admits the agent's UID, not root | description | Fixed in §4.7's text. |
+
+**The P1 and its proposed fix.** Both races share one cause, which Astra names: containment had no barrier covering every trusted peer, only a sweep of the ones already parsed. Rev 5 replaces the sweep with a barrier that is state, not an action: while it is up, a trusted connection's header grants no identity, whenever it was accepted and whenever its header completes; the flag is set before the sweep, so nothing slips between them; it persists across restarts; only an explicit resume after the marker probe shows S1 lowers it. That is Astra's own suggested direction ("refusing trusted application traffic during containment"), and it costs nothing in S0 or S1, where no client traffic is trusted. It does not touch the one-way decision.
+
+It has not been reviewed. Under the stopping rules a fourth round needs Paul's go. The choices for 8a3d302:
+1. **Accept rev 5's barrier without another round** (recommended). The change is one flag checked at one point (the parse state's resolution) plus its persistence and two verbs; §9 tests the two races directly, and the build's whole-branch review covers it.
+2. **A fourth Astra round on §4.7 only**, scoped to the barrier.
+3. **Cut containment back to "stop public ingress"** in an S3 incident (deregister or drain every target), Astra's other suggestion: simpler to state, but an outage for every HA-pool app until the TG is verified, where the barrier keeps serving.
diff --git a/docs/superpowers/specs/ASTRA-FINDINGS-edge-ppv2-R3.md b/docs/superpowers/specs/ASTRA-FINDINGS-edge-ppv2-R3.md
new file mode 100644
index 000000000..d0d2c9f97
--- /dev/null
+++ b/docs/superpowers/specs/ASTRA-FINDINGS-edge-ppv2-R3.md
@@ -0,0 +1,69 @@
+- **R2.1 P1 — S3 exclusion and containment: partly resolved.** One-way PPv2 removes the unsafe rollback transition. The new close action still permits forged connections to survive containment.
+- **R2.2 P2 — Port-80 probe: partly resolved.** The response table distinguishes ports, but the convergence gate still requires an impossible port-80 response.
+- **R2.3 P2 — Health gates versus maintenance: resolved.** §6.4 separates transition gates from named maintenance withdrawals.
+
+1. **P1 — `close-trusted` does not close every potentially forged connection (§§4.7, 6.5).**
+
+ **Evidence:** [Design:109](/home/paulca/amadan.net/carlos/platform-ppv2/docs/superpowers/specs/2026-11-12-edge-proxy-protocol-design.md:109) registers connections only when parsing resolves, closes only `proxied` and `no-client`, and explicitly continues accepting connections. [Design:212](/home/paulca/amadan.net/carlos/platform-ppv2/docs/superpowers/specs/2026-11-12-edge-proxy-protocol-design.md:212) restores preservation and immediately runs this one-shot close.
+
+ **Failure scenarios:**
+
+ - An attacker opens an S3 connection and sends a partial header. It remains `pending` during `close-trusted`, so the action misses it. The attacker completes a forged header within the ten-second deadline afterward. The connection becomes `proxied` and can serve requests indefinitely. Restoring preservation does not change an existing connection’s peer.
+ - While preservation-on propagates, a node still in S3 accepts another connection after that target’s close action. Nothing prevents it from establishing another forged identity.
+
+ The resulting address feeds forwarding at [homemap.go:1685](/home/paulca/amadan.net/carlos/platform-ppv2/internal/edge/homemap.go:1685) and is signed at [forwardproof.go:51](/home/paulca/amadan.net/carlos/platform-ppv2/internal/edge/forwardproof.go:51). AWS confirms preservation changes affect only new connections. [https://docs.aws.amazon.com/elasticloadbalancing/latest/network/edit-target-group-attributes.html](https://docs.aws.amazon.com/elasticloadbalancing/latest/network/edit-target-group-attributes.html)
+
+ **Concrete fix:** Track trusted socket peers from acceptance, including pending parsers. Make containment establish a persistent refusal barrier before closing that population, covering concurrent accepts and parse completion. Keep it until explicitly verified recovery; alternatively, stop public ingress during containment. Add witnesses for a partial header spanning the action and a new connection from a node still in S3.
+
+ **Fault family:** **F1 — client-controlled bytes becoming trusted identity.**
+
+2. **P2 — The convergence gate still cannot pass on port 80 (§6.4).**
+
+ **Evidence:** [Design:197](/home/paulca/amadan.net/carlos/platform-ppv2/docs/superpowers/specs/2026-11-12-edge-proxy-protocol-design.md:197) requires plain responses to remain `200` with the probe’s address, per target-group port; the next line inherits that requirement. Port 80 returns `302` at [edge.go:3840](/home/paulca/amadan.net/carlos/platform-ppv2/internal/edge/edge.go:3840), as the revised table correctly states.
+
+ The S3 marker row also contradicts the new detector: [design:192](/home/paulca/amadan.net/carlos/platform-ppv2/docs/superpowers/specs/2026-11-12-edge-proxy-protocol-design.md:192) predicts an echo or redirect, while line 194 closes that marker connection before either response.
+
+ **Failure scenario:** A correctly functioning A80 step cannot obtain its convergence record. A probe implementing the S3 table also expects responses the marker detector prevents.
+
+ **Concrete fix:** Make convergence explicitly require `302`, without following redirects, on port 80 and `200` plus identity on port 443. Change the S3 marker expectations to connection closure plus `marker_trusted`.
+
+ **Fault family:** **Rollout guarantees exceeding transition evidence**, carried from R2.2.
+
+3. **P2 — The root changes omit inputs needed to create and notify the trust alarm (§8).**
+
+ **Evidence:** [Design:270](/home/paulca/amadan.net/carlos/platform-ppv2/docs/superpowers/specs/2026-11-12-edge-proxy-protocol-design.md:270) gates the alarm on `regional_metrics`; [variables.tf:68](/home/paulca/amadan.net/carlos/platform-ppv2/infra/modules/region-host/ingress/variables.tf:68) defaults that input to null. The checked roots omit it:
+
+ - `platform-infrastructure@a314594d`, `dev/region-ha-ingress.tf:24`: assignment remains commented out; the module also has no alarm topic.
+ - `carloku-infrastructure@afa6ed16`, `region-ha-us.tf:5`: module supplies a topic but no `regional_metrics`.
+
+ **Failure scenario:** The repins described at [design:278](/home/paulca/amadan.net/carlos/platform-ppv2/docs/superpowers/specs/2026-11-12-edge-proxy-protocol-design.md:278) create no trust alarm. Enabling the shared input also enables the existing clock and admission alarms, so the stated “one new alarm” plan is inaccurate.
+
+ **Concrete fix:** Specify the dimensions and notification topic in both roots, account for all resulting alarms, and verify notification delivery. Alternatively, give the mandatory trust alarm its own explicit configuration.
+
+ **Fault family:** **Required detection omitted by infrastructure configuration.**
+
+4. **P2 — The health-only exception relies on incorrect handler ordering (§4.6).**
+
+ **Evidence:** [Design:101](/home/paulca/amadan.net/carlos/platform-ppv2/docs/superpowers/specs/2026-11-12-edge-proxy-protocol-design.md:101) says `lbHealthAnswer` already answers first. In fact, [edge.go:3788](/home/paulca/amadan.net/carlos/platform-ppv2/internal/edge/edge.go:3788) calls `redirectDemoRequest` before the health handler. That function selects an upstream at [demo.go:94](/home/paulca/amadan.net/carlos/platform-ppv2/internal/edge/demo.go:94) and can return a demo response.
+
+ **Failure scenario:** A `no-client` request matching the permitted health method and path, but carrying a demo Host, passes the proposed exception and reaches host routing or a demo response instead of the health answer.
+
+ **Concrete fix:** Have the outer wrapper dispatch permitted `no-client` health requests directly to `lbHealthAnswer`, without entering the ordinary handler chain. Test ordinary, demo and unknown Host values.
+
+ **Fault family:** **Identity-free connections escaping the health-only boundary.**
+
+5. **P3 — The existing drain socket is not root-only (§4.7).**
+
+ **Evidence:** [hadrain_socket_linux.go:23](/home/paulca/amadan.net/carlos/platform-ppv2/internal/host/hadrain_socket_linux.go:23) admits the agent’s UID; root verbs use a child that drops to that UID.
+
+ **Failure scenario:** A direct root caller is rejected, while another process running as the agent can call the socket. This differs from [design:109](/home/paulca/amadan.net/carlos/platform-ppv2/docs/superpowers/specs/2026-11-12-edge-proxy-protocol-design.md:109).
+
+ **Concrete fix:** Describe the root command and service-UID socket separately, preserving the existing caller mechanism.
+
+ **Fault family:** **Control-interface authority description.** Follow-up only.
+
+The sole outstanding P1 remains F1; both containment races share the absence of a barrier covering all trusted socket peers. Refusing trusted application traffic during containment, or cutting continued public serving during the incident, removes those races without reversing the accepted one-way PPv2 decision. This exhausts round 3; I do not recommend another review round.
+
+Reviewed `b06da7a081ac3e881300e438d0d91ecdda715bc4` against the named `ae1b8cca` code and installed Go 1.26.10 sources. No files changed, subagents spawned, test suites run or AWS calls made.
+
+**NOT READY**
\ No newline at end of file