carlos / platform Public

console remote instances: round 1 review fixes (Astra, f2b993c3)

1. P1: a remote row's readings are pinned to the box whose report was
   accepted for it and names this account and app
   (RouteView.metricsBox, ownerAppMetricsFrom); a row with no such report
   joins none. A rejected tenant's samples, or another box's sample of the
   same host name, no longer reach the Overview, Running, the instance
   page or carlos instances list.
2. P2: unknown remote state (incomplete read, fleet-placed record, a
   report naming no tenant) renders "Can't tell right now", the existing
   wording, instead of Asleep / Not responding / Serving; it counts as
   neither up nor asleep and the verdict says it can't tell.
3. P2: box-report reads are timed from completion, incomplete reads get
   the failure TTL, and a view waiting behind a load stops when its
   request ends (no mutex held across the load).
4. P2: no record cap. pageRecords reads every record of the app, fetching
   only those whose host is not already a local row.

Each fix has a test that failed on f2b993c3, plus mutations (all killed;
one equivalent). Root-read census re-proposed (approval classes only)
and a record-write entry for pageRecords (key-site).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev 02edd585f3f133e8da7db0d2106f34ee833a14e3 parent f2b993c
17 files changed, +595 −96
  • docs/superpowers/notes/census-proposal-console-remote-instances.md +8 −6
  • docs/superpowers/notes/console-remote-instances.md +45 −14
  • internal/console/accountfleet.go +1 −1
  • internal/console/apiinstances.go +17 −9
  • internal/console/apiroutes.go +1 −1
  • internal/console/listquery.go +7 −2
  • internal/console/metricsview.go +14 −0
  • internal/console/overview.go +18 −4
  • internal/console/remoteinstances.go +125 −40
  • internal/console/remoteinstances_round1_test.go +314 −0
  • internal/console/remoteinstances_test.go +3 −3
  • internal/console/server.go +12 −1
  • internal/console/templates/app_overview.html +1 −1
  • internal/console/view.go +7 −1
  • internal/provision/console_remote_instances_census_test.go +6 −0
  • internal/provision/testdata/plan14-root-reads-chain.tsv +1 −1
  • internal/provision/testdata/plan14-root-reads-console-remote-instances.tsv +15 −12

CI passed — run details

