region HA: control name from +rsa mirror entries too
Task 1 fix round 2 (Astra r2, F4): the hostless fallback trims the +rsa cache-key suffix to its hostname and checks it through the handshake's own certificate lookup, so an RSA-only deployment certificate addresses a control request. The hostless real-TLS test now also runs with only +rsa entries. Census envelope re-pinned.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
internal/edge/hadrain.go+10 −7internal/edge/hadrain_test.go+33 −0internal/provision/testdata/plan14-root-reads-region-ha-held-build.tsv+1 −1
Intent
<task-notification> <task-id>a79933d5fcfe210b4</task-id> <tool-use-id>toolu_01CMkfowT4qnZPsWRae8ENUv</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/283be278-5c6a-4a71-a8d6-b3d32c668985/tasks/a79933d5fcfe210b4.output</output-file> <status>completed</status> <summary>Agent "Implement Task 1: drain state" finished</summary> <note>A task-notification fires each time this agent stops with no live background children of its own. The user can send it another message and resume it, so the same task-id may notify more than once.</note> <result>Status: DONE Commit: `e2b0705a` region HA: drain acks name phase and publication; drained waits. It sits on top of `926057ca` and `ee8609ab`; nothing is pushed. All four findings are fixed, plus the P3 report note: - **F1:** every drain-state change now publishes its own `ha_drain {txn, id}`. An ask names the phase and that id, and the receiver answers only for that exact publication. `AskDrainSeen` now takes `(ctx, peer, txn, phase, id)`. - **F2:** a drained ack is only given after the fold has finished its drained effects. - **F3:** a drained fold clears the edge's own backhaul holder entries for that box, whether or not the activator is wired, before any ack. - **F4:** control requests take a verified TLS name from the certificate mirror, not from either box's host map. - **P3:** the report now explains why `haplacement.go` has no change. Tests: each finding has its regression test: - `TestHADrainSameSecondDrainedIsReadAndEvicted` - `TestHADrainedAckWaitsForEffects` - `TestHADrainedClearsBackhaulHolders` - `TestHADrainHostlessMembers` Each fails when its fix is removed. The covering runs pass in edge, activator and host, and vet and the darwin/windows builds are clean. The census test failed after the fix, so I re-ran the proposal under the same NAME and it now passes. Concerns: - The census still needs the cross-family verdict on #280. - The Task 5 driver must use the new mark API (`begin`, `waitPublished`, `setDrained`) together with `AskDrainSeen`. Report (fix section appended): /home/paulca/amadan.net/carlos/platform/.claude/worktrees/region-ha-held-build/.superpowers/sdd/2026-11-08-region-ha-held-requests/task-1-report.md</result> <usage><subagent_tokens>351154</subagent_tokens><tool_uses>18</tool_uses><duration_ms>721629</duration_ms></usage> </task-notification>
<task-notification> <task-id>b9sp5kbeg</task-id> <tool-use-id>toolu_01Uq6MfyvdZ4eqqk6u3R9efW</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/283be278-5c6a-4a71-a8d6-b3d32c668985/tasks/b9sp5kbeg.output</output-file> <status>completed</status> <summary>Background command "Wait for Task 1 re-review" completed (exit code 0)</summary> </task-notification>
Attributed to this commit: 25.9 g CO₂e (3,286,910 tokens). This is an attribution, not a measurement — usage counted from this commit's own marker forward to the next one on region-ha-held-build, 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/internal/edge/hadrain.go b/internal/edge/hadrain.go| index fb729dee1..7364e6dd4 100644 |
| --- a/internal/edge/hadrain.go |
| +++ b/internal/edge/hadrain.go |
| @@ -500,8 +500,9 @@ func (m *homeMap) controlTarget(peer string, certs *certMirror) (dial, host stri |
| return dial, host, nil |
| } |
| -// controlName is a name m holds a usable certificate for: the lowest of |
| -// prefer's exact names that has one, else the lowest exact name it holds. |
| +// controlName is a name m holds a usable certificate for, under either of |
| +// its cache keys: the lowest of prefer's exact names that has one, else the |
| +// lowest exact hostname it holds one for. |
| // "" when m is nil or holds none. |
| func (m *certMirror) controlName(prefer map[string]edgesHostView) string { |
| if m == nil { |
| @@ -516,13 +517,15 @@ func (m *certMirror) controlName(prefer map[string]edgesHostView) string { |
| if best != "" { |
| return best |
| } |
| - for name, c := range m.snapshot().certs { |
| - if name == "" || strings.Contains(name, "*") || strings.HasSuffix(name, "+rsa") || !usableFor(c, name) { |
| + // Cache keys are autocert's: "<host>" or "<host>+rsa" (certEntryNames). |
| + // Each is its hostname, checked through the same lookup a handshake |
| + // uses, so an RSA-only entry counts. |
| + for key := range m.snapshot().certs { |
| + name := strings.TrimSuffix(key, "+rsa") |
| + if name == "" || strings.Contains(name, "*") || (best != "" && name >= best) || m.certificate(name, false) == nil { |
| continue |
| } |
| - if best == "" || name < best { |
| - best = name |
| - } |
| + best = name |
| } |
| return best |
| } |
diff --git a/internal/edge/hadrain_test.go b/internal/edge/hadrain_test.go| index ee49d4d4d..1c6ad365c 100644 |
| --- a/internal/edge/hadrain_test.go |
| +++ b/internal/edge/hadrain_test.go |
| @@ -446,6 +446,39 @@ func TestHADrainHostlessMembers(t *testing.T) { |
| if _, _, err := a.be.homes.controlTarget(b.box, nil); err == nil { |
| t.Fatal("a control target without a certificate mirror") |
| } |
| + |
| + // The deployment's certificates stored only under their "+rsa" cache |
| + // keys (certEntryNames): the hostname is still found, the handshake |
| + // verifies, and the ask is answered. |
| + for _, x := range []*drainBox{a, b} { |
| + body, _, err := s.seed.Get(context.Background(), certKey(x.host)) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + if err := s.seed.Delete(context.Background(), certKey(x.host)); err != nil { |
| + t.Fatal(err) |
| + } |
| + putBucket(t, s.seed, x.host+"+rsa", body) |
| + } |
| + s.sync(t) |
| + for _, x := range []*drainBox{a, b} { |
| + snap := x.be.mirror.snapshot() |
| + if _, bare := snap.certs[x.host]; bare { |
| + t.Fatalf("%s still holds a bare-name entry", x.box) |
| + } |
| + if _, rsa := snap.certs[x.host+"+rsa"]; !rsa { |
| + t.Fatalf("%s holds no +rsa entry", x.box) |
| + } |
| + } |
| + dial, host, err := a.be.homes.controlTarget(b.box, a.edge().certs.Load()) |
| + if err != nil || host != "blog.example.com" { |
| + t.Fatalf("+rsa only: control name %q (%v), want blog.example.com", host, err) |
| + } |
| + // A new connection, so the ask makes its own verified handshake. |
| + a.edge().backhaulTransport(dial).CloseIdleConnections() |
| + if seen, err := a.edge().AskDrainSeen(context.Background(), b.box, "txn-1", DrainPhaseDraining, 101); err != nil || !seen { |
| + t.Fatalf("+rsa only: seen=%v err=%v", seen, err) |
| + } |
| } |
| // Folding a drained file runs the drained effects once per publication. |
diff --git a/internal/provision/testdata/plan14-root-reads-region-ha-held-build.tsv b/internal/provision/testdata/plan14-root-reads-region-ha-held-build.tsv| index ff65778fc..99509e71d 100644 |
| --- a/internal/provision/testdata/plan14-root-reads-region-ha-held-build.tsv |
| +++ b/internal/provision/testdata/plan14-root-reads-region-ha-held-build.tsv |
| @@ -15,5 +15,5 @@ internal/host/agent.go runAgent authority B,C,D,F rev3=census-ruling-self-serve- |
| internal/host/edgesfile.go edgesFileWriteClaims authority F,J1 rev3=census-ruling-self-serve-moves-1;basis=root-route;kept=F;scope=protected-decision-only; the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): region-ha-2a's body, which with the box's lifetimes switch on also publishes each served row's lifetime pair (registry:Incarnation and registry:ServingSeq, two new sites on the rows it already lists) and an alias's or served catch-all's primary's pair, and names that primary as target_host whatever the switch; a report the edge orders unstamped entries by, not a decision; no record, /data, release or claim read added; F,J1 authority retained; self-serve moves 1 Task 8;rev3=census-ruling-instance-egress-sizes-328-329;basis=#328 plan 2 Task 8: takes a localAddrs reader (instancectl.LocalAddresses in production, which reads /proc/net/fib_trie and /proc/net/if_inet6 in the agent) and publishes its non-loopback entries as the edges file's addrs before the write gate (boxAddrs, no read of its own), so an address change writes once. The same 44 sites, offsets moved; no record, /data, release or claim read added; a report the console's egress grant check reads, not a root decision; F,J1 authority retained.;rev3=census-ruling-edge-asset-cache-3;basis=starts with assets = assets.active(), so a policy whose box has not opened its asset store publishes no assets blocks and reads no manifests, and copies the decision's Primary (the route host the block was decided for, drift D4) into the published assets block; read sites unchanged (44); no read added. Merged onto main's #328 body, which takes the localAddrs reader: the assets.active() line sits after that signature and the loop passes pub and instancectl.LocalAddresses;rev3=census-ruling-region-ha-p1a;basis=the agent as carlos: the claims argument (*edgesClaims) becomes addrs (AddressSource) and the applyEdgesClaims(ctx, claims, routes, hosts) call is deleted with edgesclaims.go, which is the one whole:Route site removed: no host claim is read and every served row publishes as with region HA off; the box-address publication is the same code reading addrs.BoxAddresses() instead of claims.addrs; a report the edge reads, not a root decision; no read added; merge of origin/main d7ae1d76: main's edge asset cache plan 3 body is kept (census-ruling-edge-asset-cache-3): the first line is assets = assets.active(), so a policy whose store has not opened publishes no assets blocks and reads no manifests, and edgesFileLoop passes pub (assets.active() for that tick) in the assets argument; main's claims *edgesClaims argument is this branch's addrs AddressSource, and no edgesClaims, applyEdgesClaims or hostclaim reference remains;rev3=census-ruling-alias-wake-338;basis=#338 follow-up: skips publishing a platform alias edge.PlatformAliasFold refuses (and so anything attached to it); reads the same route listing;rev3=census-ruling-fleet-public-routes;basis=fleet public routes (spec 2026-10-29 rev 4, §4.2 writer rule): Task 6 and its fix rounds: publishes by FleetArmVerdict (via fleetRefusedFor): withheld rows left out; a forward host's path rows left out of its owner; no assets for forward rows; the alias loop replays Reload's alias fold from the served rows so a chained alias carries its root primary's owner; certRefused and parentRefused leave out a refused claim's wildcard parent (+registry:Alias x5, +registry:Host x4, +whole:Route, +whole:RouteAlias x2, +whole:RoutePath x7, +whole:WildcardDomain). Rows already read in the pass; keeps authority F,J1; publishes less, never more.;rev3=census-ruling-probe-burst-limit;basis=sets the constant BurstNotices=true on the box's own edges file (this build's edge answers probe-burst notices, so peers may send them); not from config or any read; the same 65 sites; a report other edges read, not a root decision; F,J1 authority retained; no new root read or write kind;rev3=census-ruling-region-ha-p3a;basis=Publish one injected role snapshot with box_role/admitted/drained; retain legacy route and alias rows during booting, cutting namespace withdrawal under the 2026-11-04 ruling; acknowledge the exact published tuple only after PUT; existing registry reads unchanged.;rev3=census-ruling-region-ha-p2b;basis=region HA P2b-1 T0 (Q1 ruling): before building the comparison copy and the body, a nil NamedPools on the identity becomes []string{} so the additive named_pools field is always an explicit array; the list itself is computed once at arm by edgesFileEligibility from the same provisionTickConfig(os.Getenv) parse as serves_shared_pool (CARLOS_POOLS through provision.ParseBoxPools, filtered to nonempty provision.ValidPool names, sorted, unique). A report the console reads for create admission, not a root decision; no record, /data, release or claim read added; read sites unchanged (65); F,J1 authority retained. One-off cost: the first pass after the upgrade writes once per box (seeded gate null vs []).;rev3=census-ruling-region-ha-p3b;basis=Require cached GroupReadersReady before first group publication and append additive names-2 capability even for supplied identities. Agent writes the same edges object/index with existing registry reads; known readers come from root boot configuration, snapshot from existing fold, no added GET/LIST or root authority.;rev3=census-ruling-region-ha-g2-fixes;basis=Omit non-forward, non-platform-alias rows outside local served pools from home publication; added Host/Pool field reads and local configuration use, existing registry/store operations retained.;rev3=census-ruling-region-ha-held-build;basis=writes also when DrainPublishRequired, and reports the written drain state, its ha_drain mark (transaction and publication id) and generation to DrainSource (in-memory); the file gains ha_drained and ha_drain beside the existing draining; no read added registry:Account@15918,registry:Alias@10421,registry:Alias@13391,registry:Alias@13441,registry:Alias@8848,registry:Alias@8867,registry:Alias@8966,registry:Alias@9020,registry:Alias@9055,registry:Alias@9117,registry:Alias@9487,registry:Alias@9644,registry:Alias@9714,registry:Alias@9746,registry:App@15930,registry:DNSStatus@9162,registry:DNSStatus@9653,registry:Host@13294,registry:Host@13314,registry:Host@13579,registry:Host@13659,registry:Host@13694,registry:Host@13743,registry:Host@14205,registry:Host@14240,registry:Host@15348,registry:Host@3963,registry:Host@4054,registry:Host@4100,registry:Host@4159,registry:Host@5274,registry:Host@6244,registry:Host@8893,registry:Host@8941,registry:Incarnation@5234,registry:Platform@5013,registry:Pool@4014,registry:Provisioned@5027,registry:Replica@5051,registry:ServingSeq@5249,registry:Status@2732,whole:Route@1026,whole:Route@17388,whole:Route@18206,whole:Route@18381,whole:Route@1841,whole:Route@2102,whole:Route@6329,whole:Route@750,whole:RouteAlias@13345,whole:RouteAlias@17410,whole:RouteAlias@18396,whole:RouteAlias@8731,whole:RouteAlias@8813,whole:RouteAlias@9005,whole:RoutePath@17403,whole:RoutePath@18389,whole:RoutePath@6113,whole:RoutePath@6145,whole:RoutePath@6192,whole:RoutePath@6220,whole:RoutePath@6258,whole:RoutePath@6278,whole:RoutePath@6290,whole:RoutePath@6344,whole:WildcardDomain@13272,whole:WildcardDomain@13648 3313d7ba7f4587179a56d76b45703ec75f105fd818a7f32bcfaf361b58664740 |
| internal/edge/hadrain.go Edge.serveHAControl legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-held-build;basis=new: answers a signed drain ask. Reads the request body (io.ReadAll under MaxBytesReader 4 KiB and a 2 s read deadline), verifies its own mesh-key MAC, requires a phase (draining or drained) and a nonzero publication id, and may refresh the edges fold (the existing refreshHosts: LIST plus GET of control/edges/ in the deployment bucket); reads no local file; answers JSON seen true or false, or a bare 404. Fix round 1: the ask names phase and publication id instead of a generation file:ReadAll@674 6f135b934ef3a804ed07bd8567e2ee4dc8db9f8abee97038d3946892ac9c1128 |
| @coverage internal/activator 67c3b9cafcb9ce380e6bf90e628cb1926bc6fe87f9428c368fae960586f0134c |
| -@coverage internal/edge 9b708161eef4bd895c8116c634fd332eeb2e193916e0329911dd3163c62d7d12 |
| +@coverage internal/edge 25f0bdd23e0ec2cf89fcb99347cbc503434d5f2109c68505236c078076e04c16 |
| @coverage internal/host 2e83bba2a89d116388857912876ebde007a7c7b7fb6a3265c04856d60185583d |