Console: settings sidebar gains Placement and Errors and analytics; Advanced folds into General
The settings sidebar runs General, Domains, Placement, Release pipeline, Environments, Storage, Email, Feature flags, Errors and analytics, Delete. The Errors and Analytics forms move from General to the new /settings/errors-analytics section, and both app-level POSTs send every success and refusal back there; the account-level handlers are unchanged. The Control plane card moves from Advanced to the end of General, and the control-plane refusal and both control-plane POSTs point at /settings. Old URLs answer 303 through appRedirect, after accountApp's gates: GET /settings/advanced to /settings, GET /pipeline to /settings/pipeline (handlePipelineSettings is gone; POST /pipeline is unchanged). The Errors and Analytics tab hints link the new section. NAV-C41 to C44 built. The perf walk expects 303 on /pipeline and /settings/advanced and walks /settings/errors-analytics; the stale /pipeline over record is dropped. Claim probe and fixture follow the /pipeline redirect.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
18 files changed,
+220
−76
internal/console/analyticsview.go+1 −1internal/console/apianalytics_test.go+2 −2internal/console/approved_nav_copy_test.go+1 −0internal/console/appsettings.go+10 −10internal/console/appsettings_sections_test.go+147 −12internal/console/claim_invariant_fixtures_test.go+1 −1internal/console/claim_invariant_probes_read_test.go+2 −2internal/console/controlplane.go+3 −3internal/console/controlplane_test.go+9 −9internal/console/errorsview.go+1 −1internal/console/perfwalk_test.go+7 −1internal/console/pipelinepage.go+7 −13internal/console/pipelinepage_test.go+2 −2internal/console/server.go+18 −11internal/console/templates/app_analytics.html+3 −2internal/console/templates/app_errors.html+1 −1internal/console/templates/app_settings.html+4 −3internal/console/testdata/perf-budgets.txt+1 −2
diff --git a/internal/console/analyticsview.go b/internal/console/analyticsview.go| index bfa5dc753..0718060a0 100644 |
| --- a/internal/console/analyticsview.go |
| +++ b/internal/console/analyticsview.go |
| @@ -96,7 +96,7 @@ func (s *Server) handleAppAnalyticsSetting(w http.ResponseWriter, r *http.Reques |
| return |
| } |
| count, door, bad := analyticsFormValues(r) |
| - back := appSettingsURL(acct.Sqid, app, "general") |
| + back := appSettingsURL(acct.Sqid, app, "errors-analytics") |
| // The setting lives in the deployment bucket, so a console without one |
| // has nowhere to put it — refused before the write rather than panicking |
| // inside it, exactly as the errors level is. |
diff --git a/internal/console/apianalytics_test.go b/internal/console/apianalytics_test.go| index 4c4831835..119e8ecfa 100644 |
| --- a/internal/console/apianalytics_test.go |
| +++ b/internal/console/apianalytics_test.go |
| @@ -75,7 +75,7 @@ func TestSettingsPagesShowAnalyticsSwitch(t *testing.T) { |
| fx.setUser("paul@keymail.dev") |
| c := newBrowser(t) |
| signUp(t, fx, c, "code-analytics-signin") |
| - status, _, body := get(t, c, fx.u("/apps/titogo/settings")) |
| + status, _, body := get(t, c, fx.u("/apps/titogo/settings/errors-analytics")) |
| if status != 200 || !strings.Contains(body, "analytics/setting") || !strings.Contains(body, "currently off, from the default") { |
| t.Fatalf("app settings: %d", status) |
| } |
| @@ -84,7 +84,7 @@ func TestSettingsPagesShowAnalyticsSwitch(t *testing.T) { |
| if status != 303 { |
| t.Fatalf("account switch: %d", status) |
| } |
| - _, _, body = get(t, c, fx.u("/apps/titogo/settings")) |
| + _, _, body = get(t, c, fx.u("/apps/titogo/settings/errors-analytics")) |
| if !strings.Contains(body, "currently edge, from the account") { |
| t.Fatal("inheritance not shown") |
| } |
diff --git a/internal/console/approved_nav_copy_test.go b/internal/console/approved_nav_copy_test.go| index 54fec1cf3..672af0592 100644 |
| --- a/internal/console/approved_nav_copy_test.go |
| +++ b/internal/console/approved_nav_copy_test.go |
| @@ -29,6 +29,7 @@ var navCopyBuilt = map[string]bool{ |
| "NAV-C29": true, "NAV-C30": true, "NAV-C31": true, "NAV-C32": true, |
| "NAV-C33": true, "NAV-C34": true, "NAV-C35": true, "NAV-C36": true, |
| "NAV-C37": true, "NAV-C38": true, "NAV-C39": true, "NAV-C40": true, |
| + "NAV-C41": true, "NAV-C42": true, "NAV-C43": true, "NAV-C44": true, |
| "NAV-C45": true, |
| "NAV-C10": true, "NAV-C11": true, "NAV-C12": true, "NAV-C13": true, |
| "NAV-C14": true, "NAV-C15": true, "NAV-C16": true, |
diff --git a/internal/console/appsettings.go b/internal/console/appsettings.go| index f40993a3b..a6600341c 100644 |
| --- a/internal/console/appsettings.go |
| +++ b/internal/console/appsettings.go |
| @@ -54,16 +54,16 @@ import ( |
| // this server-side means a typo gets the same 404 as any other unknown app |
| // page, rather than rendering an empty settings shell. |
| var appSettingsSections = map[string]bool{ |
| - "general": true, |
| - "domains": true, |
| - "placement": true, |
| - "pipeline": true, |
| - "environments": true, |
| - "storage": true, |
| - "email": true, |
| - "features": true, |
| - "advanced": true, |
| - "delete": true, |
| + "general": true, |
| + "domains": true, |
| + "placement": true, |
| + "pipeline": true, |
| + "environments": true, |
| + "storage": true, |
| + "email": true, |
| + "features": true, |
| + "errors-analytics": true, |
| + "delete": true, |
| } |
| func appSettingsURL(acct, app, section string) string { |
diff --git a/internal/console/appsettings_sections_test.go b/internal/console/appsettings_sections_test.go| index b7808c511..01ee7877b 100644 |
| --- a/internal/console/appsettings_sections_test.go |
| +++ b/internal/console/appsettings_sections_test.go |
| @@ -4,6 +4,7 @@ import ( |
| "bytes" |
| "net/http" |
| "net/url" |
| + "regexp" |
| "strings" |
| "testing" |
| ) |
| @@ -13,21 +14,25 @@ func TestAppSettingsSectionRoutes(t *testing.T) { |
| c := newBrowser(t) |
| signUp(t, fx, c, "code-settings-sections-browser") |
| - for _, section := range []string{"general", "domains", "placement", "storage", "email", "features", "advanced", "delete"} { |
| + for _, section := range []string{"general", "domains", "placement", "environments", "storage", "email", |
| + "features", "errors-analytics", "delete", "pipeline"} { |
| status, _, body := get(t, c, fx.u("/apps/titogo/settings/"+section)) |
| if status != http.StatusOK { |
| t.Errorf("GET settings/%s = %d, want 200: %s", section, status, body) |
| } |
| } |
| _, _, general := get(t, c, fx.u("/apps/titogo/settings")) |
| - for _, want := range []string{ |
| - `aria-label="Settings sections"`, ">General</a>", ">Domains</a>", ">Placement</a>", |
| - ">Release pipeline</a>", ">Storage</a>", ">Email</a>", |
| - ">Feature flags</a>", ">Advanced</a>", ">Delete</a>", |
| - } { |
| - if !strings.Contains(general, want) { |
| - t.Errorf("Settings navigation missing %q", want) |
| - } |
| + if !strings.Contains(general, `aria-label="Settings sections"`) { |
| + t.Fatal("Settings navigation missing") |
| + } |
| + got := settingsNavLabels(t, general) |
| + want := []string{"General", "Domains", "Placement", "Release pipeline", "Environments", "Storage", |
| + "Email", "Feature flags", "Errors and analytics", "Delete"} |
| + if strings.Join(got, "|") != strings.Join(want, "|") { |
| + t.Fatalf("Settings navigation = %q, want %q", got, want) |
| + } |
| + if strings.Contains(general, ">Advanced</a>") { |
| + t.Fatal("Settings navigation still offers Advanced") |
| } |
| if strings.Contains(general, "Domains & TLS") { |
| t.Fatal("General still renders the Domains section") |
| @@ -40,9 +45,138 @@ func TestAppSettingsSectionRoutes(t *testing.T) { |
| if status != http.StatusNotFound { |
| t.Errorf("GET unknown settings section = %d, want 404", status) |
| } |
| + // Advanced folded into General; its old URL answers with a redirect. |
| + status, loc, _ := get(t, c, fx.u("/apps/titogo/settings/advanced")) |
| + if status != http.StatusSeeOther || loc != fx.path("/apps/titogo/settings") { |
| + t.Errorf("GET settings/advanced = %d -> %q, want 303 to %q", status, loc, fx.path("/apps/titogo/settings")) |
| + } |
| + assertNonMember404(t, fx, "/apps/titogo/settings/advanced") |
| assertNonMember404(t, fx, "/apps/titogo/settings/domains") |
| } |
| +// settingsNavLabels is the link texts of the settings sidebar, in order. |
| +func settingsNavLabels(t *testing.T, body string) []string { |
| + t.Helper() |
| + i := strings.Index(body, `<nav class="settings-nav"`) |
| + if i < 0 { |
| + t.Fatal("no settings sidebar") |
| + } |
| + nav := body[i:] |
| + j := strings.Index(nav, "</nav>") |
| + if j < 0 { |
| + t.Fatal("settings sidebar is not closed") |
| + } |
| + var labels []string |
| + for _, m := range regexp.MustCompile(`>([^<]+)</a>`).FindAllStringSubmatch(nav[:j], -1) { |
| + labels = append(labels, m[1]) |
| + } |
| + return labels |
| +} |
| + |
| +func TestErrorsAndAnalyticsSection(t *testing.T) { |
| + fx, _ := instanceFixture(t, "code-settings-telemetry") |
| + fx.setUser("paul@keymail.dev") |
| + c := newBrowser(t) |
| + signUp(t, fx, c, "code-settings-telemetry-browser") |
| + |
| + _, _, general := get(t, c, fx.u("/apps/titogo/settings")) |
| + for _, gone := range []string{`/apps/titogo/errors/level"`, `/apps/titogo/analytics/setting"`} { |
| + if strings.Contains(general, gone) { |
| + t.Errorf("General still carries the form posting to %s", gone) |
| + } |
| + } |
| + if !strings.Contains(general, `/apps/titogo/control-plane/set"`) { |
| + t.Error("General does not carry the control-plane card Advanced used to") |
| + } |
| + status, _, section := get(t, c, fx.u("/apps/titogo/settings/errors-analytics")) |
| + if status != http.StatusOK { |
| + t.Fatalf("GET settings/errors-analytics = %d", status) |
| + } |
| + for _, want := range []string{`/apps/titogo/errors/level"`, `/apps/titogo/analytics/setting"`, |
| + "<h2>Errors</h2>", "<h2>Analytics</h2>", `aria-current="page">Errors and analytics</a>`} { |
| + if !strings.Contains(section, want) { |
| + t.Errorf("Errors and analytics section missing %q", want) |
| + } |
| + } |
| +} |
| + |
| +func TestTelemetrySavesReturnToTheirSection(t *testing.T) { |
| + fx, _ := instanceFixture(t, "code-settings-telemetry-save") |
| + fx.setUser("paul@keymail.dev") |
| + c := newBrowser(t) |
| + signUp(t, fx, c, "code-settings-telemetry-save-browser") |
| + csrf := sessionToken(t, fx, c) |
| + back := fx.path("/apps/titogo/settings/errors-analytics") |
| + |
| + for _, tc := range []struct { |
| + door string |
| + form url.Values |
| + flash string |
| + }{ |
| + {"/apps/titogo/errors/level", url.Values{"level": {"warn"}}, "Errors now include warn lines and above for this app."}, |
| + {"/apps/titogo/errors/level", url.Values{"level": {"bogus"}}, "Choose error or warn."}, |
| + {"/apps/titogo/analytics/setting", url.Values{"count": {"edge"}, "door": {"on"}}, |
| + "Analytics counting is now edge and the browser door on for this app."}, |
| + {"/apps/titogo/analytics/setting", url.Values{"count": {"bogus"}}, "Choose edge or off for counting."}, |
| + } { |
| + tc.form.Set("csrf", csrf) |
| + status, loc, body := postForm(t, c, fx.u(tc.door), tc.form) |
| + if status != http.StatusSeeOther || loc != back { |
| + t.Errorf("POST %s %v = %d -> %q, want 303 to %q: %s", tc.door, tc.form, status, loc, back, body) |
| + continue |
| + } |
| + _, _, page := get(t, c, fx.ts.URL+loc) |
| + if !strings.Contains(page, tc.flash) { |
| + t.Errorf("POST %s %v: the section does not show %q", tc.door, tc.form, tc.flash) |
| + } |
| + } |
| + |
| + // A member meets the owner gate's byte-identical 404 on both doors, |
| + // exactly as on an account that does not exist. |
| + fx.setUser("alice@keymail.dev") |
| + m := newBrowser(t) |
| + signUp(t, fx, m, "code-settings-telemetry-save-member") |
| + mcsrf := sessionToken(t, fx, m) |
| + for _, door := range []string{"/apps/titogo/errors/level", "/apps/titogo/analytics/setting"} { |
| + form := url.Values{"csrf": {mcsrf}, "level": {"warn"}, "count": {"edge"}} |
| + s1, l1, b1 := postForm(t, m, fx.u(door), form) |
| + s2, _, b2 := postForm(t, m, fx.ts.URL+"/a/zzzzzzzz"+door, form) |
| + if s1 != http.StatusNotFound || l1 != "" || s2 != http.StatusNotFound || b1 != b2 { |
| + t.Errorf("member POST %s = %d -> %q, unknown account = %d, identical = %v; want the byte-identical 404", |
| + door, s1, l1, s2, b1 == b2) |
| + } |
| + } |
| +} |
| + |
| +func TestTelemetryHintsLinkTheSection(t *testing.T) { |
| + fx, _ := instanceFixture(t, "code-settings-telemetry-hints") |
| + c := newBrowser(t) |
| + signUp(t, fx, c, "code-settings-telemetry-hints-browser") |
| + const section = `/apps/titogo/settings/errors-analytics"` |
| + |
| + _, _, errs := get(t, c, fx.u("/apps/titogo/errors")) |
| + if !strings.Contains(errs, "The level is set in <a href=") || |
| + !strings.Contains(errs, section+">Settings, under Errors and analytics</a>.") { |
| + t.Errorf("Errors tab hint does not link the Errors and analytics section:\n%s", errs) |
| + } |
| + |
| + _, _, an := get(t, c, fx.u("/apps/titogo/analytics")) |
| + i := strings.Index(an, "Turn it on for this app in ") |
| + if i < 0 { |
| + t.Fatalf("Analytics tab (off) has no hint:\n%s", an) |
| + } |
| + hint, _, _ := strings.Cut(an[i:], "</p>") |
| + for _, want := range []string{section + ">Settings, under Errors and analytics</a>", |
| + "or for the whole account in the account's <a href=", `/settings">Settings</a>.`} { |
| + if !strings.Contains(hint, want) { |
| + t.Errorf("Analytics tab hint missing %q: %s", want, hint) |
| + } |
| + } |
| + if strings.Contains(hint, `/apps/titogo/settings">`) { |
| + t.Errorf("Analytics tab hint still links the app's General settings: %s", hint) |
| + } |
| +} |
| + |
| func TestAppSettingsURL(t *testing.T) { |
| if got := appSettingsURL("a b", "an/app", "general"); got != "/a/a%20b/apps/an%2Fapp/settings" { |
| t.Errorf("general URL = %q", got) |
| @@ -61,9 +195,9 @@ func TestPipelineSettingsCanonicalSectionURL(t *testing.T) { |
| if status != http.StatusOK || !strings.Contains(body, "Release pipeline") { |
| t.Fatalf("GET settings/pipeline = %d: %s", status, body) |
| } |
| - status, _, body = get(t, c, fx.u("/apps/titogo/pipeline")) |
| - if status != http.StatusOK || !strings.Contains(body, "Release pipeline") { |
| - t.Fatalf("legacy GET pipeline = %d: %s", status, body) |
| + status, loc, _ := get(t, c, fx.u("/apps/titogo/pipeline")) |
| + if status != http.StatusSeeOther || loc != fx.path("/apps/titogo/settings/pipeline") { |
| + t.Fatalf("legacy GET pipeline = %d -> %q, want 303 to the settings section", status, loc) |
| } |
| csrf := sessionToken(t, fx, c) |
| status, _, body = postForm(t, c, fx.u("/apps/titogo/pipeline"), url.Values{ |
| @@ -73,6 +207,7 @@ func TestPipelineSettingsCanonicalSectionURL(t *testing.T) { |
| !strings.Contains(body, `aria-current="page">Release pipeline</a>`) { |
| t.Fatalf("pipeline draft rerender lost Settings navigation = %d: %s", status, body) |
| } |
| + assertNonMember404(t, fx, "/apps/titogo/pipeline") |
| } |
| func TestSettingsValidationRetainsTypedValues(t *testing.T) { |
diff --git a/internal/console/claim_invariant_fixtures_test.go b/internal/console/claim_invariant_fixtures_test.go| index ac44f0d3e..4440127fb 100644 |
| --- a/internal/console/claim_invariant_fixtures_test.go |
| +++ b/internal/console/claim_invariant_fixtures_test.go |
| @@ -796,7 +796,7 @@ var claimFixtures = map[string]claimFixture{ |
| "route GET /a/{sqid}/apps/{app}/instances/{host}": claimRead("renders one instance and polls its report over HTTP"), |
| "route GET /a/{sqid}/apps/{app}/logs": claimRead("renders the logs page"), |
| "route GET /a/{sqid}/apps/{app}/logs/data": claimRead("returns log chunks as JSON"), |
| - "route GET /a/{sqid}/apps/{app}/pipeline": claimRead("renders the pipeline form"), |
| + "route GET /a/{sqid}/apps/{app}/pipeline": claimRead("redirects to the pipeline settings section"), |
| "route GET /a/{sqid}/apps/{app}/releases": claimRead("renders releases"), |
| "route GET /a/{sqid}/apps/{app}/settings": claimRead("renders app settings"), |
| "route GET /a/{sqid}/apps/{app}/settings/{section}": claimRead("renders one app settings section"), |
diff --git a/internal/console/claim_invariant_probes_read_test.go b/internal/console/claim_invariant_probes_read_test.go| index 2f2ff20a1..fb54dfd1b 100644 |
| --- a/internal/console/claim_invariant_probes_read_test.go |
| +++ b/internal/console/claim_invariant_probes_read_test.go |
| @@ -139,10 +139,10 @@ var claimReadProbes = map[string]claimProbe{ |
| "route GET /a/{sqid}/apps/{app}/instances/{host}": claimPageRead(nil, "/a/bab/apps/kass/instances/kass.carlosapp.dev", "kass.carlosapp.dev"), |
| "route GET /a/{sqid}/apps/{app}/logs": claimPageRead(nil, "/a/bab/apps/titogo/logs", "titogo"), |
| "route GET /a/{sqid}/apps/{app}/logs/data": claimPageRead(nil, "/a/bab/apps/titogo/logs/data", `"lines"`), |
| - "route GET /a/{sqid}/apps/{app}/pipeline": claimPageRead(nil, "/a/bab/apps/titogo/pipeline", "titogo"), |
| + "route GET /a/{sqid}/apps/{app}/pipeline": claimRedirectRead("/a/bab/apps/titogo/pipeline", http.StatusSeeOther, "/a/bab/apps/titogo/settings/pipeline"), |
| "route GET /a/{sqid}/apps/{app}/releases": claimPageRead(nil, "/a/bab/apps/kass/releases", "v1"), |
| "route GET /a/{sqid}/apps/{app}/settings": claimPageRead(nil, "/a/bab/apps/titogo/settings", "titogo"), |
| - "route GET /a/{sqid}/apps/{app}/settings/{section}": claimPageRead(nil, "/a/bab/apps/titogo/settings/advanced", |
| + "route GET /a/{sqid}/apps/{app}/settings/{section}": claimPageRead(nil, "/a/bab/apps/titogo/settings/general", |
| "/apps/titogo/control-plane/set"), |
| "route GET /a/{sqid}/fleet": claimPageRead(claimWorldFleet, "/a/bab/fleet", "pi"), |
| "route GET /a/{sqid}/fleet/byo": claimPageRead(nil, "/a/bab/fleet/byo", "<h1>Bring your own fleet</h1>"), |
diff --git a/internal/console/controlplane.go b/internal/console/controlplane.go| index 52a3f7faa..f2fcb3f31 100644 |
| --- a/internal/console/controlplane.go |
| +++ b/internal/console/controlplane.go |
| @@ -78,7 +78,7 @@ func (s *Server) controlPlaneRefusal(acct *Account, app, verb string) (msg strin |
| // caller has no page to be already looking at, and a browser flash pointing at |
| // an absolute URL costs nothing. |
| func (s *Server) appSettingsURL(acct *Account, app string) string { |
| - return s.cfg.Origin + appSettingsURL(acct.Sqid, app, "advanced") |
| + return s.cfg.Origin + appSettingsURL(acct.Sqid, app, "general") |
| } |
| // refuseControlPlane is controlPlaneRefusal for the JSON doors: it writes the |
| @@ -220,7 +220,7 @@ func (s *Server) handleAppControlPlaneClear(w http.ResponseWriter, r *http.Reque |
| } |
| back := func(kind, msg string) { |
| s.setFlash(w, kind, msg) |
| - http.Redirect(w, r, appSettingsURL(acct.Sqid, app, "advanced"), http.StatusSeeOther) |
| + http.Redirect(w, r, appSettingsURL(acct.Sqid, app, "general"), http.StatusSeeOther) |
| } |
| // Fail CLOSED on an unreadable row, like every other reader of this flag: |
| // clearing what may already be clear is harmless, but a lookup error here |
| @@ -277,7 +277,7 @@ func (s *Server) handleAppControlPlaneSet(w http.ResponseWriter, r *http.Request |
| } |
| back := func(kind, msg string) { |
| s.setFlash(w, kind, msg) |
| - http.Redirect(w, r, appSettingsURL(acct.Sqid, app, "advanced"), http.StatusSeeOther) |
| + http.Redirect(w, r, appSettingsURL(acct.Sqid, app, "general"), http.StatusSeeOther) |
| } |
| defer s.lockApp(acct.Sqid, app)() |
| if msg, _ := s.temporaryRefusal(acct, app, "mark it as the control plane"); msg != "" { |
diff --git a/internal/console/controlplane_test.go b/internal/console/controlplane_test.go| index 024167233..08cf6b77e 100644 |
| --- a/internal/console/controlplane_test.go |
| +++ b/internal/console/controlplane_test.go |
| @@ -55,7 +55,7 @@ func TestControlPlaneAppRefusesTrash(t *testing.T) { |
| // And WHERE to clear it. A CLI caller has no page in front of them, so a |
| // refusal that names the flag without naming the card strands exactly the |
| // operator it just stopped. |
| - if !strings.Contains(msg, "/a/bab/apps/console/settings/advanced") { |
| + if !strings.Contains(msg, "/a/bab/apps/console/settings)") { |
| t.Fatalf("refusal %q does not point at the settings card that can clear the flag", msg) |
| } |
| present, err := fx.st.HasAppIn(OpsAccountID, "console") |
| @@ -343,7 +343,7 @@ func TestOwnerClearsTheControlPlaneFlag(t *testing.T) { |
| csrf := sessionToken(t, fx, c) |
| // The page has to OFFER it, or the door might as well not exist. |
| - if _, _, page := get(t, c, fx.u("/apps/console/settings/advanced")); !strings.Contains(page, "/apps/console/control-plane/clear") { |
| + if _, _, page := get(t, c, fx.u("/apps/console/settings")); !strings.Contains(page, "/apps/console/control-plane/clear") { |
| t.Fatalf("the settings page offers no way to clear the flag:\n%s", page) |
| } |
| status, loc, body := postGated(t, fx, c, fx.u("/apps/console/control-plane/clear"), |
| @@ -356,7 +356,7 @@ func TestOwnerClearsTheControlPlaneFlag(t *testing.T) { |
| t.Fatalf("AppFlags after a confirmed clear = %v %v, want false", cp, err) |
| } |
| // The card is state-driven: with the flag gone, so is the button. |
| - if _, _, page := get(t, c, fx.u("/apps/console/settings/advanced")); strings.Contains(page, "/apps/console/control-plane/clear") { |
| + if _, _, page := get(t, c, fx.u("/apps/console/settings")); strings.Contains(page, "/apps/console/control-plane/clear") { |
| t.Fatalf("the clear form is still offered on an app that is no longer flagged:\n%s", page) |
| } |
| // And the verb that was refused now works — the whole point of the door. |
| @@ -439,7 +439,7 @@ func TestOwnerSetsTheControlPlaneFlagWithoutAPasskey(t *testing.T) { |
| c := signInPaul(t, fx) |
| csrf := sessionToken(t, fx, c) |
| - if _, _, page := get(t, c, fx.u("/apps/titogo/settings/advanced")); !strings.Contains(page, "/apps/titogo/control-plane/set") { |
| + if _, _, page := get(t, c, fx.u("/apps/titogo/settings")); !strings.Contains(page, "/apps/titogo/control-plane/set") { |
| t.Fatalf("the settings page offers no way to set the flag:\n%s", page) |
| } |
| status, loc, body := postForm(t, c, fx.u("/apps/titogo/control-plane/set"), |
| @@ -447,7 +447,7 @@ func TestOwnerSetsTheControlPlaneFlagWithoutAPasskey(t *testing.T) { |
| if status != http.StatusSeeOther { |
| t.Fatalf("set the flag = %d -> %q:\n%s", status, loc, body) |
| } |
| - if loc != fx.path("/apps/titogo/settings/advanced") { |
| + if loc != fx.path("/apps/titogo/settings") { |
| t.Fatalf("set redirected to %q, want the settings tab — a Keymail redirect means setting grew a passkey it must not have", loc) |
| } |
| if cp, _, err := fx.st.AppFlags(OpsAccountID, "titogo"); err != nil || !cp { |
| @@ -492,7 +492,7 @@ func TestMemberCannotSetTheControlPlaneFlag(t *testing.T) { |
| signUp(t, fx, owner, "code-cp-set-owner-probe") |
| status, loc, _ = postForm(t, owner, fx.u("/apps/titogo/control-plane/set"), |
| url.Values{"csrf": {sessionToken(t, fx, owner)}}) |
| - if status != http.StatusSeeOther || loc != fx.path("/apps/titogo/settings/advanced") { |
| + if status != http.StatusSeeOther || loc != fx.path("/apps/titogo/settings") { |
| t.Fatalf("the OWNER on the same URL = %d -> %q, want the handler's redirect — the member's 404 may just be a missing route", status, loc) |
| } |
| if cp, _, err := fx.st.AppFlags(OpsAccountID, "titogo"); err != nil || !cp { |
| @@ -925,7 +925,7 @@ func TestControlPlaneAppRefusesInstanceDelete(t *testing.T) { |
| if !strings.Contains(out, "control plane") { |
| t.Fatalf("refusal %q does not name the flag the operator has to clear", out) |
| } |
| - if !strings.Contains(out, "/a/bab/apps/console/settings/advanced") { |
| + if !strings.Contains(out, "/a/bab/apps/console/settings)") { |
| t.Fatalf("refusal %q does not point at the settings card that can clear the flag", out) |
| } |
| // The record survived. This is the assertion the door exists for: the |
| @@ -1132,7 +1132,7 @@ func TestControlPlaneAppRefusesDomainDetach(t *testing.T) { |
| if !strings.Contains(out, "control plane") { |
| t.Fatalf("refusal %q does not name the flag the operator has to clear", out) |
| } |
| - if !strings.Contains(out, "/a/bab/apps/kass/settings/advanced") { |
| + if !strings.Contains(out, "/a/bab/apps/kass/settings)") { |
| t.Fatalf("refusal %q does not point at the settings card that can clear the flag", out) |
| } |
| claimOf(t, fx, host) |
| @@ -1185,7 +1185,7 @@ func TestControlPlaneAppRefusesBrowserDomainDetach(t *testing.T) { |
| if !strings.Contains(body, "control plane") { |
| t.Fatalf("browser refusal does not name the flag:\n%s", body) |
| } |
| - if !strings.Contains(body, "/a/bab/apps/kass/settings/advanced") { |
| + if !strings.Contains(body, "/a/bab/apps/kass/settings)") { |
| t.Fatalf("browser refusal does not point at the settings card that can clear the flag:\n%s", body) |
| } |
| claimOf(t, fx, host) |
diff --git a/internal/console/errorsview.go b/internal/console/errorsview.go| index 8ec549c26..3eaa3b791 100644 |
| --- a/internal/console/errorsview.go |
| +++ b/internal/console/errorsview.go |
| @@ -307,7 +307,7 @@ func (s *Server) handleAppErrorLevel(w http.ResponseWriter, r *http.Request) { |
| return |
| } |
| level := r.FormValue("level") |
| - back := appSettingsURL(acct.Sqid, app, "general") |
| + back := appSettingsURL(acct.Sqid, app, "errors-analytics") |
| // The setting lives in the deployment bucket, so a console without one |
| // has nowhere to put it. Refused before the write rather than panicking |
| // inside it, the way the rename door refuses its own bucket check. |
diff --git a/internal/console/perfwalk_test.go b/internal/console/perfwalk_test.go| index bb9477fad..2bfe378be 100644 |
| --- a/internal/console/perfwalk_test.go |
| +++ b/internal/console/perfwalk_test.go |
| @@ -417,12 +417,15 @@ func perfTargets(fx *consoleFixture) map[string][]perfTarget { |
| "GET /a/{sqid}/apps/{app}/instances/{host}": ok(app + "/instances/kass.carlosapp.dev"), |
| } |
| for _, tab := range []string{"account-review", "activity", "analytics", "availability", "errors", |
| - "instances", "logs", "logs/data", "pipeline", "settings"} { |
| + "instances", "logs", "logs/data", "settings"} { |
| m["GET /a/{sqid}/apps/{app}/"+tab] = ok(app + "/" + tab) |
| } |
| // /deployments is a 303 to Releases; the fixture's page 2 of Versions is |
| // the empty-page state, which still runs the listing. |
| m["GET /a/{sqid}/apps/{app}/deployments"] = []perfTarget{{Path: app + "/deployments", Expect: http.StatusSeeOther}} |
| + // GET /pipeline is a 303 to the settings section, which the sections |
| + // below walk as /settings/pipeline. |
| + m["GET /a/{sqid}/apps/{app}/pipeline"] = []perfTarget{{Path: app + "/pipeline", Expect: http.StatusSeeOther}} |
| m["GET /a/{sqid}/apps/{app}/releases"] = []perfTarget{ |
| {Path: app + "/releases", Expect: http.StatusOK}, |
| {Path: app + "/releases?page=2", Expect: http.StatusOK}, |
| @@ -436,6 +439,9 @@ func perfTargets(fx *consoleFixture) map[string][]perfTarget { |
| m["GET /a/{sqid}/apps/{app}/settings/{section}"] = append(m["GET /a/{sqid}/apps/{app}/settings/{section}"], |
| perfTarget{Path: app + "/settings/" + s, Expect: http.StatusOK}) |
| } |
| + // Advanced folded into General; its old URL is a 303 to /settings. |
| + m["GET /a/{sqid}/apps/{app}/settings/{section}"] = append(m["GET /a/{sqid}/apps/{app}/settings/{section}"], |
| + perfTarget{Path: app + "/settings/advanced", Expect: http.StatusSeeOther}) |
| return m |
| } |
diff --git a/internal/console/pipelinepage.go b/internal/console/pipelinepage.go| index 371f873b3..75e828d61 100644 |
| --- a/internal/console/pipelinepage.go |
| +++ b/internal/console/pipelinepage.go |
| @@ -1,8 +1,9 @@ |
| // The console UI half of release pipelines v2 |
| // (docs/superpowers/specs/2026-08-20-release-pipelines-v2-design.md): the |
| // pending-changes card every app page carries (PendingChangeView, |
| -// pendingChangeViews) and the pipeline settings page, GET/POST |
| -// /a/{sqid}/apps/{app}/pipeline (pipelinepage.go's own name). |
| +// pendingChangeViews) and the pipeline settings page: GET |
| +// /a/{sqid}/apps/{app}/settings/pipeline, POST /a/{sqid}/apps/{app}/pipeline |
| +// (pipelinepage.go's own name; the old GET there redirects to the section). |
| // |
| // The settings POST is deliberately NOT a second copy of the API PUT's |
| // guarded-write logic (apipipeline.go's handleAPIPipelinePut): both doors |
| @@ -210,17 +211,10 @@ func (s *Server) writePipeline(ctx context.Context, acct *Account, app string, c |
| // ---- the settings page: GET -------------------------------------------- |
| -// handlePipelineSettings renders the current (or default) pipeline as an |
| -// editable form. Read-only, so membership is the whole gate — same as the |
| -// rest of the app's settings tab. |
| -func (s *Server) handlePipelineSettings(w http.ResponseWriter, r *http.Request) { |
| - p, acct, ok := s.appPage(w, r, "settings") |
| - if !ok { |
| - return |
| - } |
| - s.handlePipelineSettingsPage(w, r, p, acct) |
| -} |
| - |
| +// handlePipelineSettingsPage renders the current (or default) pipeline as |
| +// an editable form: the Settings tab's Release pipeline section, reached |
| +// through handleAppSettings. Read-only, so membership is the whole gate, |
| +// same as the rest of the app's settings tab. |
| func (s *Server) handlePipelineSettingsPage(w http.ResponseWriter, r *http.Request, p page, acct *Account) { |
| setAppSettingsSection(&p, "pipeline") |
| ctx, cancel := context.WithTimeout(r.Context(), pipelineStoreTimeout) |
diff --git a/internal/console/pipelinepage_test.go b/internal/console/pipelinepage_test.go| index d1e693a2b..0cafa3de8 100644 |
| --- a/internal/console/pipelinepage_test.go |
| +++ b/internal/console/pipelinepage_test.go |
| @@ -332,7 +332,7 @@ func TestPipelineCardAndSettingsTemplates(t *testing.T) { |
| // Still the one-channel default: the settings page shows the form, with |
| // the single "edge" row, and offers the two starter templates. |
| - _, _, sbody := get(t, c, fx.u("/apps/multi/pipeline")) |
| + _, _, sbody := get(t, c, fx.u("/apps/multi/settings/pipeline")) |
| for _, want := range []string{ |
| `action="/a/bab/apps/multi/pipeline"`, |
| `name="ch.0.name" value="edge"`, |
| @@ -372,7 +372,7 @@ func TestPipelineCardAndSettingsTemplates(t *testing.T) { |
| // The settings page reflects the write, and — no longer the untouched |
| // default — stops offering the starter templates. |
| - _, _, sbody2 := get(t, c, fx.u("/apps/multi/pipeline")) |
| + _, _, sbody2 := get(t, c, fx.u("/apps/multi/settings/pipeline")) |
| if !strings.Contains(sbody2, `name="ch.1.name" value="production"`) { |
| t.Errorf("settings page does not show the saved production row:\n%s", sbody2) |
| } |
diff --git a/internal/console/server.go b/internal/console/server.go| index 872f3d361..3a81eaf64 100644 |
| --- a/internal/console/server.go |
| +++ b/internal/console/server.go |
| @@ -1615,10 +1615,11 @@ func NewServer(cfg Config, st *Store) (*Server, error) { |
| s.registerRoute("GET /a/{sqid}/apps/{app}/activity", s.handleAppActivity) |
| s.registerRoute("GET /a/{sqid}/apps/{app}/settings", s.handleAppSettings) |
| s.registerRoute("GET /a/{sqid}/apps/{app}/settings/{section}", s.handleAppSettings) |
| - // The pipeline settings page (pipelinepage.go, release pipelines v2 §5): |
| - // GET renders the current (or default) channel list as an editable |
| - // form; POST goes through the same guarded path the API PUT does. |
| - s.registerRoute("GET /a/{sqid}/apps/{app}/pipeline", s.handlePipelineSettings) |
| + // The pipeline settings page (pipelinepage.go, release pipelines v2 §5) |
| + // is the Settings tab's Release pipeline section; the old GET answers |
| + // with a 303 to it, after accountApp's gates. POST goes through the same |
| + // guarded path the API PUT does, and keeps this path. |
| + s.registerRoute("GET /a/{sqid}/apps/{app}/pipeline", s.appRedirect("/settings/pipeline")) |
| s.registerRoute("POST /a/{sqid}/apps/{app}/pipeline", s.handlePipelineSettingsSave) |
| s.registerRoute("POST /a/{sqid}/apps/{app}/promote", s.handlePromote) |
| s.registerRoute("POST /a/{sqid}/apps/{app}/rollback", s.handleRollback) |
| @@ -2018,12 +2019,12 @@ type page struct { |
| // Task 8's routes. |
| Pending []PendingChangeView |
| - // The pipeline settings page (pipelinepage.go), GET/POST |
| - // /a/{sqid}/apps/{app}/pipeline: PipelineRows is the current (or |
| - // mid-edit draft) channel list as editable form rows, indexed ch.<i>.*; |
| - // PipelineIsDefault is whether it's still the untouched one-channel |
| - // default a fresh app is created with, which is when the two starter |
| - // templates (Edge → Production, Full ladder) are worth offering. |
| + // The pipeline settings page (pipelinepage.go), GET |
| + // /a/{sqid}/apps/{app}/settings/pipeline and POST .../pipeline: |
| + // PipelineRows is the current (or mid-edit draft) channel list as |
| + // editable form rows, indexed ch.<i>.*; PipelineIsDefault is whether |
| + // it's still the untouched one-channel default a fresh app is created |
| + // with, which is when the two starter templates (Edge → Production, Full ladder) are worth offering. |
| PipelineRows []PipelineFormRow |
| PipelineIsDefault bool |
| SettingsSection string // app Settings sub-page selected by the URL |
| @@ -4170,6 +4171,12 @@ func (s *Server) handleAppActivity(w http.ResponseWriter, r *http.Request) { |
| // identity (and renaming it, while that is still only a record), domains, |
| // the account-move repair, and deletion. |
| func (s *Server) handleAppSettings(w http.ResponseWriter, r *http.Request) { |
| + // Advanced folded into General. appRedirect runs accountApp first, so a |
| + // non-member gets the same 404 here as on any other section. |
| + if r.PathValue("section") == "advanced" { |
| + s.appRedirect("/settings")(w, r) |
| + return |
| + } |
| p, acct, ok := s.appPage(w, r, "settings") |
| if !ok { |
| return |
| @@ -4205,7 +4212,7 @@ func setAppSettingsSection(p *page, section string) { |
| {"storage", "Storage"}, |
| {"email", "Email"}, |
| {"features", "Feature flags"}, |
| - {"advanced", "Advanced"}, |
| + {"errors-analytics", "Errors and analytics"}, |
| {"delete", "Delete"}, |
| } { |
| href := p.Nav + "/apps/" + url.PathEscape(p.AppName) + "/settings" |
diff --git a/internal/console/templates/app_analytics.html b/internal/console/templates/app_analytics.html| index 2a0a42dc8..8a1fc3628 100644 |
| --- a/internal/console/templates/app_analytics.html |
| +++ b/internal/console/templates/app_analytics.html |
| @@ -8,8 +8,9 @@ |
| {{if not .AnalyticsWin.On}} |
| <p><strong>Analytics is off for this app</strong> (from the {{.AnalyticsWin.Setting.CountFrom}}). |
| When on, the edge counts HTML page views and daily visitors as it serves them: no JavaScript, no cookie, |
| -no stored IP. A visitor is a salted hash that changes every day. Turn it on for this app or for the whole |
| -account on the <a href="{{.Base}}/apps/{{.AppName}}/settings">Settings</a> tab.</p> |
| +no stored IP. A visitor is a salted hash that changes every day. |
| +Turn it on for this app in <a href="{{.Nav}}/apps/{{.AppName}}/settings/errors-analytics">Settings, under Errors and analytics</a>, |
| +or for the whole account in the account's <a href="{{.Nav}}/settings">Settings</a>.</p> |
| {{end}} |
| <form method="get" class="toolbar"> |
| <label>range |
diff --git a/internal/console/templates/app_errors.html b/internal/console/templates/app_errors.html| index 57fe56357..47287c8bd 100644 |
| --- a/internal/console/templates/app_errors.html |
| +++ b/internal/console/templates/app_errors.html |
| @@ -74,6 +74,6 @@ Counts are to the nearest flush. Messages are redacted for addresses and credent |
| <p class="small">Times are UTC. The same view from a terminal: <code>carlos errors --app {{.AppName}} --since {{.ErrSince}}</code>.</p> |
| {{else if not .ErrsErr}} |
| <p>No errors in this window.</p> |
| -<p class="small">Log lines at <code>{{.ErrWin.LogLevel}}</code> and above and the app's own 500s appear here on their own (a 502, 503 or 504 is on <a href="{{.Nav}}/apps/{{.AppName}}/availability">Availability</a>); a JavaScript or server-side error needs the hook (coming in a later step). The level is set on the Settings tab. The same view from a terminal: <code>carlos errors --app {{.AppName}}</code>.</p> |
| +<p class="small">Log lines at <code>{{.ErrWin.LogLevel}}</code> and above and the app's own 500s appear here on their own (a 502, 503 or 504 is on <a href="{{.Nav}}/apps/{{.AppName}}/availability">Availability</a>); a JavaScript or server-side error needs the hook (coming in a later step). The level is set in <a href="{{.Nav}}/apps/{{.AppName}}/settings/errors-analytics">Settings, under Errors and analytics</a>. The same view from a terminal: <code>carlos errors --app {{.AppName}}</code>.</p> |
| {{end}} |
| {{template "bottom" .}}{{end}} |
diff --git a/internal/console/templates/app_settings.html b/internal/console/templates/app_settings.html| index efb72a2cb..57157acf7 100644 |
| --- a/internal/console/templates/app_settings.html |
| +++ b/internal/console/templates/app_settings.html |
| @@ -373,7 +373,7 @@ credentials — an operator of this deployment has to tear it down.</p> |
| {{end}} |
| {{end}}{{end}} |
| {{end}} |
| -{{if eq .SettingsSection "general"}} |
| +{{if eq .SettingsSection "errors-analytics"}} |
| <h2>Errors</h2> |
| {{if .ErrLevelUnread}} |
| <p class="small">This app’s Errors log level could not be read just now, so it is not shown |
| @@ -422,7 +422,8 @@ the {{.AnalyticsSetting.CountFrom}}. Only the account owner can change it.</p> |
| JavaScript, no cookie, no stored IP. A visitor is a salted hash that changes every day and cannot be |
| joined across days. Whether that needs consent where your visitors are is your call, which is why it |
| is off until you turn it on.</p> |
| - |
| +{{end}} |
| +{{if eq .SettingsSection "general"}} |
| <h2>{{.SwapCopy.Heading}}</h2> |
| {{if .SwapUnread}} |
| <p class="small">{{.SwapCopy.Unread}}</p> |
| @@ -538,7 +539,7 @@ none on the record; it was handed over once, at creation.</p> |
| {{end}} |
| {{end}}{{end}} |
| {{end}} |
| -{{if eq .SettingsSection "advanced"}} |
| +{{if eq .SettingsSection "general"}} |
| {{if and .Settings .IsOwner}} |
| <h2 class="danger-head">Control plane</h2> |
diff --git a/internal/console/testdata/perf-budgets.txt b/internal/console/testdata/perf-budgets.txt| index 0104ad93f..d5a865490 100644 |
| --- a/internal/console/testdata/perf-budgets.txt |
| +++ b/internal/console/testdata/perf-budgets.txt |
| @@ -46,10 +46,9 @@ GET /a/{sqid}/apps/{app}/errors over: the app-tab frame plus both telemetry sett |
| GET /a/{sqid}/apps/{app}/instances over: the app-tab frame plus instances.json, and every edges file and box report listed and read twice (24 S3 calls warm) |
| GET /a/{sqid}/apps/{app}/instances/{host} over: the app-tab frame plus the instance record, and the box reports and the fleet box reports listed and read three times (31 S3 calls warm) |
| GET /a/{sqid}/apps/{app}/logs over: the app-tab frame plus a listing and a read of every instance record and three listings for the log chunks (15 S3 calls warm) |
| -GET /a/{sqid}/apps/{app}/pipeline over: the app-tab frame plus a second pipeline read (8 S3 calls warm) |
| GET /a/{sqid}/apps/{app}/releases over: the app-tab frame plus a second pipeline read for the pending card, the release and tag listings, at most 20 manifests, retention and instances.json (14 S3 calls warm; 12 on the fixture's empty page 2) |
| GET /a/{sqid}/apps/{app}/settings over: populateAppSettings builds every section: each environment and its store read twice, every instance record, the domain claims, cert-warm records, every box report and a listing of every key under the app (34 S3 calls warm) |
| -GET /a/{sqid}/apps/{app}/settings/{section} over: every section is built whichever one is shown, as on the general section (34 S3 calls warm; the pipeline section 8) |
| +GET /a/{sqid}/apps/{app}/settings/{section} over: every section is built whichever one is shown, as on the general section (34 S3 calls warm; the pipeline section 8; the advanced redirect none) |
| GET /a/{sqid}/fleet over: reads status/fleet.json and lists and reads each customer fleet's box reports (3 S3 calls warm) |
| GET /a/{sqid}/fleets/{fleet} over: lists and reads the fleet's box reports (2 S3 calls warm) |
| GET /a/{sqid}/settings over: reads the account and app telemetry settings and the storage entitlement (3 S3 calls warm) |