carlos / platform Public

Console: one-level app tab bar with Errors, Availability and Analytics as tabs

Nine tabs, aria-current on the page's own tab, no lognav and no
Deployments sub-tab bar. deploymentsCopy.Title is Releases (NAV-C01).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev 8607e6df8046b4dc79268481f38cd467c88ec643 parent f5900e0
13 files changed, +115 −25
  • internal/console/appnav_test.go +72 −0
  • internal/console/approved_nav_copy_test.go +3 −1
  • internal/console/deployments.go +1 −1
  • internal/console/deployments_test.go +1 −1
  • internal/console/navsnapshot_test.go +34 −0
  • internal/console/server_test.go +1 −1
  • internal/console/templates/app_analytics.html +0 −1
  • internal/console/templates/app_availability.html +0 −1
  • internal/console/templates/app_deployments.html +0 −4
  • internal/console/templates/app_errors.html +0 −1
  • internal/console/templates/app_logs.html +0 −1
  • internal/console/templates/app_releases.html +0 −4
  • internal/console/templates/appnav.html +3 −9

CI failed — run details

diff --git a/internal/console/appnav_test.go b/internal/console/appnav_test.go
new file mode 100644
index 000000000..1124990c6
--- /dev/null
+++ b/internal/console/appnav_test.go
@@ -0,0 +1,72 @@
+package console
+
+import (
+ "reflect"
+ "regexp"
+ "strings"
+ "testing"
+)
+
+var tabLinkRE = regexp.MustCompile(`(?s)<a\b([^>]*)>(.*?)</a>`)
+
+// appTabLabels returns the text of every link in the app tab bar, in order,
+// and the one that carries aria-current="page". It fails the test unless
+// exactly one link is current.
+func appTabLabels(t *testing.T, body string) (labels []string, current string) {
+ t.Helper()
+ const open = `<nav class="tabs" aria-label="App sections">`
+ _, rest, ok := strings.Cut(body, open)
+ if !ok {
+ t.Fatalf("no %s in the page", open)
+ }
+ bar, _, ok := strings.Cut(rest, "</nav>")
+ if !ok {
+ t.Fatal("the app tab bar is never closed")
+ }
+ var currents []string
+ for _, m := range tabLinkRE.FindAllStringSubmatch(bar, -1) {
+ text := strings.TrimSpace(m[2])
+ labels = append(labels, text)
+ if strings.Contains(m[1], `aria-current="page"`) {
+ currents = append(currents, text)
+ }
+ }
+ if len(currents) != 1 {
+ t.Fatalf("%d tabs carry aria-current=page (%v), want exactly one", len(currents), currents)
+ }
+ return labels, currents[0]
+}
+
+func TestAppTabBarIsOneLevel(t *testing.T) {
+ fx := newConsoleFixture(t)
+ c := signInPaul(t, fx)
+ want := []string{"Overview", "Running", "Releases", "Logs", "Errors", "Availability", "Analytics", "Activity", "Settings"}
+ for path, current := range map[string]string{
+ "/apps/kass": "Overview", "/apps/kass/instances": "Running", "/apps/kass/releases": "Releases",
+ "/apps/kass/logs": "Logs", "/apps/kass/errors": "Errors", "/apps/kass/availability": "Availability",
+ "/apps/kass/analytics": "Analytics", "/apps/kass/activity": "Activity",
+ "/apps/kass/settings": "Settings", "/apps/kass/settings/domains": "Settings",
+ } {
+ status, _, body := get(t, c, fx.u(path))
+ if status != 200 {
+ t.Errorf("GET %s = %d, want 200", path, status)
+ continue
+ }
+ labels, cur := appTabLabels(t, body)
+ if !reflect.DeepEqual(labels, want) {
+ t.Errorf("%s: tabs = %v, want %v", path, labels, want)
+ }
+ if cur != current {
+ t.Errorf("%s: current tab = %q, want %q", path, cur, current)
+ }
+ if n := strings.Count(body, `class="tabs"`); n != 1 {
+ t.Errorf("%s: %d tab bars, want 1 (no sub-tab bar)", path, n)
+ }
+ if strings.Contains(body, `aria-label="Logs"`) {
+ t.Errorf("%s: the Logs sub-tab bar is still there", path)
+ }
+ if !strings.Contains(body, `/apps/kass/releases"`) {
+ t.Errorf("%s: no tab links /apps/kass/releases", path)
+ }
+ }
+}
diff --git a/internal/console/approved_nav_copy_test.go b/internal/console/approved_nav_copy_test.go
index d5f771fd7..bb150c771 100644
--- a/internal/console/approved_nav_copy_test.go
+++ b/internal/console/approved_nav_copy_test.go
@@ -22,7 +22,9 @@ const navCopyDeckPath = "../../docs/superpowers/plans/2026-10-25-console-ux-nav-
// task that writes a row's text adds its id here in the same commit, once the
// row is approved. From then on a "gate" row's new text must be in its file,
// and any other row's named test must exist.
-var navCopyBuilt = map[string]bool{}
+var navCopyBuilt = map[string]bool{
+ "NAV-C01": true, "NAV-C02": true, "NAV-C03": true, "NAV-C04": true,
+}
type navCopyRow struct{ ID, Where, Old, New, CheckedBy, Status string }
diff --git a/internal/console/deployments.go b/internal/console/deployments.go
index 973747de8..6621d2472 100644
--- a/internal/console/deployments.go
+++ b/internal/console/deployments.go
@@ -21,7 +21,7 @@ type deploymentObservedVersion struct {
type deploymentsCopyStrings struct{ Title, History, NoTarget, Instances, Target, Observed, NoChannels string }
var deploymentsCopy = deploymentsCopyStrings{
- Title: "Deployments",
+ Title: "Releases",
History: "Release history",
NoTarget: "No target published",
Instances: "View instances",
diff --git a/internal/console/deployments_test.go b/internal/console/deployments_test.go
index 5f816b21f..1a9d60143 100644
--- a/internal/console/deployments_test.go
+++ b/internal/console/deployments_test.go
@@ -42,7 +42,7 @@ func TestDeploymentRoutesAndHistory(t *testing.T) {
if status != 200 {
t.Fatalf("deployments status = %d", status)
}
- for _, want := range []string{`/apps/kass/releases#version-v1`, `/apps/kass/instances?channel=stable`, `/apps/kass/deployments" aria-current="page">`} {
+ for _, want := range []string{`/apps/kass/releases#version-v1`, `/apps/kass/instances?channel=stable`} {
if !strings.Contains(body, want) {
t.Errorf("deployments missing %q", want)
}
diff --git a/internal/console/navsnapshot_test.go b/internal/console/navsnapshot_test.go
new file mode 100644
index 000000000..90a5e6b09
--- /dev/null
+++ b/internal/console/navsnapshot_test.go
@@ -0,0 +1,34 @@
+package console
+
+import (
+ "os"
+ "path/filepath"
+ "testing"
+
+ "github.com/carlosframework/platform/internal/registry"
+)
+
+// TestNavSnapshots writes the HTML of the navigation screens to
+// $CONSOLE_SNAPSHOT_DIR so a headless browser can screenshot them. It skips
+// unless the variable is set; it asserts nothing about the pages.
+func TestNavSnapshots(t *testing.T) {
+ dir := os.Getenv("CONSOLE_SNAPSHOT_DIR")
+ if dir == "" {
+ t.Skip("CONSOLE_SNAPSHOT_DIR is not set")
+ }
+ fx := newConsoleFixture(t)
+ c := signInPaul(t, fx)
+ fx.addRoute(t, registry.Route{Host: "web-1.example.com", App: "kass", Account: fx.sqid, Kind: "instance", Status: "ready"})
+ for name, path := range map[string]string{
+ "overview": "/apps/kass", "running": "/apps/kass/instances", "releases": "/apps/kass/releases",
+ "logs": "/apps/kass/logs", "errors": "/apps/kass/errors", "availability": "/apps/kass/availability",
+ "analytics": "/apps/kass/analytics", "activity": "/apps/kass/activity",
+ "settings": "/apps/kass/settings", "placement": "/apps/kass/settings/placement",
+ "apps": "/", "trash": "/trash", "account-settings": "/settings",
+ } {
+ _, _, body := get(t, c, fx.u(path))
+ if err := os.WriteFile(filepath.Join(dir, name+".html"), []byte(body), 0o644); err != nil {
+ t.Fatal(err)
+ }
+ }
+}
diff --git a/internal/console/server_test.go b/internal/console/server_test.go
index 8dcb36e29..02d987a3e 100644
--- a/internal/console/server_test.go
+++ b/internal/console/server_test.go
@@ -602,7 +602,7 @@ func TestReleasesTab(t *testing.T) {
t.Fatalf("GET releases tab = %d", status)
}
for _, want := range []string{
- `/apps/kass/deployments" aria-current="page">`,
+ `/apps/kass/releases" aria-current="page">`,
"<h2>Channels</h2>", "<h2>Canaries</h2>", "All versions (",
} {
if !strings.Contains(body, want) {
diff --git a/internal/console/templates/app_analytics.html b/internal/console/templates/app_analytics.html
index e44adf352..87772e714 100644
--- a/internal/console/templates/app_analytics.html
+++ b/internal/console/templates/app_analytics.html
@@ -2,7 +2,6 @@
{{if .Flash}}<p class="banner">{{.Flash}}</p>{{end}}
{{if .FlashErr}}<p class="banner error">{{.FlashErr}}</p>{{end}}
{{template "appnav" .}}
-{{template "lognav" .}}
<h2 class="visually-hidden">Analytics</h2>
{{if .AnalyticsErr}}<p class="banner error">{{.AnalyticsErr}}</p>{{end}}
diff --git a/internal/console/templates/app_availability.html b/internal/console/templates/app_availability.html
index e5fd5ef47..2af05a0be 100644
--- a/internal/console/templates/app_availability.html
+++ b/internal/console/templates/app_availability.html
@@ -2,7 +2,6 @@
{{if .Flash}}<p class="banner">{{.Flash}}</p>{{end}}
{{if .FlashErr}}<p class="banner error">{{.FlashErr}}</p>{{end}}
{{template "appnav" .}}
-{{template "lognav" .}}
<h2 class="visually-hidden">Availability</h2>
{{if .ErrsErr}}<p class="banner error">{{.ErrsErr}}</p>{{end}}
diff --git a/internal/console/templates/app_deployments.html b/internal/console/templates/app_deployments.html
index 61cfebdfd..4890c6709 100644
--- a/internal/console/templates/app_deployments.html
+++ b/internal/console/templates/app_deployments.html
@@ -4,10 +4,6 @@
{{template "appnav" .}}
{{template "accountreviewbanner" .}}
<h2>{{.DeploymentsCopy.Title}}</h2>
-<nav class="tabs" aria-label="{{.DeploymentsCopy.Title}}">
- <a href="{{.Nav}}/apps/{{.AppName}}/deployments" aria-current="page">{{.DeploymentsCopy.Title}}</a>
- <a href="{{.Nav}}/apps/{{.AppName}}/releases">{{.DeploymentsCopy.History}}</a>
-</nav>
{{if .DeploymentTargets}}
<div class="tablewrap">
<table>
diff --git a/internal/console/templates/app_errors.html b/internal/console/templates/app_errors.html
index 0525cd51a..97552ece3 100644
--- a/internal/console/templates/app_errors.html
+++ b/internal/console/templates/app_errors.html
@@ -2,7 +2,6 @@
{{if .Flash}}<p class="banner">{{.Flash}}</p>{{end}}
{{if .FlashErr}}<p class="banner error">{{.FlashErr}}</p>{{end}}
{{template "appnav" .}}
-{{template "lognav" .}}
<h2 class="visually-hidden">Errors</h2>
{{if .ErrsErr}}<p class="banner error">{{.ErrsErr}}</p>{{end}}
diff --git a/internal/console/templates/app_logs.html b/internal/console/templates/app_logs.html
index 6ef6e785f..6196d18b8 100644
--- a/internal/console/templates/app_logs.html
+++ b/internal/console/templates/app_logs.html
@@ -2,7 +2,6 @@
{{if .Flash}}<p class="banner">{{.Flash}}</p>{{end}}
{{if .FlashErr}}<p class="banner error">{{.FlashErr}}</p>{{end}}
{{template "appnav" .}}
-{{template "lognav" .}}
<h2 class="visually-hidden">Logs</h2>
{{if .LogsErr}}<p class="banner error">{{.LogsErr}}</p>{{end}}
diff --git a/internal/console/templates/app_releases.html b/internal/console/templates/app_releases.html
index 78febd318..8feb655a2 100644
--- a/internal/console/templates/app_releases.html
+++ b/internal/console/templates/app_releases.html
@@ -2,10 +2,6 @@
{{if .Flash}}<p class="banner">{{.Flash}}</p>{{end}}
{{if .FlashErr}}<p class="banner error">{{.FlashErr}}</p>{{end}}
{{template "appnav" .}}
-<nav class="tabs" aria-label="{{.DeploymentsCopy.Title}}">
- <a href="{{.Nav}}/apps/{{.AppName}}/deployments">{{.DeploymentsCopy.Title}}</a>
- <a href="{{.Nav}}/apps/{{.AppName}}/releases" aria-current="page">{{.DeploymentsCopy.History}}</a>
-</nav>
<h2>{{.DeploymentsCopy.History}}</h2>
{{template "accountreviewbanner" .}}
diff --git a/internal/console/templates/appnav.html b/internal/console/templates/appnav.html
index c8e5be222..bab728e31 100644
--- a/internal/console/templates/appnav.html
+++ b/internal/console/templates/appnav.html
@@ -13,18 +13,12 @@
<nav class="tabs" aria-label="App sections">
<a href="{{.Nav}}/apps/{{.AppName}}"{{if eq .ActiveTab "overview"}} aria-current="page"{{end}}>Overview</a>
<a href="{{.Nav}}/apps/{{.AppName}}/instances"{{if eq .ActiveTab "instances"}} aria-current="page"{{end}}>Running</a>
- <a href="{{.Nav}}/apps/{{.AppName}}/deployments"{{if eq .ActiveTab "releases"}} aria-current="page"{{end}}>{{.DeploymentsCopy.Title}}</a>
- <a href="{{.Nav}}/apps/{{.AppName}}/logs"{{if or (eq .ActiveTab "logs") (eq .ActiveTab "errors") (eq .ActiveTab "availability") (eq .ActiveTab "analytics")}} aria-current="page"{{end}}>Logs</a>
- <a href="{{.Nav}}/apps/{{.AppName}}/activity"{{if eq .ActiveTab "activity"}} aria-current="page"{{end}}>Activity</a>
- <a href="{{.Nav}}/apps/{{.AppName}}/settings"{{if eq .ActiveTab "settings"}} aria-current="page"{{end}}>Settings</a>
-</nav>
-{{end}}
-
-{{define "lognav"}}
-<nav class="tabs" aria-label="Logs">
+ <a href="{{.Nav}}/apps/{{.AppName}}/releases"{{if eq .ActiveTab "releases"}} aria-current="page"{{end}}>{{.DeploymentsCopy.Title}}</a>
<a href="{{.Nav}}/apps/{{.AppName}}/logs"{{if eq .ActiveTab "logs"}} aria-current="page"{{end}}>Logs</a>
<a href="{{.Nav}}/apps/{{.AppName}}/errors"{{if eq .ActiveTab "errors"}} aria-current="page"{{end}}>Errors</a>
<a href="{{.Nav}}/apps/{{.AppName}}/availability"{{if eq .ActiveTab "availability"}} aria-current="page"{{end}}>Availability</a>
<a href="{{.Nav}}/apps/{{.AppName}}/analytics"{{if eq .ActiveTab "analytics"}} aria-current="page"{{end}}>Analytics</a>
+ <a href="{{.Nav}}/apps/{{.AppName}}/activity"{{if eq .ActiveTab "activity"}} aria-current="page"{{end}}>Activity</a>
+ <a href="{{.Nav}}/apps/{{.AppName}}/settings"{{if eq .ActiveTab "settings"}} aria-current="page"{{end}}>Settings</a>
</nav>
{{end}}