carlos / platform Public

console: dashboard review fixes: an unreadable box listing shows as such; fixed-clock fixtures

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev f2a23946c89ab6651e892215b1401cbe45e49a42 parent 371d88b
10 files changed, +109 −53
  • .amadan/test-weights.tsv +1 −0
  • approved_operator_pages_copy_test.go +8 −6
  • docs/superpowers/plans/2026-10-25-operator-pages-copy.md +12 −0
  • internal/console/opboxes.go +3 −1
  • internal/console/opdashboard.go +22 −26
  • internal/console/opdashboard_test.go +40 −15
  • internal/console/server.go +3 −0
  • internal/console/server_test.go +13 −3
  • internal/console/templates/ops_boxes.html +3 −0
  • internal/console/templates/ops_dashboard.html +4 −2
diff --git a/.amadan/test-weights.tsv b/.amadan/test-weights.tsv
index 1533968c1..e9f8fe49e 100644
--- a/.amadan/test-weights.tsv
+++ b/.amadan/test-weights.tsv
@@ -42,6 +42,7 @@ github.com/carlosframework/platform TestE2EDBThroughConsole 1.49
github.com/carlosframework/platform TestWatchRolloutListFailuresTimeOutNamingTheList 1.20
github.com/carlosframework/platform/internal/console TestDashboardRemoteReadsAreTheDeclaredOnes 1.11
github.com/carlosframework/platform TestAuthLoginDenied 1.00
+github.com/carlosframework/platform/internal/console TestDashboardReadFailuresDegrade 0.94
github.com/carlosframework/platform TestDBForwardPullOnAQueryOnlyConsole 0.97
github.com/carlosframework/platform TestDeployWatchReadsTheConsolesList 0.90
github.com/carlosframework/platform TestDBForwardRefusesSQLThatIsNotUTF8 0.88
diff --git a/approved_operator_pages_copy_test.go b/approved_operator_pages_copy_test.go
index d52f150e6..68cc8c201 100644
--- a/approved_operator_pages_copy_test.go
+++ b/approved_operator_pages_copy_test.go
@@ -17,7 +17,7 @@ import (
// gate does.
//
// - TestOperatorPagesCopyInventory: the record names exactly
-// operatorPagesCopyIDs (OPS-1 to OPS-153), and no row holds an em dash;
+// operatorPagesCopyIDs (OPS-1 to OPS-154), and no row holds an em dash;
// - TestOperatorPagesCopyBuiltRowsAreApprovedAndPresent: an id in
// operatorPagesCopyBuilt is an approved row, and its text is in the file
// it names. No pending string reaches code or templates.
@@ -30,10 +30,10 @@ const operatorPagesCopyRoot = "internal/console"
var operatorPagesCopyIDPattern = regexp.MustCompile(`^OPS-[0-9]+$`)
-// operatorPagesCopyIDs is the record's inventory, pinned: OPS-1 to OPS-153.
+// operatorPagesCopyIDs is the record's inventory, pinned: OPS-1 to OPS-154.
var operatorPagesCopyIDs = func() []string {
- ids := make([]string, 0, 153)
- for i := 1; i <= 153; i++ {
+ ids := make([]string, 0, 154)
+ for i := 1; i <= 154; i++ {
ids = append(ids, "OPS-"+strconv.Itoa(i))
}
return ids
@@ -68,6 +68,8 @@ var operatorPagesCopyBuilt = []string{
"OPS-57", "OPS-58", "OPS-59", "OPS-60", "OPS-61", "OPS-62", "OPS-63", "OPS-64",
"OPS-65", "OPS-66", "OPS-67", "OPS-68", "OPS-69", "OPS-70", "OPS-71", "OPS-72",
"OPS-73", "OPS-74", "OPS-75", "OPS-76",
+ // Task 9 review fix: the box reports could not be read.
+ "OPS-154",
}
// operatorPagesBuiltRows is entryBuiltRows for operatorPagesCopyBuilt.
@@ -136,8 +138,8 @@ func TestOperatorPagesCopyInventory(t *testing.T) {
rows := mustParseOperatorPagesCopyRecord(t)
reportAll(t, checkMovesInventory(rows, operatorPagesCopyIDs))
reportAll(t, checkMovesNoEmDash(rows))
- if len(rows) != 153 {
- t.Errorf("the record has %d rows, want 153", len(rows))
+ if len(rows) != 154 {
+ t.Errorf("the record has %d rows, want 154", len(rows))
}
}
diff --git a/docs/superpowers/plans/2026-10-25-operator-pages-copy.md b/docs/superpowers/plans/2026-10-25-operator-pages-copy.md
index f06c2f193..9a595cb51 100644
--- a/docs/superpowers/plans/2026-10-25-operator-pages-copy.md
+++ b/docs/superpowers/plans/2026-10-25-operator-pages-copy.md
@@ -273,3 +273,15 @@ Labels for the five workers registered since the first set was drawn (2026-10-26
| OPS-151 | jobs.go (StartLifetimeRecoveryPass) | Lifetime recovery | approved |
| OPS-152 | jobs.go (StartIncarnationMigrationPass) | Incarnation migration | approved |
| OPS-153 | jobs.go (StartEgressReport) | Outbound transfer report | approved |
+
+## Task 9 review fix
+
+Controller ruling 2026-10-27 (approved by controller ruling): OPS-154
+mirrors OPS-26. A one-string Luna check (`gpt-5.6-luna`) kept the text
+as written. It shows in the dashboard's callout (linking to Boxes), in
+place of the dashboard's Boxes rows, and in place of the Hosts table on
+Boxes, whenever the box reports could not be listed or read.
+
+| id | file | text | status |
+|---|---|---|---|
+| OPS-154 | opdashboard.go (the callout item; the dashboard's Boxes section and Boxes show the same line) | Could not read the box reports. | approved |
diff --git a/internal/console/opboxes.go b/internal/console/opboxes.go
index 442020116..d7f643a02 100644
--- a/internal/console/opboxes.go
+++ b/internal/console/opboxes.go
@@ -71,11 +71,13 @@ func (s *Server) handleBoxes(w http.ResponseWriter, r *http.Request) {
// The private host detail is an EXTRA read on a page that already has its
// answer: a bucket that won't list the boxes costs the operator the
// per-host block, not the whole page, so this degrades with a log line
- // rather than turning a readable page into a 500.
+ // rather than turning a readable page into a 500. It says so (OPS-154)
+ // where the Hosts table would be.
hosts, err := s.opHostRows(ctx, &p)
if err != nil {
log.Printf("console: fleet hosts: %v", err)
hosts = nil
+ p.HostsUnread = opHostsUnread
}
// Region labels (spec §5 rows 10, 11): box regions from the cached name
// map, each app's stored region from SQLite and one registry listing.
diff --git a/internal/console/opdashboard.go b/internal/console/opdashboard.go
index b0b7aaa42..50c875460 100644
--- a/internal/console/opdashboard.go
+++ b/internal/console/opdashboard.go
@@ -32,6 +32,10 @@ const (
dashWordSilent = "Silent"
dashWordStale = "Stale"
dashUnknown = "unknown"
+ // opHostsUnread stands for the box reports when they could not be
+ // listed or read: a callout item, the dashboard's Boxes section and
+ // the Hosts section of Boxes.
+ opHostsUnread = "Could not read the box reports."
)
// attentionItem is one line of the needs-attention callout: Lead, then Code
@@ -46,6 +50,7 @@ type attentionInput struct {
Fleet *status.Fleet
FleetErr error
Boxes []dashBox
+ HostsErr error
Now time.Time
Alerts []FiringAlert
AlertsKnown bool
@@ -64,7 +69,8 @@ func attnCode(format, code, href, link string, rest ...any) attentionItem {
}
// attentionItems is the callout's list and tone: one item per Silent row of
-// Boxes, an old summary, a summary that could not be read, each down
+// Boxes, box reports that could not be read, an old summary, a summary
+// that could not be read, each down
// service, each firing alert (once the projection is known), the storage
// queue when it is waiting, and each job whose last run failed. The tone is
// negative when a service is down, warning for anything else, positive for
@@ -76,6 +82,9 @@ func attentionItems(in attentionInput) (items []attentionItem, tone string) {
items = append(items, attnCode("Box %s has stopped reporting.", b.Label, "/fleet/boxes#box-"+b.Label, boxes))
}
}
+ if in.HostsErr != nil {
+ items = append(items, attentionItem{Lead: opHostsUnread, Href: "/fleet/boxes", Link: boxes})
+ }
down := false
if in.FleetErr != nil {
items = append(items, attentionItem{Lead: "Could not read the fleet summary."})
@@ -267,24 +276,6 @@ func dashBoxes(f *status.Fleet, hosts []HostRow, now time.Time) (rows []dashBox,
return dashFinish(rows, stale), stale
}
-// dashFleetBoxes is the Boxes table when the box reports could not be
-// listed: fleet.json's rows alone, Silent where fleet.json says the box is
-// stale, else by its load word, with no meter and no last report.
-func dashFleetBoxes(f *status.Fleet, now time.Time) []dashBox {
- if f == nil {
- return nil
- }
- rows := make([]dashBox, 0, len(f.Boxes))
- for _, fb := range f.Boxes {
- row := dashBox{Label: fb.Label, Region: fb.Region, Status: dashLoadPill(fb.Load)}
- if fb.Stale {
- row.Status = opPill{Label: dashWordSilent, Tone: "negative"}
- }
- rows = append(rows, row)
- }
- return dashFinish(rows, dashSummaryStale(f, now))
-}
-
// dashFinish sorts rows by label, names an empty region unknown, and marks
// every row Stale under an old summary.
func dashFinish(rows []dashBox, stale bool) []dashBox {
@@ -310,7 +301,10 @@ type dashView struct {
Activity []FeedRow
Boxes []dashBox
HasFleet bool
- Jobs []opJobRow
+ // HostsUnread is OPS-154 when the box reports could not be read,
+ // shown in place of the Boxes rows; "" otherwise.
+ HostsUnread string
+ Jobs []opJobRow
}
// Title is the callout's heading.
@@ -339,8 +333,9 @@ func (d *dashView) Icon() string {
// handleDashboard serves the dashboard at /fleet, for signed-in operators
// only, behind operatorOnly's 404-to-everyone gate. A failed SQLite read
-// leaves its section empty and a failed bucket read degrades (an item in
-// the callout, or Boxes from fleet.json alone); neither is a 500.
+// leaves its section empty and a failed bucket read is a callout item (and,
+// for the box reports, OPS-154 in place of the Boxes rows); neither is a
+// 500.
func (s *Server) handleDashboard(w http.ResponseWriter, r *http.Request) {
addr, raw, ok := s.operatorOnly(w, r)
if !ok {
@@ -378,9 +373,10 @@ func (s *Server) handleDashboard(w http.ResponseWriter, r *http.Request) {
f = nil
}
d.HasFleet = f != nil
- if hosts, err := s.opHostRows(ctx, &p); err != nil {
- log.Printf("console: dashboard fleet hosts: %v", err)
- d.Boxes = dashFleetBoxes(f, now)
+ hosts, hostsErr := s.opHostRows(ctx, &p)
+ if hostsErr != nil {
+ log.Printf("console: dashboard fleet hosts: %v", hostsErr)
+ d.HostsUnread = opHostsUnread
} else {
d.Boxes, _ = dashBoxes(f, hosts, now)
}
@@ -396,7 +392,7 @@ func (s *Server) handleDashboard(w http.ResponseWriter, r *http.Request) {
alerts, known := s.alertsNow.Firing()
jobs := s.jobs.Snapshot()
d.Attention, d.Tone = attentionItems(attentionInput{
- Fleet: f, FleetErr: fleetErr, Boxes: d.Boxes, Now: now,
+ Fleet: f, FleetErr: fleetErr, Boxes: d.Boxes, HostsErr: hostsErr, Now: now,
Alerts: alerts, AlertsKnown: known, StorePending: pending, Jobs: jobs,
})
d.Jobs = opJobRows(jobs)
diff --git a/internal/console/opdashboard_test.go b/internal/console/opdashboard_test.go
index 00c24c6b1..2b93bab9b 100644
--- a/internal/console/opdashboard_test.go
+++ b/internal/console/opdashboard_test.go
@@ -8,6 +8,7 @@ import (
"html"
"net/http"
"regexp"
+ "slices"
"strconv"
"strings"
"testing"
@@ -27,10 +28,25 @@ const opFleetKey = "status/fleet.json"
type operatorWorld struct {
c *http.Client
shop, notes *Account
+ now time.Time // the console's clock (opNow) from the seeding on
+}
+
+// opWorldClock is the latest UTC midday at or before the wall clock: a fixed
+// clock for seedOperatorWorld, so that "today" (since UTC midnight) holds
+// every row seeded seconds before it, whatever the hour the test runs.
+func opWorldClock() time.Time {
+ wall := time.Now()
+ noon := opMidnight(wall).Add(12 * time.Hour)
+ if noon.After(wall) {
+ noon = noon.Add(-24 * time.Hour)
+ }
+ return noon
}
// seedOperatorWorld signs Paul in as an operator and a store operator and
-// seeds the world the operator pages show (shared with Tasks 10, 11 and 14):
+// seeds the world the operator pages show (shared with Tasks 10, 11 and 14),
+// on one fixed clock at midday UTC (opWorldClock), set as the console's
+// opNow, so the seeding and every request read the same "now":
//
// - eight people under example.com, joined over 30 days: two today, the
// rest 2, 5, 9, 21, 25 and 29 days ago, none 10 to 20 days ago; three of
@@ -48,7 +64,8 @@ func seedOperatorWorld(t *testing.T, fx *consoleFixture) operatorWorld {
t.Helper()
ctx := context.Background()
c := signInOperator(t, fx)
- now := time.Now()
+ now := opWorldClock()
+ fx.srv.opNow = func() time.Time { return now }
if _, err := fx.st.db.Exec(`UPDATE users SET created_at = ? WHERE address = ?`,
now.Add(-45*24*time.Hour).Unix(), "paul@keymail.dev"); err != nil {
t.Fatal(err)
@@ -112,7 +129,7 @@ func seedOperatorWorld(t *testing.T, fx *consoleFixture) operatorWorld {
}
}
- seedHostBoxes(t, fx)
+ seedHostBoxesAt(t, fx, now)
if err := fx.st.SetGrantToken("paul@keymail.dev", "grant-p", now); err != nil {
t.Fatal(err)
@@ -133,7 +150,7 @@ func seedOperatorWorld(t *testing.T, fx *consoleFixture) operatorWorld {
if _, _, err := fx.rel.Get(ctx, objstore.EntitlementKey(fx.sqid)); err != nil {
putEntitlement(t, fx, fx.sqid, &objstore.Entitlement{Applied: &objstore.Applied{By: "paul@keymail.dev", At: now, Note: "for uploads"}})
}
- return operatorWorld{c: c, shop: shop, notes: notes}
+ return operatorWorld{c: c, shop: shop, notes: notes, now: now}
}
// dashGet is GET /fleet as c, which must answer 200.
@@ -383,7 +400,7 @@ func TestDashboardSeriesHasThirtyDaysWithZerosFilled(t *testing.T) {
if len(rows) != 30 {
t.Fatalf("the hidden table has %d rows, want 30:\n%s", len(rows), table)
}
- today := opMidnight(time.Now())
+ today := opMidnight(w.now)
for k := 10; k <= 20; k++ {
r := rows[29-k]
if r[2] != "0" {
@@ -637,8 +654,9 @@ func TestDashboardEmptyLists(t *testing.T) {
}
// TestDashboardReadFailuresDegrade: a refused fleet.json read is a callout
-// item, a refused box listing leaves the Boxes section on fleet.json's
-// rows; neither is a 500.
+// item; a refused box listing is a callout item linking to Boxes and
+// OPS-154 in place of the Boxes rows, never a Healthy pill or an all-clear;
+// neither is a 500.
func TestDashboardReadFailuresDegrade(t *testing.T) {
fx, lat := newPerfFixture(t)
c := signInOperator(t, fx)
@@ -657,14 +675,21 @@ func TestDashboardReadFailuresDegrade(t *testing.T) {
t.Fatal("the view never listed status/boxes/")
}
boxes := dashSection(t, body, "Boxes")
- rows := dashRows(boxes)
- if len(rows) < 2 || !strings.Contains(boxes, ">ada-stargazing</a>") {
- t.Fatalf("with the listing refused the Boxes section does not show fleet.json's rows:\n%s", boxes)
+ if !strings.Contains(boxes, `<p rst-empty-body>Could not read the box reports.</p>`) {
+ t.Errorf("with the listing refused the Boxes section does not say so:\n%s", boxes)
}
- for _, r := range rows[1:] {
- if strings.Contains(r, "<meter") || !strings.Contains(r, `<span class="rst-cell-mut">unknown</span>`) {
- t.Errorf("a row read only from fleet.json shows a reading it does not have: %s", r)
- }
+ if rows := dashRows(boxes); len(rows) != 0 {
+ t.Errorf("with the listing refused the Boxes section shows %d rows:\n%s", len(rows), boxes)
+ }
+ if strings.Contains(body, `rst-tone="positive">Healthy</span>`) {
+ t.Errorf("a box shows Healthy though its report could not be read:\n%s", boxes)
+ }
+ want := `Could not read the box reports. <a href="/fleet/boxes">Boxes</a>`
+ if !slices.Contains(dashItems(t, body), want) {
+ t.Errorf("no callout item %q:\n%s", want, dashCallout(t, body))
+ }
+ if strings.Contains(dashCallout(t, body), "Everything is running.") {
+ t.Errorf("the callout is all-clear with the box reports unread:\n%s", dashCallout(t, body))
}
}
@@ -701,7 +726,7 @@ func TestDashboardBoxesKeepTheMockupColumns(t *testing.T) {
`>grace-kayaking</a>`,
`<span rst-status rst-tone="negative">Silent</span>`,
`<span class="rst-cell-mut">unknown</span>`,
- "1h0m ago</span>",
+ `title="` + w.now.Add(-time.Hour).UTC().Format("2006-01-02 15:04 UTC") + `">`,
} {
if !strings.Contains(dark, want) {
t.Errorf("the dark box's row has no %s: %s", want, dark)
diff --git a/internal/console/server.go b/internal/console/server.go
index 1814f80b4..24d8ae379 100644
--- a/internal/console/server.go
+++ b/internal/console/server.go
@@ -2256,6 +2256,9 @@ type page struct {
// yet, no bucket handle, or a boxes read that failed are all "no detail
// to show", never a reason to fail the page.
Hosts []HostRow
+ // HostsUnread is OPS-154 on Boxes when the box reports could not be
+ // read, shown where the Hosts table would be; "" otherwise.
+ HostsUnread string
// BoxRegions maps a box label to its region label for the fleet pages;
// a box absent from it keeps its own STATUS_BOX_REGION word.
// FleetAppRegions maps an app name on the platform fleet page to its
diff --git a/internal/console/server_test.go b/internal/console/server_test.go
index 3d48d8b19..a8706d245 100644
--- a/internal/console/server_test.go
+++ b/internal/console/server_test.go
@@ -1932,9 +1932,15 @@ func TestBoxesMemoryTextIsUsedOverTotal(t *testing.T) {
// carrying a private Metrics block, and publishes the merged feed over them —
// the exact pair /fleet/boxes' Hosts detail has to tell apart.
func seedHostBoxes(t *testing.T, fx *consoleFixture) {
+ t.Helper()
+ seedHostBoxesAt(t, fx, time.Now())
+}
+
+// seedHostBoxesAt is seedHostBoxes with now as the clock: ada-stargazing
+// reports at now, grace-kayaking an hour before.
+func seedHostBoxesAt(t *testing.T, fx *consoleFixture, now time.Time) {
t.Helper()
ctx := context.Background()
- now := time.Now()
for _, b := range []status.Box{
{
GeneratedAt: now, Label: "ada-stargazing", Region: "eu-west-1",
@@ -2002,7 +2008,8 @@ func TestFleetHostsDetailSuppressesStaleMetrics(t *testing.T) {
// TestFleetHostsDegradeWhenUnreadable: the Hosts detail is an extra read on a
// page that already had a job. If the boxes can't be listed, the page still
// renders the merged feed it could read — metrics are never the reason Boxes
-// 500s.
+// 500s — and says where the Hosts table would be that the reports could not
+// be read (OPS-154).
//
// The failure is injected at the S3 fake (newPerfFixture, recordS3), so the
// console's own client meets a refused listing of status/boxes/ while
@@ -2018,9 +2025,12 @@ func TestFleetHostsDegradeWhenUnreadable(t *testing.T) {
if rec.listings("status/boxes/") == 0 {
t.Fatalf("the view never listed %s, so no failure was met: %+v", "status/boxes/", rec.all())
}
- if strings.Contains(body, "<h2>Hosts</h2>") {
+ if strings.Contains(body, "<th>Host</th>") {
t.Errorf("the Hosts detail rendered with its listing refused:\n%s", body)
}
+ if !strings.Contains(body, "<h2>Hosts</h2></div>\n<div rst-empty>\n <p rst-empty-body>Could not read the box reports.</p>") {
+ t.Errorf("the Hosts section does not say the box reports could not be read:\n%s", body)
+ }
}
// TestFleetHostsEscapesHostSuppliedStrings: Release and Tunnel are strings a
diff --git a/internal/console/templates/ops_boxes.html b/internal/console/templates/ops_boxes.html
index 7e62a2372..6e6cedac5 100644
--- a/internal/console/templates/ops_boxes.html
+++ b/internal/console/templates/ops_boxes.html
@@ -117,6 +117,9 @@
</table>
</div>
<p co-note>Read from <code>status/boxes/</code> in the deployment bucket, which is not public — these are raw figures, unlike the aggregate feed above, and this page is why they stay behind a session.</p>
+{{else if .HostsUnread}}
+<div rst-box-head><h2>Hosts</h2></div>
+{{template "op_empty" (opEmpty "" .HostsUnread)}}
{{end}}
{{template "op_jobs" .Jobs}}
{{template "op_bottom" .}}{{end}}
diff --git a/internal/console/templates/ops_dashboard.html b/internal/console/templates/ops_dashboard.html
index d1a8c5e89..9f5a212ef 100644
--- a/internal/console/templates/ops_dashboard.html
+++ b/internal/console/templates/ops_dashboard.html
@@ -67,9 +67,11 @@
{{template "op_bottom" .}}{{end}}
{{/* The dashboard's Boxes section (data *dashView): one row per box, its
- status, region, memory in use as a meter, and when it last reported. */}}
+ status, region, memory in use as a meter, and when it last reported;
+ OPS-154 instead when the box reports could not be read. */}}
{{define "ops_dashboard_boxes"}}<div rst-box-head><h2>Boxes</h2><a rst-btn="ghost" href="/fleet/boxes">All boxes</a></div>
-{{if .Boxes}}
+{{if .HostsUnread}}{{template "op_empty" (opEmpty "" .HostsUnread)}}
+{{else if .Boxes}}
<div rst-card co-cols="boxes">
<div rst-lrow="head"><span>Box</span><span>Status</span><span>Region</span><span>Load</span><span>Last report</span></div>
{{- range .Boxes}}