region HA: keep the forward dial gate TCP-only (item 5 fix)
Invariant: the per-address dial gate shares only TCP connect evidence about an address; a TLS result belongs to the one host and request that made it. Move TLS outside the gate onto its own detached context with the original deadline, retaining canceled-request failure observations. Add the real two-host transport witness, replace the synthetic queue error with a real waiter timeout, restore the strict paused-peer assertion, and fix test import grouping. Refresh the accumulated census proposal, including the intervening paging and departure-copy changes. Validation: targeted edge/activator tests, race coverage (queue fixture teardown synchronized after its first run), census checks, vet, and Darwin arm64/Windows amd64 builds. Independent review remains pending.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
docs/superpowers/notes/census-proposal-region-ha-followups.md+4 −2docs/superpowers/notes/census-region-ha-followups-claims.md+2 −1internal/edge/forwardha.go+19 −14internal/edge/forwardha_export_test.go+83 −7internal/edge/haplacement_wiring_test.go+117 −10internal/provision/testdata/plan14-root-reads-chain.tsv+1 −1internal/provision/testdata/plan14-root-reads-region-ha-followups.tsv+8 −6
CI passed — run details
Intent
<task-notification> <task-id>a835cdd9ae252e521</task-id> <tool-use-id>toolu_012Po3rVfZUQSc19CQPLfSiZ</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/acef84d4-5254-488e-9bf2-166a4d113752/tasks/a835cdd9ae252e521.output</output-file> <status>completed</status> <summary>Agent "Opus review item 5" 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>**Verdict: NOT READY.** There is one P1, no P2s and three P3s. The targeted edge and activator tests all pass. **P1-1. One host's TLS failure now fails other hosts' forwards to the same box.** The commit moved the TLS handshake inside the dial gate. That gate is shared by every host forwarded to the same box (`forwardha.go:325-328`), but each handshake checks a certificate for one host only (`forwardha.go:331,342`; `edge.go:4319`). A failed handshake for one host is now handed to the requests already waiting on the gate, whatever host they are for (`forwardha.go:417`). It is also handed to every new dial to that box for 2 s afterwards (`forwardha.go:405-407,435`). - **Failure scenario:** host A has a bad certificate on a healthy box. Steady traffic for A keeps re-arming that 2 s failure. Requests for other tenants that need a new connection get a 503 and are noted as unreachable. For placement that marks a healthy peer suspect; for holder requests it fires `OnDepartureSuspect` against a healthy box. - **Fix:** keep the gate TCP-only, as before this commit. Do the handshake after the gate on its own detached context with the same deadline, and report a handshake failure only to that request's observation. This also brings back the strict paused-peer assertion. - **Alternative fix:** key the gate by address and server name together. **P3-1. The `queued` witness is artificial.** The test makes the gate's own dial return `errForwardDialQueued`, which never happens in production. It should drive a real waiter timing out behind a held dial. **P3-2. The looser assertion in the paused-peer burst witness is justified, but its comment understates it.** In every run, 3 of the 4 requests timed out in the queue and only the request that took the gate reported a real failure. This matches today's behaviour when TCP gets no answer, and the test still requires one real failure, recovery on the survivor and the expected lock-read count. Restore the strict assertion once P1 is fixed. If TLS stays in the gate, reword the comment and the gate doc's "millisecond dial" (`forwardha.go:380`). **P3-3. Import grouping.** `forwardha_export_test.go` puts the `boxchoice` import inside the standard-library group. **What I checked and found correct:** - The late note carries the same Ref, Gen, Kind and PeerGen as the decision, and is sent only for Placement and Recovery. - Exactly one late note is sent. - A visitor cancel alone never marks a peer suspect (R7); this holds under Go 1.26's dial-context handling. - There is no goroutine or memory leak. - The N-HA15 re-read is unchanged. - `placementPeers.note` is still the only classifier. - The handshake deadline and certificate verification for each handshake are unchanged. I created no scratch files. Findings are in `/home/paulca/amadan.net/carlos/platform/.claude/worktrees/region-ha-followups/.superpowers/sdd/2026-11-03-region-ha-followups/review-item5-r1.md`</result> <usage><subagent_tokens>94555</subagent_tokens><tool_uses>27</tool_uses><duration_ms>396882</duration_ms></usage> </task-notification>
Attributed to this commit: 25.5 g CO₂e (3,053,157 tokens). This is an attribution, not a measurement — usage counted from this commit's own marker forward to the next one on region-ha-followups, 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/notes/census-proposal-region-ha-followups.md b/docs/superpowers/notes/census-proposal-region-ha-followups.md| index 2d518ffb1..cfa0dddd9 100644 |
| --- a/docs/superpowers/notes/census-proposal-region-ha-followups.md |
| +++ b/docs/superpowers/notes/census-proposal-region-ha-followups.md |
| @@ -5,9 +5,10 @@ Ruling `census-ruling-region-ha-followups`. The independent reviewer approves or |
| | unit | change | read sites | what changed | |
| |---|---|---|---| |
| | `internal/host/hadeparture_identity.go` `departureIdentities.Proof` | body | unchanged (1) | Allow live EC2 fallback only after clean absence of pair, ref and iid; identity read errors, mismatches and verification failures refuse. Additional reads use the existing registry identity lookup for ref and iid separately. | |
| +| `internal/host/hadepartures_scan.go` `Controller.retryScan` | body | unchanged (1) | Use the approved operator text for permission-fault and retained-edges notices and pages. Keep persisted retry timing, permission-episode suppression and the hourly page claim unchanged; no new read or completion authority. | |
| | `internal/host/hadepartures_wiring.go` `armHADepartures` | body | unchanged (17) | Inject the existing PageOperator function into the backend when HA departures are armed; no new read or paging transport. | |
| | `internal/activator/haadopt.go` `Service.AdoptHost` | sites | +whole:Route | Attach a per-acquire termination proof observer to finalizer acquisitions so refusals retain alarms; avoid duplicate fallback observations. The observer receives the existing route and departure ref for paging; no new storage read or takeover authority. | |
| -| `internal/activator/hatakeover.go` `ExecBackend.reportTakeover` | sites | +registry:Host ×2 | Page only departure-finalize proof refusals through the injected host sink, at warning level and once per host per hour. Read the existing route Host for page throttling and body; no new storage read or takeover authority. | |
| +| `internal/activator/hatakeover.go` `ExecBackend.reportTakeover` | sites | +registry:Host ×3 | Page only departure-finalize proof refusals through the injected host sink, at warning level and once per host per hour. Send on a detached five-second context and log send failures. Read the existing route Host for page throttling, body and failure logging; no new storage read or takeover authority. | |
| | `internal/edge/forwardha.go` `Edge.frontForwardHA` | sites | +registry:Host, +whole:Route | Report detached TCP/TLS failure after a canceled Placement or Recovery request through the existing NoteForward classifier, preserving Ref, Gen and PeerGen. Reuse the route Host to correlate the late result; no new storage read or routing authority. | |
| Envelopes re-pinned: `internal/activator`, `internal/edge`, `internal/host`, `internal/lease`, `internal/termfence`. |
| @@ -17,11 +18,12 @@ Review: a model from the other family than the author reads the branch's diff ag |
| Recorded dispositions, which each change must still satisfy: |
| - `internal/host/hadeparture_identity.go` `departureIdentities.Proof`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=B3b: read immutable box bytes and local verified bindings; require AWS signature plus independent fixed/group binding, unique ref/iid, exact digest and known scope. Unknown walks persist one 1000-key page and at most 32 new GETs per turn; errors never prove absence. |
| +- `internal/host/hadepartures_scan.go` `Controller.retryScan`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=B4: Read only the bound departure to persist bounded retry timing and the existing hourly per-departure page claim. No completion authority. Fix r1/P15: bound detached retry bookkeeping to five seconds so cancellation still records backoff/page. Permission episodes use only the structured ha_departure_permission_fault code and key, never wake-state prose. B4 fix r4/P18: Retained fixed edges use the existing persisted 30/60/120/300-second retry and hourly departure claim, emitting only ha_departure_edges_retained plus the key. Skip generic prose paging for that code. B4 fix r5: After the existing durable hourly claim succeeds for retained fixed edges, keep the structured log and send PageOperator a warning with subject ha_departure_edges_retained and body code/key/box fields through the existing bounded alert sinks. Return delivery errors; never call the generic C3 page for this state. No new read site or completion authority. B5: Emit permission notice only on permission_new, the persisted fault-episode transition; suppress repeat hourly permission logs. Other departure pages retain the durable hourly claim. |
| - `internal/host/hadepartures_wiring.go` `armHADepartures`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=B3 fix r1: Install proof adapter, adoption identity and suspicion callbacks before asynchronous startup. Lazily retry the same deployment/data clients; lifetime callback reads only the current host through ExecBackend.TerminationLifetime. Add bounded structured paging for unresolved per-iid records. No new bucket, tenant input path or acquire bypass. B4: Wire the shared lock reader and existing AdoptHost entry. Read local route, Pair and duty revision only after authoritative inventory eligibility; bind its record lifetime and refuse missing/mismatched local routes. No route synthesis or pool widening. B5: Publish the armed controller to the existing metrics sampler. No new loop, remote source or process authority. |
| - `internal/activator/haadopt.go` `Service.AdoptHost`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Serialize through the existing host operation state. Read local route/revision/receipt plus configured lock/manifest/wake objects; use only restricted ordinary acquire, exact guarded restore, ordinary unclean release and verified readback for adoption. No process launch, local-copy reuse or secret access. B3: pass the optional shared durable termination proof adapter into the existing restricted finalizer acquire. The adapter validates the exact classified peer and current host lifetime, uses the acquire data-bucket client, and cannot bypass expiry or CAS. No new read in this unit. B4: A first scanner import may reuse its staging lock observation; the ordinary acquire still rereads and compares the exact ETag/generation and expiry. Existing receipt replay keeps its fresh read. No new read path or takeover authority. |
| - `internal/activator/hatakeover.go` `ExecBackend.reportTakeover`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Final fix P2-1: report all refused proof results through the per-host alarm and distinguish visitor from departure-finalize. No reads or authority. |
| - `internal/edge/forwardha.go` `Edge.frontForwardHA`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=census-ruling-region-ha-p1b2;basis=new (region HA P1b-2): the agent's edge decides at the front door whether to forward a visitor request: reads the route's HA flag and host from the box's own registry row and asks the activator; forwards only to a box in view over the existing signed hop; root never calls it;rev3=census-ruling-region-ha-dead-holder-backoff;basis=ForwardTarget returns a ForwardDecision (Ref, Refuse, Gen); a Refuse is answered at the front door with the existing unreachable answer (503, Retry-After: 10, same body, via answerHolderUnreachable), with no forward, dial, note or per-request step. A forward passes the decision to forwardHA and NoteForward carries Ref and Gen back. The round-1 connection callback (NoteConnected) is gone: the dial bound now lives in forwardTransport's forwardDialGate, which coalesces TCP dials per holder address in memory. The same 5 read sites; no new read; root never calls it.;rev3=census-ruling-region-ha-p1b3a;basis=Pass the existing route to a lazy cached wakeSnapshot closure, handle explicit local denial before all accounting, and refuse a disappeared Placement choice rather than falling through locally; whole Route read only, no new store or filesystem operation and no root authority.;rev3=census-ruling-edge-held-streams;basis=the edge in the agent (carlos-edge.service, user carlos): for a marked request to a hibernating HA route it uses the new HAForwarderFromMemory (ForwardTargetFromMemory) instead of ForwardTarget, so the hold path makes no holder-lock read; a non-stream marked request is left to this box's classification, and a holder not known from memory is answered with the one-retry event. The unmarked path is unchanged. Reads only the request mark and the already-loaded route and home map; no read added. |
| -Seal: `6ef1e3bc1dbacd5b548b1cbfe3a6d37bd5f701e03969feef2736212ee11713df` → `61ed62d78faa0788b1afa997ac966cf69350fdf99914e90b7e70eb8d934e0470`. |
| +Seal: `6ef1e3bc1dbacd5b548b1cbfe3a6d37bd5f701e03969feef2736212ee11713df` → `cfb026f1f9d59f325937cbddf26df2d94d5240d1f7846e80db713b8f6a15c387`. |
| Overlay: `internal/provision/testdata/plan14-root-reads-region-ha-followups.tsv`, appended to `internal/provision/testdata/plan14-root-reads-chain.tsv`. |
diff --git a/docs/superpowers/notes/census-region-ha-followups-claims.md b/docs/superpowers/notes/census-region-ha-followups-claims.md| index 3ee3bb947..bce3436d1 100644 |
| --- a/docs/superpowers/notes/census-region-ha-followups-claims.md |
| +++ b/docs/superpowers/notes/census-region-ha-followups-claims.md |
| @@ -1,5 +1,6 @@ |
| internal/host/hadeparture_identity.go:departureIdentities.Proof Allow live EC2 fallback only after clean absence of pair, ref and iid; identity read errors, mismatches and verification failures refuse. Additional reads use the existing registry identity lookup for ref and iid separately. |
| internal/activator/haadopt.go:Service.AdoptHost Attach a per-acquire termination proof observer to finalizer acquisitions so refusals retain alarms; avoid duplicate fallback observations. The observer receives the existing route and departure ref for paging; no new storage read or takeover authority. |
| internal/host/hadepartures_wiring.go:armHADepartures Inject the existing PageOperator function into the backend when HA departures are armed; no new read or paging transport. |
| -internal/activator/hatakeover.go:ExecBackend.reportTakeover Page only departure-finalize proof refusals through the injected host sink, at warning level and once per host per hour. Read the existing route Host for page throttling and body; no new storage read or takeover authority. |
| +internal/activator/hatakeover.go:ExecBackend.reportTakeover Page only departure-finalize proof refusals through the injected host sink, at warning level and once per host per hour. Send on a detached five-second context and log send failures. Read the existing route Host for page throttling, body and failure logging; no new storage read or takeover authority. |
| internal/edge/forwardha.go:Edge.frontForwardHA Report detached TCP/TLS failure after a canceled Placement or Recovery request through the existing NoteForward classifier, preserving Ref, Gen and PeerGen. Reuse the route Host to correlate the late result; no new storage read or routing authority. |
| +internal/host/hadepartures_scan.go:Controller.retryScan Use the approved operator text for permission-fault and retained-edges notices and pages. Keep persisted retry timing, permission-episode suppression and the hourly page claim unchanged; no new read or completion authority. |
diff --git a/internal/edge/forwardha.go b/internal/edge/forwardha.go| index 6b4574ec3..aaae7b500 100644 |
| --- a/internal/edge/forwardha.go |
| +++ b/internal/edge/forwardha.go |
| @@ -312,8 +312,8 @@ func answerHolderUnreachable(w http.ResponseWriter, r *http.Request) { |
| // is a forwardConnectError. A separate cache, so backhaulTo's 5 s transports |
| // to the same address are never this one. |
| // |
| -// Its TCP and TLS dials go through one forwardDialGate, the transport being one per |
| -// holder address: at most one dial to a holder is in flight, however many |
| +// Its TCP dials go through one forwardDialGate, the transport being one per |
| +// holder address: at most one TCP dial to a holder is in flight, however many |
| // requests need a connection and whatever the holder cache believes. |
| // |
| // It does the TLS itself (DialTLSContext) so that the deadline and the error |
| @@ -334,17 +334,9 @@ func (e *Edge) forwardTransport(dial string) *http.Transport { |
| } |
| ctx, cancel := context.WithTimeout(ctx, forwardDialTimeout) |
| defer cancel() |
| - conn, err := gate.dial(ctx, func(ctx context.Context) (net.Conn, error) { |
| - raw, err := forwardDial(ctx, network, net.JoinHostPort(dial, backhaulPort)) |
| - if err != nil { |
| - return nil, err |
| - } |
| - conn := tls.Client(raw, &tls.Config{ServerName: name, RootCAs: backhaulRootCAs, MinVersion: tls.VersionTLS12}) |
| - if err := conn.HandshakeContext(ctx); err != nil { |
| - raw.Close() |
| - return nil, err |
| - } |
| - return conn, nil |
| + deadline, _ := ctx.Deadline() |
| + raw, err := gate.dial(ctx, func(ctx context.Context) (net.Conn, error) { |
| + return forwardDial(ctx, network, net.JoinHostPort(dial, backhaulPort)) |
| }) |
| if err != nil { |
| if observation, ok := ctx.Value(forwardDialObservationKey{}).(*forwardDialObservation); ok && !errors.Is(err, errForwardDialQueued) { |
| @@ -352,6 +344,19 @@ func (e *Edge) forwardTransport(dial string) *http.Transport { |
| } |
| return nil, &forwardConnectError{err} |
| } |
| + // A certificate result belongs to this host and request, never to |
| + // the address's TCP waiters or standing failure. Let the handshake |
| + // finish after cancellation, within the original dial deadline. |
| + hctx, hcancel := context.WithDeadline(context.WithoutCancel(ctx), deadline) |
| + defer hcancel() |
| + conn := tls.Client(raw, &tls.Config{ServerName: name, RootCAs: backhaulRootCAs, MinVersion: tls.VersionTLS12}) |
| + if err := conn.HandshakeContext(hctx); err != nil { |
| + raw.Close() |
| + if observation, ok := ctx.Value(forwardDialObservationKey{}).(*forwardDialObservation); ok { |
| + observation.update(true, false) |
| + } |
| + return nil, &forwardConnectError{err} |
| + } |
| return conn, nil |
| }, |
| ResponseHeaderTimeout: backhaulHeaderTimeout, |
| @@ -370,7 +375,7 @@ func (e *Edge) forwardTransport(dial string) *http.Transport { |
| return tr |
| } |
| -// forwardDialGate serializes one holder address's TCP and TLS dials: at most one is |
| +// forwardDialGate serializes one holder address's TCP dials: at most one is |
| // in flight, always. A dial that arrives while one is in flight waits for |
| // its outcome. A failure answers every waiter at once with its error, and |
| // every dial that arrives until the failed one's forwardDialTimeout has run |
diff --git a/internal/edge/forwardha_export_test.go b/internal/edge/forwardha_export_test.go| index 631cabe56..1412bd8c7 100644 |
| --- a/internal/edge/forwardha_export_test.go |
| +++ b/internal/edge/forwardha_export_test.go |
| @@ -2,16 +2,20 @@ package edge |
| import ( |
| "context" |
| + "crypto/tls" |
| "errors" |
| "fmt" |
| - "github.com/carlosframework/platform/internal/boxchoice" |
| "io" |
| "net" |
| "net/http" |
| + "net/http/httptest" |
| + "strings" |
| "sync" |
| "sync/atomic" |
| "testing" |
| "time" |
| + |
| + "github.com/carlosframework/platform/internal/boxchoice" |
| ) |
| // The forward scene (forwardha_test.go) for forwardha_wiring_test.go, the |
| @@ -21,6 +25,7 @@ import ( |
| // HAForwardHost is the born-HA host both boxes of the scene serve. |
| const HAForwardHost = fwHost |
| +const HAForwardOtherHost = fwAssetHost |
| // HAForwardHolder is the holder box's ref in the scene. |
| const HAForwardHolder = "betty" |
| @@ -61,7 +66,11 @@ func (s *HAForwardScene) Get(path string) (status int, retryAfter, body string, |
| } |
| func (s *HAForwardScene) GetContext(ctx context.Context, path string) (status int, retryAfter, body string, err error) { |
| - req, err := http.NewRequestWithContext(ctx, http.MethodGet, "https://"+fwHost+path, nil) |
| + return s.GetHostContext(ctx, fwHost, path) |
| +} |
| + |
| +func (s *HAForwardScene) GetHostContext(ctx context.Context, host, path string) (status int, retryAfter, body string, err error) { |
| + req, err := http.NewRequestWithContext(ctx, http.MethodGet, "https://"+host+path, nil) |
| if err != nil { |
| return 0, "", "", err |
| } |
| @@ -88,13 +97,17 @@ func (s *HAForwardScene) HolderDown(blackholed bool) { |
| }) |
| } |
| -func (s *HAForwardScene) EnablePlacement(t *testing.T) { |
| +func (s *HAForwardScene) EnablePlacement(t *testing.T, otherHosts ...string) { |
| t.Helper() |
| + var hosts []string |
| + for _, host := range append([]string{fwHost}, otherHosts...) { |
| + hosts = append(hosts, fmt.Sprintf(`%q:{"role":"home","account":"abc","app":"shop"}`, host)) |
| + } |
| s.x.a.homes.privateDial = true |
| for _, ref := range []string{"annie", "betty"} { |
| putJSON(t, s.x.seed, "control/edges/"+ref+".json", fmt.Sprintf( |
| - `{"v":1,"box":%q,"eip":"127.0.0.1","region":"ie","generation":%q,"data_bucket":"bkt","secrets_key_fp":"fp","capabilities":["region-ha-1"],"hibernation_configured":true,"headroom":{"mem_free_mib":50,"mem_total_mib":100,"disk_free_mib":50,"disk_total_mib":100},"hosts":{%q:{"role":"home","account":"abc","app":"shop"}}}`, |
| - ref, time.Now().UTC().Format(time.RFC3339Nano), fwHost)) |
| + `{"v":1,"box":%q,"eip":"127.0.0.1","region":"ie","generation":%q,"data_bucket":"bkt","secrets_key_fp":"fp","capabilities":["region-ha-1"],"hibernation_configured":true,"headroom":{"mem_free_mib":50,"mem_total_mib":100,"disk_free_mib":50,"disk_total_mib":100},"hosts":{%s}}`, |
| + ref, time.Now().UTC().Format(time.RFC3339Nano), strings.Join(hosts, ","))) |
| } |
| s.x.converge(t) |
| } |
| @@ -137,8 +150,6 @@ func (s *HAForwardScene) HoldDial(t *testing.T, mode string) (<-chan struct{}, f |
| a, b := net.Pipe() |
| b.Close() |
| return a, nil |
| - case "queued": |
| - return nil, fmt.Errorf("%w: %w", errForwardDialQueued, context.DeadlineExceeded) |
| } |
| var d net.Dialer |
| return d.DialContext(ctx, network, s.x.b.tlsAddr) |
| @@ -155,3 +166,68 @@ func (s *HAForwardScene) PlacementDecision(t *testing.T) ForwardDecision { |
| } |
| return s.x.a.edge.act.(HAForwarder).ForwardTarget(t.Context(), *rt, func() boxchoice.WakeSnapshot { return s.x.a.homes.wakeSnapshot(*rt, time.Now()) }) |
| } |
| + |
| +// ShortenSecondDialWait leaves the first connect held while a real waiter expires. |
| +func (s *HAForwardScene) ShortenSecondDialWait(t *testing.T) (queuedDone, firstDone <-chan struct{}) { |
| + t.Helper() |
| + dial, ok := s.x.a.homes.boxInView(HAForwardHolder, time.Now()) |
| + if !ok { |
| + t.Fatal("peer not in view") |
| + } |
| + tr := s.x.a.edge.forwardTransport(dial) |
| + original := tr.DialTLSContext |
| + var calls atomic.Int64 |
| + done, first := make(chan struct{}), make(chan struct{}) |
| + tr.DialTLSContext = func(ctx context.Context, network, addr string) (net.Conn, error) { |
| + switch calls.Add(1) { |
| + case 1: |
| + defer close(first) |
| + case 2: |
| + ctx, cancel := context.WithTimeout(ctx, 50*time.Millisecond) |
| + defer cancel() |
| + defer close(done) |
| + return original(ctx, network, addr) |
| + } |
| + return original(ctx, network, addr) |
| + } |
| + return done, first |
| +} |
| + |
| +func (s *HAForwardScene) CloseIdleForwards() { |
| + s.x.a.edge.forwardTransports.Range(func(_, v any) bool { |
| + v.(*http.Transport).CloseIdleConnections() |
| + return true |
| + }) |
| +} |
| + |
| +// HoldBadHostHandshake serves the healthy host's certificate for the other host. |
| +func (s *HAForwardScene) HoldBadHostHandshake(t *testing.T) (<-chan struct{}, func()) { |
| + t.Helper() |
| + started, release := make(chan struct{}), make(chan struct{}) |
| + var startOnce, releaseOnce sync.Once |
| + resume := func() { releaseOnce.Do(func() { close(release) }) } |
| + server := httptest.NewUnstartedServer(s.x.b.edge) |
| + server.TLS = &tls.Config{MinVersion: tls.VersionTLS12, GetCertificate: func(hello *tls.ClientHelloInfo) (*tls.Certificate, error) { |
| + if hello.ServerName == HAForwardOtherHost { |
| + startOnce.Do(func() { close(started) }) |
| + select { |
| + case <-release: |
| + case <-hello.Context().Done(): |
| + return nil, hello.Context().Err() |
| + } |
| + copy := *hello |
| + copy.ServerName = HAForwardHost |
| + hello = © |
| + } |
| + return s.x.b.live.Load().getCert(hello) |
| + }} |
| + server.StartTLS() |
| + old := forwardDial |
| + forwardDial = func(ctx context.Context, network, _ string) (net.Conn, error) { |
| + s.dials.Add(1) |
| + var d net.Dialer |
| + return d.DialContext(ctx, network, server.Listener.Addr().String()) |
| + } |
| + t.Cleanup(func() { resume(); s.CloseIdleForwards(); server.Close(); forwardDial = old }) |
| + return started, resume |
| +} |
diff --git a/internal/edge/haplacement_wiring_test.go b/internal/edge/haplacement_wiring_test.go| index 23503294b..61797aa58 100644 |
| --- a/internal/edge/haplacement_wiring_test.go |
| +++ b/internal/edge/haplacement_wiring_test.go |
| @@ -23,12 +23,14 @@ type placementAcquire struct { |
| held *lease.Held |
| acquires int |
| notes []edge.ForwardResult |
| + noteHosts []string |
| } |
| func (a *placementAcquire) NoteForward(host string, res edge.ForwardResult) { |
| a.Service.NoteForward(host, res) |
| a.mu.Lock() |
| a.notes = append(a.notes, res) |
| + a.noteHosts = append(a.noteHosts, host) |
| a.mu.Unlock() |
| } |
| @@ -111,6 +113,7 @@ func testFrontPlacementPausedPeer(t *testing.T, previousHolder, stillHeld bool) |
| } |
| x.HolderDown(false) |
| a.notes = nil |
| + a.noteHosts = nil |
| } |
| x.PausePeer(t) |
| type answer struct { |
| @@ -148,18 +151,10 @@ func testFrontPlacementPausedPeer(t *testing.T, previousHolder, stillHeld bool) |
| if previousHolder { |
| wantKind = edge.Holder |
| } |
| - sawDialFailure := false |
| for _, note := range a.notes { |
| - // TLS now holds the same dial gate as TCP. A waiter can reach its |
| - // queue deadline before the detached handshake reports its failure. |
| - queued := note.Outcome == edge.ForwardCanceled && wantKind != edge.Holder || note.Outcome == edge.ForwardDone && wantKind == edge.Holder |
| - if note.Kind != wantKind || (note.Outcome != edge.ForwardUnreachable && !queued) || note.Ref != edge.HAForwardHolder || note.PeerGen == 0 || note.Status != 0 { |
| - t.Fatalf("forward result: %+v, want failed dial or queued kind %d", note, wantKind) |
| + if note.Kind != wantKind || note.Outcome != edge.ForwardUnreachable || note.Ref != edge.HAForwardHolder || note.PeerGen == 0 { |
| + t.Fatalf("forward result: %+v, want unreachable kind %d", note, wantKind) |
| } |
| - sawDialFailure = sawDialFailure || note.Outcome == edge.ForwardUnreachable |
| - } |
| - if !sawDialFailure { |
| - t.Fatal("no actual dial failure reached the classifier") |
| } |
| dials := x.Dials() |
| failed := time.Now() |
| @@ -225,6 +220,10 @@ func TestPlacementCanceledDialRealWiring(t *testing.T) { |
| }) |
| x := edge.NewHAForwardScene(t, a) |
| x.EnablePlacement(t) |
| + var queuedDone, firstDialDone <-chan struct{} |
| + if mode == "queued" { |
| + queuedDone, firstDialDone = x.ShortenSecondDialWait(t) |
| + } |
| started, resume := x.HoldDial(t, mode) |
| ctx, cancel := context.WithCancel(t.Context()) |
| defer cancel() |
| @@ -235,6 +234,20 @@ func TestPlacementCanceledDialRealWiring(t *testing.T) { |
| case <-time.After(3 * time.Second): |
| t.Fatal("dial never started") |
| } |
| + if mode == "queued" { |
| + status, retry, _, err := x.Get("/queued") |
| + if err != nil || status != 503 || retry != "10" { |
| + t.Fatalf("queued response: %d %q %v", status, retry, err) |
| + } |
| + select { |
| + case <-queuedDone: |
| + case <-time.After(time.Second): |
| + t.Fatal("queued dial did not finish") |
| + } |
| + if x.Dials() != 1 { |
| + t.Fatalf("waiter dialled: %d connects", x.Dials()) |
| + } |
| + } |
| cancel() |
| select { |
| case <-done: |
| @@ -263,6 +276,13 @@ func TestPlacementCanceledDialRealWiring(t *testing.T) { |
| t.Fatal("missing canceled request outcome") |
| } |
| resume() |
| + if mode == "queued" { |
| + select { |
| + case <-firstDialDone: |
| + case <-time.After(3 * time.Second): |
| + t.Fatal("detached first dial did not finish") |
| + } |
| + } |
| failed := mode == "connect" || mode == "tls" |
| if failed && !waitNote(edge.ForwardUnreachable) { |
| t.Fatal("detached dial failure never reached NoteForward") |
| @@ -293,3 +313,90 @@ func TestPlacementCanceledDialRealWiring(t *testing.T) { |
| }) |
| } |
| } |
| + |
| +func TestForwardTLSFailureIsHostLocalRealWiring(t *testing.T) { |
| + fx := locktest.NewLockFixture(t) |
| + cfg := activator.Config{Bucket: fx.Bucket, Idle: time.Hour, Self: func() hafresh.Self { return hafresh.Self{Ref: "annie", IID: "i-a"} }} |
| + a := &placementAcquire{Service: activator.New(cfg, &activator.ExecBackend{Cfg: cfg}, nil)} |
| + t.Cleanup(func() { a.Service.Shutdown(context.Background()) }) |
| + // A is a true holder; its own failure must not change B's placement peer. |
| + held, err := json.Marshal(hafresh.Lock{Generation: 9, ExpiresAt: time.Now().Add(time.Minute), Owner: hafresh.OwnerFor(hafresh.Self{Ref: "betty", IID: "i-b"}, 7, true)}) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + fx.PutLock(activator.HibernatePrefix("", edge.HAForwardOtherHost), held) |
| + marker, err := hafresh.MarkerBody(145, hafresh.Marker{V: 1, Box: "betty", IID: "i-b", Clean: true}) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + fx.PutLock(activator.HibernatePrefix("", edge.HAForwardHost), marker) |
| + x := edge.NewHAForwardScene(t, a) |
| + x.EnablePlacement(t, edge.HAForwardOtherHost) |
| + started, resume := x.HoldBadHostHandshake(t) |
| + type answer struct { |
| + status int |
| + body string |
| + err error |
| + } |
| + get := func(host, path string) <-chan answer { |
| + done := make(chan answer, 1) |
| + go func() { |
| + status, _, body, err := x.GetHostContext(t.Context(), host, path) |
| + done <- answer{status, body, err} |
| + }() |
| + return done |
| + } |
| + first := get(edge.HAForwardOtherHost, "/a") |
| + select { |
| + case <-started: |
| + case <-time.After(time.Second): |
| + t.Fatal("A handshake did not start") |
| + } |
| + start := time.Now() |
| + concurrent := get(edge.HAForwardHost, "/b-concurrent") |
| + var b answer |
| + select { |
| + case b = <-concurrent: |
| + case <-time.After(time.Second): |
| + t.Error("B waited behind A's TLS handshake") |
| + resume() |
| + b = <-concurrent |
| + } |
| + resume() |
| + if bad := <-first; bad.err != nil || bad.status != 503 { |
| + t.Fatalf("A: %+v, want bad certificate failure", bad) |
| + } |
| + if b.err != nil || b.status != 200 || b.body != "betty|"+edge.HAForwardHost+"|/b-concurrent" { |
| + t.Errorf("concurrent B: %+v", b) |
| + } |
| + if next := x.PlacementDecision(t); next.Ref != edge.HAForwardHolder || next.Kind != edge.Placement { |
| + t.Fatalf("B's peer marked suspect: %+v", next) |
| + } |
| + x.CloseIdleForwards() |
| + before := x.Dials() |
| + following := <-get(edge.HAForwardHost, "/b-following") |
| + if following.err != nil || following.status != 200 || following.body != "betty|"+edge.HAForwardHost+"|/b-following" { |
| + t.Errorf("following B: %+v", following) |
| + } |
| + if time.Since(start) >= 2*time.Second || x.Dials() != before+1 { |
| + t.Fatalf("following B did not make a new connection inside 2s: elapsed=%v dials=%d -> %d", time.Since(start), before, x.Dials()) |
| + } |
| + if next := x.PlacementDecision(t); next.Ref != edge.HAForwardHolder { |
| + t.Fatalf("following B's peer marked suspect: %+v", next) |
| + } |
| + a.mu.Lock() |
| + defer a.mu.Unlock() |
| + n := 0 |
| + for i, note := range a.notes { |
| + if a.noteHosts[i] != edge.HAForwardHost { |
| + continue |
| + } |
| + n++ |
| + if note.Kind != edge.Placement || note.Outcome != edge.ForwardDone || note.Status != 200 { |
| + t.Errorf("B note: %+v", note) |
| + } |
| + } |
| + if n != 2 { |
| + t.Fatalf("B notes = %d, want 2", n) |
| + } |
| +} |
diff --git a/internal/provision/testdata/plan14-root-reads-chain.tsv b/internal/provision/testdata/plan14-root-reads-chain.tsv| index c93b60c66..2e41cf5d0 100644 |
| --- a/internal/provision/testdata/plan14-root-reads-chain.tsv |
| +++ b/internal/provision/testdata/plan14-root-reads-chain.tsv |
| @@ -78,4 +78,4 @@ plan14-root-reads-region-ha-p1b3b-t.tsv c68e2453bfc8afaf3794eb4c08850428982fa695 |
| plan14-root-reads-region-host-store-deny.tsv 951f33500fdf9e47408fd2b8fe8cab419eaf1f6b1803b6ccd169ff19fe7882c6 |
| plan14-root-reads-managed-fleets-2a.tsv f85f8dabebc725fa75b88853af634fa9ca08323721f879e220da44c1e3fdbc38 |
| plan14-root-reads-agent-start-demo-1.tsv 6ef1e3bc1dbacd5b548b1cbfe3a6d37bd5f701e03969feef2736212ee11713df |
| -plan14-root-reads-region-ha-followups.tsv 61ed62d78faa0788b1afa997ac966cf69350fdf99914e90b7e70eb8d934e0470 |
| +plan14-root-reads-region-ha-followups.tsv cfb026f1f9d59f325937cbddf26df2d94d5240d1f7846e80db713b8f6a15c387 |
diff --git a/internal/provision/testdata/plan14-root-reads-region-ha-followups.tsv b/internal/provision/testdata/plan14-root-reads-region-ha-followups.tsv| index 954e62939..db57a8fdf 100644 |
| --- a/internal/provision/testdata/plan14-root-reads-region-ha-followups.tsv |
| +++ b/internal/provision/testdata/plan14-root-reads-region-ha-followups.tsv |
| @@ -1,17 +1,19 @@ |
| # Census overlay region-ha-followups, written by census-propose (#369). census-ruling-region-ha-followups, approved on #280 before the merge; the approval card is docs/superpowers/notes/census-proposal-region-ha-followups.md. |
| -# 2 body, 3 sites, 5 envelope: each changed unit re-frozen at its existing disposition with its claim appended. |
| +# 3 body, 3 sites, 5 envelope: each changed unit re-frozen at its existing disposition with its claim appended. |
| @legacy 483c203479120cde40c786e23804ada71cb946154c040c4dc687af44c02a8df2 internal/host/hadeparture_identity.go departureIdentities.Proof legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=B3b: read immutable box bytes and local verified bindings; require AWS signature plus independent fixed/group binding, unique ref/iid, exact digest and known scope. Unknown walks persist one 1000-key page and at most 32 new GETs per turn; errors never prove absence.;rev3=census-ruling-region-ha-followups;basis=Allow live EC2 fallback only after clean absence of pair, ref and iid; identity read errors, mismatches and verification failures refuse. Additional reads use the existing registry identity lookup for ref and iid separately. registry:Raw@925 d81bcf013b1bf180184550c4fe1db5991cf4d77c863426a0350d2121b0fb6fa5 |
| +@legacy 82819cd1bd69e3bd69d66deba797e44970909f13ed648943528e19e92db27028 internal/host/hadepartures_scan.go Controller.retryScan legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=B4: Read only the bound departure to persist bounded retry timing and the existing hourly per-departure page claim. No completion authority. Fix r1/P15: bound detached retry bookkeeping to five seconds so cancellation still records backoff/page. Permission episodes use only the structured ha_departure_permission_fault code and key, never wake-state prose. B4 fix r4/P18: Retained fixed edges use the existing persisted 30/60/120/300-second retry and hourly departure claim, emitting only ha_departure_edges_retained plus the key. Skip generic prose paging for that code. B4 fix r5: After the existing durable hourly claim succeeds for retained fixed edges, keep the structured log and send PageOperator a warning with subject ha_departure_edges_retained and body code/key/box fields through the existing bounded alert sinks. Return delivery errors; never call the generic C3 page for this state. No new read site or completion authority. B5: Emit permission notice only on permission_new, the persisted fault-episode transition; suppress repeat hourly permission logs. Other departure pages retain the durable hourly claim.;rev3=census-ruling-region-ha-followups;basis=Use the approved operator text for permission-fault and retained-edges notices and pages. Keep persisted retry timing, permission-episode suppression and the hourly page claim unchanged; no new read or completion authority. whole:HADeparture@1075 659e664756bc9750424ab043c40bbdc88e0764d873320faf0cf802b26a61614e |
| @legacy 4b3bd237cdebfb9bb284f24d4892f973956e208951694a833a92f53e5c021b74 internal/host/hadepartures_wiring.go armHADepartures legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=B3 fix r1: Install proof adapter, adoption identity and suspicion callbacks before asynchronous startup. Lazily retry the same deployment/data clients; lifetime callback reads only the current host through ExecBackend.TerminationLifetime. Add bounded structured paging for unresolved per-iid records. No new bucket, tenant input path or acquire bypass. B4: Wire the shared lock reader and existing AdoptHost entry. Read local route, Pair and duty revision only after authoritative inventory eligibility; bind its record lifetime and refuse missing/mismatched local routes. No route synthesis or pool widening. B5: Publish the armed controller to the existing metrics sampler. No new loop, remote source or process authority.;rev3=census-ruling-region-ha-followups;basis=Inject the existing PageOperator function into the backend when HA departures are armed; no new read or paging transport. registry:Account@3494,registry:Account@7088,registry:App@7115,registry:IID@3515,registry:Incarnation@7275,registry:Pool@7134,registry:Region@3505,registry:Region@7155,registry:Revision@7510,registry:Revision@7907,registry:ServingSeq@7303,whole:DutyState@7629,whole:Pair@7492,whole:Pair@7885,whole:Pair@7891,whole:Route@7075,whole:Route@7784 f9f261f51c304508d6e989e75231debc648c5b613275dea26c70acea9757e55c |
| @legacy 798811939bbc49ed2e48e5f0cf32221560070d13c68a7f5109c99a21b8a7380d internal/activator/haadopt.go Service.AdoptHost legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Serialize through the existing host operation state. Read local route/revision/receipt plus configured lock/manifest/wake objects; use only restricted ordinary acquire, exact guarded restore, ordinary unclean release and verified readback for adoption. No process launch, local-copy reuse or secret access. B3: pass the optional shared durable termination proof adapter into the existing restricted finalizer acquire. The adapter validates the exact classified peer and current host lifetime, uses the acquire data-bucket client, and cannot bypass expiry or CAS. No new read in this unit. B4: A first scanner import may reuse its staging lock observation; the ordinary acquire still rereads and compares the exact ETag/generation and expiry. Existing receipt replay keeps its fresh read. No new read path or takeover authority.;rev3=census-ruling-region-ha-followups;basis=Attach a per-acquire termination proof observer to finalizer acquisitions so refusals retain alarms; avoid duplicate fallback observations. The observer receives the existing route and departure ref for paging; no new storage read or takeover authority. registry:AcquiredGeneration@2549,registry:AcquiredGeneration@2922,registry:AcquiredGeneration@3700,registry:AcquiredGeneration@4312,registry:AcquiredGeneration@4403,registry:AcquiredGeneration@5042,registry:AcquiredGeneration@5133,registry:DepartureIID@1797,registry:DepartureIID@5641,registry:DepartureRef@1761,registry:DepartureRef@5625,registry:ExpectedPair@8079,registry:Host@1162,registry:Host@1258,registry:Host@1330,registry:Host@1399,registry:Host@1665,registry:Host@2040,registry:Host@2766,registry:Host@3103,registry:Host@3490,registry:Host@5454,registry:Host@5875,registry:Host@6060,registry:Host@7084,registry:Host@7841,registry:Host@8143,registry:Host@861,registry:Host@8706,registry:Host@959,registry:Lifetime@5677,registry:Lifetime@8048,registry:LockETag@5712,registry:LockGeneration@1833,registry:LockGeneration@5724,registry:Phase@2881,registry:Phase@2898,registry:Phase@3240,registry:Phase@3278,registry:Phase@3334,registry:Phase@4344,registry:Phase@4436,registry:Phase@4986,registry:Phase@5074,registry:Receipt@5701,registry:Revision@3122,registry:Revision@5689,registry:Sequence@3026,registry:Sequence@3046,registry:WakeDigest@2985,registry:WakeDigest@3007,whole:HAAdoption@3139,whole:HAAdoption@6016,whole:HAWakeImport@2968,whole:HAWakeImport@5596,whole:HAWakeImport@5612,whole:HAWakeImport@5620,whole:HAWakeImport@5894,whole:HAWakeImport@7850,whole:HAWakeImport@8152,whole:HAWakeImport@8244,whole:Pair@3116,whole:Pair@5888,whole:Pair@8085,whole:Pair@8105,whole:Route@1128,whole:Route@1171,whole:Route@1178,whole:Route@138,whole:Route@193,whole:Route@2698,whole:Route@3400,whole:Route@453,whole:Route@4713,whole:Route@531,whole:Route@5543,whole:Route@6597,whole:Route@6642,whole:Route@6797,whole:Route@723,whole:Route@7352,whole:Route@7937,whole:Route@889 946a102ba08ce347a42263ecc03fe95b429e7acc93547972b38cd92be4c6f7ac |
| -@legacy ee48fadb790a9a28a6dbddd4d2b94fbc4abb0dd1a49a075897097d368614bb87 internal/activator/hatakeover.go ExecBackend.reportTakeover legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Final fix P2-1: report all refused proof results through the per-host alarm and distinguish visitor from departure-finalize. No reads or authority.;rev3=census-ruling-region-ha-followups;basis=Page only departure-finalize proof refusals through the injected host sink, at warning level and once per host per hour. Read the existing route Host for page throttling and body; no new storage read or takeover authority. registry:Host@347,registry:Host@429,registry:Host@605,registry:Host@781,registry:Host@933 468e4efc3d2c7beaefa604e8741be14f5d7b198157b6680683b14bb03e3059f8 |
| +@legacy 8f854e386e1dc80beb6c68dad70615ad8c14c963b821685d9cbadfa0a25f03db internal/activator/hatakeover.go ExecBackend.reportTakeover legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Final fix P2-1: report all refused proof results through the per-host alarm and distinguish visitor from departure-finalize. No reads or authority.;rev3=census-ruling-region-ha-followups;basis=Page only departure-finalize proof refusals through the injected host sink, at warning level and once per host per hour. Send on a detached five-second context and log send failures. Read the existing route Host for page throttling, body and failure logging; no new storage read or takeover authority. registry:Host@1147,registry:Host@1299,registry:Host@347,registry:Host@429,registry:Host@870,registry:Host@973 21cd67e0d112da40a7587283a7651c4fe12fb1382124d93002bfee02d3c96897 |
| @legacy 9be352a054787e5ca61ba5bbad294e1c1a53ee4e15c81d6d70c9c9f38719cb07 internal/edge/forwardha.go Edge.frontForwardHA legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b2;basis=new (region HA P1b-2): the agent's edge decides at the front door whether to forward a visitor request: reads the route's HA flag and host from the box's own registry row and asks the activator; forwards only to a box in view over the existing signed hop; root never calls it;rev3=census-ruling-region-ha-dead-holder-backoff;basis=ForwardTarget returns a ForwardDecision (Ref, Refuse, Gen); a Refuse is answered at the front door with the existing unreachable answer (503, Retry-After: 10, same body, via answerHolderUnreachable), with no forward, dial, note or per-request step. A forward passes the decision to forwardHA and NoteForward carries Ref and Gen back. The round-1 connection callback (NoteConnected) is gone: the dial bound now lives in forwardTransport's forwardDialGate, which coalesces TCP dials per holder address in memory. The same 5 read sites; no new read; root never calls it.;rev3=census-ruling-region-ha-p1b3a;basis=Pass the existing route to a lazy cached wakeSnapshot closure, handle explicit local denial before all accounting, and refuse a disappeared Placement choice rather than falling through locally; whole Route read only, no new store or filesystem operation and no root authority.;rev3=census-ruling-edge-held-streams;basis=the edge in the agent (carlos-edge.service, user carlos): for a marked request to a hibernating HA route it uses the new HAForwarderFromMemory (ForwardTargetFromMemory) instead of ForwardTarget, so the hold path makes no holder-lock read; a non-stream marked request is left to this box's classification, and a holder not known from memory is answered with the one-retry event. The unmarked path is unchanged. Reads only the request mark and the already-loaded route and home map; no read added.;rev3=census-ruling-region-ha-followups;basis=Report detached TCP/TLS failure after a canceled Placement or Recovery request through the existing NoteForward classifier, preserving Ref, Gen and PeerGen. Reuse the route Host to correlate the late result; no new storage read or routing authority. registry:HA@225,registry:Hibernate@584,registry:Host@1833,registry:Host@2103,whole:Route@1244,whole:Route@1368,whole:Route@1836,whole:Route@2106,whole:Route@228,whole:Route@515,whole:Route@587 49fb997abc1b78de4456e64378c691fa191ca04541eddeedcddd80570989d298 |
| internal/host/hadeparture_identity.go departureIdentities.Proof legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=B3b: read immutable box bytes and local verified bindings; require AWS signature plus independent fixed/group binding, unique ref/iid, exact digest and known scope. Unknown walks persist one 1000-key page and at most 32 new GETs per turn; errors never prove absence.;rev3=census-ruling-region-ha-followups;basis=Allow live EC2 fallback only after clean absence of pair, ref and iid; identity read errors, mismatches and verification failures refuse. Additional reads use the existing registry identity lookup for ref and iid separately. registry:Raw@925 d81bcf013b1bf180184550c4fe1db5991cf4d77c863426a0350d2121b0fb6fa5 |
| +internal/host/hadepartures_scan.go Controller.retryScan legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=B4: Read only the bound departure to persist bounded retry timing and the existing hourly per-departure page claim. No completion authority. Fix r1/P15: bound detached retry bookkeeping to five seconds so cancellation still records backoff/page. Permission episodes use only the structured ha_departure_permission_fault code and key, never wake-state prose. B4 fix r4/P18: Retained fixed edges use the existing persisted 30/60/120/300-second retry and hourly departure claim, emitting only ha_departure_edges_retained plus the key. Skip generic prose paging for that code. B4 fix r5: After the existing durable hourly claim succeeds for retained fixed edges, keep the structured log and send PageOperator a warning with subject ha_departure_edges_retained and body code/key/box fields through the existing bounded alert sinks. Return delivery errors; never call the generic C3 page for this state. No new read site or completion authority. B5: Emit permission notice only on permission_new, the persisted fault-episode transition; suppress repeat hourly permission logs. Other departure pages retain the durable hourly claim.;rev3=census-ruling-region-ha-followups;basis=Use the approved operator text for permission-fault and retained-edges notices and pages. Keep persisted retry timing, permission-episode suppression and the hourly page claim unchanged; no new read or completion authority. whole:HADeparture@1075 659e664756bc9750424ab043c40bbdc88e0764d873320faf0cf802b26a61614e |
| internal/host/hadepartures_wiring.go armHADepartures legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=B3 fix r1: Install proof adapter, adoption identity and suspicion callbacks before asynchronous startup. Lazily retry the same deployment/data clients; lifetime callback reads only the current host through ExecBackend.TerminationLifetime. Add bounded structured paging for unresolved per-iid records. No new bucket, tenant input path or acquire bypass. B4: Wire the shared lock reader and existing AdoptHost entry. Read local route, Pair and duty revision only after authoritative inventory eligibility; bind its record lifetime and refuse missing/mismatched local routes. No route synthesis or pool widening. B5: Publish the armed controller to the existing metrics sampler. No new loop, remote source or process authority.;rev3=census-ruling-region-ha-followups;basis=Inject the existing PageOperator function into the backend when HA departures are armed; no new read or paging transport. registry:Account@3494,registry:Account@7088,registry:App@7115,registry:IID@3515,registry:Incarnation@7275,registry:Pool@7134,registry:Region@3505,registry:Region@7155,registry:Revision@7510,registry:Revision@7907,registry:ServingSeq@7303,whole:DutyState@7629,whole:Pair@7492,whole:Pair@7885,whole:Pair@7891,whole:Route@7075,whole:Route@7784 f9f261f51c304508d6e989e75231debc648c5b613275dea26c70acea9757e55c |
| internal/activator/haadopt.go Service.AdoptHost legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Serialize through the existing host operation state. Read local route/revision/receipt plus configured lock/manifest/wake objects; use only restricted ordinary acquire, exact guarded restore, ordinary unclean release and verified readback for adoption. No process launch, local-copy reuse or secret access. B3: pass the optional shared durable termination proof adapter into the existing restricted finalizer acquire. The adapter validates the exact classified peer and current host lifetime, uses the acquire data-bucket client, and cannot bypass expiry or CAS. No new read in this unit. B4: A first scanner import may reuse its staging lock observation; the ordinary acquire still rereads and compares the exact ETag/generation and expiry. Existing receipt replay keeps its fresh read. No new read path or takeover authority.;rev3=census-ruling-region-ha-followups;basis=Attach a per-acquire termination proof observer to finalizer acquisitions so refusals retain alarms; avoid duplicate fallback observations. The observer receives the existing route and departure ref for paging; no new storage read or takeover authority. registry:AcquiredGeneration@2549,registry:AcquiredGeneration@2922,registry:AcquiredGeneration@3700,registry:AcquiredGeneration@4312,registry:AcquiredGeneration@4403,registry:AcquiredGeneration@5042,registry:AcquiredGeneration@5133,registry:DepartureIID@1797,registry:DepartureIID@5641,registry:DepartureRef@1761,registry:DepartureRef@5625,registry:ExpectedPair@8079,registry:Host@1162,registry:Host@1258,registry:Host@1330,registry:Host@1399,registry:Host@1665,registry:Host@2040,registry:Host@2766,registry:Host@3103,registry:Host@3490,registry:Host@5454,registry:Host@5875,registry:Host@6060,registry:Host@7084,registry:Host@7841,registry:Host@8143,registry:Host@861,registry:Host@8706,registry:Host@959,registry:Lifetime@5677,registry:Lifetime@8048,registry:LockETag@5712,registry:LockGeneration@1833,registry:LockGeneration@5724,registry:Phase@2881,registry:Phase@2898,registry:Phase@3240,registry:Phase@3278,registry:Phase@3334,registry:Phase@4344,registry:Phase@4436,registry:Phase@4986,registry:Phase@5074,registry:Receipt@5701,registry:Revision@3122,registry:Revision@5689,registry:Sequence@3026,registry:Sequence@3046,registry:WakeDigest@2985,registry:WakeDigest@3007,whole:HAAdoption@3139,whole:HAAdoption@6016,whole:HAWakeImport@2968,whole:HAWakeImport@5596,whole:HAWakeImport@5612,whole:HAWakeImport@5620,whole:HAWakeImport@5894,whole:HAWakeImport@7850,whole:HAWakeImport@8152,whole:HAWakeImport@8244,whole:Pair@3116,whole:Pair@5888,whole:Pair@8085,whole:Pair@8105,whole:Route@1128,whole:Route@1171,whole:Route@1178,whole:Route@138,whole:Route@193,whole:Route@2698,whole:Route@3400,whole:Route@453,whole:Route@4713,whole:Route@531,whole:Route@5543,whole:Route@6597,whole:Route@6642,whole:Route@6797,whole:Route@723,whole:Route@7352,whole:Route@7937,whole:Route@889 946a102ba08ce347a42263ecc03fe95b429e7acc93547972b38cd92be4c6f7ac |
| -internal/activator/hatakeover.go ExecBackend.reportTakeover legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Final fix P2-1: report all refused proof results through the per-host alarm and distinguish visitor from departure-finalize. No reads or authority.;rev3=census-ruling-region-ha-followups;basis=Page only departure-finalize proof refusals through the injected host sink, at warning level and once per host per hour. Read the existing route Host for page throttling and body; no new storage read or takeover authority. registry:Host@347,registry:Host@429,registry:Host@605,registry:Host@781,registry:Host@933 468e4efc3d2c7beaefa604e8741be14f5d7b198157b6680683b14bb03e3059f8 |
| +internal/activator/hatakeover.go ExecBackend.reportTakeover legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Final fix P2-1: report all refused proof results through the per-host alarm and distinguish visitor from departure-finalize. No reads or authority.;rev3=census-ruling-region-ha-followups;basis=Page only departure-finalize proof refusals through the injected host sink, at warning level and once per host per hour. Send on a detached five-second context and log send failures. Read the existing route Host for page throttling, body and failure logging; no new storage read or takeover authority. registry:Host@1147,registry:Host@1299,registry:Host@347,registry:Host@429,registry:Host@870,registry:Host@973 21cd67e0d112da40a7587283a7651c4fe12fb1382124d93002bfee02d3c96897 |
| internal/edge/forwardha.go Edge.frontForwardHA legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b2;basis=new (region HA P1b-2): the agent's edge decides at the front door whether to forward a visitor request: reads the route's HA flag and host from the box's own registry row and asks the activator; forwards only to a box in view over the existing signed hop; root never calls it;rev3=census-ruling-region-ha-dead-holder-backoff;basis=ForwardTarget returns a ForwardDecision (Ref, Refuse, Gen); a Refuse is answered at the front door with the existing unreachable answer (503, Retry-After: 10, same body, via answerHolderUnreachable), with no forward, dial, note or per-request step. A forward passes the decision to forwardHA and NoteForward carries Ref and Gen back. The round-1 connection callback (NoteConnected) is gone: the dial bound now lives in forwardTransport's forwardDialGate, which coalesces TCP dials per holder address in memory. The same 5 read sites; no new read; root never calls it.;rev3=census-ruling-region-ha-p1b3a;basis=Pass the existing route to a lazy cached wakeSnapshot closure, handle explicit local denial before all accounting, and refuse a disappeared Placement choice rather than falling through locally; whole Route read only, no new store or filesystem operation and no root authority.;rev3=census-ruling-edge-held-streams;basis=the edge in the agent (carlos-edge.service, user carlos): for a marked request to a hibernating HA route it uses the new HAForwarderFromMemory (ForwardTargetFromMemory) instead of ForwardTarget, so the hold path makes no holder-lock read; a non-stream marked request is left to this box's classification, and a holder not known from memory is answered with the one-retry event. The unmarked path is unchanged. Reads only the request mark and the already-loaded route and home map; no read added.;rev3=census-ruling-region-ha-followups;basis=Report detached TCP/TLS failure after a canceled Placement or Recovery request through the existing NoteForward classifier, preserving Ref, Gen and PeerGen. Reuse the route Host to correlate the late result; no new storage read or routing authority. registry:HA@225,registry:Hibernate@584,registry:Host@1833,registry:Host@2103,whole:Route@1244,whole:Route@1368,whole:Route@1836,whole:Route@2106,whole:Route@228,whole:Route@515,whole:Route@587 49fb997abc1b78de4456e64378c691fa191ca04541eddeedcddd80570989d298 |
| -@coverage internal/activator ea527f56aadac16fbf3ffeffb9f9397f1bbe00571e2a25e491af4422db293066 |
| -@coverage internal/edge 0602d9dd2d176f1cdae32e0780768c84322f173929344ffa79bae849b26a0ff9 |
| -@coverage internal/host fd2b445e4d22da9609cd089451992353d4a34d7ead27211b4129c7bbbc4bb870 |
| +@coverage internal/activator 32ff596a2f6f023a26f06f2b18c27b6f399ac1111846f1a0e20ac7d7ebe6c0e0 |
| +@coverage internal/edge a3cbd20538b38c2e6c0b9174f13af4efb9a75de3106e1857af406c53c919b2bd |
| +@coverage internal/host f23595b5431d48ef6a02f1066738492b0ef8b5c4e03d4ff41e779c8eb85b52e2 |
| @coverage internal/lease 8f86fe32a2dead1e40c5137ffbeb122b0e9c4178a79c85d1907f8f9fd40404f6 |
| @coverage internal/termfence 7a07efdde97fd45351ba0692da510752b14a6f142efaa1f3061635eacd27aec9 |