label-case-running-tile: a remote instance no box reports yet is unknown, not asleep (Astra round 1 P2)
Astra round 1: no P1, one P2, census approved for every unit and envelope (findings committed unedited beside the brief). The P2: a remote instance that is "Setting up" (no box reports its host) counted as asleep on its hibernate setting. A remote instance's process state now comes only from the report appFacts.host accepted (RouteView.box); with none it is unknown, so the tile reads "?".
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
4 files changed,
+69
−5
docs/superpowers/specs/CODEX-FINDINGS-LABEL-CASE-RUNNING-TILE.md+33 −0internal/console/overview.go+7 −2internal/console/runningtile_test.go+28 −2internal/provision/testdata/plan14-root-reads-label-case-running-tile.tsv+1 −1
CI passed — run details
diff --git a/docs/superpowers/specs/CODEX-FINDINGS-LABEL-CASE-RUNNING-TILE.md b/docs/superpowers/specs/CODEX-FINDINGS-LABEL-CASE-RUNNING-TILE.md| new file mode 100644 |
| index 000000000..b73c0a6a2 |
| --- /dev/null |
| +++ b/docs/superpowers/specs/CODEX-FINDINGS-LABEL-CASE-RUNNING-TILE.md |
| @@ -0,0 +1,33 @@ |
| +Reviewed `origin/main...cfe075541fa5e6d3574af54ec6c1e1269e7e3892`, round 1. Both prerequisite changes are ancestors of `origin/main`. |
| + |
| +Census verdicts for this commit: |
| + |
| +| Unit or envelope | Verdict | Evidence | |
| +|---|---|---| |
| +| `app_overview.html:external` | **Approve** | [app_overview.html:32](/home/paulca/amadan.net/carlos/platform-label-case/internal/console/templates/app_overview.html:32), line 38: presentation only; Resources retains the original nil-metrics condition. The recorded unknown-state guards remain. | |
| +| `.` | **Approve** | [apimode.go:1052](/home/paulca/amadan.net/carlos/platform-label-case/apimode.go:1052), [region_labels.go:8](/home/paulca/amadan.net/carlos/platform-label-case/region_labels.go:8): production edits are comments; test changes update label expectations. | |
| +| `internal/console` | **Approve** | [overview.go:122](/home/paulca/amadan.net/carlos/platform-label-case/internal/console/overview.go:122), lines 149–200: account filtering precedes local-instance counting; no new reads or authority. [deployments.go:94](/home/paulca/amadan.net/carlos/platform-label-case/internal/console/deployments.go:94) changes only a comment. | |
| +| `internal/console/templates` | **Approve** | [app_overview.html:38](/home/paulca/amadan.net/carlos/platform-label-case/internal/console/templates/app_overview.html:38): the sole template edit changes which boolean controls existing wording. | |
| +| `internal/dbdoor` | **Approve** | [forward.go:14](/home/paulca/amadan.net/carlos/platform-label-case/internal/dbdoor/forward.go:14): comment and test expectations only; forwarding validation is unchanged. | |
| +| `internal/regionlabel` | **Approve** | [regionlabel.go:119](/home/paulca/amadan.net/carlos/platform-label-case/internal/regionlabel/regionlabel.go:119): uppercase conversion applies only to `Text`; `Code`, lookup keys and bare-code fallback remain unchanged. No I/O added. | |
| + |
| +No census escalation: these changes neither expand root access nor weaken an authority check. The presentation defect below does not change that assessment. |
| + |
| +**P1:** None found. |
| + |
| +**P2 — Running tile counts an unreported remote instance as asleep.** |
| +Evidence: [overview.go:200](/home/paulca/amadan.net/carlos/platform-label-case/internal/console/overview.go:200), [overview.go:190](/home/paulca/amadan.net/carlos/platform-label-case/internal/console/overview.go:190), and [remoteinstances.go:450](/home/paulca/amadan.net/carlos/platform-label-case/internal/console/remoteinstances.go:450). |
| + |
| +Create one hibernating remote instance before its box reports it. A complete report read with no host match produces `Status: "pending"`, `unknown: false`, and no accepted report. The overview nevertheless increments `InstanceAsleep`. With this change, nil metrics no longer suppress that count: the tile renders **“0 of 1” / “copies reporting · 1 asleep”**, while the Running row correctly says **“Setting up”**. |
| + |
| +Fix the overview classification so pending remote rows cannot count as asleep; preserve an explicit unreported/setup state. Add a two-box regression that creates the record without reconciling or publishing its host report, then checks the tile. **Fault family:** remote process state must come from an accepted tenant-scoped report; hibernation configuration is not evidence of sleep. |
| + |
| +**P3:** None. |
| + |
| +Other checks: `appFacts.host` rejects mismatched tenants, unnamed tenants and reports predating the record ([remoteinstances.go:319](/home/paulca/amadan.net/carlos/platform-label-case/internal/console/remoteinstances.go:319)). Remote metrics remain excluded ([server.go:3860](/home/paulca/amadan.net/carlos/platform-label-case/internal/console/server.go:3860)); Resources retains its prior behavior. I found no separate production formatter retaining lowercase bracketed labels. Account filtering also already occurs before `Assemble` groups routes, despite the brief’s description. |
| + |
| +The positive regression tests use real create/reconcile/report/HTTP wiring and, by inspection, distinguish the old `?` behavior. Execution and mutation verification were unavailable: targeted `go test` failed before compilation because the sandbox denied creation of Go’s build directory. Changed-file formatting and `git diff --check` passed. No files were edited. |
| + |
| +Apply the P2 fix without reopening the review, retaining the required census check. |
| + |
| +READY AFTER FIXES |
| \ No newline at end of file |
diff --git a/internal/console/overview.go b/internal/console/overview.go| index 4af58b823..0f6a5cc69 100644 |
| --- a/internal/console/overview.go |
| +++ b/internal/console/overview.go |
| @@ -168,7 +168,12 @@ func assembleOverview(view *AppView, acct string, metrics []InstanceMetrics, ver |
| continue |
| } |
| st.InstanceTotal++ |
| - if rt.unknown { |
| + // A remote instance's process state comes only from the box report |
| + // appFacts.host accepted for it (rt.box names that box). One with |
| + // none, "Setting up" because no box reports the host yet, is not |
| + // asleep on the strength of its hibernate setting: unknown. |
| + unknown := rt.unknown || (rt.remote && rt.Kind == "instance" && rt.box == "") |
| + if unknown { |
| // A route on another box whose state no report vouches for, |
| // whatever its kind: neither up, down nor asleep, and a static |
| // one is not "served" on no evidence (remoteinstances.go). |
| @@ -179,7 +184,7 @@ func assembleOverview(view *AppView, acct string, metrics []InstanceMetrics, ver |
| if !rt.remote { |
| localInstances++ |
| } |
| - if rt.unknown { |
| + if unknown { |
| unknownInstances++ |
| } else if rt.Status == "failed" { |
| // Failed (an instance held down after a failed build) wins |
diff --git a/internal/console/runningtile_test.go b/internal/console/runningtile_test.go| index 2103a67c1..4bb4d02d0 100644 |
| --- a/internal/console/runningtile_test.go |
| +++ b/internal/console/runningtile_test.go |
| @@ -128,8 +128,8 @@ func TestRunningTileOtherAccountsReportOnly(t *testing.T) { |
| // one with a local instance still is. |
| func TestOverviewRunningFromRemoteState(t *testing.T) { |
| remote := []RouteView{ |
| - {Host: "a.example.com", Account: "x", Kind: "instance", Hibernate: true, Status: "ready", Version: "v1", remote: true, boxAwake: true}, |
| - {Host: "b.example.com", Account: "x", Kind: "instance", Hibernate: true, Status: "ready", Version: "v1", remote: true}, |
| + {Host: "a.example.com", Account: "x", Kind: "instance", Hibernate: true, Status: "ready", Version: "v1", remote: true, box: "b", boxAwake: true}, |
| + {Host: "b.example.com", Account: "x", Kind: "instance", Hibernate: true, Status: "ready", Version: "v1", remote: true, box: "b"}, |
| {Host: "c.example.com", Account: "x", Kind: "instance", Hibernate: true, remote: true, unknown: true}, |
| } |
| st := assembleOverview(&AppView{Routes: remote[:2]}, "x", nil, nil, boxJoin{}) |
| @@ -157,3 +157,29 @@ func TestOverviewRunningFromRemoteState(t *testing.T) { |
| t.Fatalf("another account's local row = %+v", st) |
| } |
| } |
| + |
| +// TestRunningTileSettingUpIsNotAsleep (Astra round 1, P2): a remote |
| +// instance no box reports yet is "Setting up" on the Running tab. Its |
| +// hibernate setting is not evidence of sleep: the tile cannot tell. |
| +func TestRunningTileSettingUpIsNotAsleep(t *testing.T) { |
| + tb := newTwoBoxes(t) |
| + tb.create(t, tb.token, tb.sqid, "shop", remoteHost, "uk", "") |
| + regA, err := registry.Open(tb.fx.regPath) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + // A complete read of the box reports, none of which names the host. |
| + report(t, tb.fx.rel, regA, "box-a", "ie", time.Now(), nil, 1024) |
| + if row := instanceRow(t, tb.page(t, "/apps/shop/instances"), remoteHost); !strings.Contains(row, "Setting up") { |
| + t.Fatalf("Running row for an unminted remote instance = %s", row) |
| + } |
| + tile := runningTile(t, tb.page(t, "/apps/shop")) |
| + if !strings.Contains(tile, `<p class="tile-value">?</p>`) || !strings.Contains(tile, "no data right now") || strings.Contains(tile, "asleep") { |
| + t.Fatalf("Running tile for an instance no box reports yet:\n%s", tile) |
| + } |
| + pending := RouteView{Host: "p.example.com", Account: "x", Kind: "instance", Hibernate: true, Status: "pending", remote: true} |
| + st := assembleOverview(&AppView{Routes: []RouteView{pending}}, "x", []InstanceMetrics{}, nil, boxJoin{}) |
| + if st.InstanceAsleep != 0 || st.InstanceUnknown != 1 || st.InstanceCounted != 0 { |
| + t.Fatalf("a pending remote row = %+v", st) |
| + } |
| +} |
diff --git a/internal/provision/testdata/plan14-root-reads-label-case-running-tile.tsv b/internal/provision/testdata/plan14-root-reads-label-case-running-tile.tsv| index 0cb303f50..4db72a250 100644 |
| --- a/internal/provision/testdata/plan14-root-reads-label-case-running-tile.tsv |
| +++ b/internal/provision/testdata/plan14-root-reads-label-case-running-tile.tsv |
| @@ -3,7 +3,7 @@ |
| @legacy 4318200cc341acddf6a83fefd42380e8629abb6a2c0e239b9f64acf925089c0b internal/console/templates/app_overview.html external legacy accepted-legacy accepted-legacy;rev3=J4;basis=root-input;rev3=census-ruling-console-remote-instances;basis=Running tile does not claim Served when a route's state is unknown and reads the existing 'no data right now' when every instance's state is unknown; Web addresses tile reads 'no data right now' instead of 'DNS & certs OK' for a domain with no reading; display only.;rev3=census-ruling-console-ux-nav;basis=release headings and links use DeploymentsCopy.Title, and safety-delay copy rewritten without em dashes; merged over main's console-remote-instances edits, which stay as main has them; markup only; no read added;rev3=census-ruling-region-labels;basis=a Region tile (the stored region or fleet, and RC-15); markup only; no read added;rev3=census-ruling-label-case-running-tile;basis=the Resources tile reads ResourcesUnavailable (nil metrics) where it read MetricsUnavailable; the Running tile keeps MetricsUnavailable, now true only when an instance on the console box needed the sweep; markup only; no read added file:external@0 d4a46b0656ab7c058d1647d436fa67b7834e744ae65e52412dd67f3df2964431 |
| internal/console/templates/app_overview.html external legacy accepted-legacy accepted-legacy;rev3=J4;basis=root-input;rev3=census-ruling-console-remote-instances;basis=Running tile does not claim Served when a route's state is unknown and reads the existing 'no data right now' when every instance's state is unknown; Web addresses tile reads 'no data right now' instead of 'DNS & certs OK' for a domain with no reading; display only.;rev3=census-ruling-console-ux-nav;basis=release headings and links use DeploymentsCopy.Title, and safety-delay copy rewritten without em dashes; merged over main's console-remote-instances edits, which stay as main has them; markup only; no read added;rev3=census-ruling-region-labels;basis=a Region tile (the stored region or fleet, and RC-15); markup only; no read added;rev3=census-ruling-label-case-running-tile;basis=the Resources tile reads ResourcesUnavailable (nil metrics) where it read MetricsUnavailable; the Running tile keeps MetricsUnavailable, now true only when an instance on the console box needed the sweep; markup only; no read added file:external@0 d4a46b0656ab7c058d1647d436fa67b7834e744ae65e52412dd67f3df2964431 |
| @coverage . 6c03a0e9e685f1f7ba2cf905cc5c564a3061a77fa5d6e74c6073b87166fbde34 |
| -@coverage internal/console c65ddbf40017bfde8b7038d594fb1bc546a8fbe698310d86198dbba57b40c552 |
| +@coverage internal/console 4906953f55c207cb66df257114a4e3942252f0b96f30a8cd09926f7e833be077 |
| @coverage internal/console/templates 307492c6e5b40182679d518c3b2d30ed3d91b1ceead1ef9ff86478cd443df4b3 |
| @coverage internal/dbdoor 10d2eda9dd7dc2e9b5ae558c41309c7bec659c4a9a87d3df71d2cd7799658e94 |
| @coverage internal/regionlabel 08772d8bbc83b564f840ed366bcbcff3996083e1e2ff3cf095f017b9b455d1a5 |