console remote instances: record-write census entries
TestPlan9B8RecordWriteCensus (CI): Server.handleAppInstance changed and Server.channelHosts now lists sidecar records under SidecarsPrefix. Both read and write nothing: key-site. Layered on edgeRateLimitWriteCensusInventory as consoleRemoteInstancesWriteCensusInventory.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2 files changed,
+39
−1
internal/provision/console_remote_instances_census_test.go+38 −0internal/provision/plan9_b8_census_test.go+1 −1
CI failed — run details
diff --git a/internal/provision/console_remote_instances_census_test.go b/internal/provision/console_remote_instances_census_test.go| new file mode 100644 |
| index 000000000..d9122ed8e |
| --- /dev/null |
| +++ b/internal/provision/console_remote_instances_census_test.go |
| @@ -0,0 +1,38 @@ |
| +package provision |
| + |
| +// Record-write census entries for console-remote-instances (the console's |
| +// app pages show instances on other boxes), layered on |
| +// edgeRateLimitWriteCensusInventory (main's newest at c7996590). |
| +// Reviewed by the branch author; the census owner rules on #280 |
| +// (census-ruling-console-remote-instances, with the root-read card |
| +// docs/superpowers/notes/census-proposal-console-remote-instances.md). |
| +// No record write is added anywhere. |
| +// - Server.handleAppInstance: a remote row (an instance record with no |
| +// row in the console box's registry) takes its aliases from its box |
| +// report instead of the local ListAliases; its instances literal (the |
| +// list URL it links back to) is unchanged and it writes nothing: |
| +// key-site. |
| +// - Server.channelHosts (the canary-retire guard) now also lists the |
| +// app's sidecar records under SidecarsPrefix and reads each with |
| +// GetSidecarRecord, refusing on any read error, to count followers on |
| +// other boxes; it reads, never writes: key-site, like |
| +// Server.checkSidecars. |
| +func consoleRemoteInstancesWriteCensusInventory() []censusEntry { |
| + entries := append([]censusEntry(nil), edgeRateLimitWriteCensusInventory()...) |
| + replacements := []censusEntry{ |
| + {"internal/console/instancepage.go", "Server.handleAppInstance", "key-site", "lit:instances", "07f5c01659b0d453d5996abb6a6e9493f74c7df97e3cddfe0f765b6f316de4a7"}, |
| + {"internal/console/server.go", "Server.channelHosts", "key-site", "key:SidecarsPrefix", "0bfd742f32f4173619a9e0031c8c56cf47142762d60ec8e67a3ca1549a1028ef"}, |
| + } |
| + for _, r := range replacements { |
| + found := false |
| + for i, e := range entries { |
| + if e.File == r.File && e.Unit == r.Unit { |
| + entries[i], found = r, true |
| + } |
| + } |
| + if !found { |
| + entries = append(entries, r) |
| + } |
| + } |
| + return entries |
| +} |
diff --git a/internal/provision/plan9_b8_census_test.go b/internal/provision/plan9_b8_census_test.go| index 180079532..ebebc3b99 100644 |
| --- a/internal/provision/plan9_b8_census_test.go |
| +++ b/internal/provision/plan9_b8_census_test.go |
| @@ -366,7 +366,7 @@ func TestPlan9B8RecordWriteCensus(t *testing.T) { |
| if len(got) < 100 { |
| t.Fatalf("census found only %d units under %s; the walk is broken", len(got), root) |
| } |
| - inventory := edgeRateLimitWriteCensusInventory() |
| + inventory := consoleRemoteInstancesWriteCensusInventory() |
| problems := append(censusDiff(inventory, got), censusPolicy(inventory)...) |
| if len(problems) > 0 { |
| t.Fatalf("record-write census rejected %d site(s); update the explicit inventory only after reviewing the source:\n %s", len(problems), strings.Join(problems, "\n ")) |