Console perf quick-wins plan (replaces the 17-task cache plan)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 file changed,
+190
−0
docs/superpowers/plans/2026-10-26-console-perf-quick-wins.md+190 −0
CI passed — run details
diff --git a/docs/superpowers/plans/2026-10-26-console-perf-quick-wins.md b/docs/superpowers/plans/2026-10-26-console-perf-quick-wins.md| new file mode 100644 |
| index 000000000..de1cb74d6 |
| --- /dev/null |
| +++ b/docs/superpowers/plans/2026-10-26-console-perf-quick-wins.md |
| @@ -0,0 +1,190 @@ |
| +# Console perf quick wins Implementation Plan |
| + |
| +> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking. |
| + |
| +**Goal:** Cut the warm S3 requests behind the console's slowest screens, so most app tabs fit the 150 ms page budget, using small fixes each provable by the perf walk's own counts. |
| + |
| +**Architecture:** Two small caches and a handful of local fixes. The account manifest check is remembered in process once it succeeds. A per-app frame cache holds the reads every app tab makes first (channels, production flag, pipeline) for 30 s, and every console write that names an app clears that app's entry before its response goes out. A per-request memo stops the same box reports, edges and instance manifest being read twice in one page. Settings sections read only what they show, and account settings stops reading a key nothing writes. |
| + |
| +**Tech Stack:** Go, `internal/console`, `internal/release`, `internal/telemetry`, the perf walk (`internal/console/perfwalk_test.go`) over `internal/s3fake`. |
| + |
| +**Spec:** `docs/superpowers/specs/2026-10-25-console-ux-perf-design.md`, Part 2 (§2.4 C and the "read your own writes" rule of §2.4 A). This plan REPLACES `docs/superpowers/plans/2026-10-25-console-perf-2-fixes.md`: no read-set cache, no deferred parts, no restricted loaders. |
| + |
| +**Driven by:** the `over:` records in `internal/console/testdata/perf-budgets.txt` (measured 2026-10-26, 25 ms per S3 request). "The frame" below is the 7 warm S3 calls every app tab pays first: the account manifest `Get`, the channel listing plus one `Get` per channel (3 in the fixture), the production flag and the pipeline. |
| + |
| +## Global Constraints |
| + |
| +- Local tests are targeted: `go test ./internal/console/ -run '<names>' -count=1`. Never a whole package, never an empty `-run`. CI runs the full suite. |
| +- `gofmt -l` empty, `go vet ./internal/console/ ./internal/telemetry/`, and `GOOS=darwin go build ./... && GOOS=windows go build ./...` before each commit. |
| +- Leave `GOCACHE` at its default. |
| +- New tests go through the production wiring: `newPerfFixture` (real S3 client over `internal/s3fake`) or `newConsoleFixture`, signed in with `signInPaul`, writes made with `postForm` against the real routes. |
| +- Warm S3 requests only go down. No new background polling, timers or per-box reads. `TestPerfSessionS3Requests` stays at or under its ceiling after every task. |
| +- Security gate order (session, CSRF, owner/role) is unchanged. Caches are consulted only after a handler's gate has passed, and only on GET/HEAD view paths; write doors keep their own direct reads. |
| +- Cached values are immutable to callers: every read from a cache returns a deep copy. |
| +- No new user-facing copy. If a task finds it cannot avoid one, stop and get a Luna pass on the string first. |
| +- No tenant names in code, tests or fixtures. |
| +- Commit per task; every commit message ends with `Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>`. |
| +- Each task edits `internal/console/testdata/perf-budgets.txt` for the screens it fixes: a screen with 0 warm calls and under 150 ms loses its record; a screen with a few calls left and under 150 ms becomes `calls <n>: <reason>`; a screen still slow keeps `over:` with its new count in the reason. |
| +- AGENTS.md "Stopping rules" apply. Per rule 3, Task 2 (a cache) gets its own review; the rest are covered by one whole-branch review. |
| + |
| +## Review Focus |
| + |
| +- A person promotes, rolls back, edits a channel or canary, or saves settings, in the browser or with the CLI, and the next page view must show the change, never the pre-write value. Owned by Task 2 (`TestAppFrameOwnWriteVisible`, `TestAppFrameCLIWriteVisible`). |
| +- A GET that started before a write and finishes after it must not put the old value back into the cache. Owned by Task 2 (`TestAppFrameLoadDuringWriteNotStored`). |
| +- A failed read (S3 error on a channel or the pipeline) must not be cached: the next view retries. Owned by Task 2 (`TestAppFrameErrorNotCached`). |
| +- A strict reader of box reports (`loadBoxJoinComplete`) must still see "incomplete" when one box report fails, after the memo. Owned by Task 3 (`TestRequestMemoKeepsBoxCompleteness`). |
| +- A write door that decides placement from `liveEdges` must keep reading fresh, not a memoized view. Owned by Task 3 (`TestReqMemoOnlyOnViews`). |
| + |
| +--- |
| + |
| +### Task 1: Remember the account manifest |
| + |
| +Every app tab `Get`s `accounts/<sqid>/account.json` (`ensureAccountManifest`, `internal/console/server.go:4384-4402`, called from `appPage` at `server.go:3611` and from `server.go:4686`). Once it exists it never needs checking again in this process. |
| + |
| +Screens: every app tab, frame 7 → 6. |
| + |
| +**Files:** |
| +- Modify: `internal/console/server.go:4384-4402` (`ensureAccountManifest`), `internal/console/server.go:892` (`Server` gains the field) |
| +- Test: `internal/console/perfquickwins_test.go` (create) |
| + |
| +**Interfaces:** |
| +- Produces: `Server.manifestSeen sync.Map` keyed by sqid (value `struct{}`). `ensureAccountManifest` returns at once for a sqid in the map; it stores the sqid after a successful `Get` or a successful `WriteAccountManifest`, never after an error. Account deletion (`handleDeleteAccount`, `ownership.go:95`) deletes the sqid from the map. |
| + |
| +- [ ] **Step 1: Write the failing test** `TestAccountManifestCheckedOncePerProcess` in `perfquickwins_test.go`: `newPerfFixture`; GET `/apps/kass/activity` twice; record request paths with `lat.Fake().OnRequest`; the key `accounts/<sqid>/account.json` is requested exactly once across both views. Second case: delete the manifest object from the fake bucket before the first view; after two views it was written once and read once. |
| +- [ ] **Step 2: Run** `go test ./internal/console/ -run TestAccountManifestCheckedOncePerProcess -count=1`. Expected: FAIL (two reads). |
| +- [ ] **Step 3: Implement** as in Interfaces. |
| +- [ ] **Step 4: Run** `go test ./internal/console/ -run 'TestAppPageBackfillsAccountManifest|TestBackfill|TestDeleteAccount' -count=1`. Expected: PASS. |
| +- [ ] **Step 5: Walk** `CI=1 go test ./internal/console/ -run 'TestConsoleScreensMeetTheBudget|TestPerfSessionS3Requests' -count=1`; update every app-tab `over:` reason from "7 S3 calls" frame to 6. Commit `console: check the account manifest once per process`. |
| + |
| +### Task 2: A per-app frame cache, cleared by every console write to the app |
| + |
| +Today `Assemble` (`internal/console/view.go:560-657`) runs `assembleChannels` (`view.go:784-832`: one listing plus one `release.Channel` per channel) and `assembleProduction` (`view.go:834`, `release.GetProduction`) for each app on every view, then `applyPipelineView` (`server.go:3687-3712`) reads the pipeline, and the Overview and Releases pending cards read it again through `pendingPipeline` (`pendinghandlers.go:473`, called from `server.go:3818` and `:3857`), as does the Pipeline settings section (`pipelinepage.go:222`). |
| + |
| +Screens, warm S3 after (from Task 1's 6): account-review 6 → 0, activity 6 → 0, settings Placement/Delete 6 → 0, settings Pipeline 7 → 0, account home `/a/{sqid}/` 5 → 0, Overview 15 → 8, Releases 13 → 6, Analytics 10 → 4, Errors and Availability 16 → 10, Logs 14 → 8, Running 23 → 17, instance page 30 → 24, Settings General 31 → 25, settings sections worst 30 → 24, errors-analytics section 8 → 2. |
| + |
| +**Files:** |
| +- Create: `internal/console/appframe.go` |
| +- Modify: `internal/console/view.go:560-657` (`Assemble` becomes a wrapper), `:784-870` (`assembleChannels`, `assembleProduction` take an `appFrame`), `AppView` gains `PipelineErr string` |
| +- Modify: `internal/console/remoteinstances.go:531-533` (`assembleApps` uses the cache) |
| +- Modify: `internal/console/server.go:3687-3712` (`applyPipelineView` reads the frame), `:3818`, `:3857` (pending cards pass `p.Detail.Pipeline`), `internal/console/pipelinepage.go:219-230` (uses `p.Detail.Pipeline` / `p.Detail.PipelineErr`) |
| +- Modify: `internal/console/claim_routes.go:59-69` (`registerRoute`: the write hook) |
| +- Test: `internal/console/appframe_test.go` (create) |
| + |
| +**Interfaces:** |
| +- Produces: |
| + - `type frameChannel struct { Name string; Pointer *release.ChannelPointer; Err string }` |
| + - `type appFrame struct { Channels []frameChannel; ChannelsErr string; Production *release.ProductionFlag; ProductionErr string; Pipeline *release.Pipeline; PipelineErr string }` and `func (f appFrame) clone() appFrame` (deep: every slice, every pointed-to struct and its slices). |
| + - `func loadAppFrame(ctx context.Context, st release.Store, pub ed25519.PublicKey, acct, app string) appFrame`: today's reads, in today's order, with `pipelineStoreTimeout` on the pipeline read. |
| + - `type appFrames struct { mu sync.Mutex; ttl time.Duration; now func() time.Time; ... }` whose zero value is ready (ttl 0 means `appFrameTTL`, nil `now` means `time.Now`), like `keyedLocks` (`applocks.go:5-15`), so `&Server{}` literals in tests stay safe. `func (c *appFrames) get(ctx context.Context, acct, app string, load func(context.Context) appFrame) appFrame`; `func (c *appFrames) clearApp(app string)` (every account's entry for that app name); `func (c *appFrames) clearAccount(sqid string)`. `const appFrameTTL = 30 * time.Second`. `Server.frames appFrames` (a value field). |
| + - `get` records a per-app generation before loading and stores the result only if the generation is unchanged and the frame has no `*Err` set. Clears bump the generation. No single-flight, no background refresh, no size cap beyond the app count (one entry per viewed app). |
| + - `func (s *Server) appFrame(ctx context.Context, acct, app string) appFrame`: `s.frames.get` with `loadAppFrame` over `s.cfg.Releases`; returns a clone. |
| + - `func Assemble(...)` keeps its signature (tests call it) and calls `assembleViews(ctx, regPath, acct, apps, dns, remote, frame func(app string) appFrame)`; `assembleApps` passes `s.appFrame`. |
| + - The write hook, in `registerRoute`: for a pattern whose method is not GET or HEAD (method-less patterns: when `r.Method` is not GET or HEAD), wrap `w` so that the first `WriteHeader` or `Write` first runs the clear, and run the clear again when the handler returns. The clear is `clearApp(r.PathValue("app"))` when the pattern has `{app}`; otherwise `clearAccount(r.PathValue("sqid"))` when it has `{sqid}`; otherwise nothing. This covers every browser door under `/a/{sqid}/apps/{app}/` (promote, rollback, production, fasttrack, canary, canary/retire, pipeline, pending confirm/reject, settings saves, rename, move, delete, domains, place, gate, swap, restart) and every CLI door under `/api/cli/apps/{account}/{app}/` (promote, rollback, releases, channels/resign, pipeline PUT, version-target, retention, delete, restore). |
| + - Every console writer of channels, production or pipeline sits under an `{app}` door, checked 2026-10-26: `handlePromote` (`server.go:4943`, `:4994`), `handleProduction` (`:5279`), `handleNewCanary` (`:5600`), `executePendingPromote` and `executePendingPolicy` (`pendinghandlers.go:560`, `:607`, reached from `proposeThenExecute` and `handlePendingConfirm`), `handlePipelineSettingsSave` (`pipelinepage.go:202`), `ensureProductionForBakes` (`apipipeline.go:269`, from the CLI pipeline PUT), and the CLI promote/rollback doors. `claimAppWith` (`server.go:4691`) writes a new app's pipeline from `POST /a/{sqid}/apps/new` (cleared by `clearAccount`) and the CLI `new` doors (a name with no live entry). So the hook alone covers them. Two explicit clears remain: `handleAppRename` calls `clearApp(newName)` (the hook clears the old name), and the trash doors (`POST /a/{sqid}/trash/restore`, `/trash/delete`, app in the form) are covered by `clearAccount`. Any writer outside the console is bounded by the 30 s window. A refused or failed write also clears: that costs one reload, which is what every view pays today. |
| +- Write doors keep their direct reads (`pendinghandlers.go:401, :496, :591, :731`, `pipelinepage.go:304`, `apipipeline.go`, `channelmove.go:146`): a decision is never made on a cached value. |
| + |
| +- [ ] **Step 1: Write the failing tests** in `appframe_test.go`, all on `newPerfFixture` with `signInPaul`: |
| + - `TestAppFrameWarmViewReadsNothing`: GET `/apps/kass/activity` twice; the second view makes 0 S3 requests (`lat.Calls()` before/after). |
| + - `TestAppFrameOwnWriteVisible`, table-driven over promote (`POST /apps/kass/promote` stable to v2), rollback, the production switch, fasttrack, a new canary, canary retire and a pipeline settings save (the settings saves that change what the frame holds): warm the frame with a GET, make the write with `postForm`, then the very next GET of the page that shows it (Releases, Overview or the settings section) shows the new value. Uses the existing seeds (`fx.channelVersion` confirms the write landed). |
| + - `TestAppFrameCLIWriteVisible`: warm the frame; promote through `POST /api/cli/apps/<sqid>/kass/promote` with the fixture's CLI token; the next browser GET of Releases shows the new version. |
| + - `TestAppFrameLoadDuringWriteNotStored`: unit test on `appFrames`: start `get` with a `load` that blocks on a channel; call `clearApp`; release the load; the next `get` calls `load` again. |
| + - `TestAppFrameErrorNotCached`: `lat.Fake().OnRequest` fails the pipeline key once with 500; two GETs: the second reads the pipeline again and shows it. |
| + - `TestAppFrameCopiesOnRead`: `get`, mutate the returned `Channels[0].Pointer.History` and `Pipeline.Channels`, `get` again: unchanged. |
| + - `TestAppFrameExpires`: `appFrames{now: clock}`; after advancing the clock 31 s the next `get` loads. |
| + - `TestOverviewReadsPipelineOnce`: with one pending change seeded, a cold GET of `/apps/kass` requests the pipeline key once. |
| +- [ ] **Step 2: Run** `go test ./internal/console/ -run 'TestAppFrame|TestOverviewReadsPipelineOnce' -count=1`. Expected: FAIL. |
| +- [ ] **Step 3: Implement** as in Interfaces. |
| +- [ ] **Step 4: Run** Step 2's command, then `go test ./internal/console/ -run 'TestAssemble|TestView|TestLadder|TestPending|TestPipeline|TestPromote|TestRollback|TestCanary|TestProduction|TestFastTrack|TestAppSettings|TestPageHeadsOnAccountPages' -count=1`. Expected: PASS. |
| +- [ ] **Step 5: Walk** (Task 1's command). Delete the records for account-review, activity and `/a/{sqid}/{$}`; Analytics becomes `calls 4: both telemetry settings, the analytics day listing and one day read`; update the remaining reasons with the measured counts. Commit `console: cache the app-tab frame for 30 s; every console write to the app clears it first`. |
| +- [ ] **Step 6: Review.** Per stopping rule 3 (a cache), one Opus or Astra review of this task from `docs/superpowers/reviews/REVIEW-BRIEF-TEMPLATE.md`, focused on the hook's coverage and the generation check. |
| + |
| +### Task 3: Read each thing once per request |
| + |
| +A request-scoped memo for the reads one GET repeats, installed only on GET and HEAD requests. No cross-request state, and write doors (which also call `liveEdges` for placement) never see it. Inventory checked 2026-10-26: |
| + |
| +- Running (`handleAppInstances`, `server.go:3930`): `liveEdges` (`regioncandidates.go:203`, `readLiveEdgesSnapshot`: a `control/edges/` listing, a `Get` per file, then `status.LoadBoxesComplete`) runs twice, from `appDefault` (`server.go:3957` → `regiondefault.go:36`) and at `server.go:3966`. `instances.json` is read twice when the app has no rows (`appPolicy`, `regioncandidates.go:285`, and `instanceDomainFor` via `attachHint`, `server.go:3976`). |
| +- Instance page (`handleAppInstance`, `instancepage.go:242`): platform `status/boxes/` loaded three times, by `systemBoxes` (`instancepage.go:285` → `apisystemupdate.go:270`), `loadRolloutJoin` (`:291` → `apiinstances.go:560`) and `updatesPage` (`:294` → … → `geoipInventory`, `apisystemgeoip.go:252`); each fleet's box reports two or three times (`apisystemupdate.go:295`, `apiinstances.go:618`, `apisystemgeoip.go:299`). |
| +- Logs (`server.go:3995`): the host picker lists and reads every instance record through `s.listRecords` (`server.go:4045`) only for `rec.Host`, while the frame already holds the same records through the process-cached `pageRecords` (`remoteinstances.go:464`). |
| +- Errors, Availability and Analytics repeat nothing (one telemetry resolve, one read per window); they are left for a later round. |
| + |
| +Screens, warm S3 after (from Task 2): Running 17 → ~9, instance page 24 → ~10, Logs 8 → 3 (the log-chunk listings). The walk records the exact counts. |
| + |
| +**Files:** |
| +- Create: `internal/console/reqmemo.go` |
| +- Modify: `internal/console/claim_routes.go:59-69` (`registerRoute` installs the memo for GET and HEAD), `internal/console/regioncandidates.go:203` (`liveEdges`), `:285` (`appPolicy`'s manifest read), `instanceDomainFor` (`server.go:5636`), `internal/console/apisystemupdate.go:270`, `:295`, `internal/console/apiinstances.go:560`, `:618`, `internal/console/apisystemgeoip.go:252` (box loads go through the memo), `internal/console/server.go:4043-4054` (Logs host picker) |
| +- Test: `internal/console/perfquickwins_test.go` |
| + |
| +**Interfaces:** |
| +- Produces: |
| + - `func withReqMemo(ctx context.Context) context.Context` and `func memoize[T any](ctx context.Context, key string, load func() (T, error)) (T, error)`: with no memo in `ctx`, `load` runs every time. Errors are memoized too (a retry inside one request changes nothing). Memoized values are shared within the request only; callers already treat these results as read-only. |
| + - `func (s *Server) loadBoxes(ctx context.Context, st release.Store, prefix string) (boxes []status.Box, complete bool, err error)`: `status.LoadBoxesComplete` behind memo key `boxes:<prefix>` (`""` for the platform, `fleets/<name>/` per fleet). `status.LoadBoxes` callers above switch to it and drop `complete`; the status package documents that both return the same boxes (`internal/status/fleet.go:225-236`). Strict callers keep using `complete` and `err` exactly as today. |
| + - `liveEdges` behind memo key `edges`; the app's `instances.json` behind `instances-manifest:<sqid>/<app>`. |
| + - The Logs host picker takes its record hosts from `s.pageRecords(ctx, acct.Sqid, p.AppName)` instead of `s.listRecords`. |
| + |
| +- [ ] **Step 1: Write the failing tests** on `newPerfFixture`, keys recorded with `lat.Fake().OnRequest`: |
| + - `TestInstancePageLoadsBoxesOnce`: GET `/apps/kass/instances/kass.carlosapp.dev`; the `status/boxes/` listing requested once, each fleet's once. |
| + - `TestRunningTabReadsEdgesOnce`: GET `/apps/kass/instances`; `control/edges/` listed once. |
| + - `TestRequestMemoKeepsBoxCompleteness`: `OnRequest` fails one box report's key; two `s.loadBoxes` calls inside one `withReqMemo` context both return `complete == false` with the same boxes, and the existing `loadBoxJoinComplete` tests stay green. |
| + - `TestLogsHostPickerReadsNoRecords`: three instance records seeded; GET `/apps/kass/logs` warm; no `Get` under `apps/<sqid>/kass/instances/`; all three hosts in the picker. |
| + - `TestReqMemoOnlyOnViews`: `memoize` on a context without `withReqMemo` runs `load` on every call; a test handler registered through `registerRoute` as `POST /x` sees no memo in its request context, and as `GET /x` sees one. |
| +- [ ] **Step 2: Run** `go test ./internal/console/ -run 'TestInstancePageLoadsBoxesOnce|TestRunningTabReadsEdgesOnce|TestRequestMemoKeepsBoxCompleteness|TestLogsHostPickerReadsNoRecords|TestReqMemoOnlyOnViews' -count=1`. Expected: FAIL. |
| +- [ ] **Step 3: Implement** as in Interfaces. |
| +- [ ] **Step 4: Run** Step 2's command, then `go test ./internal/console/ -run 'TestInstancePage|TestInstancesTab|TestRegion|TestUpdatesEnforced|TestUpdatesSection|TestSystemUpdate|TestBoxJoin|TestGeoip|TestAppLogs' -count=1`. Expected: PASS. |
| +- [ ] **Step 5: Walk**; Logs becomes `calls 3: the three log-chunk listings`; Running and the instance page keep `over:` with their measured counts unless they now pass. Commit `console: each remote read once per request`. |
| + |
| +### Task 4: Settings sections read only what they show |
| + |
| +`settingsSectionReadsFor` (`server.go:4294-4307`) sends General, Domains, Environments, Storage, Email and Feature flags through the whole `assembleSettings` (`appsettings.go:329-403`), which makes every read for every section: `settingsDomains` (`:343`, claims, `aliasReadings` box reports, cert-warm listing and reads), `settingsGates` (`:369`, every instance record), `appDeployEmpty` (`:374`, two full listings), `envCards` (`:384`, environments plus a store `GetIn` each at `:532`), `storeCard` (`:385`), `storeEnvCards` (`:386`, the same store records again at `:567`), `mailCard` (`:387`), `featuresCard` (`:388`). Environments and Storage each display only their own loop, so splitting by section also ends the double store read. `AppFlags`, `readyRouteHost` and the mismatch lookup are local and stay. |
| + |
| +Screens: `/settings` (General) 25 → 3 (the two one-key listings and the swap policy); `/settings/{section}`: Environments, Storage, Email, Feature flags drop to their own reads (1 to 2 + 2 per environment); Domains keeps claims, box reports, cert-warm and gates, so the record stays `over:` with Domains' measured count as the worst. |
| + |
| +**Files:** |
| +- Modify: `internal/console/server.go:4283-4307` (`settingsSectionReads` gains `domains, gates, deployEmpty, envs, store, mail, features bool` in place of `record`), `:4310-4318` (`populateAppSettings` passes them) |
| +- Modify: `internal/console/appsettings.go:329-403` (`assembleSettings` takes the flags), `:752-763` (`appDeployEmpty`) |
| +- Test: `internal/console/perfquickwins_test.go` |
| + |
| +**Interfaces:** |
| +- Produces: |
| + - `func (s *Server) assembleSettings(ctx context.Context, p *page, acct *Account, reads settingsSectionReads) SettingsView`: each remote part runs only when its flag is set. Section flags: general `{deployEmpty, swap}`; domains `{domains, gates}`; environments `{envs}`; storage `{store}`; email `{mail}`; features `{features}`; placement, errors-analytics, delete, pipeline unchanged. |
| + - `appDeployEmpty` asks each prefix (`release.AppPrefix`, `release.LegacyAppPrefix`) for one key: `release.PageLister.ListPage(ctx, prefix, "", 1)` (`internal/release/store.go:382-384`) when the store implements it, else `List`. Its rename callers (`appsettings.go:861`, `:916`) get the same. `S3Store` and `DirStore` implement `PageLister`; the console test store (`deletableStore`, `view_test.go:22`) does not, so the fallback is exercised by the existing settings tests. |
| + |
| +- [ ] **Step 1: Write the failing tests:** |
| + - `TestSettingsSectionReadsOnlyItsOwn`, table over general, environments, storage, email, features: GET the section on `newPerfFixture`, record keys with `OnRequest`; General requests nothing under `instances/`, `status/boxes/`, `control/cert-warm/`, `stores/` or the environments prefix; Environments nothing under `status/boxes/`, `control/cert-warm/`, `instances/`; Storage, Email and Features nothing under any of those nor each other's keys. |
| + - `TestSettingsStorageReadsEachStoreOnce`: two environments seeded; GET Storage; each environment's store record requested once. |
| + - `TestAppDeployEmptyAsksForOneKey`: a store wrapper with `ListPage` recording `limit`: called with 1 per prefix, `List` never called; over a store without `ListPage`, falls back to `List` and gives the same answer. |
| +- [ ] **Step 2: Run** `go test ./internal/console/ -run 'TestSettingsSectionReadsOnlyItsOwn|TestSettingsStorageReadsEachStoreOnce|TestAppDeployEmptyAsksForOneKey' -count=1`. Expected: FAIL. |
| +- [ ] **Step 3: Implement** as in Interfaces. |
| +- [ ] **Step 4: Run** Step 2's command, then `go test ./internal/console/ -run 'TestAppSettings|TestSettings|TestDomains|TestStore|TestEnvironment|TestRename|TestAppSwap' -count=1`. Expected: PASS. |
| +- [ ] **Step 5: Walk**; General's record becomes `calls 3: the two one-key app listings for the rename check and the swap policy`; the sections record keeps `over:` with Domains' measured count and the others' counts in the reason. Commit `console: each settings section reads only what it shows`. |
| + |
| +### Task 5: Account settings reads the account's telemetry key, not an app key |
| + |
| +`handleAccountSettings` calls `telemetry.Resolve(ctx, s.cfg.Releases, acct.Sqid, "")` (`server.go:3522`), which reads `telemetry.AppKey(sqid, "")` = `apps/<sqid>//telemetry.json`, a key nothing writes, plus the account key. The account level is written at `telemetry.AccountKey(sqid)` (`internal/telemetry/telemetry.go:48`) by `handleAccountErrorLevel` (`errorsview.go:364`) and `handleAccountAnalyticsSetting` (`analyticsview.go:156`); `Resolve` (`telemetry.go:109-122`) reads that key and then the app key. |
| + |
| +Screens: `/a/{sqid}/settings` 3 → 2. |
| + |
| +**Files:** |
| +- Modify: `internal/console/server.go:3516-3527` |
| +- Test: `internal/console/perfquickwins_test.go` |
| + |
| +**Interfaces:** |
| +- Consumes: `telemetry.Read(ctx, s, telemetry.AccountKey(sqid)) (Settings, string, error)`, `telemetry.Fold(acct, appSt Settings) Resolved`. |
| + |
| +- [ ] **Step 1: Write the failing tests:** `TestAccountSettingsReadsNoAppTelemetryKey`: GET `/settings`; no requested key contains `//`. `TestAccountSettingsShowsAccountLevel`: set the account Errors level through its POST door; GET `/settings` shows it (the same assertion the existing account-settings tests make, kept green). |
| +- [ ] **Step 2: Run** `go test ./internal/console/ -run 'TestAccountSettingsReadsNoAppTelemetryKey|TestAccountSettingsShowsAccountLevel' -count=1`. Expected: first FAILS. |
| +- [ ] **Step 3: Implement:** `telemetry.Read` of the account key, folded with `telemetry.Fold(acct, telemetry.Settings{})`; a bucketless console (`s.cfg.Releases == nil`) folds defaults as `Resolve` does; a read error sets `ErrLevelUnread` as today. |
| +- [ ] **Step 4: Run** `go test ./internal/console/ -run 'TestAccountSettings|TestTelemetry|TestErrors|TestAnalytics' -count=1`. Expected: PASS. |
| +- [ ] **Step 5: Walk**: `/a/{sqid}/settings` becomes `calls 2: the account telemetry settings and the storage entitlement`. Commit `console: account settings reads the account telemetry key only`. |
| + |
| +### Task 6: Lower the session ceiling, tidy the budgets, census |
| + |
| +**Files:** |
| +- Modify: `internal/console/testdata/perf-session-s3.txt`, `internal/console/testdata/perf-budgets.txt` |
| +- Census overlay files written by `make census-propose` |
| + |
| +- [ ] **Step 1: Measure:** `go test ./internal/console/ -run TestPerfSessionS3Requests -count=1 -v`; read "the scripted session made N S3 requests". |
| +- [ ] **Step 2: Lower the ceiling:** set `perf-session-s3.txt` to `<N> after console-perf-quick-wins, 2026-10-26` (replacing `1000 baseline before plan 2`). Rerun Step 1's command: PASS. |
| +- [ ] **Step 3: Check the budgets file:** every remaining `over:` reason carries the measured warm count; the header comment says these records are deleted by the next round, not "plan 2". Expected left `over:` (out of this plan's scope, for the next round): Overview (release listing, manifests, box reports), Releases, Errors, Availability, Running and the instance page if still over 5 calls, the Domains settings section, the account fleet pages, `/a/{sqid}/plan/keep`, `/a/{sqid}/trash`, and the operator pages (Part 3). Run `CI=1 go test ./internal/console/ -run 'TestConsoleScreensMeetTheBudget|TestPerfBudgetsFileParses' -count=1`: PASS. |
| +- [ ] **Step 4: Gate:** `gofmt -l ./internal`, `go vet ./internal/console/ ./internal/telemetry/`, `GOOS=darwin go build ./...`, `GOOS=windows go build ./...`. |
| +- [ ] **Step 5: Census** (AGENTS.md "The census"): `make census-card`; write CLAIMS (one line per changed unit, "same reads, fewer calls" or the read removed); `make census-propose NAME=console-perf-quick-wins CLAIMS=<file>`; a cross-model reviewer approves `body`/`sites`/`envelope`/`removed` rows; any `reads`/`new`/`quiet`/`other` row goes to Paul as a decision. |
| +- [ ] **Step 6: Commit** `console perf: lower the session S3 ceiling to <N>`, then the whole-branch review. |