label-case-running-tile: region labels read London (UK); the Running tile counts instances on other boxes
Region labels: regionlabel.ForCode renders the bracketed code in upper case, "London (UK)" (Paul, 2026-10-26). Label.Code and every value field keep the lower-case code. Tests, docs/site/cli.md and the copy records follow; the copy records note Paul's direct ruling. Running tile: an app whose instances are all on other boxes asks the metrics sweep for no host, and the nil answer read as a failed sweep, so the tile said "?" and "no data right now". MetricsUnavailable is now set only when an instance on the console's own box needed the sweep; remote instances count from the box report remoteFacts accepts (boxAwake). A new ResourcesUnavailable keeps the Resources tile as it was.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
34 files changed,
+483
−181
apimode.go+1 −1apps_region_cmd_e2e_test.go+5 −5apps_region_test.go+7 −7canary_region_test.go+2 −2dbforward_e2e_test.go+1 −1deploy_region_test.go+2 −2docs/site/cli.md+3 −3docs/superpowers/plans/2026-10-22-db-region-forward-copy.md+5 −1docs/superpowers/plans/LUNA-COPY-REVIEW-REGION-LABELS-1.md+10 −1docs/superpowers/plans/LUNA-COPY-REVIEW-REGION-LABELS-2.md+10 −1docs/superpowers/specs/2026-10-25-region-labels-design.md+1 −1docs/superpowers/specs/CODEX-REVIEW-BRIEF-LABEL-CASE-RUNNING-TILE.md+101 −0instances_seed_test.go+2 −2internal/console/appregionset_test.go+7 −7internal/console/deployments.go+1 −1internal/console/overview.go+20 −3internal/console/regiondefault_test.go+4 −4internal/console/regionfacts_test.go+4 −4internal/console/regionlabels_test.go+19 −19internal/console/regionnames_test.go+4 −4internal/console/regionwire_test.go+18 −18internal/console/runningtile_test.go+159 −0internal/console/templates/app_overview.html+1 −1internal/dbdoor/client_test.go+2 −2internal/dbdoor/forward.go+1 −1internal/regionlabel/move_test.go+21 −21internal/regionlabel/regionlabel.go+7 −4internal/regionlabel/regionlabel_test.go+6 −6move_test.go+11 −11offline_move_e2e_test.go+2 −2region_labels.go+1 −1region_labels_e2e_test.go+7 −7region_labels_test.go+35 −35statuslive_regions_test.go+3 −3
diff --git a/apimode.go b/apimode.go| index 4701fbcd6..494de1961 100644 |
| --- a/apimode.go |
| +++ b/apimode.go |
| @@ -1049,7 +1049,7 @@ type apiCreateAppResult struct { |
| RegionName string `json:"region_name"` |
| RegionSource string `json:"region_source"` |
| RegionsAvailable int `json:"regions_available"` |
| - // RegionLabel is the stored region's label, "London (uk)" (region |
| + // RegionLabel is the stored region's label, "London (UK)" (region |
| // labels spec §4); "" from an older console. |
| RegionLabel string `json:"region_label"` |
| } |
diff --git a/apps_region_cmd_e2e_test.go b/apps_region_cmd_e2e_test.go| index 454c00410..1a948efdd 100644 |
| --- a/apps_region_cmd_e2e_test.go |
| +++ b/apps_region_cmd_e2e_test.go |
| @@ -117,14 +117,14 @@ func TestAppsRegionThroughTheConsole(t *testing.T) { |
| before := "home1." + labelsDomain |
| e.out(t, runInstancesCreate, "-app", "shop", "-account", "ops", "-host", before) |
| - if got := e.out(t, runAppsRegion, "--app", "shop", "--account", "ops"); got != "shop's region is Dublin (ie). for apps not using a pool, new instances start there; pooled apps start new instances in the home region\n" { |
| + if got := e.out(t, runAppsRegion, "--app", "shop", "--account", "ops"); got != "shop's region is Dublin (IE). for apps not using a pool, new instances start there; pooled apps start new instances in the home region\n" { |
| t.Fatalf("apps region:\n%q", got) |
| } |
| got := e.out(t, runAppsRegion, "--app", "shop", "--account", "ops", "--set", "uk") |
| - if !strings.HasSuffix(got, "shop's region changed from Dublin (ie) to London (uk). new instances start in London (uk). existing instances stay where they are.\n") { |
| + if !strings.HasSuffix(got, "shop's region changed from Dublin (IE) to London (UK). new instances start in London (UK). existing instances stay where they are.\n") { |
| t.Fatalf("apps region --set:\n%q", got) |
| } |
| - if got := e.out(t, runAppsRegion, "--app", "shop", "--account", "ops", "--set", "uk"); !strings.HasSuffix(got, "shop's region is already London (uk). nothing changed.\n") { |
| + if got := e.out(t, runAppsRegion, "--app", "shop", "--account", "ops", "--set", "uk"); !strings.HasSuffix(got, "shop's region is already London (UK). nothing changed.\n") { |
| t.Fatalf("apps region --set again:\n%q", got) |
| } |
| @@ -134,14 +134,14 @@ func TestAppsRegionThroughTheConsole(t *testing.T) { |
| } |
| after := "new1." + labelsDomain |
| if got := e.out(t, runInstancesCreate, "-app", "shop", "-account", "ops", "-host", after); !strings.Contains(got, |
| - "created instance "+after+" (channel beta, London (uk))") { |
| + "created instance "+after+" (channel beta, London (UK))") { |
| t.Fatalf("instances create after the change:\n%s", got) |
| } |
| rec, err = provision.GetRecord(ctx, e.rel, release.OpsAccount, "shop", after) |
| if err != nil || rec.Region != "uk" { |
| t.Fatalf("the new instance has region %q (%v), want uk", rec.Region, err) |
| } |
| - if apps := e.out(t, runAppsList, "--account", "ops"); !strings.Contains(apps, "London (uk)") { |
| + if apps := e.out(t, runAppsList, "--account", "ops"); !strings.Contains(apps, "London (UK)") { |
| t.Fatalf("apps list after the change:\n%s", apps) |
| } |
| } |
diff --git a/apps_region_test.go b/apps_region_test.go| index cd4911433..99875afdd 100644 |
| --- a/apps_region_test.go |
| +++ b/apps_region_test.go |
| @@ -206,7 +206,7 @@ func TestPrintAppRegionOnFleet(t *testing.T) { |
| // included. |
| func TestPrintAppRegionWithLabels(t *testing.T) { |
| lab := func(source string, avail int) apiCreateAppResult { |
| - return apiCreateAppResult{Region: "uk", RegionName: "UK · London", RegionLabel: "London (uk)", RegionSource: source, RegionsAvailable: avail} |
| + return apiCreateAppResult{Region: "uk", RegionName: "UK · London", RegionLabel: "London (UK)", RegionSource: source, RegionsAvailable: avail} |
| } |
| for _, c := range []struct { |
| name string |
| @@ -214,13 +214,13 @@ func TestPrintAppRegionWithLabels(t *testing.T) { |
| asked string |
| want string |
| }{ |
| - {"timezone", lab("timezone", 2), "", "Region: London (uk), from your timezone. Use --region to choose another.\n"}, |
| - {"ip", lab("ip", 2), "", "Region: London (uk), from your network location. Use --region to choose another.\n"}, |
| - {"default, one region", lab("default", 1), "", "Region: London (uk), the platform default.\n"}, |
| - {"default, two regions", lab("default", 2), "", "Region: London (uk), the platform default. Use --region to choose another.\n"}, |
| - {"chosen", lab("chosen", 3), "uk", "Region: London (uk).\n"}, |
| + {"timezone", lab("timezone", 2), "", "Region: London (UK), from your timezone. Use --region to choose another.\n"}, |
| + {"ip", lab("ip", 2), "", "Region: London (UK), from your network location. Use --region to choose another.\n"}, |
| + {"default, one region", lab("default", 1), "", "Region: London (UK), the platform default.\n"}, |
| + {"default, two regions", lab("default", 2), "", "Region: London (UK), the platform default. Use --region to choose another.\n"}, |
| + {"chosen", lab("chosen", 3), "uk", "Region: London (UK).\n"}, |
| {"switch off, asked", lab("default", 1), "au", |
| - "This console is not assigning app regions yet, so --region was not applied. This app's instances start in London (uk).\n"}, |
| + "This console is not assigning app regions yet, so --region was not applied. This app's instances start in London (UK).\n"}, |
| // A label not fit to print is no label: today's line, today's rule. |
| {"unprintable label", apiCreateAppResult{Region: "uk", RegionName: "UK · London", RegionLabel: "London\x1b[0m", RegionSource: "timezone", RegionsAvailable: 2}, "", |
| "Region: UK · London (from your timezone). Use --region to choose another.\n"}, |
diff --git a/canary_region_test.go b/canary_region_test.go| index 027d589b3..46d80597b 100644 |
| --- a/canary_region_test.go |
| +++ b/canary_region_test.go |
| @@ -32,7 +32,7 @@ func TestCanaryRegionCheck(t *testing.T) { |
| } |
| plain := apiRegionsResult{Regions: names, Default: "ie", AppDefault: known(apiAppDefault{Region: "uk", Effective: "uk"})} |
| labelled := apiRegionsResult{Default: "ie", AppDefault: known(apiAppDefault{Region: "uk", Effective: "uk"}), |
| - Regions: []apiRegionEntry{{Code: "ie", Name: "P-ie", Label: "Dublin (ie)"}, {Code: "uk", Name: "P-uk", Label: "London (uk)"}}} |
| + Regions: []apiRegionEntry{{Code: "ie", Name: "P-ie", Label: "Dublin (IE)"}, {Code: "uk", Name: "P-uk", Label: "London (UK)"}}} |
| fleet := apiRegionsResult{Regions: names, Default: "ie", AppDefault: known(apiAppDefault{Region: "uk", Effective: "fleet/acme", Reason: "fleet"})} |
| older := apiRegionsResult{Regions: names, Default: "ie"} // no app_default |
| unread := apiRegionsResult{Regions: names, Default: "ie", AppDefault: &apiAppDefault{Region: "uk", Effective: "uk", RegionKnown: true, Reason: "policy-unreadable"}} |
| @@ -59,7 +59,7 @@ func TestCanaryRegionCheck(t *testing.T) { |
| {"existing, same", plain, nil, []apiInstanceRecord{existingUK}, nil, "uk", ""}, |
| {"existing home read as its name", plain, nil, []apiInstanceRecord{existingHome}, nil, "ie", ""}, |
| {"existing, different, named by place", plain, nil, []apiInstanceRecord{existingUK}, nil, "ie", canaryRegionMismatch(host, "P-uk")}, |
| - {"existing, different, named by label", labelled, nil, []apiInstanceRecord{existingUK}, nil, "ie", canaryRegionMismatch(host, "London (uk)")}, |
| + {"existing, different, named by label", labelled, nil, []apiInstanceRecord{existingUK}, nil, "ie", canaryRegionMismatch(host, "London (UK)")}, |
| {"fleet, first run", fleet, nil, nil, nil, "uk", canaryRegionOnFleet("blog", "acme")}, |
| {"fleet, repeat", fleet, nil, []apiInstanceRecord{existingUK}, nil, "uk", canaryRegionOnFleet("blog", "acme")}, |
| {"older console, first run", older, nil, nil, nil, "uk", canaryFleetUnknown("blog")}, |
diff --git a/dbforward_e2e_test.go b/dbforward_e2e_test.go| index db33871cc..211a8442a 100644 |
| --- a/dbforward_e2e_test.go |
| +++ b/dbforward_e2e_test.go |
| @@ -983,7 +983,7 @@ func TestDBForwardPullOnAQueryOnlyConsole(t *testing.T) { |
| func TestDBForwardSaysTheLabel(t *testing.T) { |
| e := newDBFE2E(t, dbfE2EOptions{forward: true, noBox: true, labels: true}) |
| out, stderr, err := e.run(t, "db", "query", "--account", "ops", "--app", "shop", "--instance", dbfE2EFar, "--sql", "SELECT 'caf\xe9'") |
| - if err == nil || out != "" || !strings.Contains(stderr, fmt.Sprintf(dbfNotUTF8, "London (uk)")) { |
| + if err == nil || out != "" || !strings.Contains(stderr, fmt.Sprintf(dbfNotUTF8, "London (UK)")) { |
| t.Fatalf("%q %q %v", out, stderr, err) |
| } |
| } |
diff --git a/deploy_region_test.go b/deploy_region_test.go| index 8d7685c0b..7bfce87fb 100644 |
| --- a/deploy_region_test.go |
| +++ b/deploy_region_test.go |
| @@ -9,7 +9,7 @@ import ( |
| // without app_default (an older console) skips the check. |
| func TestDeployRegionPreflight(t *testing.T) { |
| uk := &apiAppDefault{Region: "uk", Name: "P-uk", Effective: "uk", RegionKnown: true, PlacementKnown: true} |
| - labelled := &apiAppDefault{Region: "uk", Name: "P-uk", Label: "London (uk)", Effective: "uk", RegionKnown: true, PlacementKnown: true} |
| + labelled := &apiAppDefault{Region: "uk", Name: "P-uk", Label: "London (UK)", Effective: "uk", RegionKnown: true, PlacementKnown: true} |
| fleet := &apiAppDefault{Region: "uk", Name: "P-uk", Effective: "fleet/acme", Reason: "fleet", RegionKnown: true, PlacementKnown: true} |
| // The console reports a home app's region as the home's own code, never |
| // "" (homeRegionOut), so naming the home equals the stored "". |
| @@ -25,7 +25,7 @@ func TestDeployRegionPreflight(t *testing.T) { |
| {"no flag", apiRegionsResult{AppDefault: uk}, boom, "", ""}, |
| {"equal", apiRegionsResult{AppDefault: uk}, nil, "uk", ""}, |
| {"different", apiRegionsResult{AppDefault: uk}, nil, "ie", deployRegionMismatch("blog", "P-uk")}, |
| - {"different, labelled", apiRegionsResult{AppDefault: labelled}, nil, "ie", deployRegionMismatch("blog", "London (uk)")}, |
| + {"different, labelled", apiRegionsResult{AppDefault: labelled}, nil, "ie", deployRegionMismatch("blog", "London (UK)")}, |
| {"older console", apiRegionsResult{}, nil, "ie", ""}, |
| {"read failed", apiRegionsResult{}, boom, "ie", deployRegionUnreadable("blog", boom)}, |
| {"fleet, stored equal", apiRegionsResult{AppDefault: fleet}, nil, "uk", ""}, |
diff --git a/docs/site/cli.md b/docs/site/cli.md| index 08d959a04..e01b2bd74 100644 |
| --- a/docs/site/cli.md |
| +++ b/docs/site/cli.md |
| @@ -900,7 +900,7 @@ every few minutes, and asleep instances are measured too. A dash means no box |
| has measured it: the instance is not running anywhere yet, it has not created |
| its database, or it keeps its data somewhere CARLOS does not manage. |
| -The REGION column names where each instance runs, as a place and a code, such as London (uk). While an instance moves, it also says which way. |
| +The REGION column names where each instance runs, as a place and a code, such as London (UK). While an instance moves, it also says which way. |
| The `EGRESS` column lists the private addresses the instance may reach, or `-` for none. A word after `!` means the allow is not in force yet: `pending` until the instance next starts, `failing` while its box retries, or `not available` on a box that cannot apply it. The `REASON` column says why, after `egress:`. |
| @@ -1186,7 +1186,7 @@ necessarily a complete one. The command says so every time it prints. |
| Its `DB` column is each route's SQLite database size, the same figure as in |
| [carlos instances](/docs/cli#carlos-instances). |
| -The REGION column names where each route or box runs, such as London (uk). |
| +The REGION column names where each route or box runs, such as London (UK). |
| ### carlos domains |
| @@ -2316,7 +2316,7 @@ rows have paths the layout pass does not recognise and leaves alone, and |
| `external` rows are run by another supervisor. Like `--instances`, it goes |
| through the console and is operator only. |
| -The REGION column names where each route or box runs, such as London (uk). |
| +The REGION column names where each route or box runs, such as London (UK). |
| The `SIZE` column is the size an awake nested instance runs at: `swap` while a deploy is swapping it, `?` when its box could not read it, and `-` for anything else. `standard>large` means it runs at standard and its policy asks for large; a note under the table says when that takes effect. The `EGRESS` column is the instance's egress allow as its box applies it. A `!` before an address means one of the deployment's boxes now holds it. A word after `!` means the allow is not in force: `failing`, `policy unreadable`, `policy unverifiable`, `policy expired`, `box not wholly nested`, `not yet supported under claims`, or `refused` when the box dropped an entry. `REASON` gives the detail after `egress:`. |
diff --git a/docs/superpowers/plans/2026-10-22-db-region-forward-copy.md b/docs/superpowers/plans/2026-10-22-db-region-forward-copy.md| index 7e8b1c6c6..814d9ab39 100644 |
| --- a/docs/superpowers/plans/2026-10-22-db-region-forward-copy.md |
| +++ b/docs/superpowers/plans/2026-10-22-db-region-forward-copy.md |
| @@ -31,7 +31,7 @@ Placeholders: `<host>` the instance's hostname; `<region>` a placement code |
| such as uk; `<size>` and `<cap>` byte sizes as the CLI prints them; `<n>` a |
| count of bytes; `<sha>` the first 16 hex digits of a SHA-256; `<time>` an |
| RFC 3339 time; `<place>` the region as the console labels it, such as |
| -London (uk), or `region <code>` from an older console (region labels, |
| +London (UK), or `region <code>` from an older console (region labels, |
| 2026-10-26). |
| Region labels (2026-10-26): the CLI rows DBF-3, 4, 5, 8, 11, 12, 13, 17, 18, |
| @@ -89,3 +89,7 @@ DBF-23 replaces DBF-30 on the CLI page; DBF-30 stays here, approved, and leaves |
| |---|---|---|---| |
| | DBF-30 | docs/site/cli.md | If the app has more than one instance, name one with `--instance`. Only sleeping instances have a database copy. An instance on your own fleet or in a pool cannot be read this way, and the command says which.\n\nWhen an instance keeps its data in a different region from the console's, `carlos db query` runs in that region. A server there restores the copy, runs your query and sends back only the rows. The rows are encrypted for your terminal on the way, so nothing in between can read them, and nothing is printed until all of them have arrived and been checked. In that region, the copy can be at most 2 GB once restored, the query runs for at most 5 minutes, and the rows can total at most 64 MB. `carlos db pull` cannot fetch a copy from another region yet. | approved | |
| | DBF-31 | docs/site/cli.md | `carlos system db-worker` runs on platform boxes only. systemd starts it for each forwarded database query. You never run it yourself. | approved | |
| + |
| +Label case (2026-10-26): `<place>` shows its code in upper case, "London |
| +(UK)", by Paul's direct ruling (branch label-case-running-tile). The code |
| +stays lower case wherever it is a value (`--region uk`, JSON `region`). |
diff --git a/docs/superpowers/plans/LUNA-COPY-REVIEW-REGION-LABELS-1.md b/docs/superpowers/plans/LUNA-COPY-REVIEW-REGION-LABELS-1.md| index 825908796..c941f900f 100644 |
| --- a/docs/superpowers/plans/LUNA-COPY-REVIEW-REGION-LABELS-1.md |
| +++ b/docs/superpowers/plans/LUNA-COPY-REVIEW-REGION-LABELS-1.md |
| @@ -13,4 +13,13 @@ Flagged rows: |
| - Interpretation 2: confirmed. “also in” excludes every-region instances and other accounts’ instances. |
| - Interpretation 3: confirmed. Offline sentences use `the home region` when no home is named. |
| -1 row changed, 0 flagged, 20 left alone. |
| \ No newline at end of file |
| +1 row changed, 0 flagged, 20 left alone. |
| + |
| +## Paul's ruling, 2026-10-26: the code in brackets is upper case |
| + |
| +Every label shows its code in upper case: "London (UK)", "Dublin (IE)", |
| +"moving to Sydney (AU)". This is Paul's direct ruling (branch |
| +label-case-running-tile), not a Luna pass: the form Luna reviewed is |
| +unchanged apart from the case. The code stays lower case wherever it is a |
| +value: CLI flags (`--region uk`), JSON code fields (`region`, `from`, `to`) |
| +and stored data. A code with no known place still shows as the bare code. |
diff --git a/docs/superpowers/plans/LUNA-COPY-REVIEW-REGION-LABELS-2.md b/docs/superpowers/plans/LUNA-COPY-REVIEW-REGION-LABELS-2.md| index b59b75a0a..bcde5431c 100644 |
| --- a/docs/superpowers/plans/LUNA-COPY-REVIEW-REGION-LABELS-2.md |
| +++ b/docs/superpowers/plans/LUNA-COPY-REVIEW-REGION-LABELS-2.md |
| @@ -27,4 +27,13 @@ Model gpt-5.6-luna via codex exec, brief `LUNA-COPY-BRIEF-REGION-LABELS-2.md` at |
| - 3: Confirmed. A home box uses `the home region`. |
| - 4: Confirmed. An empty table cell remains the existing dash. |
| -3. 12 changed, 2 flagged, 6 left alone. |
| \ No newline at end of file |
| +3. 12 changed, 2 flagged, 6 left alone. |
| + |
| +## Paul's ruling, 2026-10-26: the code in brackets is upper case |
| + |
| +Every label shows its code in upper case: "London (UK)", "Dublin (IE)", |
| +"moving to Sydney (AU)". This is Paul's direct ruling (branch |
| +label-case-running-tile), not a Luna pass: the form Luna reviewed is |
| +unchanged apart from the case. The code stays lower case wherever it is a |
| +value: CLI flags (`--region uk`), JSON code fields (`region`, `from`, `to`) |
| +and stored data. A code with no known place still shows as the bare code. |
diff --git a/docs/superpowers/specs/2026-10-25-region-labels-design.md b/docs/superpowers/specs/2026-10-25-region-labels-design.md| index f222ee32d..55e7a41d6 100644 |
| --- a/docs/superpowers/specs/2026-10-25-region-labels-design.md |
| +++ b/docs/superpowers/specs/2026-10-25-region-labels-design.md |
| @@ -67,7 +67,7 @@ func ForCode(code, home string, n Names) Label |
| | a named pool and the everywhere class | `pool <name>` | |
| | the everywhere class, no pool, not a fleet (`provision.ServedEverywhere(rec)` for records; `everywhereRoute` for registry-only rows) | `every region` | |
| | `""` with no home named | `the home region` | |
| -| a code whose AWS region the table knows | `<place> (<code>)` | |
| +| a code whose AWS region the table knows | `<place> (<CODE>)`, the code in upper case: "London (UK)" (Paul, 2026-10-26) | |
| | any other code | `<code>` | |
| A named pool that is not of the everywhere class keeps its region label: the pool narrows which boxes, the region still says where. `<place>` is the C23 place after its last " · ", or the whole place. Pickers keep the full C23 place. |
diff --git a/docs/superpowers/specs/CODEX-REVIEW-BRIEF-LABEL-CASE-RUNNING-TILE.md b/docs/superpowers/specs/CODEX-REVIEW-BRIEF-LABEL-CASE-RUNNING-TILE.md| new file mode 100644 |
| index 000000000..c030e91a8 |
| --- /dev/null |
| +++ b/docs/superpowers/specs/CODEX-REVIEW-BRIEF-LABEL-CASE-RUNNING-TILE.md |
| @@ -0,0 +1,101 @@ |
| +# Review brief: branch label-case-running-tile, round 1 of 3 |
| + |
| +Repo carlos/platform, branch `label-case-running-tile`, commit named in |
| +the reviewer's prompt. |
| +Under review: the diff `origin/main...HEAD` (merge base with main). |
| +Authorities: `docs/superpowers/specs/2026-10-25-region-labels-design.md` |
| +§3 and §4 (region labels, merged b1d00ca7); |
| +`docs/superpowers/notes/console-remote-instances.md` and |
| +`internal/console/remoteinstances.go` (instances on other boxes, merged |
| +93425891). Do not review against unmerged branches; if this work needs |
| +one, say so as a P1 and stop. |
| + |
| +You are an independent reviewer. Read the diff, then the code it touches, |
| +and check every claim against that code. |
| + |
| +## The change |
| + |
| +Two fixes Paul asked for on 2026-10-26. |
| + |
| +1. **Region label case.** `regionlabel.ForCode` now renders |
| + `<place> (<CODE>)`: "London (UK)", not "London (uk)". `Label.Code` |
| + and every value field keep the lower-case code (`--region uk`, JSON |
| + `region`, `from`, `to`, stored data). The rest of the diff is test |
| + expectations, comments, `docs/site/cli.md` and copy records updated |
| + to match. A code with no known place still renders as the bare |
| + lower-case code (spec §3.1 table, last row). |
| +2. **The overview's Running tile showed "?" for an app whose instances |
| + are all on other boxes.** Root cause: `appResourceMetrics` |
| + (`internal/console/server.go`) skips every remote row, so with no |
| + local instance it asks `ownerAppMetricsFrom` for no hosts, which |
| + returns `nil, nil`. `assembleOverview` read any nil metrics as a |
| + failed sweep (`MetricsUnavailable`), and the template and |
| + `healthVerdict` turn that into "?", "no data right now" and "Can't |
| + tell right now". The per-row counts were already right: remote rows |
| + count from `RouteView.boxAwake`, set only from the one report |
| + `appFacts.host` accepts. The fix: `MetricsUnavailable` is now true |
| + only when metrics are nil AND the account has an instance on the |
| + console's own box. A new `ResourcesUnavailable` (metrics nil) keeps |
| + the Resources tile's wording exactly as before. |
| + |
| +## Fixed: do not re-argue |
| + |
| +- Paul's ruling (2026-10-26): the bracketed code is upper case; the code |
| + as a value stays lower case. Recorded in |
| + `docs/superpowers/plans/LUNA-COPY-REVIEW-REGION-LABELS-{1,2}.md`. No |
| + new copy pass is needed for the case alone. |
| +- Remote metrics stay cut (console-remote-instances round 6): no remote |
| + CPU, memory or graph sample may reach any page. The Resources tile is |
| + out of scope. |
| +- The tenant rule for remote facts: only through `remoteFacts` / |
| + `appFacts.host` (record plus a report entry naming the same account |
| + and app, generated after the record's creation). |
| + |
| +## What to check |
| + |
| +1. Does any remote row's awake or asleep state reach the Running tile or |
| + the verdict from anything other than the report `appFacts.host` |
| + accepted? In particular: another account's report for the same host, |
| + a report naming no tenant, a report older than the record, and a |
| + same-named app in another account (Assemble groups by app name). |
| +2. Is "?" still shown wherever state is genuinely unknown: a failed sweep |
| + with any local instance, every remote instance unknown, an incomplete |
| + box-report read? |
| +3. Does the change let any remote metrics sample (CPU, memory, sparkline) |
| + onto any page? The Resources tile must render as before for every |
| + case. |
| +4. Region labels: is any value (a flag the CLI prints for the user to |
| + type, a JSON code field, a stored region, a comparison) now upper |
| + case? Is there a label built outside `regionlabel.ForCode` that still |
| + renders a lower-case bracketed code? |
| +5. Tests: do `internal/console/runningtile_test.go`'s tests fail without |
| + the fix and exercise the two-box path through real wiring? |
| + |
| +## Severity |
| + |
| +- **P1**: unsafe, would not compile, a test fails, or it would not work. |
| + Blocks merge. |
| +- **P2**: wrong or missing. Fixed without reopening this review. (The |
| + census, and review of any newly changed security, root, termination |
| + or production-storage behaviour, still check the fix; see AGENTS.md, |
| + "Stopping rules".) |
| +- **P3**: clarity or polish. Goes on a follow-up list; never a reason for |
| + another round. |
| + |
| +A P1 states its failure scenario and the evidence (file:line). Do not |
| +raise a P2 to P1 to keep the review open. |
| + |
| +## Output |
| + |
| +Findings ranked P1, P2, P3. Each gives the section or task, the problem, |
| +the evidence (file:line, verified), the failure scenario, a concrete |
| +fix and the invariant or trust boundary it breaks (that is its fault |
| +family). End with exactly one verdict: |
| + |
| +- **READY**: no P1 and no P2. |
| +- **READY AFTER FIXES**: no P1. The listed P2s are fixed without another |
| + round. |
| +- **NOT READY**: one or more P1s, listed. |
| + |
| +Do not edit files. Do not spawn Anthropic-model reviewers or subagents of |
| +your own. Do not run the full test suites. |
diff --git a/instances_seed_test.go b/instances_seed_test.go| index 328ec087e..287940b1e 100644 |
| --- a/instances_seed_test.go |
| +++ b/instances_seed_test.go |
| @@ -221,10 +221,10 @@ func TestSeededCreateStopsWhenTheContextEnds(t *testing.T) { |
| // region_label and full place are kept for the success line; an older |
| // console's answer prints as before. |
| func TestSeededCreateKeepsTheCreatesLabel(t *testing.T) { |
| - labelled := `{"host":"canary.example.com","channel":"stable","region_name":"UK · London","region_label":"London (uk)","seed":{"id":"sd_x","kind":"replica","from":"www.example.com","state":"reserving"}}` |
| + labelled := `{"host":"canary.example.com","channel":"stable","region_name":"UK · London","region_label":"London (UK)","seed":{"id":"sd_x","kind":"replica","from":"www.example.com","state":"reserving"}}` |
| out, err, _ := runSeeded(t, &seedConsole{createStatus: 202, createBody: labelled, |
| gets: []func(http.ResponseWriter){seedRecord("ready", "")}}) |
| - if err != nil || !strings.Contains(out, "created instance canary.example.com (channel stable, London (uk)") || strings.Contains(out, "UK · London") { |
| + if err != nil || !strings.Contains(out, "created instance canary.example.com (channel stable, London (UK)") || strings.Contains(out, "UK · London") { |
| t.Fatalf("labelled console: %v\n%s", err, out) |
| } |
| out, err, _ = runSeeded(t, &seedConsole{createStatus: 202, createBody: reservingBody, |
diff --git a/internal/console/appregionset_test.go b/internal/console/appregionset_test.go| index 9cb5f56dc..b37fc0a03 100644 |
| --- a/internal/console/appregionset_test.go |
| +++ b/internal/console/appregionset_test.go |
| @@ -188,7 +188,7 @@ func TestAppRegionSetAuthorization(t *testing.T) { |
| t.Fatalf("refused callers audited %d rows", len(evs)) |
| } |
| // A member may read the region; another account may not. |
| - if st, out := fx.get(t, member, "shop"); st != http.StatusOK || decodeRegionView(t, out).Label != "Dublin (ie)" { |
| + if st, out := fx.get(t, member, "shop"); st != http.StatusOK || decodeRegionView(t, out).Label != "Dublin (IE)" { |
| t.Fatalf("member GET = %d %s", st, out) |
| } |
| if st, out := fx.get(t, other, "shop"); st != http.StatusNotFound || out != bare { |
| @@ -237,7 +237,7 @@ func TestAppRegionSetWritesOnlyTheRowAndAudits(t *testing.T) { |
| t.Fatalf("set = %d %s", st, out) |
| } |
| v := decodeRegionView(t, out) |
| - if v.Previous != "ie" || v.PreviousLabel != "Dublin (ie)" || v.Label != "London (uk)" { |
| + if v.Previous != "ie" || v.PreviousLabel != "Dublin (IE)" || v.Label != "London (UK)" { |
| t.Fatalf("reply = %+v", v) |
| } |
| if after := bucketSnapshot(t, fx.rel); !equalSnapshots(before, after) { |
| @@ -248,12 +248,12 @@ func TestAppRegionSetWritesOnlyTheRowAndAudits(t *testing.T) { |
| t.Fatalf("the existing instance's region is %q (%v), want it unchanged", rec.Region, err) |
| } |
| evs := fx.regionEvents(t, "shop") |
| - if len(evs) != 1 || evs[0].Detail != "changed shop's region from Dublin (ie) to London (uk) (cli)" { |
| + if len(evs) != 1 || evs[0].Detail != "changed shop's region from Dublin (IE) to London (UK) (cli)" { |
| t.Fatalf("audit = %+v", evs) |
| } |
| // The same region again changes nothing and audits nothing. |
| st, out = fx.put(t, owner, "shop", "uk") |
| - if v := decodeRegionView(t, out); st != http.StatusOK || v.Changed || v.Label != "London (uk)" { |
| + if v := decodeRegionView(t, out); st != http.StatusOK || v.Changed || v.Label != "London (UK)" { |
| t.Fatalf("same region = %d %s", st, out) |
| } |
| if evs := fx.regionEvents(t, "shop"); len(evs) != 1 { |
| @@ -407,8 +407,8 @@ func TestAppRegionSettingsControl(t *testing.T) { |
| memberC, memberCSRF := signInAs(t, fx.consoleFixture, arMember, "code-ar-member-web") |
| page := fx.ts.URL + "/a/" + arSqid + "/apps/shop/settings" |
| _, _, body := get(t, ownerC, page) |
| - if !strings.Contains(body, appRegionSetCopy.ControlButton) || !strings.Contains(body, `<option value="uk">London (uk)</option>`) || |
| - !strings.Contains(body, `<option value="ie" selected>Dublin (ie)</option>`) { |
| + if !strings.Contains(body, appRegionSetCopy.ControlButton) || !strings.Contains(body, `<option value="uk">London (UK)</option>`) || |
| + !strings.Contains(body, `<option value="ie" selected>Dublin (IE)</option>`) { |
| t.Fatalf("owner's settings page has no region control:\n%s", body) |
| } |
| if _, _, body := get(t, memberC, page); strings.Contains(body, appRegionSetCopy.ControlButton) { |
| @@ -432,7 +432,7 @@ func TestAppRegionSettingsControl(t *testing.T) { |
| t.Fatalf("stored %q after the owner's post", r) |
| } |
| _, _, body = get(t, ownerC, page) |
| - if !strings.Contains(body, fmt.Sprintf(appRegionSetCopy.FlashChanged, "London (uk)")) || !strings.Contains(body, appRegionSetCopy.SourceChanged) { |
| + if !strings.Contains(body, fmt.Sprintf(appRegionSetCopy.FlashChanged, "London (UK)")) || !strings.Contains(body, appRegionSetCopy.SourceChanged) { |
| t.Fatalf("no flash or source sentence after the change:\n%s", body) |
| } |
| } |
diff --git a/internal/console/deployments.go b/internal/console/deployments.go| index 51631e9de..7c53326e2 100644 |
| --- a/internal/console/deployments.go |
| +++ b/internal/console/deployments.go |
| @@ -91,7 +91,7 @@ func assembleDeploymentTargets(view *AppView, account string) []deploymentTarget |
| return out |
| } |
| -// RegionsText is RC-20: "3 in Dublin (ie)", joined with ", ", "" with none. |
| +// RegionsText is RC-20: "3 in Dublin (IE)", joined with ", ", "" with none. |
| func (d deploymentTarget) RegionsText() string { |
| parts := make([]string, 0, len(d.Regions)) |
| for _, c := range d.Regions { |
diff --git a/internal/console/overview.go b/internal/console/overview.go| index cfde971f7..4af58b823 100644 |
| --- a/internal/console/overview.go |
| +++ b/internal/console/overview.go |
| @@ -53,9 +53,18 @@ type OverviewStats struct { |
| // Crashed/Never started) is read. |
| SidecarTotal int |
| - // MetricsUnavailable: the sweep itself failed (nil metrics), which is |
| - // "readings unavailable", not "zero instances reporting". |
| + // MetricsUnavailable: the sweep itself failed (nil metrics) while an |
| + // instance on the console's own box needed it, which is "readings |
| + // unavailable", not "zero instances reporting". The Running tile and |
| + // the verdict read it. An instance on another box takes no readings |
| + // (appResourceMetrics), so an app with none on this box has nothing the |
| + // sweep could fail at: its tile counts the box reports' awake state. |
| MetricsUnavailable bool |
| + // ResourcesUnavailable: no readings were taken at all (nil metrics), |
| + // whether the sweep failed or every instance is on another box. The |
| + // Resources tile's "no data right now" reads it; remote CPU and memory |
| + // are not shown. |
| + ResourcesUnavailable bool |
| // InstanceExpected is how many of this account's routes are lifecycle- |
| // managed processes (kind "instance") — the only kind the metrics sweep |
| @@ -111,8 +120,12 @@ type OverviewStats struct { |
| // account — a same-named app elsewhere must not inflate this dashboard or |
| // wave its failed cert on it. |
| func assembleOverview(view *AppView, acct string, metrics []InstanceMetrics, versions []VersionView, dbJoin boxJoin) OverviewStats { |
| - st := OverviewStats{MetricsUnavailable: metrics == nil} |
| + st := OverviewStats{ResourcesUnavailable: metrics == nil} |
| unknownInstances := 0 |
| + // localInstances is how many of the account's instances the sweep was |
| + // asked for: only those on the console's own box (appResourceMetrics). |
| + // With none, a nil read is no sweep, not a failed one. |
| + localInstances := 0 |
| st.Deployment = observedDeployment(view.Routes, acct) |
| reporting := make(map[string]bool, len(metrics)) |
| for _, m := range metrics { |
| @@ -163,6 +176,9 @@ func assembleOverview(view *AppView, acct string, metrics []InstanceMetrics, ver |
| } |
| if rt.Kind == "instance" { |
| st.InstanceExpected++ |
| + if !rt.remote { |
| + localInstances++ |
| + } |
| if rt.unknown { |
| unknownInstances++ |
| } else if rt.Status == "failed" { |
| @@ -181,6 +197,7 @@ func assembleOverview(view *AppView, acct string, metrics []InstanceMetrics, ver |
| } |
| } |
| st.InstanceCounted = st.InstanceExpected - st.InstanceNoReadings - unknownInstances |
| + st.MetricsUnavailable = metrics == nil && localInstances > 0 |
| // 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 |
diff --git a/internal/console/regiondefault_test.go b/internal/console/regiondefault_test.go| index 0c3295b72..116f91475 100644 |
| --- a/internal/console/regiondefault_test.go |
| +++ b/internal/console/regiondefault_test.go |
| @@ -357,8 +357,8 @@ func TestRegionsLegacyFieldsGolden(t *testing.T) { |
| // label from the console's name map (region labels spec §3). Assertions |
| // compare the HTML-escaped copy, both ways (codex plan-R1 8). |
| func TestInstancesTabRegionLines(t *testing.T) { |
| - starts := html.EscapeString(fmt.Sprintf(regionCopy.StartsIn, "London (uk)")) |
| - cantUK := html.EscapeString(fmt.Sprintf(regionCopy.CantStart, "London (uk)")) |
| + starts := html.EscapeString(fmt.Sprintf(regionCopy.StartsIn, "London (UK)")) |
| + cantUK := html.EscapeString(fmt.Sprintf(regionCopy.CantStart, "London (UK)")) |
| page := func(fx *consoleFixture) string { |
| _, _, body := get(t, signInPaul(t, fx), fx.u("/apps/titogo/instances")) |
| return body |
| @@ -414,7 +414,7 @@ func TestInstancesTabRegionLines(t *testing.T) { |
| m := titoManifest() |
| m.Pool = "tito" |
| enableInstances(t, fx, "titogo", m) |
| - if body := page(fx); !strings.Contains(body, "New pooled instances") || !strings.Contains(body, "Dublin (ie)") { |
| + if body := page(fx); !strings.Contains(body, "New pooled instances") || !strings.Contains(body, "Dublin (IE)") { |
| t.Error("a pooled app's line does not name where pooled creates land") |
| } |
| } |
| @@ -424,7 +424,7 @@ func TestInstancesTabRegionLines(t *testing.T) { |
| // home's label, whether or not the home has a sibling. A home the |
| // allow-list leaves out is still C8, whatever the sibling count. |
| func TestInstancesTabRegionLineForAHomeApp(t *testing.T) { |
| - const homeLabel = "Dublin (ie)" |
| + const homeLabel = "Dublin (IE)" |
| starts := html.EscapeString(fmt.Sprintf(regionCopy.StartsIn, homeLabel)) |
| cantHome := html.EscapeString(fmt.Sprintf(regionCopy.CantStart, homeLabel)) |
| page := func(fx *consoleFixture) string { |
diff --git a/internal/console/regionfacts_test.go b/internal/console/regionfacts_test.go| index 7a592683d..3c7fe1011 100644 |
| --- a/internal/console/regionfacts_test.go |
| +++ b/internal/console/regionfacts_test.go |
| @@ -45,8 +45,8 @@ func TestRegionFactsByCase(t *testing.T) { |
| text, sentence string |
| source string |
| }{ |
| - {"shop", nil, true, "Dublin (ie)", "This app's region is Dublin (ie).", "The platform default."}, |
| - {"blog", nil, true, "London (uk)", "This app's region is London (uk).", "From your timezone when the app was created."}, |
| + {"shop", nil, true, "Dublin (IE)", "This app's region is Dublin (IE).", "The platform default."}, |
| + {"blog", nil, true, "London (UK)", "This app's region is London (UK).", "From your timezone when the app was created."}, |
| {"cart", nil, true, "fleet private", "This app runs on your fleet private.", ""}, |
| {"legacy", legacyRows, true, "fleet private", "This app runs on your fleet private.", ""}, |
| {"legacy", nil, false, "", "", ""}, |
| @@ -120,7 +120,7 @@ func TestElsewhereCounts(t *testing.T) { |
| row("bac", "uk", false), // another account's row: never counted |
| } |
| got := elsewhereCounts(routes, "bab", stored) |
| - if len(got) != 2 || got[0].Line() != "also in London (uk): 2 instances" || got[1].Line() != "also in Sydney (au): 1 instance" { |
| + if len(got) != 2 || got[0].Line() != "also in London (UK): 2 instances" || got[1].Line() != "also in Sydney (AU): 1 instance" { |
| t.Fatalf("elsewhere = %+v", got) |
| } |
| if elsewhereCounts(routes, "bab", appRegionFacts{}) != nil { |
| @@ -170,7 +170,7 @@ func TestLivePlacesNamedAndFleetAppRegions(t *testing.T) { |
| t.Fatalf("LivePlacesNamed = %+v %v", rows, err) |
| } |
| got := fx.srv.fleetAppRegions([]string{"shop", "blog", "cart", "missing"}) |
| - if got["shop"] != "London (uk)" || got["cart"] != "London (uk)" { |
| + if got["shop"] != "London (UK)" || got["cart"] != "London (UK)" { |
| t.Fatalf("fleet app regions = %v", got) |
| } |
| if _, has := got["blog"]; has { |
diff --git a/internal/console/regionlabels_test.go b/internal/console/regionlabels_test.go| index b879382b5..4937143ed 100644 |
| --- a/internal/console/regionlabels_test.go |
| +++ b/internal/console/regionlabels_test.go |
| @@ -56,15 +56,15 @@ func TestRegionLabelsOnRunningInstanceAndFlow(t *testing.T) { |
| publishRegionEdges(t, tb) |
| running := tb.text(t, "/apps/shop/instances") |
| - for _, want := range []string{"<th scope=\"col\">Region</th>", "Dublin (ie)", "London (uk)"} { |
| + for _, want := range []string{"<th scope=\"col\">Region</th>", "Dublin (IE)", "London (UK)"} { |
| if !strings.Contains(running, want) { |
| t.Fatalf("Running lacks %q:\n%s", want, running) |
| } |
| } |
| - if inst := tb.text(t, "/apps/shop/instances/"+remoteHost); !strings.Contains(inst, "<dt>Region</dt><dd>London (uk)") { |
| + if inst := tb.text(t, "/apps/shop/instances/"+remoteHost); !strings.Contains(inst, "<dt>Region</dt><dd>London (UK)") { |
| t.Fatalf("instance page lacks the Region fact:\n%s", inst) |
| } |
| - if ov := tb.text(t, "/apps/shop"); !strings.Contains(ov, remoteHost) || !strings.Contains(ov, "London (uk)") { |
| + if ov := tb.text(t, "/apps/shop"); !strings.Contains(ov, remoteHost) || !strings.Contains(ov, "London (UK)") { |
| t.Fatalf("overview addresses lack the label:\n%s", ov) |
| } |
| } |
| @@ -80,10 +80,10 @@ func TestRegionLabelsShowAMoveInFlight(t *testing.T) { |
| t.Fatal(err) |
| } |
| running := tb.text(t, "/apps/shop/instances") |
| - if !strings.Contains(running, "London (uk)") || !strings.Contains(running, "moving to Sydney (au)") { |
| + if !strings.Contains(running, "London (UK)") || !strings.Contains(running, "moving to Sydney (AU)") { |
| t.Fatalf("Running lacks the label and move phrase:\n%s", running) |
| } |
| - if inst := tb.text(t, "/apps/shop/instances/"+remoteHost); !strings.Contains(inst, "moving to Sydney (au)") { |
| + if inst := tb.text(t, "/apps/shop/instances/"+remoteHost); !strings.Contains(inst, "moving to Sydney (AU)") { |
| t.Fatalf("instance page lacks the move phrase:\n%s", inst) |
| } |
| } |
| @@ -94,7 +94,7 @@ func TestRegionLabelsBeforeTheMapIsRead(t *testing.T) { |
| tb.setUp(t, true) |
| writeRegionEdges(t, tb) // home named, files written, map never read |
| running := tb.text(t, "/apps/shop/instances") |
| - if strings.Contains(running, "London (uk)") || !strings.Contains(running, ">uk<") { |
| + if strings.Contains(running, "London (UK)") || !strings.Contains(running, ">uk<") { |
| t.Fatalf("before a read the label must be the code:\n%s", running) |
| } |
| } |
| @@ -109,26 +109,26 @@ func TestRegionLabelsOnAccountOverviewSettingsDeployments(t *testing.T) { |
| publishRegionEdges(t, tb) |
| home := tb.text(t, "/") |
| - for _, want := range []string{"Region</th>", "Dublin (ie)", "also in London (uk): 1 instance", "London (uk)"} { |
| + for _, want := range []string{"Region</th>", "Dublin (IE)", "also in London (UK): 1 instance", "London (UK)"} { |
| if !strings.Contains(home, want) { |
| t.Fatalf("account app list lacks %q:\n%s", want, home) |
| } |
| } |
| ov := tb.text(t, "/apps/shop") |
| - for _, want := range []string{"<h2>Region</h2>", "Dublin (ie)", "also in London (uk): 1 instance"} { |
| + for _, want := range []string{"<h2>Region</h2>", "Dublin (IE)", "also in London (UK): 1 instance"} { |
| if !strings.Contains(ov, want) { |
| t.Fatalf("overview lacks %q:\n%s", want, ov) |
| } |
| } |
| - if st := tb.text(t, "/apps/shop/settings"); !strings.Contains(st, "This app's region is Dublin (ie).") || |
| + if st := tb.text(t, "/apps/shop/settings"); !strings.Contains(st, "This app's region is Dublin (IE).") || |
| !strings.Contains(st, "See Running to find where new instances start.") { |
| t.Fatalf("Settings lacks the region section:\n%s", st) |
| } |
| - if st := tb.text(t, "/apps/blog/settings"); !strings.Contains(st, "This app's region is London (uk).") || |
| + if st := tb.text(t, "/apps/blog/settings"); !strings.Contains(st, "This app's region is London (UK).") || |
| !strings.Contains(st, "From your timezone when the app was created.") { |
| t.Fatalf("blog's Settings lacks its region and source:\n%s", st) |
| } |
| - if dep := tb.text(t, "/apps/shop/releases"); !strings.Contains(dep, "1 in Dublin (ie), 1 in London (uk)") { |
| + if dep := tb.text(t, "/apps/shop/releases"); !strings.Contains(dep, "1 in Dublin (IE), 1 in London (UK)") { |
| t.Fatalf("Deployments lacks the regions with the count:\n%s", dep) |
| } |
| } |
| @@ -138,7 +138,7 @@ func TestDeploymentsNameTheOneRegion(t *testing.T) { |
| tb := newTwoBoxes(t) |
| tb.setUp(t, false) |
| publishRegionEdges(t, tb) |
| - if dep := tb.text(t, "/apps/shop/releases"); !strings.Contains(dep, "1 in London (uk)") { |
| + if dep := tb.text(t, "/apps/shop/releases"); !strings.Contains(dep, "1 in London (UK)") { |
| t.Fatalf("Deployments with one region:\n%s", dep) |
| } |
| } |
| @@ -185,7 +185,7 @@ func TestStoredRegionUnknownOnPages(t *testing.T) { |
| return "", "", errors.New("database is locked") |
| } |
| home := tb.text(t, "/") |
| - if !strings.Contains(home, "Region</th>") || strings.Contains(home, "Dublin (ie)") || strings.Contains(home, "also in") { |
| + if !strings.Contains(home, "Region</th>") || strings.Contains(home, "Dublin (IE)") || strings.Contains(home, "also in") { |
| t.Fatalf("account list with the stored region unread:\n%s", home) |
| } |
| ov := tb.text(t, "/apps/shop") |
| @@ -211,7 +211,7 @@ func TestRunningPlacementLineAlwaysNamesTheRegion(t *testing.T) { |
| running := tb.text(t, "/apps/blog/instances") |
| // labels 9: a home app is told where it starts even with no sibling |
| // eligible to tell it apart from. |
| - if !strings.Contains(running, "New instances start in Dublin (ie), this app's region.") { |
| + if !strings.Contains(running, "New instances start in Dublin (IE), this app's region.") { |
| t.Fatalf("Running lacks C7 with the label:\n%s", running) |
| } |
| } |
| @@ -231,13 +231,13 @@ func TestRunningPooledPlacementLines(t *testing.T) { |
| t.Fatal(err) |
| } |
| publishRegionEdges(t, tb) |
| - if got := tb.text(t, "/apps/cart/instances"); !strings.Contains(got, "New pooled instances start in Dublin (ie).") { |
| + if got := tb.text(t, "/apps/cart/instances"); !strings.Contains(got, "New pooled instances start in Dublin (IE).") { |
| t.Fatalf("a pooled app the home may take:\n%s", got) |
| } |
| // shop's manifest is pooled with the allow-list ie, uk: the home's "" |
| // is not on it, so a pooled create cannot land. |
| if got := tb.text(t, "/apps/shop/instances"); !strings.Contains(got, |
| - "New pooled instances can't start in Dublin (ie) right now. Pass a region to place one elsewhere.") { |
| + "New pooled instances can't start in Dublin (IE) right now. Pass a region to place one elsewhere.") { |
| t.Fatalf("a pooled app the home may not take:\n%s", got) |
| } |
| } |
| @@ -290,7 +290,7 @@ func TestActivityCreateLineNamesTheLabel(t *testing.T) { |
| t.Fatalf("create = %d", status) |
| } |
| events, err := tb.fx.st.Events(5151, "cart", 5) |
| - if err != nil || len(events) == 0 || !strings.Contains(events[0].Detail, "created app cart in London (uk)") { |
| + if err != nil || len(events) == 0 || !strings.Contains(events[0].Detail, "created app cart in London (UK)") { |
| t.Fatalf("activity = %+v %v", events, err) |
| } |
| } |
| @@ -310,12 +310,12 @@ func TestFleetPagesUseTheBoxMap(t *testing.T) { |
| t.Fatal(err) |
| } |
| page := tb.textAt(t, "/fleet") |
| - for _, want := range []string{"London (uk)", "far away", "Dublin (ie)"} { // box B, an unknown box's word, shop's stored region |
| + for _, want := range []string{"London (UK)", "far away", "Dublin (IE)"} { // box B, an unknown box's word, shop's stored region |
| if !strings.Contains(page, want) { |
| t.Fatalf("platform fleet page lacks %q:\n%s", want, page) |
| } |
| } |
| - if acct := tb.text(t, "/fleet"); !strings.Contains(acct, "London (uk)") || !strings.Contains(acct, "far away") { |
| + if acct := tb.text(t, "/fleet"); !strings.Contains(acct, "London (UK)") || !strings.Contains(acct, "far away") { |
| t.Fatalf("account fleet chips:\n%s", acct) |
| } |
| } |
diff --git a/internal/console/regionnames_test.go b/internal/console/regionnames_test.go| index 1827a4056..c16894f6f 100644 |
| --- a/internal/console/regionnames_test.go |
| +++ b/internal/console/regionnames_test.go |
| @@ -159,7 +159,7 @@ func TestRegionNamesKeepTheOldMapOnFailure(t *testing.T) { |
| if err := fx.rel.Delete(ctx, edgesfile.Key("box-bad")); err != nil { |
| t.Fatal(err) |
| } |
| - if !fx.srv.refreshRegionNames(ctx, nil, t0.Add(20*time.Minute)) || label("uk") != "London (uk)" || label("au") != "Sydney (au)" { |
| + if !fx.srv.refreshRegionNames(ctx, nil, t0.Add(20*time.Minute)) || label("uk") != "London (UK)" || label("au") != "Sydney (AU)" { |
| t.Fatalf("after a complete read: %q, %q", label("uk"), label("au")) |
| } |
| // A later refused listing, then a later refused GET, keep that map. |
| @@ -167,7 +167,7 @@ func TestRegionNamesKeepTheOldMapOnFailure(t *testing.T) { |
| fx.srv.refreshRegionNames(ctx, nil, t0.Add(2*time.Hour)) |
| cs.refuse, cs.failGet = false, edgesfile.Key("box-uk") |
| fx.srv.refreshRegionNames(ctx, nil, t0.Add(3*time.Hour)) |
| - if label("uk") != "London (uk)" || label("au") != "Sydney (au)" { |
| + if label("uk") != "London (UK)" || label("au") != "Sydney (AU)" { |
| t.Fatalf("a failed rebuild changed the map: %q, %q", label("uk"), label("au")) |
| } |
| } |
| @@ -223,7 +223,7 @@ func TestRegionNamesRequestBudget(t *testing.T) { |
| t.Fatalf("inside the floor the new box is already read: %q", got) |
| } |
| fx.srv.refreshRegionNames(ctx, gens, t0.Add(10*time.Minute)) |
| - if got := regionlabel.ForCode("au", "ie", fx.srv.regionNames()).Text; got != "Sydney (au)" { |
| - t.Fatalf("at the floor after a generation change: %q, want Sydney (au)", got) |
| + if got := regionlabel.ForCode("au", "ie", fx.srv.regionNames()).Text; got != "Sydney (AU)" { |
| + t.Fatalf("at the floor after a generation change: %q, want Sydney (AU)", got) |
| } |
| } |
diff --git a/internal/console/regionwire_test.go b/internal/console/regionwire_test.go| index 9abf68db2..6d9b3f951 100644 |
| --- a/internal/console/regionwire_test.go |
| +++ b/internal/console/regionwire_test.go |
| @@ -48,8 +48,8 @@ func TestInstanceDoorsCarryLabels(t *testing.T) { |
| for _, r := range list.Instances { |
| got[r.Host] = [3]string{r.Region, r.RegionName, r.MovePhrase} |
| } |
| - if status != http.StatusOK || got[remoteHost] != [3]string{"uk", "London (uk)", "moving to Sydney (au)"} || |
| - got[localHost] != [3]string{"ie", "Dublin (ie)", ""} { |
| + if status != http.StatusOK || got[remoteHost] != [3]string{"uk", "London (UK)", "moving to Sydney (AU)"} || |
| + got[localHost] != [3]string{"ie", "Dublin (IE)", ""} { |
| t.Fatalf("list = %d %v", status, got) |
| } |
| status, _, body = rawReq(t, http.MethodGet, instancesURL(tb.fx, tb.sqid, "shop")+"/"+remoteHost, tb.token, "") |
| @@ -58,7 +58,7 @@ func TestInstanceDoorsCarryLabels(t *testing.T) { |
| MovePhrase string `json:"move_phrase"` |
| } |
| decode(t, body, &one) |
| - if status != http.StatusOK || one.RegionName != "London (uk)" || one.MovePhrase != "moving to Sydney (au)" { |
| + if status != http.StatusOK || one.RegionName != "London (UK)" || one.MovePhrase != "moving to Sydney (AU)" { |
| t.Fatalf("get = %d %+v", status, one) |
| } |
| @@ -72,7 +72,7 @@ func TestInstanceDoorsCarryLabels(t *testing.T) { |
| RegionLabel string `json:"region_label"` |
| } |
| decode(t, body, &created) |
| - if status != http.StatusCreated || created.RegionName == "" || created.RegionLabel != "London (uk)" { |
| + if status != http.StatusCreated || created.RegionName == "" || created.RegionLabel != "London (UK)" { |
| t.Fatalf("create = %d %s", status, body) |
| } |
| } |
| @@ -85,7 +85,7 @@ func TestAppDoorsCarryLabels(t *testing.T) { |
| // /regions: a label per entry, and app_default's. |
| _, res := getJSON(t, tb.fx.ts.URL+"/api/cli/apps/"+tb.sqid+"/shop/regions", tb.token) |
| d, _ := res["app_default"].(map[string]any) |
| - if d["label"] != "Dublin (ie)" || d["region"] != "ie" { |
| + if d["label"] != "Dublin (IE)" || d["region"] != "ie" { |
| t.Fatalf("app_default = %v", d) |
| } |
| labels := map[string]any{} |
| @@ -93,13 +93,13 @@ func TestAppDoorsCarryLabels(t *testing.T) { |
| m := e.(map[string]any) |
| labels[m["code"].(string)] = m["label"] |
| } |
| - if labels["ie"] != "Dublin (ie)" || labels["uk"] != "London (uk)" { |
| + if labels["ie"] != "Dublin (IE)" || labels["uk"] != "London (UK)" { |
| t.Fatalf("regions = %v", labels) |
| } |
| // /new: region_label beside region_name. |
| _, created := postJSON(t, newAppURL(tb.fx), map[string]string{"name": "cart"}, tb.token) |
| - if created["region_label"] != "Dublin (ie)" { |
| + if created["region_label"] != "Dublin (IE)" { |
| t.Fatalf("/new = %v", created) |
| } |
| @@ -109,7 +109,7 @@ func TestAppDoorsCarryLabels(t *testing.T) { |
| for _, e := range rres["routes"].([]any) { |
| m := e.(map[string]any) |
| if m["host"] == localHost { |
| - found = m["region"] == "ie" && m["region_name"] == "Dublin (ie)" |
| + found = m["region"] == "ie" && m["region_name"] == "Dublin (IE)" |
| } |
| } |
| if !found { |
| @@ -153,7 +153,7 @@ func TestAppListCarriesStoredRegions(t *testing.T) { |
| } |
| cs.reset() |
| rows := listApps() |
| - if rows["shop"]["region_name"] != "Dublin (ie)" || rows["shop"]["region"] != "ie" || |
| + if rows["shop"]["region_name"] != "Dublin (IE)" || rows["shop"]["region"] != "ie" || |
| rows["legacy"]["region_name"] != "fleet private" || rows["legacy"]["region"] != "fleet/private" { |
| t.Fatalf("/list = %v", rows) |
| } |
| @@ -226,7 +226,7 @@ func TestSidecarListCarriesLabels(t *testing.T) { |
| } `json:"sidecars"` |
| } |
| decode(t, body, &list) |
| - if len(list.Sidecars) != 1 || list.Sidecars[0].RegionName != "London (uk)" { |
| + if len(list.Sidecars) != 1 || list.Sidecars[0].RegionName != "London (UK)" { |
| t.Fatalf("sidecars = %s", body) |
| } |
| } |
| @@ -280,26 +280,26 @@ func TestMoveViewsCarryLabels(t *testing.T) { |
| fx.srv.cfg.MovesEnabled = true |
| defer func() { fx.srv.cfg.MovesEnabled = false }() |
| code, flat := getJSON(t, base, token) |
| - if code != http.StatusOK || flat["target"] != "au" || flat["target_name"] != "Sydney (au)" { |
| + if code != http.StatusOK || flat["target"] != "au" || flat["target_name"] != "Sydney (AU)" { |
| t.Fatalf("flat = %d %v", code, flat) |
| } |
| code, det := getJSON(t, base+"?detail=1", token) |
| d, _ := det["detail"].(map[string]any) |
| - if code != http.StatusOK || d["from"] != "uk" || d["from_name"] != "London (uk)" || d["to_name"] != "Sydney (au)" { |
| + if code != http.StatusOK || d["from"] != "uk" || d["from_name"] != "London (UK)" || d["to_name"] != "Sydney (AU)" { |
| t.Fatalf("detail = %d %v", code, det) |
| } |
| }) |
| t.Run("offline", func(t *testing.T) { |
| code, off := getJSON(t, base+"/offline", token) |
| if code != http.StatusOK || off["from"] != "uk" || off["to"] != "au" || |
| - off["from_name"] != "London (uk)" || off["to_name"] != "Sydney (au)" { |
| + off["from_name"] != "London (UK)" || off["to_name"] != "Sydney (AU)" { |
| t.Fatalf("offline = %d %v", code, off) |
| } |
| // Stopping waits for the seal: the sentence names the source region, |
| // whichever check it stops at ("no eligible box in <from> ..." or |
| // "Waiting for <box> in <from> ..."), by its label. |
| w, _ := off["waiting"].(string) |
| - if !strings.Contains(w, "London (uk)") || strings.Contains(w, " in uk ") { |
| + if !strings.Contains(w, "London (UK)") || strings.Contains(w, " in uk ") { |
| t.Fatalf("waiting = %q, want the source's label", w) |
| } |
| }) |
| @@ -315,7 +315,7 @@ func TestDBDoorsCarryLabels(t *testing.T) { |
| status, _, body := rawReq(t, http.MethodGet, fx.listURL(), fx.member, "") |
| var marker dbdoor.ForwardBody |
| decode(t, body, &marker) |
| - if status != http.StatusConflict || marker.Region != "uk" || marker.RegionName != "London (uk)" || |
| + if status != http.StatusConflict || marker.Region != "uk" || marker.RegionName != "London (UK)" || |
| marker.Error != fmt.Sprintf(dbfUpdateCarlos, dbfHost, "uk") { |
| t.Fatalf("marker = %d %s", status, body) |
| } |
| @@ -328,7 +328,7 @@ func TestDBDoorsCarryLabels(t *testing.T) { |
| var refusal map[string]string |
| decode(t, string(raw), &refusal) |
| if res.StatusCode != http.StatusConflict || refusal["error"] != fmt.Sprintf(dbfMoving, "moving.example.com") || |
| - refusal["from_name"] != "London (uk)" || refusal["to_name"] != "ie" { |
| + refusal["from_name"] != "London (UK)" || refusal["to_name"] != "ie" { |
| t.Fatalf("moving refusal = %d %v", res.StatusCode, refusal) |
| } |
| // A legacy journal (no id) names no endpoints. |
| @@ -361,7 +361,7 @@ func TestStatusDoorsCarryLabels(t *testing.T) { |
| for _, e := range inst["instances"].([]any) { |
| m := e.(map[string]any) |
| if m["box"] == status.Label("box-b") { |
| - ok = m["region"] == "uk" && m["region_name"] == "London (uk)" |
| + ok = m["region"] == "uk" && m["region_name"] == "London (UK)" |
| } |
| } |
| if !ok { |
| @@ -372,7 +372,7 @@ func TestStatusDoorsCarryLabels(t *testing.T) { |
| for _, e := range lay["boxes"].([]any) { |
| m := e.(map[string]any) |
| if m["box"] == status.Label("box-b") { |
| - ok = m["region"] == "uk" && m["region_name"] == "London (uk)" |
| + ok = m["region"] == "uk" && m["region_name"] == "London (UK)" |
| } |
| } |
| if !ok { |
diff --git a/internal/console/runningtile_test.go b/internal/console/runningtile_test.go| new file mode 100644 |
| index 000000000..2103a67c1 |
| --- /dev/null |
| +++ b/internal/console/runningtile_test.go |
| @@ -0,0 +1,159 @@ |
| +package console |
| + |
| +// The overview's Running tile for instances on other boxes (Paul, |
| +// 2026-10-26). An app whose every instance runs on another box takes no |
| +// readings on the console's box (appResourceMetrics skips remote rows), so |
| +// the metrics read is nil. That nil used to read as a failed sweep, and the |
| +// tile said "?" and "no data right now" while the Running tab and |
| +// `carlos instances list` said Running. The tile now counts a remote |
| +// instance from the one box report remoteFacts accepts for it: awake is |
| +// running, a hibernating one that is not awake is asleep. No remote metrics |
| +// sample is read, and "?" stays for state nobody can vouch for. |
| + |
| +import ( |
| + "strings" |
| + "testing" |
| + "time" |
| + |
| + "github.com/carlosframework/platform/internal/metrics" |
| + "github.com/carlosframework/platform/internal/registry" |
| + "github.com/carlosframework/platform/internal/status" |
| +) |
| + |
| +const asleepHost = "eu2.shop.example.com" |
| + |
| +// runningTile is the overview's Running tile, value and detail. |
| +func runningTile(t *testing.T, ov string) string { |
| + t.Helper() |
| + i := strings.Index(ov, "<h2>Running</h2>") |
| + if i < 0 { |
| + t.Fatalf("no Running tile:\n%s", ov) |
| + } |
| + j := strings.Index(ov[i:], "</a>") |
| + if j < 0 { |
| + t.Fatalf("Running tile not closed:\n%s", ov[i:]) |
| + } |
| + return ov[i : i+j] |
| +} |
| + |
| +// TestRunningTileCountsInstancesOnOtherBoxes: two instances on box B, one |
| +// awake and one asleep by B's rollout report, nothing on the console's box. |
| +// Box C reports the asleep host as awake for another account, and that |
| +// report is ignored. |
| +func TestRunningTileCountsInstancesOnOtherBoxes(t *testing.T) { |
| + tb := newTwoBoxes(t) |
| + tb.create(t, tb.token, tb.sqid, "shop", remoteHost, "uk", "") |
| + tb.create(t, tb.token, tb.sqid, "shop", asleepHost, "uk", "") |
| + tb.reconcile(t, "v3") |
| + regA, err := registry.Open(tb.fx.regPath) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + if rt, err := regA.Get(asleepHost); err != nil || rt != nil { |
| + t.Fatalf("the console's box minted %s: %+v %v", asleepHost, rt, err) |
| + } |
| + // B samples both units: the tile must not need (or show) them. |
| + sweep(t, tb.fx.rel, status.Label("box-b"), map[string]metrics.UnitSample{ |
| + "carlos-exec@" + remoteHost: {CPUFrac: p(0.27), MemBytes: pi64(3 << 20)}, |
| + }) |
| + 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(), map[string]bool{remoteHost: true}, 4096) |
| + regC, err := registry.Open(t.TempDir() + "/registry-c.db") |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + t.Cleanup(func() { regC.Close() }) |
| + if err := regC.Upsert(registry.Route{Host: asleepHost, Kind: "instance", App: "shop", Account: "rvl", |
| + Channel: "stable", Version: "v8", Provisioned: true, Status: "ready", Hibernate: true}); err != nil { |
| + t.Fatal(err) |
| + } |
| + report(t, tb.fx.rel, regC, "box-c", "uk", time.Now().Add(time.Second), map[string]bool{asleepHost: true}, 70<<20) |
| + |
| + ov := tb.page(t, "/apps/shop") |
| + tile := runningTile(t, ov) |
| + if !strings.Contains(tile, `<p class="tile-value">1 of 2</p>`) || !strings.Contains(tile, "copies reporting · 1 asleep") { |
| + t.Fatalf("Running tile for one awake and one asleep remote instance:\n%s", tile) |
| + } |
| + if strings.Contains(tile, "?") || strings.Contains(tile, "no data right now") { |
| + t.Fatalf("Running tile says it cannot tell:\n%s", tile) |
| + } |
| + // The verdict follows the tile: every instance accounted for. |
| + if strings.Contains(ov, "Can't tell right now") { |
| + t.Fatalf("overview says it can't tell with every remote state known:\n%s", ov) |
| + } |
| + // Still no remote metrics: the Resources tile is as it was. |
| + for _, bad := range []string{"27%", "3.0 MB", "v8", "70.0 MB"} { |
| + if strings.Contains(ov, bad) { |
| + t.Fatalf("overview shows %q, a remote reading or another account's report:\n%s", bad, ov) |
| + } |
| + } |
| + // The Database tile sums B's accepted sizes only: 4 KB each. |
| + if !strings.Contains(ov, "8.0 KB") { |
| + t.Fatalf("Database tile is not B's two sizes:\n%s", ov) |
| + } |
| + if i := strings.Index(ov, "<h2>Resources</h2>"); i < 0 || !strings.Contains(ov[i:], "— · —</p>\n <p class=\"tile-detail\">no data right now</p>") { |
| + t.Fatalf("Resources tile changed:\n%s", ov) |
| + } |
| +} |
| + |
| +// TestRunningTileAwakeRemoteInstance: one remote instance, awake. |
| +func TestRunningTileAwakeRemoteInstance(t *testing.T) { |
| + tb := newTwoBoxes(t) |
| + tb.setUp(t, false) |
| + tile := runningTile(t, tb.page(t, "/apps/shop")) |
| + if !strings.Contains(tile, `<p class="tile-value">1 of 1</p>`) || !strings.Contains(tile, "copies reporting") || strings.Contains(tile, "asleep") { |
| + t.Fatalf("Running tile for one awake remote instance:\n%s", tile) |
| + } |
| +} |
| + |
| +// TestRunningTileOtherAccountsReportOnly: the only report naming the host |
| +// says another account's. Its awake state is not this app's, so the tile |
| +// cannot tell. |
| +func TestRunningTileOtherAccountsReportOnly(t *testing.T) { |
| + tb := newTwoBoxes(t) |
| + tb.create(t, tb.token, tb.sqid, "shop", remoteHost, "uk", "") |
| + if err := tb.regB.Upsert(registry.Route{Host: remoteHost, Kind: "instance", App: "shop", Account: "rvl", |
| + Channel: "stable", Version: "v8", Provisioned: true, Status: "ready", Hibernate: true}); err != nil { |
| + t.Fatal(err) |
| + } |
| + report(t, tb.fx.rel, tb.regB, "box-b", "uk", time.Now(), map[string]bool{remoteHost: true}, 4096) |
| + tile := runningTile(t, tb.page(t, "/apps/shop")) |
| + if !strings.Contains(tile, `<p class="tile-value">?</p>`) || !strings.Contains(tile, "no data right now") { |
| + t.Fatalf("Running tile with only another account's report:\n%s", tile) |
| + } |
| +} |
| + |
| +// TestOverviewRunningFromRemoteState pins assembleOverview: a nil metrics |
| +// read with no instance on the console's box is not a failed sweep, and |
| +// one with a local instance still is. |
| +func TestOverviewRunningFromRemoteState(t *testing.T) { |
| + remote := []RouteView{ |
| + {Host: "a.example.com", Account: "x", Kind: "instance", Hibernate: true, Status: "ready", Version: "v1", remote: true, boxAwake: true}, |
| + {Host: "b.example.com", Account: "x", Kind: "instance", Hibernate: true, Status: "ready", Version: "v1", remote: true}, |
| + {Host: "c.example.com", Account: "x", Kind: "instance", Hibernate: true, remote: true, unknown: true}, |
| + } |
| + st := assembleOverview(&AppView{Routes: remote[:2]}, "x", nil, nil, boxJoin{}) |
| + if st.MetricsUnavailable || st.InstanceReporting != 1 || st.InstanceAsleep != 1 || st.InstanceCounted != 2 || !st.ResourcesUnavailable { |
| + t.Fatalf("remote only = %+v", st) |
| + } |
| + if st.Verdict != "ok" { |
| + t.Fatalf("remote only verdict = %q", st.VerdictLabel) |
| + } |
| + st = assembleOverview(&AppView{Routes: remote}, "x", nil, nil, boxJoin{}) |
| + if st.MetricsUnavailable || st.InstanceCounted != 2 || st.InstanceUnknown != 1 || st.Verdict != "unknown" { |
| + t.Fatalf("remote with one unknown = %+v", st) |
| + } |
| + st = assembleOverview(&AppView{Routes: remote[2:]}, "x", nil, nil, boxJoin{}) |
| + if st.MetricsUnavailable || st.InstanceCounted != 0 || st.InstanceUnknown != 1 { |
| + t.Fatalf("remote all unknown = %+v", st) |
| + } |
| + local := append([]RouteView{{Host: "l.example.com", Account: "x", Kind: "instance", Hibernate: true, Provisioned: true}}, remote[:2]...) |
| + if st = assembleOverview(&AppView{Routes: local}, "x", nil, nil, boxJoin{}); !st.MetricsUnavailable || !st.ResourcesUnavailable { |
| + t.Fatalf("a failed sweep with a local instance = %+v", st) |
| + } |
| + // Another account's rows count for nothing, local or remote. |
| + other := []RouteView{{Host: "o.example.com", Account: "y", Kind: "instance", Hibernate: true}, remote[0]} |
| + if st = assembleOverview(&AppView{Routes: other}, "x", nil, nil, boxJoin{}); st.MetricsUnavailable || st.InstanceTotal != 1 || st.InstanceReporting != 1 { |
| + t.Fatalf("another account's local row = %+v", st) |
| + } |
| +} |
diff --git a/internal/console/templates/app_overview.html b/internal/console/templates/app_overview.html| index 908f95efc..cf12c87c7 100644 |
| --- a/internal/console/templates/app_overview.html |
| +++ b/internal/console/templates/app_overview.html |
| @@ -35,7 +35,7 @@ |
| <a class="tile" href="{{$.Nav}}/apps/{{$.AppName}}/instances"> |
| <h2>Resources</h2> |
| <p class="tile-value">{{pct .CPUSum}} · {{bytesOrDash .MemSum}}</p> |
| - <p class="tile-detail">{{if .CPUSum}}CPU · memory, from the copies responding{{else if .MetricsUnavailable}}no data right now{{else}}no recent data{{end}}</p> |
| + <p class="tile-detail">{{if .CPUSum}}CPU · memory, from the copies responding{{else if .ResourcesUnavailable}}no data right now{{else}}no recent data{{end}}</p> |
| </a> |
| {{/* Sizes come from the routes, not the metrics sweep: a sleeping copy's |
| database is still on disk. Hidden for apps that run nothing. */}} |
diff --git a/internal/dbdoor/client_test.go b/internal/dbdoor/client_test.go| index 84206c84c..685513ecd 100644 |
| --- a/internal/dbdoor/client_test.go |
| +++ b/internal/dbdoor/client_test.go |
| @@ -314,9 +314,9 @@ func TestClientCapsRetryAfter(t *testing.T) { |
| func TestDoorErrorReadsTheRegionName(t *testing.T) { |
| t.Parallel() |
| err := doorError(doorResponse(http.StatusConflict, |
| - `{"error":"x","forward":1,"region":"uk","region_name":"London (uk)","forward_ops":["query"]}`)) |
| + `{"error":"x","forward":1,"region":"uk","region_name":"London (UK)","forward_ops":["query"]}`)) |
| var de *DoorError |
| - if !errors.As(err, &de) || de.Forward == nil || de.Forward.Region != "uk" || de.Forward.RegionName != "London (uk)" { |
| + if !errors.As(err, &de) || de.Forward == nil || de.Forward.Region != "uk" || de.Forward.RegionName != "London (UK)" { |
| t.Fatalf("%#v", err) |
| } |
| err = doorError(doorResponse(http.StatusConflict, `{"error":"x","forward":1,"region":"uk","forward_ops":["query"]}`)) |
diff --git a/internal/dbdoor/forward.go b/internal/dbdoor/forward.go| index 1f059ebc0..1de689bdc 100644 |
| --- a/internal/dbdoor/forward.go |
| +++ b/internal/dbdoor/forward.go |
| @@ -12,7 +12,7 @@ type ForwardBody struct { |
| Region string `json:"region"` |
| ForwardOps []string `json:"forward_ops"` |
| // RegionName is the console's label for Region (region labels spec |
| - // §4): "London (uk)". An older console sends none. |
| + // §4): "London (UK)". An older console sends none. |
| RegionName string `json:"region_name,omitempty"` |
| } |
diff --git a/internal/regionlabel/move_test.go b/internal/regionlabel/move_test.go| index 224cc59bf..64d9f609c 100644 |
| --- a/internal/regionlabel/move_test.go |
| +++ b/internal/regionlabel/move_test.go |
| @@ -69,24 +69,24 @@ func TestMovePhraseByClass(t *testing.T) { |
| return r |
| } |
| for state, want := range map[string]string{ |
| - provision.MovePreparing: "moving to Sydney (au)", |
| - provision.MoveReady: "moving to Sydney (au)", |
| - provision.MoveCutting: "moving to Sydney (au)", |
| - provision.OfflineStaging: "moving to Sydney (au)", |
| - provision.OfflineStopping: "moving to Sydney (au)", |
| - provision.OfflineSealing: "moving to Sydney (au)", |
| - provision.OfflineSealed: "moving to Sydney (au)", |
| - provision.MoveLanding: "arriving from London (uk)", |
| - provision.MoveCommitted: "arriving from London (uk)", |
| - provision.OfflineLanding: "arriving from London (uk)", |
| - provision.OfflineLanded: "arriving from London (uk)", |
| - provision.OfflineOpen: "arriving from London (uk)", |
| - provision.OfflineFinishing: "arriving from London (uk)", |
| - provision.MoveAborting: "returning from Sydney (au)", |
| - provision.MoveReverting: "returning from Sydney (au)", |
| - provision.MoveRollingBack: "returning from Sydney (au)", |
| - provision.MoveStuck: "returning from Sydney (au)", |
| - provision.OfflineReverting: "returning from Sydney (au)", |
| + provision.MovePreparing: "moving to Sydney (AU)", |
| + provision.MoveReady: "moving to Sydney (AU)", |
| + provision.MoveCutting: "moving to Sydney (AU)", |
| + provision.OfflineStaging: "moving to Sydney (AU)", |
| + provision.OfflineStopping: "moving to Sydney (AU)", |
| + provision.OfflineSealing: "moving to Sydney (AU)", |
| + provision.OfflineSealed: "moving to Sydney (AU)", |
| + provision.MoveLanding: "arriving from London (UK)", |
| + provision.MoveCommitted: "arriving from London (UK)", |
| + provision.OfflineLanding: "arriving from London (UK)", |
| + provision.OfflineLanded: "arriving from London (UK)", |
| + provision.OfflineOpen: "arriving from London (UK)", |
| + provision.OfflineFinishing: "arriving from London (UK)", |
| + provision.MoveAborting: "returning from Sydney (AU)", |
| + provision.MoveReverting: "returning from Sydney (AU)", |
| + provision.MoveRollingBack: "returning from Sydney (AU)", |
| + provision.MoveStuck: "returning from Sydney (AU)", |
| + provision.OfflineReverting: "returning from Sydney (AU)", |
| "a-state-from-a-newer-box": "", |
| } { |
| if got := MovePhrase(at(state), "ie", n); got != want { |
| @@ -108,19 +108,19 @@ func TestMovePhraseFollowsTheFlip(t *testing.T) { |
| r := rec("uk", "", "") |
| const id = "mv_abcdefghijklmnopqrstuvwxyz" |
| r.Move = &provision.MoveState{Kind: provision.MoveKindOffline, ID: id, From: "uk", To: "au", State: provision.OfflineSealed} |
| - if got := ForRecord(r, "ie", n).Text + ", " + MovePhrase(r, "ie", n); got != "London (uk), moving to Sydney (au)" { |
| + if got := ForRecord(r, "ie", n).Text + ", " + MovePhrase(r, "ie", n); got != "London (UK), moving to Sydney (AU)" { |
| t.Fatalf("sealed: %q", got) |
| } |
| if err := provision.OfflineFlip(id)(&r); err != nil { |
| t.Fatal(err) |
| } |
| - if got := ForRecord(r, "ie", n).Text + ", " + MovePhrase(r, "ie", n); got != "Sydney (au), arriving from London (uk)" { |
| + if got := ForRecord(r, "ie", n).Text + ", " + MovePhrase(r, "ie", n); got != "Sydney (AU), arriving from London (UK)" { |
| t.Fatalf("flipped: %q", got) |
| } |
| if err := provision.OfflineAbort(id)(&r); err != nil { |
| t.Fatal(err) |
| } |
| - if got := ForRecord(r, "ie", n).Text + ", " + MovePhrase(r, "ie", n); got != "London (uk), returning from Sydney (au)" { |
| + if got := ForRecord(r, "ie", n).Text + ", " + MovePhrase(r, "ie", n); got != "London (UK), returning from Sydney (AU)" { |
| t.Fatalf("aborted landing: %q", got) |
| } |
| } |
diff --git a/internal/regionlabel/regionlabel.go b/internal/regionlabel/regionlabel.go| index fd56d3dac..9f7ccee14 100644 |
| --- a/internal/regionlabel/regionlabel.go |
| +++ b/internal/regionlabel/regionlabel.go |
| @@ -1,8 +1,9 @@ |
| // Package regionlabel names where an app or an instance runs, as a place |
| -// and a code: "London (uk)" (region labels spec |
| +// and a code: "London (UK)" (region labels spec |
| // docs/superpowers/specs/2026-10-25-region-labels-design.md §3; Paul's |
| -// ruling of 2026-10-25). It is pure: it reads nothing. The console builds a |
| -// Names from one edges read and keeps it (internal/console/regionnames.go). |
| +// rulings of 2026-10-25, and of 2026-10-26 for the upper-case code). It |
| +// is pure: it reads nothing. The console builds a Names from one edges |
| +// read and keeps it (internal/console/regionnames.go). |
| package regionlabel |
| import ( |
| @@ -127,9 +128,11 @@ func ForCode(code, home string, n Names) Label { |
| return Label{Text: homeText} |
| } |
| l := Label{Code: display, Text: display} |
| + // The code in brackets is upper case, "London (UK)" (Paul, 2026-10-26). |
| + // Code keeps the stored lower-case value: flags and JSON code fields use it. |
| if r, ok := geo.LookupAWSRegion(n.aws[display]); ok { |
| l.Place = r.Place |
| - l.Text = City(r.Place) + " (" + display + ")" |
| + l.Text = City(r.Place) + " (" + strings.ToUpper(display) + ")" |
| } |
| return l |
| } |
diff --git a/internal/regionlabel/regionlabel_test.go b/internal/regionlabel/regionlabel_test.go| index 8d8839e7a..be188650d 100644 |
| --- a/internal/regionlabel/regionlabel_test.go |
| +++ b/internal/regionlabel/regionlabel_test.go |
| @@ -36,15 +36,15 @@ func TestLabelTableInOrder(t *testing.T) { |
| {"a static record on a fleet: fleet first", ForRecord(rec("fleet/private", "shop", "static"), "ie", n), "fleet private"}, |
| {"a pooled static record: pool", ForRecord(rec("uk", "shop", "static"), "ie", n), "pool shop"}, |
| {"a static record with no pool: every region", ForRecord(rec("uk", "", "static"), "ie", n), "every region"}, |
| - {"a pooled socket-backed record keeps its region", ForRecord(rec("uk", "shop", ""), "ie", n), "London (uk)"}, |
| - {"the home's record", ForRecord(rec("", "", ""), "ie", n), "Dublin (ie)"}, |
| + {"a pooled socket-backed record keeps its region", ForRecord(rec("uk", "shop", ""), "ie", n), "London (UK)"}, |
| + {"the home's record", ForRecord(rec("", "", ""), "ie", n), "Dublin (IE)"}, |
| {"no home named", ForCode("", "", n), "the home region"}, |
| - {"a code the table knows", ForCode("au", "ie", n), "Sydney (au)"}, |
| - {"the home's name as a code", ForCode("ie", "ie", n), "Dublin (ie)"}, |
| + {"a code the table knows", ForCode("au", "ie", n), "Sydney (AU)"}, |
| + {"the home's name as a code", ForCode("ie", "ie", n), "Dublin (IE)"}, |
| {"a code no box publishes", ForCode("nz", "ie", n), "nz"}, |
| {"a registry-only everywhere row", ForRoute(registry.Route{Host: "s.shop.example.com", Kind: "static", Region: "uk"}, "ie", n), "every region"}, |
| {"a registry-only pooled everywhere row", ForRoute(registry.Route{Host: "s.shop.example.com", Kind: "static", Region: "uk", Pool: "shop"}, "ie", n), "pool shop"}, |
| - {"a registry-only socket row", ForRoute(registry.Route{Host: "e.shop.example.com", Kind: "instance", Region: "uk"}, "ie", n), "London (uk)"}, |
| + {"a registry-only socket row", ForRoute(registry.Route{Host: "e.shop.example.com", Kind: "instance", Region: "uk"}, "ie", n), "London (UK)"}, |
| {"a registry-only fleet row", ForRoute(registry.Route{Host: "e.shop.example.com", Kind: "static", Region: "fleet/private"}, "ie", n), "fleet private"}, |
| } |
| for _, c := range cases { |
| @@ -111,7 +111,7 @@ func TestNamesFromFolds(t *testing.T) { |
| {V: 1, Box: "pi-1", Placement: "fleet/pi", Region: "eu-west-1"}, |
| {V: 1, Box: "bad-1", Placement: "UK!", Region: "eu-west-2"}, |
| }}, "ie") |
| - for code, want := range map[string]string{"ie": "Dublin (ie)", "uk": "London (uk)", "tie": "Frankfurt (tie)"} { |
| + for code, want := range map[string]string{"ie": "Dublin (IE)", "uk": "London (UK)", "tie": "Frankfurt (TIE)"} { |
| if got := ForCode(code, "ie", n).Text; got != want { |
| t.Errorf("%s: %q, want %q", code, got, want) |
| } |
diff --git a/move_test.go b/move_test.go| index 5cb4b6a81..474d8a295 100644 |
| --- a/move_test.go |
| +++ b/move_test.go |
| @@ -1918,9 +1918,9 @@ func TestMoveOfflineAbortStaged(t *testing.T) { |
| // the request still sends the code. |
| func TestMoveLinesNameRegionsByLabel(t *testing.T) { |
| named := func(f frame) frame { |
| - f["target_name"] = "London (uk)" |
| + f["target_name"] = "London (UK)" |
| if d, ok := f["detail"].(frame); ok { |
| - d["from_name"], d["to_name"] = "Dublin (ie)", "London (uk)" |
| + d["from_name"], d["to_name"] = "Dublin (IE)", "London (UK)" |
| } |
| return f |
| } |
| @@ -1938,10 +1938,10 @@ func TestMoveLinesNameRegionsByLabel(t *testing.T) { |
| t.Fatalf("exit %d:\n%s", code, out) |
| } |
| wantLines(t, out, |
| - "Moving "+tHost+" from Dublin (ie) to London (uk).", |
| - "London (uk) is ready. Starting the cut. "+tHost+" will be offline for about 45 seconds.", |
| - "Stopped in Dublin (ie). Starting in London (uk).", |
| - "Moved. "+tHost+" is served from London (uk). It was offline for 41 seconds.") |
| + "Moving "+tHost+" from Dublin (IE) to London (UK).", |
| + "London (UK) is ready. Starting the cut. "+tHost+" will be offline for about 45 seconds.", |
| + "Stopped in Dublin (IE). Starting in London (UK).", |
| + "Moved. "+tHost+" is served from London (UK). It was offline for 41 seconds.") |
| if m := c.mutations(); len(m) != 1 || m[0] != "POST "+tMovePth+` {"cut":"auto","region":"uk"}` { |
| t.Fatalf("the request must carry the code: %q", m) |
| } |
| @@ -1949,10 +1949,10 @@ func TestMoveLinesNameRegionsByLabel(t *testing.T) { |
| // TestMoveOfflineLinesNameRegionsByLabel: surface 26, Review Focus 3. |
| func TestMoveOfflineLinesNameRegionsByLabel(t *testing.T) { |
| - named := func(f frame) frame { f["from_name"], f["to_name"] = "Dublin (ie)", "London (uk)"; return f } |
| + named := func(f frame) frame { f["from_name"], f["to_name"] = "Dublin (IE)", "London (UK)"; return f } |
| c := &fakeOfflineConsole{gets: []frame{named(offView("offline-sealed", frame{"next": "flip"}))}} |
| - if code, out := runOfflineAgainst(t, c, "status"); code != 0 || out != "Moving "+oHost+" from Dublin (ie) to London (uk).\n"+ |
| - "Copied and checked. Run carlos move offline flip --host "+oHost+" to start it in London (uk).\n" { |
| + if code, out := runOfflineAgainst(t, c, "status"); code != 0 || out != "Moving "+oHost+" from Dublin (IE) to London (UK).\n"+ |
| + "Copied and checked. Run carlos move offline flip --host "+oHost+" to start it in London (UK).\n" { |
| t.Fatalf("exit %d:\n%s", code, out) |
| } |
| // Staged, ready to start: the prose names the label, the command keeps |
| @@ -1960,12 +1960,12 @@ func TestMoveOfflineLinesNameRegionsByLabel(t *testing.T) { |
| c = &fakeOfflineConsole{gets: []frame{named(offView("offline-staging", frame{"next": "start"}))}} |
| _, out := runOfflineAgainst(t, c, "status") |
| wantLines(t, out, |
| - "Staging "+oHost+" in London (uk). "+oHost+" keeps serving while the data is copied.", |
| + "Staging "+oHost+" in London (UK). "+oHost+" keeps serving while the data is copied.", |
| oHost+" keeps serving. Run carlos move offline start --host "+oHost+" --to uk when you are ready to take it offline.") |
| // No bare code in prose, in any state: once the labels, the box name |
| // and --to's value are taken out, no "ie" or "uk" is left. |
| bare := regexp.MustCompile(`\b(ie|uk)\b`) |
| - strip := strings.NewReplacer("Dublin (ie)", "", "London (uk)", "", "--to uk", "", "ie-box", "") |
| + strip := strings.NewReplacer("Dublin (IE)", "", "London (UK)", "", "--to uk", "", "ie-box", "") |
| for _, state := range []string{"offline-stopping", "offline-sealing", "offline-landing", "offline-landed", "offline-reverting"} { |
| c = &fakeOfflineConsole{gets: []frame{named(offView(state, frame{"next": map[string]string{ |
| "offline-stopping": "seal", "offline-landed": "open", "offline-reverting": "finish"}[state]}))}} |
diff --git a/offline_move_e2e_test.go b/offline_move_e2e_test.go| index b0b85ce36..7cc471e29 100644 |
| --- a/offline_move_e2e_test.go |
| +++ b/offline_move_e2e_test.go |
| @@ -378,8 +378,8 @@ func TestMoveOfflineNamesRegionsThroughTheRealDoors(t *testing.T) { |
| t.Fatalf("status exit %d:\n%s", code, out) |
| } |
| wantLines(t, out, |
| - "Moving "+e.host+" from Dublin (ie) to London (uk).", |
| - "Waiting for ie-box in Dublin (ie) to confirm it has stopped "+e.host+". "+e.host+" is offline.") |
| + "Moving "+e.host+" from Dublin (IE) to London (UK).", |
| + "Waiting for ie-box in Dublin (IE) to confirm it has stopped "+e.host+". "+e.host+" is offline.") |
| cancel() |
| <-done |
| } |
diff --git a/region_labels.go b/region_labels.go| index 48e685f4c..0eb129cc7 100644 |
| --- a/region_labels.go |
| +++ b/region_labels.go |
| @@ -7,7 +7,7 @@ import ( |
| // The region labels (spec docs/superpowers/specs/2026-10-25-region-labels-design.md, |
| // §5 surfaces 15 to 30): the CLI prints the label the console sends, |
| -// "London (uk)", and what it printed before when the console sends none. |
| +// "London (UK)", and what it printed before when the console sends none. |
| // placeMaxBytes bounds a label the CLI will print: a city, a code and a |
| // move phrase fit many times over. |
diff --git a/region_labels_e2e_test.go b/region_labels_e2e_test.go| index 6caa9dd98..acbd9f608 100644 |
| --- a/region_labels_e2e_test.go |
| +++ b/region_labels_e2e_test.go |
| @@ -124,11 +124,11 @@ func TestRegionLabelsCreateLinesThroughTheConsole(t *testing.T) { |
| e := newLabelsE2E(t) |
| e.out(t, runInstancesEnable, "-app", "shop", "-account", "ops", "-channel", "beta") |
| if got := e.out(t, runInstancesCreate, "-app", "shop", "-account", "ops", "-host", "uk1."+labelsDomain, "-region", "uk"); !strings.Contains(got, |
| - "created instance uk1."+labelsDomain+" (channel beta, London (uk))") { |
| + "created instance uk1."+labelsDomain+" (channel beta, London (UK))") { |
| t.Fatalf("instances create:\n%s", got) |
| } |
| if got := e.out(t, runAppsCreate, "-app", "cart", "-account", "ops"); !strings.Contains(got, |
| - "Region: Dublin (ie), the platform default.\n") { |
| + "Region: Dublin (IE), the platform default.\n") { |
| t.Fatalf("apps create on a switch-off console:\n%s", got) |
| } |
| } |
| @@ -140,13 +140,13 @@ func TestRegionLabelsListingsThroughTheConsole(t *testing.T) { |
| e.out(t, runInstancesCreate, "-app", "shop", "-account", "ops", "-host", "home1."+labelsDomain) |
| list := e.out(t, runInstancesList, "-app", "shop", "-account", "ops") |
| - for _, want := range []string{"London (uk)", "Dublin (ie)"} { |
| + for _, want := range []string{"London (UK)", "Dublin (IE)"} { |
| if !strings.Contains(list, want) { |
| t.Fatalf("instances list lacks %q:\n%s", want, list) |
| } |
| } |
| apps := e.out(t, runAppsList, "--account", "ops") |
| - if !strings.Contains(apps, "Dublin (ie)") { |
| + if !strings.Contains(apps, "Dublin (IE)") { |
| t.Fatalf("apps list:\n%s", apps) |
| } |
| @@ -160,7 +160,7 @@ func TestRegionLabelsListingsThroughTheConsole(t *testing.T) { |
| t.Fatal(err) |
| } |
| routes := e.out(t, runRoutes, "-app", "shop", "-account", "ops") |
| - if !strings.Contains(routes, "REGION") || !strings.Contains(routes, "London (uk)") { |
| + if !strings.Contains(routes, "REGION") || !strings.Contains(routes, "London (UK)") { |
| t.Fatalf("routes:\n%s", routes) |
| } |
| } |
| @@ -189,14 +189,14 @@ func TestRegionLabelsStatusThroughTheConsole(t *testing.T) { |
| } |
| // No reconcile ran, so the unit matches no route and reads as the |
| // box's own: its REGION cell is the box's all the same. |
| - if !strings.Contains(out.String(), "REGION") || !strings.Contains(out.String(), "London (uk)") { |
| + if !strings.Contains(out.String(), "REGION") || !strings.Contains(out.String(), "London (UK)") { |
| t.Fatalf("status --instances:\n%s", out.String()) |
| } |
| out.Reset() |
| if err := statusLayout(&out, ""); err != nil { |
| t.Fatal(err) |
| } |
| - if !strings.Contains(out.String(), "BOX REGION HOST LAYOUT SIZE EGRESS REASON") || !strings.Contains(out.String(), labelsUKBox+" London (uk) "+host) { |
| + if !strings.Contains(out.String(), "BOX REGION HOST LAYOUT SIZE EGRESS REASON") || !strings.Contains(out.String(), labelsUKBox+" London (UK) "+host) { |
| t.Fatalf("status --layout:\n%s", out.String()) |
| } |
| } |
diff --git a/region_labels_test.go b/region_labels_test.go| index 04d261c33..a96750b07 100644 |
| --- a/region_labels_test.go |
| +++ b/region_labels_test.go |
| @@ -14,13 +14,13 @@ import ( |
| func TestCleanPlaceRefusesWhatATerminalWouldObey(t *testing.T) { |
| t.Parallel() |
| for in, want := range map[string]string{ |
| - "London (uk)": "London (uk)", |
| - "Montréal (ca)": "Montréal (ca)", |
| + "London (UK)": "London (UK)", |
| + "Montréal (CA)": "Montréal (CA)", |
| "fleet private": "fleet private", |
| - "moving to Sydney (au)": "moving to Sydney (au)", |
| + "moving to Sydney (AU)": "moving to Sydney (AU)", |
| "": "", |
| "London\x1b[31m (uk)": "", |
| - "London (uk)\n": "", |
| + "London (UK)\n": "", |
| "London\u202e(ku)": "", |
| "\xff\xfe": "", |
| strings.Repeat("a", 129): "", |
| @@ -29,7 +29,7 @@ func TestCleanPlaceRefusesWhatATerminalWouldObey(t *testing.T) { |
| t.Errorf("cleanPlace(%q) = %q, want %q", in, got, want) |
| } |
| } |
| - if placeOr("London\x1b]0;x\x07", "uk") != "uk" || placeOr("London (uk)", "uk") != "London (uk)" || placeOr("", "uk") != "uk" { |
| + if placeOr("London\x1b]0;x\x07", "uk") != "uk" || placeOr("London (UK)", "uk") != "London (UK)" || placeOr("", "uk") != "uk" { |
| t.Fatal("placeOr must fall back on anything cleanPlace drops") |
| } |
| } |
| @@ -39,29 +39,29 @@ func TestCleanPlaceRefusesWhatATerminalWouldObey(t *testing.T) { |
| // region_name nil). |
| func TestAPITypesReadLabels(t *testing.T) { |
| var rec apiInstanceRecord |
| - json.Unmarshal([]byte(`{"host":"a.shop.example.com","region":"uk","region_name":"London (uk)","move_phrase":"moving to Sydney (au)","region_label":"London (uk)"}`), &rec) |
| - if rec.RegionName != "London (uk)" || rec.MovePhrase != "moving to Sydney (au)" || rec.RegionLabel != "London (uk)" { |
| + json.Unmarshal([]byte(`{"host":"a.shop.example.com","region":"uk","region_name":"London (UK)","move_phrase":"moving to Sydney (AU)","region_label":"London (UK)"}`), &rec) |
| + if rec.RegionName != "London (UK)" || rec.MovePhrase != "moving to Sydney (AU)" || rec.RegionLabel != "London (UK)" { |
| t.Fatalf("instance record = %+v", rec) |
| } |
| var life, old apiAppLife |
| - json.Unmarshal([]byte(`{"app":"shop","region":"ie","region_name":"Dublin (ie)"}`), &life) |
| + json.Unmarshal([]byte(`{"app":"shop","region":"ie","region_name":"Dublin (IE)"}`), &life) |
| json.Unmarshal([]byte(`{"app":"shop"}`), &old) |
| - if life.RegionName == nil || *life.RegionName != "Dublin (ie)" || life.Region != "ie" || old.RegionName != nil { |
| + if life.RegionName == nil || *life.RegionName != "Dublin (IE)" || life.Region != "ie" || old.RegionName != nil { |
| t.Fatalf("apps list rows = %+v / %+v", life, old) |
| } |
| var regions apiRegionsResult |
| - json.Unmarshal([]byte(`{"regions":[{"code":"uk","name":"UK · London","label":"London (uk)"},{"code":"au","name":"Australia · Sydney"}],"app_default":{"region":"ie","label":"Dublin (ie)"}}`), ®ions) |
| - if regions.labelOf("uk") != "London (uk)" || regions.labelOf("au") != "Australia · Sydney" || regions.labelOf("nz") != "nz" || regions.AppDefault.Label != "Dublin (ie)" { |
| + json.Unmarshal([]byte(`{"regions":[{"code":"uk","name":"UK · London","label":"London (UK)"},{"code":"au","name":"Australia · Sydney"}],"app_default":{"region":"ie","label":"Dublin (IE)"}}`), ®ions) |
| + if regions.labelOf("uk") != "London (UK)" || regions.labelOf("au") != "Australia · Sydney" || regions.labelOf("nz") != "nz" || regions.AppDefault.Label != "Dublin (IE)" { |
| t.Fatalf("regions = %+v", regions) |
| } |
| var off offlineView |
| - json.Unmarshal([]byte(`{"from":"ie","to":"uk","from_name":"Dublin (ie)","to_name":"London (uk)"}`), &off) |
| - if off.FromName != "Dublin (ie)" || off.ToName != "London (uk)" { |
| + json.Unmarshal([]byte(`{"from":"ie","to":"uk","from_name":"Dublin (IE)","to_name":"London (UK)"}`), &off) |
| + if off.FromName != "Dublin (IE)" || off.ToName != "London (UK)" { |
| t.Fatalf("offline view = %+v", off) |
| } |
| var ans moveAnswer |
| - json.Unmarshal([]byte(`{"target":"uk","target_name":"London (uk)","detail":{"from":"ie","from_name":"Dublin (ie)","to_name":"London (uk)"}}`), &ans) |
| - if ans.TargetName != "London (uk)" || ans.Detail.FromName != "Dublin (ie)" || ans.Detail.ToName != "London (uk)" { |
| + json.Unmarshal([]byte(`{"target":"uk","target_name":"London (UK)","detail":{"from":"ie","from_name":"Dublin (IE)","to_name":"London (UK)"}}`), &ans) |
| + if ans.TargetName != "London (UK)" || ans.Detail.FromName != "Dublin (IE)" || ans.Detail.ToName != "London (UK)" { |
| t.Fatalf("move answer = %+v", ans) |
| } |
| } |
| @@ -87,13 +87,13 @@ func TestListingsAgainstAnOlderConsole(t *testing.T) { |
| if got := routeRegionCell(apiRouteRow{Host: "www.shop.example.com"}); got != dashIfEmpty("") { |
| t.Fatalf("older console routes cell %q", got) |
| } |
| - if got := routeRegionCell(apiRouteRow{Region: "uk", RegionName: "London (uk)"}); got != "London (uk)" { |
| + if got := routeRegionCell(apiRouteRow{Region: "uk", RegionName: "London (UK)"}); got != "London (UK)" { |
| t.Fatalf("routes cell %q", got) |
| } |
| } |
| func TestInstancesListRegionCell(t *testing.T) { |
| - if got := instanceRegionCell(apiInstanceRecord{Region: "uk", RegionName: "London (uk)", MovePhrase: "moving to Sydney (au)"}); got != "London (uk), moving to Sydney (au)" { |
| + if got := instanceRegionCell(apiInstanceRecord{Region: "uk", RegionName: "London (UK)", MovePhrase: "moving to Sydney (AU)"}); got != "London (UK), moving to Sydney (AU)" { |
| t.Fatalf("cell %q", got) |
| } |
| } |
| @@ -107,10 +107,10 @@ func TestInstancesListDropsAnUnprintableLabel(t *testing.T) { |
| // TestAppsListLongLabel: Review Focus 5. |
| func TestAppsListLongLabel(t *testing.T) { |
| - name := "N. California (us-west)" |
| + name := "N. California (US-WEST)" |
| l := apiAppLife{App: "shop", Region: "us-west", RegionName: &name} |
| line := appLifeLine(l, time.Now(), true) |
| - if !strings.Contains(line, "N. California (us-west)") || !strings.HasPrefix(line, "shop ") { |
| + if !strings.Contains(line, "N. California (US-WEST)") || !strings.HasPrefix(line, "shop ") { |
| t.Fatalf("line %q", line) |
| } |
| empty := "" |
| @@ -123,7 +123,7 @@ func TestDeployWatchLinesSayWhere(t *testing.T) { |
| var b bytes.Buffer |
| rw := rolloutWatch{w: &b, ver: "v2"} |
| c := colorFor(&b) |
| - at := watchTarget{Host: "a.shop.example.com", Place: "London (uk)"} |
| + at := watchTarget{Host: "a.shop.example.com", Place: "London (UK)"} |
| for _, h := range []*watchedHost{ |
| {t: at, mode: modeURL}, |
| {t: at, state: rolloutSwapped}, |
| @@ -134,11 +134,11 @@ func TestDeployWatchLinesSayWhere(t *testing.T) { |
| rw.printHost(c, h) |
| } |
| for _, want := range []string{ |
| - "live https://a.shop.example.com in London (uk)\n", |
| - "swapped https://a.shop.example.com in London (uk)\n", |
| - "installed https://a.shop.example.com in London (uk) (", |
| - "failed https://a.shop.example.com in London (uk): ", |
| - "held https://a.shop.example.com in London (uk): ", |
| + "live https://a.shop.example.com in London (UK)\n", |
| + "swapped https://a.shop.example.com in London (UK)\n", |
| + "installed https://a.shop.example.com in London (UK) (", |
| + "failed https://a.shop.example.com in London (UK): ", |
| + "held https://a.shop.example.com in London (UK): ", |
| } { |
| if !strings.Contains(b.String(), want) { |
| t.Fatalf("watch output lacks %q:\n%s", want, b.String()) |
| @@ -150,23 +150,23 @@ func TestDeployWatchLinesSayWhere(t *testing.T) { |
| if b.String() != "live https://a.shop.example.com\n" { |
| t.Fatalf("older console: %q", b.String()) |
| } |
| - if p := hostPlaces([]apiInstanceRecord{{Host: "a.shop.example.com", Region: "uk", RegionName: "London (uk)"}, {Host: "b.shop.example.com", Region: "uk"}}); p["a.shop.example.com"] != "London (uk)" || p["b.shop.example.com"] != "" { |
| + if p := hostPlaces([]apiInstanceRecord{{Host: "a.shop.example.com", Region: "uk", RegionName: "London (UK)"}, {Host: "b.shop.example.com", Region: "uk"}}); p["a.shop.example.com"] != "London (UK)" || p["b.shop.example.com"] != "" { |
| t.Fatalf("hostPlaces = %v", p) |
| } |
| } |
| func TestDBSentencesNameTheLabel(t *testing.T) { |
| - labelled := dbdoor.Forward{Region: "uk", RegionName: "London (uk)"} |
| + labelled := dbdoor.Forward{Region: "uk", RegionName: "London (UK)"} |
| older := dbdoor.Forward{Region: "uk"} |
| hostile := dbdoor.Forward{Region: "uk", RegionName: "London\x1b[0m"} |
| unread := dbdoor.Forward{Region: "uk", RegionName: "uk"} // a labels console before its first edges read |
| - if fwdPlace(labelled) != "London (uk)" || fwdPlace(older) != "region uk" || fwdPlace(hostile) != "region uk" || fwdPlace(unread) != "region uk" { |
| + if fwdPlace(labelled) != "London (UK)" || fwdPlace(older) != "region uk" || fwdPlace(hostile) != "region uk" || fwdPlace(unread) != "region uk" { |
| t.Fatal("fwdPlace") |
| } |
| for _, c := range []struct{ got, want string }{ |
| - {fmt.Sprintf(dbfNotPicked, fwdPlace(labelled)), "no server in London (uk) started the read within 60 seconds. try again in a few minutes."}, |
| - {fmt.Sprintf(dbfReading, "a.shop.example.com", fwdPlace(labelled)), "reading a copy of a.shop.example.com's database in London (uk)."}, |
| - {fmt.Sprintf(dbfNoPull, "a.shop.example.com", fwdPlace(labelled)), "a.shop.example.com keeps its data in London (uk). carlos db pull cannot fetch a copy from there yet. carlos db query can read it."}, |
| + {fmt.Sprintf(dbfNotPicked, fwdPlace(labelled)), "no server in London (UK) started the read within 60 seconds. try again in a few minutes."}, |
| + {fmt.Sprintf(dbfReading, "a.shop.example.com", fwdPlace(labelled)), "reading a copy of a.shop.example.com's database in London (UK)."}, |
| + {fmt.Sprintf(dbfNoPull, "a.shop.example.com", fwdPlace(labelled)), "a.shop.example.com keeps its data in London (UK). carlos db pull cannot fetch a copy from there yet. carlos db query can read it."}, |
| // An older console: today's bytes. |
| {fmt.Sprintf(dbfNotPicked, fwdPlace(older)), "no server in region uk started the read within 60 seconds. try again in a few minutes."}, |
| {fmt.Sprintf(dbfUnchecked, fwdPlace(older)), "the answer from region uk was invalid, so carlos db printed nothing. try again."}, |
| @@ -178,14 +178,14 @@ func TestDBSentencesNameTheLabel(t *testing.T) { |
| } |
| func TestDBMovingLine(t *testing.T) { |
| - line, ok := dbMovingLine("a.shop.example.com", []byte(`{"error":"a.shop.example.com is moving between regions. read its database once the move has finished.","from_name":"London (uk)","to_name":"Dublin (ie)"}`)) |
| - if !ok || line != "a.shop.example.com is moving from London (uk) to Dublin (ie). read its database once the move has finished." { |
| + line, ok := dbMovingLine("a.shop.example.com", []byte(`{"error":"a.shop.example.com is moving between regions. read its database once the move has finished.","from_name":"London (UK)","to_name":"Dublin (IE)"}`)) |
| + if !ok || line != "a.shop.example.com is moving from London (UK) to Dublin (IE). read its database once the move has finished." { |
| t.Fatalf("%q %v", line, ok) |
| } |
| for _, body := range []string{ |
| `{"error":"a.shop.example.com is moving between regions. read its database once the move has finished."}`, // an older console: DBF-10 as sent |
| - `{"error":"x","from_name":"London (uk)"}`, // one side only |
| - `{"error":"x","from_name":"\u001b[2J","to_name":"Dublin (ie)"}`, // not fit to print |
| + `{"error":"x","from_name":"London (UK)"}`, // one side only |
| + `{"error":"x","from_name":"\u001b[2J","to_name":"Dublin (IE)"}`, // not fit to print |
| `not json`, |
| } { |
| if _, ok := dbMovingLine("a.shop.example.com", []byte(body)); ok { |
diff --git a/statuslive_regions_test.go b/statuslive_regions_test.go| index abed7fa47..b3a6bd4cf 100644 |
| --- a/statuslive_regions_test.go |
| +++ b/statuslive_regions_test.go |
| @@ -90,14 +90,14 @@ func TestStatusLiveWiring(t *testing.T) { |
| const warn = "region names could not be read" |
| one := bucket(true, "uk") |
| - if out := run(map[string]string{"CARLOS_DEPLOYMENT_BUCKET": "one"}, map[string]*liveBucket{"one": one}); !strings.Contains(out, "London (uk)") || |
| + if out := run(map[string]string{"CARLOS_DEPLOYMENT_BUCKET": "one"}, map[string]*liveBucket{"one": one}); !strings.Contains(out, "London (UK)") || |
| strings.Contains(out, warn) || !one.listedEdges() { |
| t.Fatalf("one bucket for both:\n%s", out) |
| } |
| st, dep := bucket(true), bucket(false, "uk") |
| if out := run(map[string]string{"CARLOS_STATUS_BUCKET": "st", "CARLOS_DEPLOYMENT_BUCKET": "dep"}, |
| - map[string]*liveBucket{"st": st, "dep": dep}); !strings.Contains(out, "London (uk)") || st.listedEdges() || !dep.listedEdges() { |
| + map[string]*liveBucket{"st": st, "dep": dep}); !strings.Contains(out, "London (UK)") || st.listedEdges() || !dep.listedEdges() { |
| t.Fatalf("stores apart: edges must come from the deployment store alone:\n%s", out) |
| } |
| @@ -109,7 +109,7 @@ func TestStatusLiveWiring(t *testing.T) { |
| bad := bucket(true, "uk", "bad") |
| if out := run(map[string]string{"CARLOS_DEPLOYMENT_BUCKET": "bad"}, map[string]*liveBucket{"bad": bad}); !strings.Contains(out, "London-ish") || |
| - strings.Contains(out, "London (uk)") || strings.Count(out, warn) != 1 { |
| + strings.Contains(out, "London (UK)") || strings.Count(out, warn) != 1 { |
| t.Fatalf("an incomplete edges read is not read:\n%s", out) |
| } |