carlos / platform Public

zdd-6 task 13: fix round 1

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev a67bc75d752a2d470da4e2cd0d8a337d7ed5fa13 parent 14e0b7b
3 files changed, +54 −1
  • internal/console/apisidecars_test.go +3 −0
  • internal/provision/plan9_b8_census_test.go +1 −1
  • internal/status/dryrun.go +50 −0
diff --git a/internal/console/apisidecars_test.go b/internal/console/apisidecars_test.go
index 01a2111dd..62ff24636 100644
--- a/internal/console/apisidecars_test.go
+++ b/internal/console/apisidecars_test.go
@@ -712,6 +712,9 @@ func TestAPISidecarListAndGet(t *testing.T) {
stale := status.CollectBox(nil, status.Probes{MachineID: "box2"}, time.Now().Add(-time.Hour))
stale.Metrics = &status.BoxMetrics{RouteServing: map[string]string{
"beta.titogo.bab.sidecar.internal": "deadbeef"}}
+ if err := status.WriteBox(context.Background(), fx.rel, stale); err != nil {
+ t.Fatal(err)
+ }
code, _, out := rawReq(t, http.MethodGet, u, token, "")
if code != http.StatusOK {
diff --git a/internal/provision/plan9_b8_census_test.go b/internal/provision/plan9_b8_census_test.go
index 05e671140..2db796294 100644
--- a/internal/provision/plan9_b8_census_test.go
+++ b/internal/provision/plan9_b8_census_test.go
@@ -565,7 +565,7 @@ var plan9B8CensusInventory = []censusEntry{
{"internal/console/apiinstances.go", "Server.handleAPIInstanceCreate", "record-writer", "key:CreateRecord", "20f862446f119f25d7d72eab6edd1b7cfb1528afd5b4c352e0cb8442f5080b13"},
{"internal/console/apiinstances.go", "Server.handleAPIInstanceUpdate", "record-writer", "key:UpdateRecord", "4b792c410399631eb3b38c78829df85dda045651bbc32df769767cf52f015b6d"},
{"internal/console/apiscan.go", "Server.writeScanRecord", "nonrecord", "sel:Put", "c3c092f4b7be9bf6bf09d0fe1e2c9fe52892ee97e57f6c7ab964b85fe36fb5c6"},
- {"internal/console/apisidecars.go", "Server.handleAPISidecarList", "key-site", "lit:sidecars", "57bed5957395011a0c092731f1f8b007ce92e09119ba0db7d694e255b2fecc0d"},
+ {"internal/console/apisidecars.go", "Server.handleAPISidecarList", "key-site", "lit:sidecars", "6a5e461256c985ea4924bf7ba7c0793ae601a59efe8ef570913138ef8b47441a"},
{"internal/console/apisidecars.go", "Server.handleAPISidecarCreate", "record-writer", "key:CreateSidecarRecord", "a7d5eb534b540499b9355b455966e733d61c904be5cc5a76a168833df59de1c3"},
{"internal/console/apistatusinstances.go", "Server.handleAPIStatusInstances", "key-site", "lit:instances", "2b4b9a2bea5f2fc5727869a5dcb8ae96c020e72571621f19898b195ca3b61aaa"},
{"internal/console/apisystemupdate.go", "Server.mirrorSystemArtifact", "nonrecord", "sel:Put", "76a8dcb558e3723ad5774788da37c22234c229dc3257ded5a6c7b04746c69c2f"},
diff --git a/internal/status/dryrun.go b/internal/status/dryrun.go
index 83dc32d8e..6fc85e926 100644
--- a/internal/status/dryrun.go
+++ b/internal/status/dryrun.go
@@ -92,6 +92,28 @@ const (
// the identical private home: Box.Metrics.
var dryRunRouteVersionNeedles = []string{dryRunRouteVersionHost, dryRunRouteVersionVersion}
+// dryRunRouteServingHost and dryRunRouteServingServing are Task 13's needle
+// pair (plan 5's ServingVersion): a THIRD un-opted route, distinct from
+// all others, whose only purpose is carrying a ServingVersion — the one
+// thing that makes CollectBox populate Box.Metrics.RouteServing. Neither
+// string reuses any existing needle: route_serving gets its own
+// dedicated positive/negative check, scope-split exactly like
+// dryRunRouteVersionNeedles, rather than riding along on an assertion
+// built for something else.
+const (
+ dryRunRouteServingHost = "serving-secret.internal"
+ dryRunRouteServingServing = "servingver5678"
+)
+
+// dryRunRouteServingNeedles is the scope-split pair for the fixture above:
+// REQUIRED inside status/boxes/*.json (proof that RouteServing actually
+// attached — an unexercised field is a field this self-check can't vouch
+// for) and BANNED everywhere else DryRun publishes (proof that
+// route_serving hostnames never reach fleet.json or the rendered page).
+// Same reasoning and the same scan-loop shape as dryRunRouteVersionNeedles,
+// because RouteServing lives in the identical private home: Box.Metrics.
+var dryRunRouteServingNeedles = []string{dryRunRouteServingHost, dryRunRouteServingServing}
+
// dryRunUpstreamHost and dryRunUpstreamAddr are the multi-upstream plan's own
// needle pair (Task 6) for Box.Metrics.Upstreams — the probe table, which is
// the most identifying thing this block carries: a route hostname as the KEY
@@ -186,6 +208,14 @@ func dryRunFixtures() ([]registry.Route, Probes) {
Host: dryRunRouteVersionHost, Kind: "instance", App: "stagedapp",
Status: "ready", Version: dryRunRouteVersionVersion,
},
+ {
+ // Un-opted, so its host must not surface via the apps feed either
+ // — the ONLY reason this route exists is to give CollectBox a
+ // ServingVersion to fold into Box.Metrics.RouteServing (see the
+ // needle pair's own doc comment above).
+ Host: dryRunRouteServingHost, Kind: "sidecar", App: "servingapp",
+ Status: "ready", ServingVersion: dryRunRouteServingServing,
+ },
}
memFrac, diskFrac := dryRunMemFrac, dryRunDiskFrac
@@ -395,6 +425,10 @@ func DryRun(dir string, out io.Writer) error {
// status/boxes/ object carrying the route_versions fixture, so this
// self-check can't pass by simply never exercising RouteVersions.
routeVersionKeySeen := false
+ // routeServingKeySeen is the same positive half for the serving version
+ // map (dryRunRouteServingNeedles) — Box.Metrics.RouteServing, plan 5
+ // Task 2.
+ routeServingKeySeen := false
// upstreamKeySeen is the same positive half for the probe table
// (dryRunUpstreamNeedles) — Box.Metrics.Upstreams, Task 6.
upstreamKeySeen := false
@@ -455,6 +489,19 @@ func DryRun(dir string, out io.Writer) error {
return fmt.Errorf("dry run: %s leaked a route_versions fixture %v — RouteVersions must never reach the public feed", key, leaks)
}
+ // dryRunRouteServingNeedles: same scope split as RouteVersions.
+ // RouteServing (plan 5's ServingVersion) is also a Box.Metrics field
+ // with hostnames, so status/boxes/*.json is its one privileged home
+ // and every other published key must never carry it.
+ if strings.HasPrefix(key, "status/boxes/") {
+ if leaks := ScanForLeaks(body, dryRunRouteServingNeedles); len(leaks) == 0 {
+ return fmt.Errorf("dry run: %s: expected route_serving fixtures %v, found none — RouteServing not attached?", key, dryRunRouteServingNeedles)
+ }
+ routeServingKeySeen = true
+ } else if leaks := ScanForLeaks(body, dryRunRouteServingNeedles); len(leaks) > 0 {
+ return fmt.Errorf("dry run: %s leaked a route_serving fixture %v — RouteServing must never reach the public feed", key, leaks)
+ }
+
// dryRunUpstreamNeedles: the third scope split, on the same pattern.
// Upstreams is Box.Metrics's other hostname-keyed field and the only
// one carrying backend ADDRESSES, so status/boxes/*.json is its one
@@ -534,6 +581,9 @@ func DryRun(dir string, out io.Writer) error {
if !routeVersionKeySeen {
return fmt.Errorf("dry run: no status/boxes/*.json object was scanned — route_versions scope check never ran")
}
+ if !routeServingKeySeen {
+ return fmt.Errorf("dry run: no status/boxes/*.json object was scanned — route_serving scope check never ran")
+ }
if !upstreamKeySeen {
return fmt.Errorf("dry run: no status/boxes/*.json object was scanned — upstreams scope check never ran")
}