diff --git a/docs/superpowers/notes/census-proposal-console-remote-instances.md b/docs/superpowers/notes/census-proposal-console-remote-instances.md
index 7bb176343..e4c014a98 100644
--- a/docs/superpowers/notes/census-proposal-console-remote-instances.md
+++ b/docs/superpowers/notes/census-proposal-console-remote-instances.md
@@ -5,14 +5,15 @@ Ruling `census-ruling-console-remote-instances`. Every change below keeps the di
| unit | change | read sites | what changed |
|---|---|---|---|
| `internal/console/accountfleet.go` `Server.assembleAccountFleet` | body | unchanged (9) | Fleet tab: the shared-fleet app count also reads the account's own instance records (per app of the account, under its own prefix, region not a fleet placement); the registry read is unchanged. |
-| `internal/console/apiinstances.go` `Server.healthByHost` | body | unchanged (12) | Takes an awake set (hosts whose box report says awake) that also counts as reporting; registry reads unchanged. |
-| `internal/console/apiroutes.go` `Server.handleAPIRoutes` | body | unchanged (33) | Passes nil for healthByHost's new awake argument; nothing else. |
+| `internal/console/apiinstances.go` `Server.healthByHost` | body | unchanged (12) | Takes an awake set (hosts whose accepted box report says awake) and a box pin per host (readings only from that box, via ownerAppMetricsFrom); registry reads unchanged. |
+| `internal/console/apiroutes.go` `Server.handleAPIRoutes` | body | unchanged (33) | Passes nil, nil for healthByHost's new awake and box-pin arguments; nothing else. |
| `internal/console/instancepage.go` `Server.handleAppInstance` | body | unchanged (6) | A remote row (no local registry row) takes its aliases from its box report; local rows read ListAliases as before. |
| `internal/console/server.go` `Server.channelHosts` | body | unchanged (4) | Canary-retire guard also counts the account's instance records (ListRecordsStrict) and sidecar records (listed, then each read with GetSidecarRecord; any read error including not-found refuses) from the bucket, failing closed; the registry read is unchanged. |
-| `internal/console/apiinstances.go` `Server.instanceHealth` | sites | +whole:Route ×2 | Records with no local registry row get health from their box report: two registry.Route literals built from the record (not read from any registry). |
-| `internal/console/view.go` `Assemble` | sites | +registry:Host, +whole:Route | Collects the set of local registry hosts (rt.Host) so a record host the registry has gets no remote row; adds rows from the account's records and box reports when given a remote source. |
+| `internal/console/templates/app_overview.html` `external` | body | unchanged (1) | Running tile: when every instance's state is unknown (instances on other boxes no report vouches for) the detail reads the existing 'no data right now'; display only. |
+| `internal/console/apiinstances.go` `Server.instanceHealth` | sites | +whole:Route ×2 | Records with no local registry row get health only from a box report naming the record's own account and app, with readings pinned to that box; otherwise Setting up (complete read, no report) or Can't tell right now. Builds registry.Route literals from the record; reads no registry for them. |
+| `internal/console/view.go` `Assemble` | sites | +registry:Host, +whole:Route | Collects the set of local registry hosts (rt.Host) so a record host the registry has gets no remote row and is not read; adds rows from the account's records and box reports when given a remote source. |
-Envelopes re-pinned: `internal/console`.
+Envelopes re-pinned: `internal/console`, `internal/console/templates`.
Review: a model from the other family than the author reads the branch's diff against main on the amadan.net remote (`origin` or `amadan`, whichever points at amadan.net) and gives a verdict for every unit and every re-pinned envelope above. For a unit, compare the change with its recorded disposition and basis below; for an envelope, read every changed function in the package and what it reaches. Escalate if the change lets root open, run, query or follow anything it did not before from a path or input a tenant, an app or a box agent can create, write or name; if it weakens a check, refusal, validation, argument or environment the basis relies on; or if the diff cannot settle either. Otherwise approve. Record each verdict on #280 with the tip. An escalation goes to the census owner as a decision.
@@ -23,9 +24,10 @@ Recorded dispositions, which each change must still satisfy:
- `internal/console/apiroutes.go` `Server.handleAPIRoutes`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=J1;basis=root-route
- `internal/console/instancepage.go` `Server.handleAppInstance`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=merge-ruling-2;basis=Instance page adds updates view from rollout join; browser rendering remains legacy.
- `internal/console/server.go` `Server.channelHosts`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=J1;basis=root-route
+- `internal/console/templates/app_overview.html` `external`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=J4;basis=root-input
- `internal/console/apiinstances.go` `Server.instanceHealth`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=J1;basis=root-route
- `internal/console/view.go` `Assemble`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=J1;basis=root-route
-Seal: `0c4eabfe38e12b098285bdeb5ceb0b16e5333928f5b02e160a6b16b5fd9ce1e0` → `98625108694485f86758341d9c1608c978db17519efe474f7210b3a45c258ba4`.
+Seal: `0c4eabfe38e12b098285bdeb5ceb0b16e5333928f5b02e160a6b16b5fd9ce1e0` → `dfdf49f3de3e612a21a29c24addc123c18a6cd68355dc134409b8743e6f596b4`.
Overlay: `internal/provision/testdata/plan14-root-reads-console-remote-instances.tsv`, appended to `internal/provision/testdata/plan14-root-reads-chain.tsv`.
diff --git a/docs/superpowers/notes/console-remote-instances.md b/docs/superpowers/notes/console-remote-instances.md
index 24245c114..ddadb7846 100644
--- a/docs/superpowers/notes/console-remote-instances.md
+++ b/docs/superpowers/notes/console-remote-instances.md
@@ -28,16 +28,24 @@ being inert when the AU and UK boxes started hosting instances.
2. **Live state.** Version, database size, the host's own DNS and
certificate reading, the custom domains routed to it, and whether it is
awake come from the box reports (`status/boxes/*.json`). A remote row's
- Status is `ready` when a fresh box reports the host, `pending` ("Setting
- up") when every box was read and none does, and empty (unknown) when the
- read was incomplete or the record is placed on a customer fleet. With no
- fresh report the version is unknown, so the Overview says "Can't tell
- right now".
-3. **Metrics.** No change of mechanism. Remote hosts reach
- `appResourceMetrics` through `Detail.Routes`, and the fleet-wide sweep
- matches `carlos-exec@<host>` and `carlos-app@<host>.service` on whichever
- box wrote them. A remote row carries no `Unit`: the allowlist gains the
- host and nothing a record can name.
+ Status is `ready` when a fresh box reports the host, and `pending`
+ ("Setting up") when every box was read and none does. Its process state
+ is known only from a report whose rollout names this account and app.
+ Without one (an incomplete read, a record on a customer fleet, or an
+ older box's report that names no tenant) the row's health is "Can't tell
+ right now", the console's existing wording, and the Overview verdict
+ says the same. It is never guessed as Asleep, Not responding or Serving.
+3. **Metrics.** A remote row joins readings only from the one box whose
+ report was accepted for it and names this account and app
+ (`RouteView.metricsBox`, enforced in `ownerAppMetricsFrom`). A row with
+ no such report joins none. The host name alone is not this tenant's:
+ another box may serve the same name for someone else, and its samples
+ must not land here. A remote row carries no `Unit`, so the allowlist
+ gains the host and nothing a record can name. `carlos instances list`
+ applies the same rule. The metrics box label and the status box label
+ are the same (`status.Label(machineID)` on platform boxes); if they ever
+ differed, remote rows would lose their readings, not gain someone
+ else's.
### The tenant boundary
@@ -107,11 +115,15 @@ is filed as an amadan discussion.
- Records: 0 when the change-index record view is armed and its latest
snapshot is Complete (the flagship console). The page reads the
snapshot without refreshing it; the run and seed sweeps keep it within a
- pass. Unarmed: 1 LIST plus 1 GET per record per app, the read the Logs
- tab already made. The account app list and the Fleet tab pay that per
- app when unarmed.
+ pass. Unarmed: 1 LIST per app plus 1 GET per record whose host is not
+ already a local row. There is no cap: every record is read, so no
+ instance is ever dropped from the pages, and records for local hosts
+ are listed but never fetched. The Fleet tab fetches every record of an
+ app that has no local route, when unarmed.
- Box reports: 1 LIST plus 1 GET per box, held console-wide for 60 seconds
- (10 seconds after a failed read). Boxes rewrite their reports every five
+ (10 seconds after a failed or incomplete read), timed from when the load
+ finished. One load at a time; a view waiting behind a slow load stops
+ waiting when its own request ends. Boxes rewrite their reports every five
minutes, so nothing is lost. That caps it at one read a minute however
many people browse: at 4 boxes, at most 5 requests a minute and 7,200 a
day under continuous browsing, 0 when idle. The Overview's Database tile
@@ -153,3 +165,22 @@ Mutations run against the account filter, the R18 check, the local-row
rule, the records' account scope, every branch of `channelHosts` and the
cache were all caught. One survivor is equivalent: `awake` is only ever set
from a rollout entry, which always sets `tenantKnown`.
+
+## Round 1 review (Astra, f2b993c3)
+
+Four findings, all fixed, each with a test that failed on f2b993c3
+(`internal/console/remoteinstances_round1_test.go`):
+
+1. A rejected report's readings still joined, because the metrics
+ allowlist took the host name alone. Readings are now pinned to the
+ accepted, tenant-named report's box (Metrics, above).
+2. Unknown remote state rendered as Asleep, Not responding or Serving. It
+ now renders "Can't tell right now" (Running row, instance page, `carlos
+ instances list`), counts as neither up nor asleep, and the Overview
+ verdict and tile say they can't tell.
+3. A load that timed out was published already expired. Reads are now
+ timed from completion, incomplete reads get the failure TTL, and waiting
+ is cancellable.
+4. The 500-record cap silently dropped instances. The page reader now
+ reads every record, and only the records it shows.
+
diff --git a/internal/console/accountfleet.go b/internal/console/accountfleet.go
index 75d9a0ce4..5aaf38f7c 100644
--- a/internal/console/accountfleet.go
+++ b/internal/console/accountfleet.go
@@ -159,7 +159,7 @@ func (s *Server) assembleAccountFleet(ctx context.Context, acct *Account) (card
if platformApps[app] {
continue
}
- recs, err := s.pageRecords(ctx, acct.Sqid, app)
+ recs, err := s.pageRecords(ctx, acct.Sqid, app, nil)
if err != nil {
log.Printf("console: account fleet %s: records of %s: %v", acct.Sqid, app, err)
known = false
diff --git a/internal/console/apiinstances.go b/internal/console/apiinstances.go
index 568db6e3a..5632173ab 100644
--- a/internal/console/apiinstances.go
+++ b/internal/console/apiinstances.go
@@ -284,10 +284,13 @@ func (s *Server) instanceHealth(ctx context.Context, recs []provision.Record) ma
}
// A record whose route is on another box has no row here. Its health
// comes from the box that reports it, the same join the app pages make
- // (remoteinstances.go): picked only for this record's own account and
- // app, so another tenant's report never answers for it. A record no box
- // reports stays "Setting up".
+ // (remoteinstances.go): only a report whose rollout names this record's
+ // own account and app, with readings pinned to that box. A record no
+ // box reports stays "Setting up" when every box was read; when the read
+ // was incomplete, the record is placed on a customer fleet, or the only
+ // report names no tenant, its state is unknown and says so.
var awake map[string]bool
+ boxByHost := map[string]string{}
if s.cfg.Releases != nil {
var reports fleetReports
loaded := false
@@ -300,7 +303,10 @@ func (s *Server) instanceHealth(ctx context.Context, recs []provision.Record) ma
reports, loaded = foldFleetReports(boxes, complete, time.Now()), true
}
rep := reports.pick(rec.Host, rec.Account, rec.App)
- if rep == nil {
+ if rep == nil || !rep.tenantKnown {
+ if _, fleetPlaced := registry.FleetPlacement(rec.Region); rep != nil || !reports.complete || fleetPlaced {
+ out[rec.Host] = healthUnknown
+ }
continue
}
kind := rec.Kind
@@ -309,7 +315,8 @@ func (s *Server) instanceHealth(ctx context.Context, recs []provision.Record) ma
}
routeFor[rec.Host] = registry.Route{Host: rec.Host, Kind: kind, Status: "ready",
Hibernate: rec.HibernateOrDefault(), Provisioned: true}
- if rep.tenantKnown && rep.awake {
+ boxByHost[rec.Host] = rep.box
+ if rep.awake {
if awake == nil {
awake = map[string]bool{}
}
@@ -317,7 +324,7 @@ func (s *Server) instanceHealth(ctx context.Context, recs []provision.Record) ma
}
}
}
- for h, word := range s.healthByHost(ctx, routeFor, awake) {
+ for h, word := range s.healthByHost(ctx, routeFor, awake, boxByHost) {
out[h] = word
}
return out
@@ -339,8 +346,9 @@ func (s *Server) instanceHealth(ctx context.Context, recs []provision.Record) ma
// awake names hosts whose box reports their process awake (an instance on
// another box, joined from its box report by instanceHealth): those read as
// reporting even when the sweep has no sample yet, as the Running tab reads
-// them. nil for routes on this box.
-func (s *Server) healthByHost(ctx context.Context, routeFor map[string]registry.Route, awake map[string]bool) map[string]string {
+// them. boxByHost pins such a host's readings to the box whose report was
+// accepted for it (ownerAppMetricsFrom). Both nil for routes on this box.
+func (s *Server) healthByHost(ctx context.Context, routeFor map[string]registry.Route, awake map[string]bool, boxByHost map[string]string) map[string]string {
out := make(map[string]string, len(routeFor))
hosts := make([]string, 0, len(routeFor))
unitByHost := map[string]string{}
@@ -350,7 +358,7 @@ func (s *Server) healthByHost(ctx context.Context, routeFor map[string]registry.
unitByHost[h] = rt.Unit
}
}
- am, err := s.OwnerAppMetrics(ctx, hosts, unitByHost)
+ am, err := s.ownerAppMetricsFrom(ctx, hosts, unitByHost, boxByHost)
if err != nil {
// An unreadable sweep is not knowledge that these instances are
// down: every host reads as not-reporting below, which healthWord
diff --git a/internal/console/apiroutes.go b/internal/console/apiroutes.go
index 64206b1ee..56c265151 100644
--- a/internal/console/apiroutes.go
+++ b/internal/console/apiroutes.go
@@ -153,7 +153,7 @@ func (s *Server) handleAPIRoutes(w http.ResponseWriter, r *http.Request) {
}
ctx, cancel := context.WithTimeout(r.Context(), routeListTimeout)
defer cancel()
- health := s.healthByHost(ctx, routeFor, nil)
+ health := s.healthByHost(ctx, routeFor, nil, nil)
join := loadBoxJoin(ctx, s.cfg.Releases, time.Now())
rows := make([]apiRoute, 0, len(routeFor))
for _, rt := range routeFor {
diff --git a/internal/console/listquery.go b/internal/console/listquery.go
index 6ab7cfd42..e848a815e 100644
--- a/internal/console/listquery.go
+++ b/internal/console/listquery.go
@@ -22,7 +22,12 @@ const instancePageSize = 50
// slugs, filters and links all derive from here. Waking/Crashed/Never
// started are sidecarHealthWord's own vocabulary (overview.go); Running and
// Asleep are shared with the instance family, not duplicated here.
-var healthWords = []string{"Running", "Serving", "Setting up", "Asleep", "No readings", "Not responding", "Failed", "Waking", "Crashed", "Never started"}
+var healthWords = []string{"Running", "Serving", "Setting up", "Asleep", "No readings", "Not responding", "Failed", "Waking", "Crashed", "Never started", healthUnknown}
+
+// healthUnknown is the health of an instance on another box whose state no
+// box report vouches for (RouteView.unknown). It is the console's existing
+// "can't tell" wording, not a new phrase.
+const healthUnknown = "Can't tell right now"
// instanceQuery is one request's list controls. Zero value = everything,
// first page.
@@ -48,7 +53,7 @@ func parseInstanceQuery(v url.Values) instanceQuery {
// healthSlug is a health word's URL form: "Not responding" ↔
// "not-responding".
func healthSlug(word string) string {
- return strings.ReplaceAll(strings.ToLower(word), " ", "-")
+ return strings.ReplaceAll(strings.ReplaceAll(strings.ToLower(word), "'", ""), " ", "-")
}
func healthTone(word string) string {
diff --git a/internal/console/metricsview.go b/internal/console/metricsview.go
index 7f1c70307..24609b6e2 100644
--- a/internal/console/metricsview.go
+++ b/internal/console/metricsview.go
@@ -712,6 +712,17 @@ func (m InstanceMetrics) Reporting() bool { return m.Box != "" }
// readings, Reporting false), never zeros and never silently dropped — an
// owner whose instance is asleep must still see it listed.
func (s *Server) OwnerAppMetrics(ctx context.Context, hosts []string, unitByHost map[string]string) ([]InstanceMetrics, error) {
+ return s.ownerAppMetricsFrom(ctx, hosts, unitByHost, nil)
+}
+
+// ownerAppMetricsFrom is OwnerAppMetrics where boxByHost pins a host's
+// readings to one box: a host named there takes samples from that box only
+// and ignores every other box's samples of its units. The app pages pin an
+// instance on another box to the box whose report was accepted for this
+// account (remoteinstances.go), so a box serving the same host name for
+// another tenant cannot put its readings on this page. A host not named
+// there reads as before: the freshest box's sample.
+func (s *Server) ownerAppMetricsFrom(ctx context.Context, hosts []string, unitByHost, boxByHost map[string]string) ([]InstanceMetrics, error) {
// The allowlist, keyed by the unit names each host can legally match.
// Matching is exact-string on this map: a unit the caller did not ask
// for cannot be reached by any path below.
@@ -761,6 +772,9 @@ func (s *Server) OwnerAppMetrics(ctx context.Context, hosts []string, unitByHost
if !ok {
continue // not this app's — the whole boundary is this line
}
+ if pinned, ok := boxByHost[host]; ok && pinned != box.Box {
+ continue // another box's reading of a host pinned to one box
+ }
// A host that reports on two boxes at once (a move in flight)
// shows the freshest box's reading, not whichever sorted first.
if prev, taken := at[host]; taken && !box.At.After(prev) {
diff --git a/internal/console/overview.go b/internal/console/overview.go
index b0dd5dc17..4d9d00bcb 100644
--- a/internal/console/overview.go
+++ b/internal/console/overview.go
@@ -31,6 +31,10 @@ type OverviewStats struct {
// unknowns — the tile names them separately and the verdict must not
// treat them as down (the 2026-08-10 tito false alarm).
InstanceNoReadings int
+ // InstanceUnknown counts instances on other boxes whose state no box
+ // report vouches for (RouteView.unknown). Left out of the denominator
+ // like InstanceNoReadings, and the verdict says it can't tell.
+ InstanceUnknown int
// InstanceCounted is the Running tile's denominator: InstanceExpected
// minus the unknowable. Templates render facts, never compute them.
InstanceCounted int
@@ -147,7 +151,11 @@ func assembleOverview(view *AppView, acct string, metrics []InstanceMetrics, ver
st.InstanceTotal++
if rt.Kind == "instance" {
st.InstanceExpected++
- if reporting[rt.Host] || rt.boxAwake {
+ if rt.unknown {
+ // An instance on another box whose state no report vouches
+ // for: neither up, down nor asleep (remoteinstances.go).
+ st.InstanceUnknown++
+ } else if reporting[rt.Host] || rt.boxAwake {
st.InstanceReporting++
} else if rt.Hibernate {
st.InstanceAsleep++
@@ -156,7 +164,7 @@ func assembleOverview(view *AppView, acct string, metrics []InstanceMetrics, ver
}
}
}
- st.InstanceCounted = st.InstanceExpected - st.InstanceNoReadings
+ st.InstanceCounted = st.InstanceExpected - st.InstanceNoReadings - st.InstanceUnknown
// Routes and Domains are parallel slices — Assemble appends one of each
// per registry route, in the same loop — which is what lets the domain
// rows be account-filtered here at all (DomainView carries no account of
@@ -196,6 +204,8 @@ func healthVerdict(st OverviewStats) (string, string) {
return "attention", "Needs attention"
case st.InstanceReporting+st.InstanceAsleep < st.InstanceCounted:
return "attention", "Needs attention"
+ case st.InstanceUnknown > 0:
+ return "unknown", "Can't tell right now"
case st.Deployment.ReportableCount == 0:
return "ok", "All good"
case !st.Deployment.HasReportedVersion():
@@ -259,6 +269,11 @@ func assembleInstanceRows(view *AppView, acct *Account, metrics []InstanceMetric
if status == "" {
status = "ready" // registry contract: empty status means ready
}
+ health := healthWord(rt.Kind, status, rt.Hibernate, byHost[rt.Host].Reporting() || rt.boxAwake,
+ expectsReadings(rt.Provisioned, rt.Unit, rt.Backing))
+ if rt.unknown {
+ health = healthUnknown
+ }
rows = append(rows, InstanceRow{
Host: rt.Host,
Channel: rt.Channel,
@@ -268,8 +283,7 @@ func assembleInstanceRows(view *AppView, acct *Account, metrics []InstanceMetric
Hibernate: rt.Hibernate,
Metrics: byHost[rt.Host],
Restartable: rt.Restartable,
- HealthWord: healthWord(rt.Kind, status, rt.Hibernate, byHost[rt.Host].Reporting() || rt.boxAwake,
- expectsReadings(rt.Provisioned, rt.Unit, rt.Backing)),
+ HealthWord: health,
})
}
return rows
diff --git a/internal/console/remoteinstances.go b/internal/console/remoteinstances.go
index 7a84fb02a..52a8e9abb 100644
--- a/internal/console/remoteinstances.go
+++ b/internal/console/remoteinstances.go
@@ -26,7 +26,9 @@ package console
import (
"context"
+ "errors"
"log"
+ "os"
"sort"
"strings"
"sync"
@@ -47,14 +49,17 @@ const (
)
// boxReportCache is the console-wide read of status/boxes/. One load at a
-// time (mu is held across it), so a burst of page views costs one read.
+// time, so a burst of page views costs one read; mu guards the fields and
+// is never held across a load, and loading is closed when the running load
+// is published.
type boxReportCache struct {
mu sync.Mutex
- at time.Time
+ at time.Time // when the held read FINISHED
valid bool
- failed bool
+ failed bool // the held read failed or was incomplete: boxReportFailTTL
boxes []status.Box
complete bool
+ loading chan struct{}
// now is the cache's clock; nil is time.Now. Tests set it.
now func() time.Time
}
@@ -68,33 +73,60 @@ func (c *boxReportCache) clock() time.Time {
// pageBoxReports returns every box's report, from the cache when it is
// young enough, and whether the read saw every box (status.LoadBoxesComplete).
-// The load runs on its own bounded context, detached from the request's
-// cancellation, so one closed browser tab cannot fail the read for the
-// views queued behind it. The snapshots are shared and must not be changed.
+//
+// A read is held for boxReportTTL, or boxReportFailTTL when it failed or
+// skipped a box (complete false: a partial read must not stand for a
+// minute), timed from when the load finished, so a load that ran to its
+// timeout is not published already expired. The load runs on its own
+// bounded context, detached from the request's, so one closed browser tab
+// cannot fail the read for the views behind it. A view that arrives while a
+// load runs waits for it, and stops waiting when its own request ends: it
+// then gets whatever the cache held before, reported incomplete. The
+// snapshots are shared and must not be changed.
func (s *Server) pageBoxReports(ctx context.Context) ([]status.Box, bool) {
if s.cfg.Releases == nil {
return nil, false
}
c := &s.boxReports
- c.mu.Lock()
- defer c.mu.Unlock()
- now := c.clock()
- ttl := boxReportTTL
- if c.failed {
- ttl = boxReportFailTTL
- }
- if c.valid && now.Sub(c.at) < ttl {
- return c.boxes, c.complete
- }
- loadCtx, cancel := context.WithTimeout(context.WithoutCancel(ctx), instanceStoreTimeout)
- defer cancel()
- boxes, complete, err := status.LoadBoxesComplete(loadCtx, s.cfg.Releases)
- if err != nil {
- log.Printf("console: box reports for the app pages: %v", err)
- boxes, complete = nil, false
+ for {
+ c.mu.Lock()
+ ttl := boxReportTTL
+ if c.failed {
+ ttl = boxReportFailTTL
+ }
+ if c.valid && c.clock().Sub(c.at) < ttl {
+ boxes, complete := c.boxes, c.complete
+ c.mu.Unlock()
+ return boxes, complete
+ }
+ if wait := c.loading; wait != nil {
+ held := c.boxes
+ c.mu.Unlock()
+ select {
+ case <-wait:
+ continue
+ case <-ctx.Done():
+ return held, false
+ }
+ }
+ done := make(chan struct{})
+ c.loading = done
+ c.mu.Unlock()
+
+ loadCtx, cancel := context.WithTimeout(context.WithoutCancel(ctx), instanceStoreTimeout)
+ boxes, complete, err := status.LoadBoxesComplete(loadCtx, s.cfg.Releases)
+ cancel()
+ if err != nil {
+ log.Printf("console: box reports for the app pages: %v", err)
+ boxes, complete = nil, false
+ }
+ c.mu.Lock()
+ c.at, c.valid, c.failed, c.boxes, c.complete = c.clock(), true, err != nil || !complete, boxes, complete
+ c.loading = nil
+ close(done)
+ c.mu.Unlock()
+ return boxes, complete
}
- c.at, c.valid, c.failed, c.boxes, c.complete = now, true, err != nil, boxes, complete
- return boxes, complete
}
// hostReport is one fresh box's word about one host it serves.
@@ -214,7 +246,10 @@ func betterReport(a, b *hostReport) bool {
// boxes: a record reader already scoped to the viewed account, and the
// folded box reports.
type remoteRows struct {
- records func(app string) ([]provision.Record, error)
+ // records reads app's records, skipping hosts in skip (the console
+ // box's registry hosts, which keep their local rows) without reading
+ // them.
+ records func(app string, skip map[string]bool) ([]provision.Record, error)
reports fleetReports
}
@@ -223,9 +258,20 @@ type remoteRows struct {
//
// Status: "ready" when a fresh box reports the host; "pending" (Setting up)
// when every box was read and none does, which is a record whose route has
-// not been minted anywhere; "" (unknown) otherwise. A record placed on a
-// customer fleet is never "pending": fleet boxes report elsewhere, so the
-// platform's reports cannot vouch for its absence.
+// not been minted anywhere; "" otherwise. A record placed on a customer
+// fleet is never "pending": fleet boxes report elsewhere, so the platform's
+// reports cannot vouch for its absence.
+//
+// unknown: the row's process state is known only from a report whose
+// rollout names this account and app (tenantKnown). Without one (no report
+// and nothing vouches for absence, or an older box's report that names no
+// tenant), the row says "Can't tell right now" rather than guessing Asleep,
+// Not responding or Serving.
+//
+// metricsBox: readings join a remote row only from the box whose report
+// was accepted for it AND names this tenant. Any other box's samples of the
+// host (a box serving it for another account, a stale twin) are not this
+// row's. "" means the row joins no readings at all.
//
// Unit and Caps are deliberately empty. Unit feeds the metrics allowlist
// (appResourceMetrics), and the metrics boundary for a remote row is the
@@ -262,8 +308,11 @@ func remoteRoute(rec provision.Record, rep *hostReport, complete bool, acct stri
rv.box = rep.box
rv.dbBytes = rep.dbBytes
rv.aliases = rep.aliases
- if rep.tenantKnown && rep.awake {
- rv.boxAwake = true
+ if rep.tenantKnown {
+ rv.metricsBox = rep.box
+ rv.boxAwake = rep.awake
+ } else {
+ rv.unknown = true
}
if rd := rep.reading; rd != nil {
dv.DNS = rd.DNSStatus
@@ -278,16 +327,23 @@ func remoteRoute(rec provision.Record, rep *hostReport, complete bool, acct stri
}
case complete && !fleetPlaced:
rv.Status = "pending"
+ default:
+ rv.unknown = true
}
return rv, dv
}
-// pageRecords reads acct/app's instance records for a page view. With the
-// record view armed and its latest snapshot Complete it reads the snapshot
-// and makes no request: the run and seed sweeps keep it within a pass of the
-// bucket, and a page view does not refresh it. Otherwise it reads the bucket
-// (one LIST plus a GET per record), the read the Logs tab always made.
-func (s *Server) pageRecords(ctx context.Context, acct, app string) ([]provision.Record, error) {
+// pageRecords reads acct/app's instance records for a page view, every one
+// of them: no cap, so no instance is ever dropped from the pages. Hosts in
+// skip are listed but not read (the console box's own registry hosts, which
+// keep their local rows), so a page reads only the records it shows rows
+// for. With the record view armed and its latest snapshot Complete the
+// reads are the snapshot's and make no request: the run and seed sweeps
+// keep it within a pass of the bucket, and a page view does not refresh it.
+// Otherwise it is one LIST plus a GET per record not skipped. A record that
+// will not read is logged and left out; one deleted since the listing is
+// simply gone.
+func (s *Server) pageRecords(ctx context.Context, acct, app string, skip map[string]bool) ([]provision.Record, error) {
if s.cfg.Releases == nil {
return nil, nil
}
@@ -297,8 +353,37 @@ func (s *Server) pageRecords(ctx context.Context, acct, app string) ([]provision
store = sn.Store(s.cfg.Releases)
}
}
- recs, _, err := provision.ListRecords(ctx, store, acct, app, instanceListMax)
- return recs, err
+ prefix := provision.RecordsPrefix(acct, app)
+ keys, err := store.List(ctx, prefix)
+ if err != nil {
+ return nil, err
+ }
+ var hosts []string
+ for _, key := range keys {
+ rest, ok := strings.CutPrefix(key, prefix)
+ if !ok || rest == "" || strings.Contains(rest, "/") {
+ continue
+ }
+ host, ok := strings.CutSuffix(rest, ".json")
+ if !ok || host == "" || skip[host] {
+ continue
+ }
+ hosts = append(hosts, host)
+ }
+ sort.Strings(hosts)
+ recs := make([]provision.Record, 0, len(hosts))
+ for _, host := range hosts {
+ rec, err := provision.GetRecord(ctx, store, acct, app, host)
+ switch {
+ case errors.Is(err, os.ErrNotExist):
+ continue
+ case err != nil:
+ log.Printf("console: instance record %s/%s/%s: %v", acct, app, host, err)
+ continue
+ }
+ recs = append(recs, *rec)
+ }
+ return recs, nil
}
// remoteSource builds Assemble's remote input for one page view of acct.
@@ -308,10 +393,10 @@ func (s *Server) remoteSource(ctx context.Context, acct string) *remoteRows {
}
boxes, complete := s.pageBoxReports(ctx)
return &remoteRows{
- records: func(app string) ([]provision.Record, error) {
+ records: func(app string, skip map[string]bool) ([]provision.Record, error) {
rctx, cancel := context.WithTimeout(ctx, instanceStoreTimeout)
defer cancel()
- return s.pageRecords(rctx, acct, app)
+ return s.pageRecords(rctx, acct, app, skip)
},
reports: foldFleetReports(boxes, complete, time.Now()),
}
diff --git a/internal/console/remoteinstances_round1_test.go b/internal/console/remoteinstances_round1_test.go
new file mode 100644
index 000000000..3ba030db5
--- /dev/null
+++ b/internal/console/remoteinstances_round1_test.go
@@ -0,0 +1,314 @@
+package console
+
+// Round 1 review fixes (Astra, f2b993c3) for remoteinstances.go: each test
+// here failed against that tip.
+
+import (
+ "context"
+ "errors"
+ "fmt"
+ "net/http"
+ "strings"
+ "sync"
+ "testing"
+ "time"
+
+ "github.com/carlosframework/platform/internal/metrics"
+ "github.com/carlosframework/platform/internal/provision"
+ "github.com/carlosframework/platform/internal/registry"
+ "github.com/carlosframework/platform/internal/release"
+ "github.com/carlosframework/platform/internal/status"
+)
+
+// sweepAt is sweep at a chosen sample time.
+func sweepAt(t *testing.T, rel release.Store, box string, at time.Time, units map[string]metrics.UnitSample) {
+ t.Helper()
+ at = at.UTC()
+ if err := metrics.WriteRaw(context.Background(), rel, metrics.RawChunk{
+ V: 1, Box: box, Hour: metrics.HourOf(at),
+ Samples: []metrics.Sample{{At: at, Units: units}},
+ }); err != nil {
+ t.Fatal(err)
+ }
+}
+
+// P1: this account's record names a host, but the only box serving it says
+// it is another account's. That report is refused, and so must be every
+// reading of the host: its CPU and memory are the other tenant's.
+func TestRemoteMetricsRefuseRejectedReport(t *testing.T) {
+ tb := newTwoBoxes(t)
+ tb.create(t, tb.token, tb.sqid, "shop", remoteHost, "uk", "")
+ // Box B serves the host for another account (no reconcile on B: the
+ // row is someone else's).
+ if err := tb.regB.Upsert(registry.Route{Host: remoteHost, Kind: "instance", App: "shop", Account: "rvl",
+ Channel: "stable", Version: "v8", Provisioned: true, Status: "ready"}); err != nil {
+ t.Fatal(err)
+ }
+ report(t, tb.fx.rel, tb.regB, "box-b", "uk", time.Now(), map[string]bool{remoteHost: true}, 4096)
+ sweep(t, tb.fx.rel, status.Label("box-b"), map[string]metrics.UnitSample{
+ "carlos-exec@" + remoteHost: {CPUFrac: p(0.66), MemBytes: pi64(7 << 20)},
+ })
+ for _, path := range []string{"/apps/shop", "/apps/shop/instances", "/apps/shop/instances/" + remoteHost} {
+ body := tb.page(t, path)
+ for _, bad := range []string{"66%", "7.0 MB", "v8", "4.0 KB"} {
+ if strings.Contains(body, bad) {
+ t.Fatalf("%s shows %q from a report naming another account:\n%s", path, bad, body)
+ }
+ }
+ }
+ row := instanceRow(t, tb.page(t, "/apps/shop/instances"), remoteHost)
+ if strings.Contains(row, "Running") {
+ t.Fatalf("the refused tenant's readings made the row Running: %s", row)
+ }
+ if status, _, out := rawReq(t, http.MethodGet, instancesURL(tb.fx, tb.sqid, "shop"), tb.token, ""); status != http.StatusOK || strings.Contains(out, `"health":"Running"`) {
+ t.Fatalf("instances list = %d %s", status, out)
+ }
+}
+
+// P1: the accepted report is box B's; a fresher sample of the same unit on
+// another box is not this row's to show.
+func TestRemoteMetricsOnlyFromAcceptedBox(t *testing.T) {
+ tb := newTwoBoxes(t)
+ tb.setUp(t, false)
+ sweepAt(t, tb.fx.rel, status.Label("box-c"), time.Now().Add(-10*time.Second), map[string]metrics.UnitSample{
+ "carlos-exec@" + remoteHost: {CPUFrac: p(0.66), MemBytes: pi64(7 << 20)},
+ })
+ ov := tb.page(t, "/apps/shop")
+ if strings.Contains(ov, "66%") || strings.Contains(ov, "7.0 MB") || !strings.Contains(ov, "27%") {
+ t.Fatalf("overview metrics are not the accepted box's:\n%s", ov)
+ }
+}
+
+// P2: with an incomplete read of the box reports, a remote instance's state
+// is unknown, and every page says so rather than guessing Asleep.
+func TestRemoteUnknownStateRendersUnknown(t *testing.T) {
+ tb := newTwoBoxes(t)
+ tb.create(t, tb.token, tb.sqid, "shop", remoteHost, "uk", "")
+ // One box report that will not parse: the read is incomplete, and no
+ // readable report names the host.
+ if _, err := tb.fx.rel.Put(context.Background(), "status/boxes/broken.json", []byte("{not json"), ""); err != nil {
+ t.Fatal(err)
+ }
+ run := tb.page(t, "/apps/shop/instances")
+ row := instanceRow(t, run, remoteHost)
+ if !strings.Contains(row, "Can&#39;t tell right now") || strings.Contains(row, "Asleep") || strings.Contains(row, "Not responding") {
+ t.Fatalf("Running row for an unknown remote instance = %s", row)
+ }
+ inst := tb.page(t, "/apps/shop/instances/"+remoteHost)
+ if !strings.Contains(inst, "<dt>Health</dt><dd>Can&#39;t tell right now</dd>") || strings.Contains(inst, "wakes on the next request") {
+ t.Fatalf("instance page for an unknown remote instance:\n%s", inst)
+ }
+ ov := tb.page(t, "/apps/shop")
+ if !strings.Contains(ov, "Can&#39;t tell right now") || !strings.Contains(ov, "no data right now") || strings.Contains(ov, "no readings for 0 copies") || strings.Contains(ov, "asleep") {
+ t.Fatalf("overview for an unknown remote instance:\n%s", ov)
+ }
+ if status, _, out := rawReq(t, http.MethodGet, instancesURL(tb.fx, tb.sqid, "shop"), tb.token, ""); status != http.StatusOK || !strings.Contains(out, `"health":"Can't tell right now"`) {
+ t.Fatalf("instances list = %d %s", status, out)
+ }
+}
+
+// P2: a report that names no tenant (an older box) gives a version, but not
+// the process state: a resident or static row must not read Not responding
+// or Serving on that evidence.
+func TestRemoteUnknownTenantReportHealth(t *testing.T) {
+ now := time.Now()
+ boxes := []status.Box{{GeneratedAt: now, Label: "b", Metrics: &status.BoxMetrics{
+ RouteVersions: map[string]string{"r.example.com": "v2", "s.example.com": "v2"}}}}
+ f := foldFleetReports(boxes, true, now)
+ no := false
+ var routes []RouteView
+ var domains []DomainView
+ for _, rec := range []provision.Record{
+ {Host: "r.example.com", App: "shop", Account: "a", Hibernate: &no, Addr: "127.0.0.1:1"},
+ {Host: "s.example.com", App: "shop", Account: "a", Kind: "static"},
+ } {
+ rv, dv := remoteRoute(rec, f.pick(rec.Host, "a", "shop"), f.complete, "a", DNSTargets{})
+ routes, domains = append(routes, rv), append(domains, dv)
+ }
+ view := &AppView{Routes: routes, Domains: domains}
+ for _, row := range assembleInstanceRows(view, &Account{Sqid: "a"}, []InstanceMetrics{}) {
+ if row.HealthWord != "Can't tell right now" {
+ t.Fatalf("%s health = %q on a report naming no tenant", row.Host, row.HealthWord)
+ }
+ }
+ if st := assembleOverview(view, "a", []InstanceMetrics{}, nil, boxJoin{}); st.VerdictLabel != "Can't tell right now" {
+ t.Fatalf("verdict = %q", st.VerdictLabel)
+ }
+}
+
+// reportStore serves status/boxes/ with a controllable listing.
+type reportStore struct {
+ release.Store
+ mu sync.Mutex
+ lists int
+ onList func() error
+ failGet bool
+}
+
+func (s *reportStore) List(ctx context.Context, prefix string) ([]string, error) {
+ if strings.HasPrefix(prefix, "status/boxes/") {
+ s.mu.Lock()
+ s.lists++
+ fn := s.onList
+ s.mu.Unlock()
+ if fn != nil {
+ if err := fn(); err != nil {
+ return nil, err
+ }
+ }
+ }
+ return s.Store.List(ctx, prefix)
+}
+
+func (s *reportStore) Get(ctx context.Context, key string) ([]byte, string, error) {
+ if s.failGet && strings.HasPrefix(key, "status/boxes/") {
+ return nil, "", errors.New("boom")
+ }
+ return s.Store.Get(ctx, key)
+}
+
+func (s *reportStore) listCount() int {
+ s.mu.Lock()
+ defer s.mu.Unlock()
+ return s.lists
+}
+
+func cacheServer(t *testing.T, rs *reportStore) (*Server, *time.Time) {
+ t.Helper()
+ clock := time.Now()
+ s := &Server{cfg: Config{Releases: rs}}
+ s.boxReports.now = func() time.Time { return clock }
+ return s, &clock
+}
+
+// P3: a load that fails after a long wait is held for the failure TTL from
+// when it FINISHED, not from when it started.
+func TestBoxReportCacheSlowFailureIsHeld(t *testing.T) {
+ rs := &reportStore{Store: release.NewDirStore(t.TempDir())}
+ s, clock := cacheServer(t, rs)
+ rs.onList = func() error {
+ *clock = clock.Add(15 * time.Second) // the load ran to its timeout
+ return errors.New("slow and failed")
+ }
+ s.pageBoxReports(context.Background())
+ s.pageBoxReports(context.Background())
+ if n := rs.listCount(); n != 1 {
+ t.Fatalf("box report listings = %d, want 1: a just-finished failed load was treated as already expired", n)
+ }
+}
+
+// P3: a read that skipped a box (complete false) is a failed read and is
+// held for the failure TTL only.
+func TestBoxReportCacheIncompleteIsShortLived(t *testing.T) {
+ inner := release.NewDirStore(t.TempDir())
+ b := status.CollectBox(nil, status.Probes{MachineID: "m"}, time.Now())
+ if err := status.WriteBox(context.Background(), inner, b); err != nil {
+ t.Fatal(err)
+ }
+ rs := &reportStore{Store: inner, failGet: true}
+ s, clock := cacheServer(t, rs)
+ if _, complete := s.pageBoxReports(context.Background()); complete {
+ t.Fatal("fixture: the read was complete")
+ }
+ *clock = clock.Add(boxReportFailTTL + time.Second)
+ s.pageBoxReports(context.Background())
+ if n := rs.listCount(); n != 2 {
+ t.Fatalf("box report listings = %d, want 2: an incomplete read was held as long as a good one", n)
+ }
+}
+
+// P3: a viewer waiting behind a slow load can give up when its own request
+// is cancelled.
+func TestBoxReportCacheWaitIsCancellable(t *testing.T) {
+ release1 := make(chan struct{})
+ started := make(chan struct{})
+ rs := &reportStore{Store: release.NewDirStore(t.TempDir())}
+ rs.onList = func() error { close(started); <-release1; return nil }
+ s, _ := cacheServer(t, rs)
+ defer close(release1)
+ go s.pageBoxReports(context.Background())
+ <-started
+ ctx, cancel := context.WithCancel(context.Background())
+ cancel()
+ done := make(chan struct{})
+ go func() { s.pageBoxReports(ctx); close(done) }()
+ select {
+ case <-done:
+ case <-time.After(2 * time.Second):
+ t.Fatal("a cancelled viewer stayed queued behind the slow load")
+ }
+}
+
+// P4: more records than the old 500 cap. None may be dropped: the last
+// host (sorted) shows on the Running tab and its instance page renders.
+func TestRemoteRecordsNotCapped(t *testing.T) {
+ tb := newTwoBoxes(t)
+ ctx := context.Background()
+ now := time.Now()
+ const last = "zz-last.shop.example.com"
+ for i := 0; i <= instanceListMax; i++ {
+ host := last
+ if i < instanceListMax {
+ host = fmt.Sprintf("h%04d.shop.example.com", i)
+ }
+ if err := provision.CreateRecord(ctx, tb.fx.rel, provision.Record{Schema: 1, Host: host, Slug: strings.SplitN(host, ".", 2)[0],
+ App: "shop", Account: tb.sqid, Pool: "shop", Region: "uk", Channel: "stable", CreatedAt: now}); err != nil {
+ t.Fatalf("record %s: %v", host, err)
+ }
+ }
+ views, err := tb.fx.srv.assembleApps(ctx, tb.sqid, []string{"shop"})
+ if err != nil {
+ t.Fatal(err)
+ }
+ if n := len(views[0].Routes); n != instanceListMax+1 {
+ t.Fatalf("rows = %d, want %d", n, instanceListMax+1)
+ }
+ if status, _, body := get(t, tb.browser, tb.fx.ts.URL+"/a/"+tb.sqid+"/apps/shop/instances/"+last); status != http.StatusOK {
+ t.Fatalf("instance page for the record past the old cap = %d\n%s", status, body)
+ }
+}
+
+// P1, `carlos instances list`: the accepted box reports the instance asleep
+// and has no sample; another box's sample of the same unit must not make
+// it Running.
+func TestRemoteInstancesListPinnedToAcceptedBox(t *testing.T) {
+ tb := newTwoBoxes(t)
+ tb.create(t, tb.token, tb.sqid, "shop", remoteHost, "uk", "")
+ tb.reconcile(t, "v3")
+ report(t, tb.fx.rel, tb.regB, "box-b", "uk", time.Now(), nil, 4096)
+ sweep(t, tb.fx.rel, status.Label("box-c"), map[string]metrics.UnitSample{
+ "carlos-exec@" + remoteHost: {CPUFrac: p(0.66), MemBytes: pi64(7 << 20)},
+ })
+ if status, _, out := rawReq(t, http.MethodGet, instancesURL(tb.fx, tb.sqid, "shop"), tb.token, ""); status != http.StatusOK || !strings.Contains(out, `"health":"Asleep"`) {
+ t.Fatalf("instances list = %d %s, want Asleep from the accepted box", status, out)
+ }
+ if ov := tb.page(t, "/apps/shop"); strings.Contains(ov, "66%") {
+ t.Fatalf("overview shows another box's reading:\n%s", ov)
+ }
+}
+
+// P1/P2, `carlos instances list`: an older box's report names no tenant.
+// Its version may show, but its readings do not join and the health is
+// unknown.
+func TestRemoteInstancesListUnknownTenant(t *testing.T) {
+ tb := newTwoBoxes(t)
+ tb.create(t, tb.token, tb.sqid, "shop", remoteHost, "uk", "")
+ tb.reconcile(t, "v3")
+ routes, err := tb.regB.List()
+ if err != nil {
+ t.Fatal(err)
+ }
+ b := status.CollectBox(routes, status.Probes{MachineID: "box-b", Region: "uk"}, time.Now()) // no rollout report
+ if err := status.WriteBox(context.Background(), tb.fx.rel, b); err != nil {
+ t.Fatal(err)
+ }
+ sweep(t, tb.fx.rel, status.Label("box-b"), map[string]metrics.UnitSample{
+ "carlos-exec@" + remoteHost: {CPUFrac: p(0.66), MemBytes: pi64(7 << 20)},
+ })
+ if status, _, out := rawReq(t, http.MethodGet, instancesURL(tb.fx, tb.sqid, "shop"), tb.token, ""); status != http.StatusOK || !strings.Contains(out, `"health":"Can't tell right now"`) {
+ t.Fatalf("instances list = %d %s", status, out)
+ }
+ if ov := tb.page(t, "/apps/shop"); strings.Contains(ov, "66%") {
+ t.Fatalf("overview joined readings on a report naming no tenant:\n%s", ov)
+ }
+}
diff --git a/internal/console/remoteinstances_test.go b/internal/console/remoteinstances_test.go
index f43cd8641..173101ab7 100644
--- a/internal/console/remoteinstances_test.go
+++ b/internal/console/remoteinstances_test.go
@@ -224,7 +224,7 @@ func (tb *twoBoxes) setUp(t *testing.T, local bool) {
}
report(t, tb.fx.rel, regA, "box-a", "ie", time.Now(), nil, 1024)
report(t, tb.fx.rel, tb.regB, "box-b", "uk", time.Now(), nil, 4096)
- sweep(t, tb.fx.rel, "box-b", map[string]metrics.UnitSample{
+ sweep(t, tb.fx.rel, status.Label("box-b"), map[string]metrics.UnitSample{
"carlos-exec@" + remoteHost: {CPUFrac: p(0.27), MemBytes: pi64(3 << 20)},
})
}
@@ -382,7 +382,7 @@ func TestRemoteInstanceCrossAccount(t *testing.T) {
tb.setUp(t, false)
// B's report now carries both tenants; the sweep both units.
report(t, tb.fx.rel, tb.regB, "box-b", "uk", time.Now(), nil, 9216)
- sweep(t, tb.fx.rel, "box-b", map[string]metrics.UnitSample{
+ sweep(t, tb.fx.rel, status.Label("box-b"), map[string]metrics.UnitSample{
"carlos-exec@" + remoteHost: {CPUFrac: p(0.27), MemBytes: pi64(3 << 20)},
"carlos-exec@" + rivalHost: {CPUFrac: p(0.66), MemBytes: pi64(7 << 20)},
})
@@ -484,7 +484,7 @@ func TestRemoteReportStaleAndMoving(t *testing.T) {
// trusted alone. A record that disagrees with the viewed account or app is
// never a row (the mutation target for the account filter in addRemoteRows).
func TestRemoteRecordsAccountFilter(t *testing.T) {
- remote := &remoteRows{records: func(string) ([]provision.Record, error) {
+ remote := &remoteRows{records: func(string, map[string]bool) ([]provision.Record, error) {
return []provision.Record{
{Host: "mine.example.com", App: "shop", Account: "a"},
{Host: "theirs.example.com", App: "shop", Account: "b"},
diff --git a/internal/console/server.go b/internal/console/server.go
index e32219517..ea5ce8c1b 100644
--- a/internal/console/server.go
+++ b/internal/console/server.go
@@ -3526,17 +3526,28 @@ func (s *Server) appResourceMetrics(ctx context.Context, view *AppView, acct *Ac
hosts := make([]string, 0, len(view.Routes))
hib := make(map[string]bool, len(view.Routes))
unitByHost := make(map[string]string, len(view.Routes))
+ boxByHost := map[string]string{}
for _, rt := range view.Routes {
if rt.Account != acct.Sqid {
continue
}
+ // An instance on another box joins readings only from the box whose
+ // report was accepted for this account and app (remoteinstances.go),
+ // and none at all without one: the host name alone is not this
+ // tenant's, since another box may serve it for someone else.
+ if rt.remote {
+ if rt.metricsBox == "" {
+ continue
+ }
+ boxByHost[rt.Host] = rt.metricsBox
+ }
hosts = append(hosts, rt.Host)
hib[rt.Host] = rt.Hibernate
if rt.Unit != "" {
unitByHost[rt.Host] = rt.Unit
}
}
- am, err := s.OwnerAppMetrics(ctx, hosts, unitByHost)
+ am, err := s.ownerAppMetricsFrom(ctx, hosts, unitByHost, boxByHost)
if err != nil {
log.Printf("console: app metrics %s: %v", view.App, err)
return nil
diff --git a/internal/console/templates/app_overview.html b/internal/console/templates/app_overview.html
index f029121bb..ff4f5ea46 100644
--- a/internal/console/templates/app_overview.html
+++ b/internal/console/templates/app_overview.html
@@ -30,7 +30,7 @@
<a class="tile" href="{{$.Nav}}/apps/{{$.AppName}}/instances">
<h2>Running</h2>
<p class="tile-value">{{if eq .InstanceTotal 0}}—{{else if eq .InstanceExpected 0}}Served{{else if .MetricsUnavailable}}?{{else if eq .InstanceCounted 0}}?{{else}}{{.InstanceReporting}} of {{.InstanceCounted}}{{end}}</p>
- <p class="tile-detail">{{if eq .InstanceTotal 0}}nothing running yet{{else if eq .InstanceExpected 0}}static — the platform serves it, nothing to run{{else if .MetricsUnavailable}}no data right now{{else if eq .InstanceCounted 0}}no readings for {{.InstanceNoReadings}} copies — stamp their units to see health{{else}}copies reporting{{if .InstanceAsleep}} · {{.InstanceAsleep}} asleep{{end}}{{if .InstanceNoReadings}} · {{.InstanceNoReadings}} no readings{{end}}{{end}}</p>
+ <p class="tile-detail">{{if eq .InstanceTotal 0}}nothing running yet{{else if eq .InstanceExpected 0}}static — the platform serves it, nothing to run{{else if or .MetricsUnavailable (and (eq .InstanceCounted 0) .InstanceUnknown)}}no data right now{{else if eq .InstanceCounted 0}}no readings for {{.InstanceNoReadings}} copies — stamp their units to see health{{else}}copies reporting{{if .InstanceAsleep}} · {{.InstanceAsleep}} asleep{{end}}{{if .InstanceNoReadings}} · {{.InstanceNoReadings}} no readings{{end}}{{end}}</p>
</a>
<a class="tile" href="{{$.Nav}}/apps/{{$.AppName}}/instances">
<h2>Resources</h2>
diff --git a/internal/console/view.go b/internal/console/view.go
index 86cc129d3..80e697204 100644
--- a/internal/console/view.go
+++ b/internal/console/view.go
@@ -376,6 +376,12 @@ type RouteView struct {
dbBytes *int64
aliases []string
boxAwake bool
+ // metricsBox is the one box whose metrics samples may join a remote
+ // row: the box whose accepted report names this account and app. ""
+ // joins none. unknown says the row's process state is not known
+ // (remoteRoute): its health reads "Can't tell right now".
+ metricsBox string
+ unknown bool
}
// humanizeCaps renders a registry.Route.Caps column for a person: the
@@ -679,7 +685,7 @@ func Assemble(regPath string, s release.Store, pub ed25519.PublicKey, acct strin
// disagrees with its own path; this refuses one a reader handed over from
// anywhere else).
func addRemoteRows(remote *remoteRows, acct, app string, localHosts map[string]bool, routes []RouteView, domains []DomainView, dns DNSTargets) ([]RouteView, []DomainView) {
- recs, err := remote.records(app)
+ recs, err := remote.records(app, localHosts)
if err != nil {
log.Printf("console: instance records %s/%s: %v", acct, app, err)
return routes, domains
diff --git a/internal/provision/console_remote_instances_census_test.go b/internal/provision/console_remote_instances_census_test.go
index d9122ed8e..c872ea274 100644
--- a/internal/provision/console_remote_instances_census_test.go
+++ b/internal/provision/console_remote_instances_census_test.go
@@ -17,11 +17,17 @@ package provision
// GetSidecarRecord, refusing on any read error, to count followers on
// other boxes; it reads, never writes: key-site, like
// Server.checkSidecars.
+// - Server.pageRecords is new (round 1 review): the app pages' record
+// reader. It lists RecordsPrefix for the viewed account's app and reads
+// each record not already a local row with GetRecord, through the
+// record view's snapshot when armed; it writes nothing: key-site, like
+// Server.appInstanceCount.
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"},
+ {"internal/console/remoteinstances.go", "Server.pageRecords", "key-site", "key:RecordsPrefix", "b03ec08af6e2eedc5b2fa269751b5fa3465c2e728c93a6c97964ebabb15362a4"},
}
for _, r := range replacements {
found := false
diff --git a/internal/provision/testdata/plan14-root-reads-chain.tsv b/internal/provision/testdata/plan14-root-reads-chain.tsv
index c571623d2..d1f7df03c 100644
--- a/internal/provision/testdata/plan14-root-reads-chain.tsv
+++ b/internal/provision/testdata/plan14-root-reads-chain.tsv
@@ -23,4 +23,4 @@ plan14-root-reads-plans-4a-store.tsv 72dc835c04caf5b2b49cc6ecbfd865bb3123b997ee9
plan14-root-reads-plans-4-notices-grace.tsv 43e430a3b3edf9333bfe2c64f24ca9e4c04475dc45ae4983d4e8bcab6a9c0bc4
plan14-root-reads-design-edge-rate-limit-358-decisions.tsv a067dcd9e32e6be2b7dd9c6a8256d1252ac4c737fd058c430823e382add340c4
plan14-root-reads-design-edge-rate-limit-358.tsv 0c4eabfe38e12b098285bdeb5ceb0b16e5333928f5b02e160a6b16b5fd9ce1e0
-plan14-root-reads-console-remote-instances.tsv 98625108694485f86758341d9c1608c978db17519efe474f7210b3a45c258ba4
+plan14-root-reads-console-remote-instances.tsv dfdf49f3de3e612a21a29c24addc123c18a6cd68355dc134409b8743e6f596b4
diff --git a/internal/provision/testdata/plan14-root-reads-console-remote-instances.tsv b/internal/provision/testdata/plan14-root-reads-console-remote-instances.tsv
index aec5eb2f4..e7b54670c 100644
--- a/internal/provision/testdata/plan14-root-reads-console-remote-instances.tsv
+++ b/internal/provision/testdata/plan14-root-reads-console-remote-instances.tsv
@@ -1,17 +1,20 @@
# Census overlay console-remote-instances, written by census-propose (#369). census-ruling-console-remote-instances, approved on #280 before the merge; the approval card is docs/superpowers/notes/census-proposal-console-remote-instances.md.
-# 5 body, 2 sites, 1 envelope: each changed unit re-frozen at its existing disposition with its claim appended.
-@legacy 81b2e175961839da32af0e32e53e0a75bfaac577f52b8b3b293f6ca55b2fbd10 internal/console/accountfleet.go Server.assembleAccountFleet legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-console-remote-instances;basis=Fleet tab: the shared-fleet app count also reads the account's own instance records (per app of the account, under its own prefix, region not a fleet placement); the registry read is unchanged. registry:Account@2350,registry:Account@4416,registry:App@2476,registry:Name@4809,registry:Region@2437,whole:Fleet@4001,whole:Fleet@4403,whole:Fleet@4517,whole:Route@2335 9e1c37cdfb0abb8bb0b864ed9fb5413c4b15e17f09b55d1d64760b83de0f8b64
-@legacy 6a11dad2784301b4e050926419a7f296ab7f4db44d0cf6802c1a58d5e84a1f8e internal/console/apiinstances.go Server.healthByHost legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-console-remote-instances;basis=Takes an awake set (hosts whose box report says awake) that also counts as reporting; registry reads unchanged. registry:Backing@1162,registry:Hibernate@1084,registry:Kind@1067,registry:Provisioned@1137,registry:Status@944,registry:Unit@1153,registry:Unit@318,registry:Unit@353,whole:Route@166,whole:Route@209,whole:Route@275,whole:Route@921 f05038c6c6fa601338a8799d65515a60707f4904b81f2d46ca83c4cd5b78ba8c
-@legacy 1d4fdae641d98f88343557baa875a81b33357a4e7962cce0f3682d32104530f3 internal/console/apiroutes.go Server.handleAPIRoutes legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-console-remote-instances;basis=Passes nil for healthByHost's new awake argument; nothing else. registry:Account@4604,registry:App@1646,registry:App@2104,registry:App@4543,registry:Backing@2264,registry:Canary@2402,registry:Channel@2124,registry:Environment@2149,registry:Hibernate@2223,registry:Host@1730,registry:Host@2046,registry:Host@2202,registry:Host@2358,registry:Host@4676,registry:Host@4756,registry:Kind@2061,registry:Platform@2387,registry:Prefix@4772,registry:Provisioned@2289,registry:Replication@2321,registry:Status@2173,registry:Target@4790,registry:Unit@2243,whole:Route@1635,whole:Route@1684,whole:Route@1721,whole:Route@1741,whole:Route@1861,whole:Route@1963,whole:Route@1994,whole:Route@2094,whole:Route@4667,whole:RoutePath@3609 2fc5fde5477d298cc925ecf9d3b0fbb4cda8095bd7e22df76c2e114e716b5dea
+# 6 body, 2 sites, 2 envelope: each changed unit re-frozen at its existing disposition with its claim appended.
+@legacy d0a3ae6c1eb6795c3810264874e4f1363432cbdd3aae6398e30422c7169a3726 internal/console/accountfleet.go Server.assembleAccountFleet legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-console-remote-instances;basis=Fleet tab: the shared-fleet app count also reads the account's own instance records (per app of the account, under its own prefix, region not a fleet placement); the registry read is unchanged. registry:Account@2350,registry:Account@4421,registry:App@2476,registry:Name@4814,registry:Region@2437,whole:Fleet@4006,whole:Fleet@4408,whole:Fleet@4522,whole:Route@2335 1b5ecf4066d067d721683d273e768d834df0bb9cb3cf5ff90648b1e6842bacc8
+@legacy 58a7d414fbb215c8294d5ff71b9223c0dddc230fe7b083c195bdf4f8e3bcb19d internal/console/apiinstances.go Server.healthByHost legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-console-remote-instances;basis=Takes an awake set (hosts whose accepted box report says awake) and a box pin per host (readings only from that box, via ownerAppMetricsFrom); registry reads unchanged. registry:Backing@1206,registry:Hibernate@1128,registry:Kind@1111,registry:Provisioned@1181,registry:Status@988,registry:Unit@1197,registry:Unit@347,registry:Unit@382,whole:Route@195,whole:Route@238,whole:Route@304,whole:Route@965 2cc7789d2acb4af7864927bb9a85409d70b8b39d3a5f22862660fa59cd916489
+@legacy 2bfa72171179fc26108bd6eb6b2308245cba25d3f82c41652b98637529a7ef76 internal/console/apiroutes.go Server.handleAPIRoutes legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-console-remote-instances;basis=Passes nil, nil for healthByHost's new awake and box-pin arguments; nothing else. registry:Account@4609,registry:App@1646,registry:App@2109,registry:App@4548,registry:Backing@2269,registry:Canary@2407,registry:Channel@2129,registry:Environment@2154,registry:Hibernate@2228,registry:Host@1730,registry:Host@2051,registry:Host@2207,registry:Host@2363,registry:Host@4681,registry:Host@4761,registry:Kind@2066,registry:Platform@2392,registry:Prefix@4777,registry:Provisioned@2294,registry:Replication@2326,registry:Status@2178,registry:Target@4795,registry:Unit@2248,whole:Route@1635,whole:Route@1684,whole:Route@1721,whole:Route@1741,whole:Route@1861,whole:Route@1968,whole:Route@1999,whole:Route@2099,whole:Route@4672,whole:RoutePath@3614 ff28ee87238241e58e970f653409afd8d62b2e463ef9743fda24bb72fc841eef
@legacy 68455015fbe9d2db598f2616aa59f01bda880869dbee9d7b61b65506624f6e42 internal/console/instancepage.go Server.handleAppInstance legacy accepted-legacy accepted-legacy;rev3=merge-ruling-2;basis=Instance page adds updates view from rollout join; browser rendering remains legacy.;rev3=census-ruling-console-remote-instances;basis=A remote row (no local registry row) takes its aliases from its box report; local rows read ListAliases as before. file:Query@2672,registry:Account@2444,registry:Alias@2544,registry:App@2474,registry:Host@2422,whole:RouteAlias@2405 07f5c01659b0d453d5996abb6a6e9493f74c7df97e3cddfe0f765b6f316de4a7
@legacy cc2a59e85603c31a16603b604500150850115905d8a4c7f5112d7f425bde8878 internal/console/server.go Server.channelHosts legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-console-remote-instances;basis=Canary-retire guard also counts the account's instance records (ListRecordsStrict) and sidecar records (listed, then each read with GetSidecarRecord; any read error including not-found refuses) from the bucket, failing closed; the registry read is unchanged. registry:App@424,registry:Channel@441,registry:Host@472,whole:Route@410 0bfd742f32f4173619a9e0031c8c56cf47142762d60ec8e67a3ca1549a1028ef
-@legacy bffb5c43e0fb1be71640ce52817aed2ca38afe5df0a5813114cd3d3618d52a5d internal/console/apiinstances.go Server.instanceHealth legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-console-remote-instances;basis=Records with no local registry row get health from their box report: two registry.Route literals built from the record (not read from any registry). registry:Account@1987,registry:Account@2007,registry:App@1948,registry:App@1964,registry:Host@839,registry:Unit@2117,registry:Unit@2159,whole:Route@1151,whole:Route@2054,whole:Route@2075,whole:Route@2643,whole:Route@2988,whole:Route@3306,whole:Route@792,whole:Route@821,whole:Route@832,whole:Route@850 fdc0e9bc91683b587d876e922e204458e9da749fd0e56b92a9edfcd94171241b
-@legacy a94fc36641dc57206c9123a660dc36cdc0717bb8d7ecaa7e10e014d89ba0d217 internal/console/view.go Assemble legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-console-remote-instances;basis=Collects the set of local registry hosts (rt.Host) so a record host the registry has gets no remote row; adds rows from the account's records and box reports when given a remote source. registry:App@1716,registry:App@1739,registry:App@2117,registry:App@2147,registry:Backing@2017,registry:Caps@1385,registry:Channel@960,registry:Environment@1942,registry:Hibernate@1859,registry:Host@1768,registry:Host@861,registry:Kind@1783,registry:Platform@1889,registry:Provisioned@2042,registry:Status@1800,registry:Unit@1999,registry:Version@1823,whole:Route@2092,whole:Route@2167,whole:Route@810,whole:Route@839,whole:Route@910 120ae8c042523f872fd1c19357b8bb830e4afe9da1e38ad202df2ada3ad52ada
-internal/console/accountfleet.go Server.assembleAccountFleet legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-console-remote-instances;basis=Fleet tab: the shared-fleet app count also reads the account's own instance records (per app of the account, under its own prefix, region not a fleet placement); the registry read is unchanged. registry:Account@2350,registry:Account@4416,registry:App@2476,registry:Name@4809,registry:Region@2437,whole:Fleet@4001,whole:Fleet@4403,whole:Fleet@4517,whole:Route@2335 9e1c37cdfb0abb8bb0b864ed9fb5413c4b15e17f09b55d1d64760b83de0f8b64
-internal/console/apiinstances.go Server.healthByHost legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-console-remote-instances;basis=Takes an awake set (hosts whose box report says awake) that also counts as reporting; registry reads unchanged. registry:Backing@1162,registry:Hibernate@1084,registry:Kind@1067,registry:Provisioned@1137,registry:Status@944,registry:Unit@1153,registry:Unit@318,registry:Unit@353,whole:Route@166,whole:Route@209,whole:Route@275,whole:Route@921 f05038c6c6fa601338a8799d65515a60707f4904b81f2d46ca83c4cd5b78ba8c
-internal/console/apiroutes.go Server.handleAPIRoutes legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-console-remote-instances;basis=Passes nil for healthByHost's new awake argument; nothing else. registry:Account@4604,registry:App@1646,registry:App@2104,registry:App@4543,registry:Backing@2264,registry:Canary@2402,registry:Channel@2124,registry:Environment@2149,registry:Hibernate@2223,registry:Host@1730,registry:Host@2046,registry:Host@2202,registry:Host@2358,registry:Host@4676,registry:Host@4756,registry:Kind@2061,registry:Platform@2387,registry:Prefix@4772,registry:Provisioned@2289,registry:Replication@2321,registry:Status@2173,registry:Target@4790,registry:Unit@2243,whole:Route@1635,whole:Route@1684,whole:Route@1721,whole:Route@1741,whole:Route@1861,whole:Route@1963,whole:Route@1994,whole:Route@2094,whole:Route@4667,whole:RoutePath@3609 2fc5fde5477d298cc925ecf9d3b0fbb4cda8095bd7e22df76c2e114e716b5dea
+@legacy df95584ebc6921096d1081ae045d37253f93dfeefdface01cef61b78bbb96dba 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: when every instance's state is unknown (instances on other boxes no report vouches for) the detail reads the existing 'no data right now'; display only. file:external@0 db64e6c62c55a50f43ace2b0b47cf89fe31a4f78bacc5bc89df8ba19b8e43ee4
+@legacy bca792d24a010eb4e1deb8a64fe38a0dcadfe48cfd61044cc31b5339318e2480 internal/console/apiinstances.go Server.instanceHealth legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-console-remote-instances;basis=Records with no local registry row get health only from a box report naming the record's own account and app, with readings pinned to that box; otherwise Setting up (complete read, no report) or Can't tell right now. Builds registry.Route literals from the record; reads no registry for them. registry:Account@1987,registry:Account@2007,registry:App@1948,registry:App@1964,registry:Host@839,registry:Unit@2117,registry:Unit@2159,whole:Route@1151,whole:Route@2054,whole:Route@2075,whole:Route@2854,whole:Route@3371,whole:Route@3703,whole:Route@792,whole:Route@821,whole:Route@832,whole:Route@850 25fea385596f376e01e1755ac0fc7225cd2541c8bd2744ff5dd0b232fca21ab6
+@legacy 46ce2361d69f3ea4f20a8654f43d3f8d4c42d089d9dab8a6f946855cbdd378d9 internal/console/view.go Assemble legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-console-remote-instances;basis=Collects the set of local registry hosts (rt.Host) so a record host the registry has gets no remote row and is not read; adds rows from the account's records and box reports when given a remote source. registry:App@1716,registry:App@1739,registry:App@2117,registry:App@2147,registry:Backing@2017,registry:Caps@1385,registry:Channel@960,registry:Environment@1942,registry:Hibernate@1859,registry:Host@1768,registry:Host@861,registry:Kind@1783,registry:Platform@1889,registry:Provisioned@2042,registry:Status@1800,registry:Unit@1999,registry:Version@1823,whole:Route@2092,whole:Route@2167,whole:Route@810,whole:Route@839,whole:Route@910 120ae8c042523f872fd1c19357b8bb830e4afe9da1e38ad202df2ada3ad52ada
+internal/console/accountfleet.go Server.assembleAccountFleet legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-console-remote-instances;basis=Fleet tab: the shared-fleet app count also reads the account's own instance records (per app of the account, under its own prefix, region not a fleet placement); the registry read is unchanged. registry:Account@2350,registry:Account@4421,registry:App@2476,registry:Name@4814,registry:Region@2437,whole:Fleet@4006,whole:Fleet@4408,whole:Fleet@4522,whole:Route@2335 1b5ecf4066d067d721683d273e768d834df0bb9cb3cf5ff90648b1e6842bacc8
+internal/console/apiinstances.go Server.healthByHost legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-console-remote-instances;basis=Takes an awake set (hosts whose accepted box report says awake) and a box pin per host (readings only from that box, via ownerAppMetricsFrom); registry reads unchanged. registry:Backing@1206,registry:Hibernate@1128,registry:Kind@1111,registry:Provisioned@1181,registry:Status@988,registry:Unit@1197,registry:Unit@347,registry:Unit@382,whole:Route@195,whole:Route@238,whole:Route@304,whole:Route@965 2cc7789d2acb4af7864927bb9a85409d70b8b39d3a5f22862660fa59cd916489
+internal/console/apiroutes.go Server.handleAPIRoutes legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-console-remote-instances;basis=Passes nil, nil for healthByHost's new awake and box-pin arguments; nothing else. registry:Account@4609,registry:App@1646,registry:App@2109,registry:App@4548,registry:Backing@2269,registry:Canary@2407,registry:Channel@2129,registry:Environment@2154,registry:Hibernate@2228,registry:Host@1730,registry:Host@2051,registry:Host@2207,registry:Host@2363,registry:Host@4681,registry:Host@4761,registry:Kind@2066,registry:Platform@2392,registry:Prefix@4777,registry:Provisioned@2294,registry:Replication@2326,registry:Status@2178,registry:Target@4795,registry:Unit@2248,whole:Route@1635,whole:Route@1684,whole:Route@1721,whole:Route@1741,whole:Route@1861,whole:Route@1968,whole:Route@1999,whole:Route@2099,whole:Route@4672,whole:RoutePath@3614 ff28ee87238241e58e970f653409afd8d62b2e463ef9743fda24bb72fc841eef
internal/console/instancepage.go Server.handleAppInstance legacy accepted-legacy accepted-legacy;rev3=merge-ruling-2;basis=Instance page adds updates view from rollout join; browser rendering remains legacy.;rev3=census-ruling-console-remote-instances;basis=A remote row (no local registry row) takes its aliases from its box report; local rows read ListAliases as before. file:Query@2672,registry:Account@2444,registry:Alias@2544,registry:App@2474,registry:Host@2422,whole:RouteAlias@2405 07f5c01659b0d453d5996abb6a6e9493f74c7df97e3cddfe0f765b6f316de4a7
internal/console/server.go Server.channelHosts legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-console-remote-instances;basis=Canary-retire guard also counts the account's instance records (ListRecordsStrict) and sidecar records (listed, then each read with GetSidecarRecord; any read error including not-found refuses) from the bucket, failing closed; the registry read is unchanged. registry:App@424,registry:Channel@441,registry:Host@472,whole:Route@410 0bfd742f32f4173619a9e0031c8c56cf47142762d60ec8e67a3ca1549a1028ef
-internal/console/apiinstances.go Server.instanceHealth legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-console-remote-instances;basis=Records with no local registry row get health from their box report: two registry.Route literals built from the record (not read from any registry). registry:Account@1987,registry:Account@2007,registry:App@1948,registry:App@1964,registry:Host@839,registry:Unit@2117,registry:Unit@2159,whole:Route@1151,whole:Route@2054,whole:Route@2075,whole:Route@2643,whole:Route@2988,whole:Route@3306,whole:Route@792,whole:Route@821,whole:Route@832,whole:Route@850 fdc0e9bc91683b587d876e922e204458e9da749fd0e56b92a9edfcd94171241b
-internal/console/view.go Assemble legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-console-remote-instances;basis=Collects the set of local registry hosts (rt.Host) so a record host the registry has gets no remote row; adds rows from the account's records and box reports when given a remote source. registry:App@1716,registry:App@1739,registry:App@2117,registry:App@2147,registry:Backing@2017,registry:Caps@1385,registry:Channel@960,registry:Environment@1942,registry:Hibernate@1859,registry:Host@1768,registry:Host@861,registry:Kind@1783,registry:Platform@1889,registry:Provisioned@2042,registry:Status@1800,registry:Unit@1999,registry:Version@1823,whole:Route@2092,whole:Route@2167,whole:Route@810,whole:Route@839,whole:Route@910 120ae8c042523f872fd1c19357b8bb830e4afe9da1e38ad202df2ada3ad52ada
-@coverage internal/console 0efa1233cdca2804f4f7dff0460ea176a1c111dd7de1362c763ab99626d65991
+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: when every instance's state is unknown (instances on other boxes no report vouches for) the detail reads the existing 'no data right now'; display only. file:external@0 db64e6c62c55a50f43ace2b0b47cf89fe31a4f78bacc5bc89df8ba19b8e43ee4
+internal/console/apiinstances.go Server.instanceHealth legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-console-remote-instances;basis=Records with no local registry row get health only from a box report naming the record's own account and app, with readings pinned to that box; otherwise Setting up (complete read, no report) or Can't tell right now. Builds registry.Route literals from the record; reads no registry for them. registry:Account@1987,registry:Account@2007,registry:App@1948,registry:App@1964,registry:Host@839,registry:Unit@2117,registry:Unit@2159,whole:Route@1151,whole:Route@2054,whole:Route@2075,whole:Route@2854,whole:Route@3371,whole:Route@3703,whole:Route@792,whole:Route@821,whole:Route@832,whole:Route@850 25fea385596f376e01e1755ac0fc7225cd2541c8bd2744ff5dd0b232fca21ab6
+internal/console/view.go Assemble legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-console-remote-instances;basis=Collects the set of local registry hosts (rt.Host) so a record host the registry has gets no remote row and is not read; adds rows from the account's records and box reports when given a remote source. registry:App@1716,registry:App@1739,registry:App@2117,registry:App@2147,registry:Backing@2017,registry:Caps@1385,registry:Channel@960,registry:Environment@1942,registry:Hibernate@1859,registry:Host@1768,registry:Host@861,registry:Kind@1783,registry:Platform@1889,registry:Provisioned@2042,registry:Status@1800,registry:Unit@1999,registry:Version@1823,whole:Route@2092,whole:Route@2167,whole:Route@810,whole:Route@839,whole:Route@910 120ae8c042523f872fd1c19357b8bb830e4afe9da1e38ad202df2ada3ad52ada
+@coverage internal/console 7774e036ab1ece335abc7757cc5076c6a32f981dda650f1ac2b03a73ec1fc687
+@coverage internal/console/templates 1dfd2d48f0caf03649430aeab692dee79c3dc3496345f6311346fae773929832