host: fleet boxes skip the startup HA ingress record scan (#964)
On a fleet box (its region a fleet placement) the startup HA ingress pass ran the full judged instance scan: it listed accounts/ and apps/ (which the store door scopes to the box's own account) and read every record, up to four times per start. HAIngressRoutesFromRecords leaves out every record placed on a fleet, so that scan could never produce a forwarding route there. refreshHAIngressAtStart now publishes the empty projection at once on a fleet box and reads no records; the startup alias pass still runs. Every other box is unchanged. The periodic pass needs no change for this: on a fleet box its scan is the instance reconcile's own, which the box needs for its instances, and the HA ingress hook adds no reads there (a fleet placement never reaches the tombstone or manifest reads). Narrowing that scan to the box's own records is #964 follow-up (b). TestHAIngressStartupFleetBoxListsNoRecords: a fleet box's startup makes no accounts/ or apps/ listing and publishes an empty projection; a platform box (the control) still lists both. Removing the skip fails it. Census: refreshHAIngressAtStart body change, census-ruling-fleet-skip-ha-ingress-scan. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
5 files changed,
+96
−0
docs/superpowers/notes/census-proposal-fleet-skip-ha-ingress-scan.md+19 −0internal/host/haingress.go+9 −0internal/host/haingress_fleet_test.go+62 −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..44c14da14 |
| --- /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) publishes the empty projection and returns before any record read (#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: `0ae4d72ff0196d3eabb4acee069c6de61431c1a3bef669eb7ba5294104694eb8` → `cd5d58b970562c1852b03221746e880a2d08623f65a5f4c8fadbe05ecac511b5`. |
| + |
| +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..def4cd53e 100644 |
| --- a/internal/host/haingress.go |
| +++ b/internal/host/haingress.go |
| @@ -206,6 +206,15 @@ 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). It publishes the empty projection at once; |
| + // the alias pass still runs. |
| + if _, fleet := registry.FleetPlacement(provisionTickConfig(os.Getenv).Region); fleet { |
| + boxHAIngress.publish(map[string]registry.Route{}, nil) |
| + 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..f3d37ac72 |
| --- /dev/null |
| +++ b/internal/host/haingress_fleet_test.go |
| @@ -0,0 +1,62 @@ |
| +package host |
| + |
| +import ( |
| + "context" |
| + "path/filepath" |
| + "strings" |
| + "testing" |
| + |
| + "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 |
| +// always leaves out, so the scan could only list and read the account's |
| +// records for nothing. The projection is published empty and complete, and |
| +// the startup alias pass still runs. A platform box still scans (the |
| +// control, which also shows the counting store sees the scan's listings). |
| +func TestHAIngressStartupFleetBoxListsNoRecords(t *testing.T) { |
| + for _, c := range []struct { |
| + region string |
| + scans bool |
| + }{{"fleet/acme", false}, {"ie", true}} { |
| + t.Run(c.region, 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") |
| + } |
| + reg, err := registry.Open(filepath.Join(t.TempDir(), "registry.db")) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + t.Cleanup(func() { reg.Close() }) |
| + boxHAIngress.routes.Store(nil) |
| + t.Cleanup(func() { boxHAIngress.routes.Store(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("%s: %d records listings, want scan=%v: %v", c.region, records, c.scans, live.got()) |
| + } |
| + if opened == 0 { |
| + t.Fatalf("%s: the startup alias pass did not open the store", c.region) |
| + } |
| + if r := boxHAIngress.routes.Load(); r == nil || len(*r) != 0 { |
| + t.Fatalf("%s: projection %v, want published and empty", c.region, r) |
| + } |
| + }) |
| + } |
| +} |
diff --git a/internal/provision/testdata/plan14-root-reads-chain.tsv b/internal/provision/testdata/plan14-root-reads-chain.tsv| index 98822ce93..6b57c7809 100644 |
| --- a/internal/provision/testdata/plan14-root-reads-chain.tsv |
| +++ b/internal/provision/testdata/plan14-root-reads-chain.tsv |
| @@ -179,3 +179,4 @@ plan14-root-reads-demo-referrer-same-origin.tsv 44b11f63c98595a70e62124034bdf518 |
| plan14-root-reads-member-backups-2a.tsv b130b2d616e6476f056f4bd3dd5a5f64dd77aca49e95718ad6419ed0fd37f2d5 |
| plan14-root-reads-member-backups-2a-landing.tsv bf37ccf4fdd0d81a1dba7370a393074b763841b349d45fb65de12a037faf01ea |
| plan14-root-reads-account-subdomains.tsv 0ae4d72ff0196d3eabb4acee069c6de61431c1a3bef669eb7ba5294104694eb8 |
| +plan14-root-reads-fleet-skip-ha-ingress-scan.tsv cd5d58b970562c1852b03221746e880a2d08623f65a5f4c8fadbe05ecac511b5 |
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..f48055001 |
| --- /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 01c068763231d10e4a315dbf9ef2a3676f93256d81cac71be55fc2d62d10cf8e 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) publishes the empty projection and returns before any record read (#964); every other box unchanged whole:Route@1631 d790ac2eb68f5204f7e18ef2d29963e20ef2a40ab58f193ce7674f825f286d63 |
| +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) publishes the empty projection and returns before any record read (#964); every other box unchanged whole:Route@1631 d790ac2eb68f5204f7e18ef2d29963e20ef2a40ab58f193ce7674f825f286d63 |
| +@coverage internal/host 04d4e00810c6c9c196f043c83ee9dd34a9edef616d9ba46895cff6a7f0209a3d |