host: fleet boxes skip the startup HA ingress record scan (#964)
A fleet box never forwards HA ingress (HAIngressRoutesFromRecords leaves out every fleet-placed record), so its startup pass listed and read the account records for nothing while holding reconcileMu until its 5 s budget ran out. The dev witness measured the first reconcile at +17.2 s. A fleet box now skips the scan and does not take reconcileMu; it publishes the empty projection only where none exists, so a refusal marker a pass already published stands. Platform boxes are unchanged. Tests witness both: no records listing and no wait on a held reconcileMu. Census ruling census-ruling-fleet-skip-ha-ingress-scan, approved by Astra on #280. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Squashed from fleet-skip-ha-ingress-scan into main.
5 files changed,
+179
−0
docs/superpowers/notes/census-proposal-fleet-skip-ha-ingress-scan.md+19 −0internal/host/haingress.go+11 −0internal/host/haingress_fleet_test.go+143 −0internal/provision/testdata/plan14-root-reads-chain.tsv+1 −0internal/provision/testdata/plan14-root-reads-fleet-skip-ha-ingress-scan.tsv+5 −0
CI passed — run details
diff --git a/docs/superpowers/notes/census-proposal-fleet-skip-ha-ingress-scan.md b/docs/superpowers/notes/census-proposal-fleet-skip-ha-ingress-scan.md| new file mode 100644 |
| index 000000000..7693dd0ae |
| --- /dev/null |
| +++ b/docs/superpowers/notes/census-proposal-fleet-skip-ha-ingress-scan.md |
| @@ -0,0 +1,19 @@ |
| +# Census approval: fleet-skip-ha-ingress-scan |
| + |
| +Ruling `census-ruling-fleet-skip-ha-ingress-scan`. The independent reviewer approves or rejects every change below, 0 with a new disposition; nothing goes to the census owner (Paul, #280, 2026-10-26). |
| + |
| +| unit | change | read sites | what changed | |
| +|---|---|---|---| |
| +| `internal/host/haingress.go` `refreshHAIngressAtStart` | body | unchanged (1) | a fleet box (region a fleet placement) reads no records at startup and does not wait on reconcileMu; it publishes the empty projection only where none exists (CompareAndSwap from nil), so a published refusal marker stands (#964); every other box unchanged | |
| + |
| +Envelopes re-pinned: `internal/host`. |
| + |
| +Review: a model from the other family than the author reads the branch's diff against main on the amadan.net remote (`origin` or `amadan`, whichever points at amadan.net) and gives a verdict for every unit and every re-pinned envelope above. For a unit, compare the change with its recorded disposition and basis below; for an envelope, read every changed function in the package and what it reaches. Reject if the change lets root open, run, query or follow anything it did not before from a path or input a tenant, an app or a box agent can create, write or name; if it weakens a check, refusal, validation, argument or environment the basis relies on; or if the diff cannot settle either. Otherwise approve. Record each verdict on #280 with the tip. A rejected unit goes back to the author to correct; nothing escalates to the census owner. |
| + |
| +Recorded dispositions, which each change must still satisfy: |
| + |
| +- `internal/host/haingress.go` `refreshHAIngressAtStart`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=census-ruling-region-ha-g2-fixes;basis=Serialize a bounded startup refresh with instance reconciliation; use armed RecordView or the extracted judged record scan, then publish HA metadata. New indirect record/account/manifest/lifetime reads reuse existing store/judge paths. |
| + |
| +Seal: `c6655e82e81ccd2a7547655eb393ec3fd10bba396255a1edb30d59b7ad1e682e` → `30b6ee553f864b11c18481ce747ad98d696de462e2cb9bec5832b01c2e224104`. |
| + |
| +Overlay: `internal/provision/testdata/plan14-root-reads-fleet-skip-ha-ingress-scan.tsv`, appended to `internal/provision/testdata/plan14-root-reads-chain.tsv`. |
diff --git a/internal/host/haingress.go b/internal/host/haingress.go| index 889d1d915..f50e89cf4 100644 |
| --- a/internal/host/haingress.go |
| +++ b/internal/host/haingress.go |
| @@ -206,6 +206,17 @@ func runHAIngressStartup(ctx context.Context, open func(context.Context) (releas |
| } |
| func refreshHAIngressAtStart(ctx context.Context, open func(context.Context) (release.Store, error), judge *provision.LifetimeJudge) error { |
| + // A fleet box (its region a fleet placement) never forwards: the routes |
| + // HAIngressRoutesFromRecords builds leave out every record placed on a |
| + // fleet, so the startup scan could only list and read the account's |
| + // records for nothing (#964). The alias pass still runs. It publishes |
| + // the empty projection only where none exists yet: a pass may already |
| + // have published refusal markers (retired HA records get one before the |
| + // fleet check), and those must stand (Astra review, P2). |
| + if _, fleet := registry.FleetPlacement(provisionTickConfig(os.Getenv).Region); fleet { |
| + boxHAIngress.routes.CompareAndSwap(nil, &map[string]registry.Route{}) |
| + return nil |
| + } |
| // Share the instance pass's publication order without waiting beyond the |
| // startup attempt's deadline for a pass already in flight. |
| for !reconcileMu.TryLock() { |
diff --git a/internal/host/haingress_fleet_test.go b/internal/host/haingress_fleet_test.go| new file mode 100644 |
| index 000000000..0af9897ca |
| --- /dev/null |
| +++ b/internal/host/haingress_fleet_test.go |
| @@ -0,0 +1,143 @@ |
| +package host |
| + |
| +import ( |
| + "context" |
| + "errors" |
| + "path/filepath" |
| + "strings" |
| + "testing" |
| + "time" |
| + |
| + "github.com/carlosframework/platform/internal/registry" |
| + "github.com/carlosframework/platform/internal/release" |
| +) |
| + |
| +// #964 (a): a fleet box's startup HA ingress pass makes no records listing. |
| +// Its region is a fleet placement, whose records HAIngressRoutesFromRecords |
| +// never routes, so the scan could only list and read the account's records |
| +// for nothing. The startup alias pass still runs. Where no projection exists |
| +// the empty one is published; one a pass already published (a retired HA |
| +// record's refusal marker) stands (Astra review, P2). A platform box still |
| +// scans (the control, which also shows the counting store sees the scan). |
| +func TestHAIngressStartupFleetBoxListsNoRecords(t *testing.T) { |
| + for _, c := range []struct { |
| + name, region string |
| + scans bool |
| + marker bool // a refusal marker published before startup |
| + }{ |
| + {"fleet", "fleet/acme", false, false}, |
| + {"fleet keeps a published marker", "fleet/acme", false, true}, |
| + {"platform box", "ie", true, false}, |
| + } { |
| + t.Run(c.name, func(t *testing.T) { |
| + t.Setenv("CARLOS_REGION", c.region) |
| + t.Setenv("CARLOS_REGION_HA", "1") |
| + if armedRecordView.Load() != nil { |
| + t.Fatal("fixture: a record view is armed") |
| + } |
| + isolateHAIngress(t) |
| + reg, err := registry.Open(filepath.Join(t.TempDir(), "registry.db")) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + t.Cleanup(func() { reg.Close() }) |
| + if c.marker { |
| + boxHAIngress.publish(map[string]registry.Route{"gone.example.com": {}}, nil) |
| + } |
| + live := newCICountingStore(t) |
| + opened := 0 |
| + runHAIngressStartup(t.Context(), func(context.Context) (release.Store, error) { |
| + opened++ |
| + return startupAliasStore{live}, nil |
| + }, newBoxJudge(claimsOffEnv), reg) |
| + |
| + records := 0 |
| + for _, call := range live.got() { |
| + method, key, _ := strings.Cut(call, " ") |
| + if strings.HasPrefix(method, "List") && (strings.HasPrefix(key, "apps/") || strings.HasPrefix(key, "accounts/")) { |
| + records++ |
| + } |
| + } |
| + if c.scans != (records > 0) { |
| + t.Fatalf("%d records listings, want scan=%v: %v", records, c.scans, live.got()) |
| + } |
| + if opened == 0 { |
| + t.Fatal("the startup alias pass did not open the store") |
| + } |
| + r := boxHAIngress.routes.Load() |
| + if r == nil { |
| + t.Fatal("no projection published") |
| + } |
| + if rt, known := (*r)["gone.example.com"]; c.marker != known || rt.HA { |
| + t.Fatalf("projection %v: the published refusal marker kept=%v, want %v", *r, known, c.marker) |
| + } |
| + if !c.marker && len(*r) != 0 { |
| + t.Fatalf("projection %v, want empty", *r) |
| + } |
| + }) |
| + } |
| +} |
| + |
| +// isolateHAIngress clears the box's HA ingress projection, alias claim cache |
| +// and asset authority for one test and restores them after, as |
| +// testHAIngressStartupForwards does. |
| +func isolateHAIngress(t *testing.T) { |
| + t.Helper() |
| + oldRoutes, oldNames, oldAliases, oldEpoch := boxHAIngress.routes.Load(), boxHAIngress.regional.Load(), boxHAIngress.aliases.Load(), boxHAIngress.epoch |
| + oldAuthority := boxAssetAuthority |
| + boxHAIngress.routes.Store(nil) |
| + boxHAIngress.regional.Store(nil) |
| + boxHAIngress.aliases.Store(nil) |
| + boxHAIngress.epoch = 0 |
| + aliasClaimCache.Reset() |
| + boxAssetAuthority = newAssetAuthority(nil) |
| + t.Cleanup(func() { |
| + boxHAIngress.routes.Store(oldRoutes) |
| + boxHAIngress.regional.Store(oldNames) |
| + boxHAIngress.aliases.Store(oldAliases) |
| + boxHAIngress.epoch = oldEpoch |
| + aliasClaimCache.Reset() |
| + boxAssetAuthority = oldAuthority |
| + }) |
| +} |
| + |
| +// #964 (b): a fleet box's startup HA ingress refresh does not wait on |
| +// reconcileMu, so a reconcile pass already in flight (or the first fast |
| +// tick's) is never held behind it. A platform box still serializes with the |
| +// instance pass: with reconcileMu held, its refresh waits out the attempt. |
| +func TestHAIngressStartupFleetBoxDoesNotHoldReconcile(t *testing.T) { |
| + for _, c := range []struct { |
| + name, region string |
| + waits bool |
| + }{ |
| + {"fleet", "fleet/acme", false}, |
| + {"platform box", "ie", true}, |
| + } { |
| + t.Run(c.name, func(t *testing.T) { |
| + t.Setenv("CARLOS_REGION", c.region) |
| + t.Setenv("CARLOS_REGION_HA", "1") |
| + isolateHAIngress(t) |
| + reconcileMu.Lock() |
| + defer reconcileMu.Unlock() |
| + opened := false |
| + ctx, cancel := context.WithTimeout(t.Context(), 300*time.Millisecond) |
| + defer cancel() |
| + err := refreshHAIngressAtStart(ctx, func(context.Context) (release.Store, error) { |
| + opened = true |
| + return startupAliasStore{newCICountingStore(t)}, nil |
| + }, newBoxJudge(claimsOffEnv)) |
| + if c.waits { |
| + if !errors.Is(err, context.DeadlineExceeded) || opened { |
| + t.Fatalf("platform box: err=%v opened=%v, want it to wait on reconcileMu", err, opened) |
| + } |
| + return |
| + } |
| + if err != nil || opened { |
| + t.Fatalf("fleet box: err=%v opened=%v, want an immediate return without the store", err, opened) |
| + } |
| + if r := boxHAIngress.routes.Load(); r == nil || len(*r) != 0 { |
| + t.Fatalf("fleet box: projection %v, want the empty one", r) |
| + } |
| + }) |
| + } |
| +} |
diff --git a/internal/provision/testdata/plan14-root-reads-chain.tsv b/internal/provision/testdata/plan14-root-reads-chain.tsv| index c30c10e7f..12988c77b 100644 |
| --- a/internal/provision/testdata/plan14-root-reads-chain.tsv |
| +++ b/internal/provision/testdata/plan14-root-reads-chain.tsv |
| @@ -225,3 +225,4 @@ plan14-root-reads-flat-plans.tsv 66404a2fb26ea541e99d9c3d3bd87cb3f2a346eda95cdb7 |
| plan14-root-reads-sr-followups.tsv da718fcd010b3c1db861196e0bbb9121723a9857ad16c2a15a329983688b8981 |
| plan14-root-reads-close-direct-s3-fleet-writes.tsv c6655e82e81ccd2a7547655eb393ec3fd10bba396255a1edb30d59b7ad1e682e |
| plan14-root-reads-fleet-drain-followups.tsv c6655e82e81ccd2a7547655eb393ec3fd10bba396255a1edb30d59b7ad1e682e |
| +plan14-root-reads-fleet-skip-ha-ingress-scan.tsv 30b6ee553f864b11c18481ce747ad98d696de462e2cb9bec5832b01c2e224104 |
diff --git a/internal/provision/testdata/plan14-root-reads-fleet-skip-ha-ingress-scan.tsv b/internal/provision/testdata/plan14-root-reads-fleet-skip-ha-ingress-scan.tsv| new file mode 100644 |
| index 000000000..06e9fd315 |
| --- /dev/null |
| +++ b/internal/provision/testdata/plan14-root-reads-fleet-skip-ha-ingress-scan.tsv |
| @@ -0,0 +1,5 @@ |
| +# Census overlay fleet-skip-ha-ingress-scan, written by census-propose (#369). census-ruling-fleet-skip-ha-ingress-scan, approved on #280 before the merge; the approval card is docs/superpowers/notes/census-proposal-fleet-skip-ha-ingress-scan.md. |
| +# 1 body, 0 sites, 1 envelope: each changed unit re-frozen at its existing disposition with its claim appended. |
| +@legacy 840e69d371ad863ca59696fa41194f3d7e010ce21242f121b004d3ebf0619df5 internal/host/haingress.go refreshHAIngressAtStart legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-g2-fixes;basis=Serialize a bounded startup refresh with instance reconciliation; use armed RecordView or the extracted judged record scan, then publish HA metadata. New indirect record/account/manifest/lifetime reads reuse existing store/judge paths.;rev3=census-ruling-fleet-skip-ha-ingress-scan;basis=a fleet box (region a fleet placement) reads no records at startup and does not wait on reconcileMu; it publishes the empty projection only where none exists (CompareAndSwap from nil), so a published refusal marker stands (#964); every other box unchanged whole:Route@1817 903a857f4a8ecb2376a1b4c5f3fffedb59921f064b97ca901d674ea23e17d8d0 |
| +internal/host/haingress.go refreshHAIngressAtStart legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-g2-fixes;basis=Serialize a bounded startup refresh with instance reconciliation; use armed RecordView or the extracted judged record scan, then publish HA metadata. New indirect record/account/manifest/lifetime reads reuse existing store/judge paths.;rev3=census-ruling-fleet-skip-ha-ingress-scan;basis=a fleet box (region a fleet placement) reads no records at startup and does not wait on reconcileMu; it publishes the empty projection only where none exists (CompareAndSwap from nil), so a published refusal marker stands (#964); every other box unchanged whole:Route@1817 903a857f4a8ecb2376a1b4c5f3fffedb59921f064b97ca901d674ea23e17d8d0 |
| +@coverage internal/host 8f7a34324fe2c0efdc9f9bfc7d64340da5ce644d31ac013f2ec9febf5bda81ed |