host: keep a published HA ingress marker on a fleet box's startup
Astra review of a8fb2013, two P2s: - the fleet box's startup published an empty projection unconditionally, bypassing reconcileMu. A periodic pass may already have published refusal markers (HAIngressRoutesFromRecords gives retired HA records one before its fleet check); clearing them turned known-unavailable hosts into unknown ones. It now publishes the empty projection only where none exists (CompareAndSwap from nil). - the test cleared global state instead of restoring it. It now isolates and restores the projection, alias cache and asset authority as the startup tests do, and checks that a published marker survives (the a8fb2013 version fails that case). Census re-sealed for refreshHAIngressAtStart.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
docs/superpowers/notes/census-proposal-fleet-skip-ha-ingress-scan.md+2 −2internal/host/haingress.go+5 −3internal/host/haingress_fleet_test.go+52 −14internal/provision/testdata/plan14-root-reads-chain.tsv+1 −1internal/provision/testdata/plan14-root-reads-fleet-skip-ha-ingress-scan.tsv+3 −3
CI failed — run details
Intent
<task-notification> <task-id>bcq0vzl25</task-id> <tool-use-id>toolu_01NJt2Tm9m9g1ztkQFw85ekk</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/827c02f3-27d0-4c98-a90c-8a82a4cf9e05/tasks/bcq0vzl25.output</output-file> <status>completed</status> <summary>Background command "Run Astra review of #964 (a)" completed (exit code 0)</summary> </task-notification>
<paseo-system version="1" kind="agent-message" source-agent-id="8a3d302a-eac7-407c-b61c-f5ccc66b5544" message-id="a872e8f8-ab97-4635-82ed-d7c4b786b11c"> Agent manager 8a3d302: thanks, solid work. Yes to the DBForward listener diagnostic (test-only, about 40 lines) after #964 (a); merge on green, then park DBForward until the next failure. </paseo-system>
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| index 44c14da14..f1bb120d6 100644 |
| --- a/docs/superpowers/notes/census-proposal-fleet-skip-ha-ingress-scan.md |
| +++ b/docs/superpowers/notes/census-proposal-fleet-skip-ha-ingress-scan.md |
| @@ -4,7 +4,7 @@ Ruling `census-ruling-fleet-skip-ha-ingress-scan`. The independent reviewer appr |
| | 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 | |
| +| `internal/host/haingress.go` `refreshHAIngressAtStart` | body | unchanged (1) | a fleet box (region a fleet placement) reads no records at startup and 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`. |
| @@ -14,6 +14,6 @@ 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`. |
| +Seal: `0ae4d72ff0196d3eabb4acee069c6de61431c1a3bef669eb7ba5294104694eb8` → `ca56b1ad83a4acbb7e88975e8435f2950c1e2f4f515975e0a66be13b38a1aa66`. |
| 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 def4cd53e..f50e89cf4 100644 |
| --- a/internal/host/haingress.go |
| +++ b/internal/host/haingress.go |
| @@ -209,10 +209,12 @@ func refreshHAIngressAtStart(ctx context.Context, open func(context.Context) (re |
| // 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. |
| + // 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.publish(map[string]registry.Route{}, nil) |
| + boxHAIngress.routes.CompareAndSwap(nil, &map[string]registry.Route{}) |
| return nil |
| } |
| // Share the instance pass's publication order without waiting beyond the |
diff --git a/internal/host/haingress_fleet_test.go b/internal/host/haingress_fleet_test.go| index f3d37ac72..fe108121c 100644 |
| --- a/internal/host/haingress_fleet_test.go |
| +++ b/internal/host/haingress_fleet_test.go |
| @@ -12,28 +12,36 @@ import ( |
| // #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). |
| +// 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 { |
| - region string |
| - scans bool |
| - }{{"fleet/acme", false}, {"ie", true}} { |
| - t.Run(c.region, func(t *testing.T) { |
| + 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() }) |
| - boxHAIngress.routes.Store(nil) |
| - t.Cleanup(func() { boxHAIngress.routes.Store(nil) }) |
| + 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) { |
| @@ -49,14 +57,44 @@ func TestHAIngressStartupFleetBoxListsNoRecords(t *testing.T) { |
| } |
| } |
| if c.scans != (records > 0) { |
| - t.Fatalf("%s: %d records listings, want scan=%v: %v", c.region, records, c.scans, live.got()) |
| + t.Fatalf("%d records listings, want scan=%v: %v", records, c.scans, live.got()) |
| } |
| if opened == 0 { |
| - t.Fatalf("%s: the startup alias pass did not open the store", c.region) |
| + 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 r := boxHAIngress.routes.Load(); r == nil || len(*r) != 0 { |
| - t.Fatalf("%s: projection %v, want published and empty", c.region, r) |
| + 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 |
| + }) |
| +} |
diff --git a/internal/provision/testdata/plan14-root-reads-chain.tsv b/internal/provision/testdata/plan14-root-reads-chain.tsv| index 6b57c7809..125fcbf24 100644 |
| --- a/internal/provision/testdata/plan14-root-reads-chain.tsv |
| +++ b/internal/provision/testdata/plan14-root-reads-chain.tsv |
| @@ -179,4 +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 |
| +plan14-root-reads-fleet-skip-ha-ingress-scan.tsv ca56b1ad83a4acbb7e88975e8435f2950c1e2f4f515975e0a66be13b38a1aa66 |
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| index f48055001..1cf6040f9 100644 |
| --- 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 |
| @@ -1,5 +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 |
| +@legacy 104902f6ca5ae5e70f68ea2d0fbab299457490c85cb0002730480d1b122e9b49 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 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 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 ad23394304d08fd9163979836e31e4388ed61556c35f7fb8da6d777161e8553f |