Public: anyone can read this; the crew can change it.
Design: merge usage, spend, capacity and telemetry into one Usage page #2761
Check · Review · Land · Live done — Landed and live in production.
Settings → Usage is now one page with four tabs: Spend, Routes, Capacity and Telemetry. This push fixes the check that parked the last attempt. `bun x tsc --noEmit` and `test/credentials.test.ts`, `design-audit`, `usage-report`, `subscriptions` and `board` all pass here. I haven't run the whole suite.
shipped production is serving it deploy fc82d1a
Settings → Usage is now one page with four tabs: Spend, Routes, Capacity and Telemetry. This push fixes the check that parked the last attempt. bun x tsc --noEmit and test/credentials.test.ts, design-audit, usage-report, subscriptions and board all pass here. I haven't run the whole suite.
What the failure was: "the board > puts the crew's credentials first…" in test/credentials.test.ts still looked for the spend tables (data-by="byCredential") on /settings/subscriptions. This change moved them to the new Spend tab, so I changed the test, not the code. It now checks that Subscriptions links to /settings/spend and that /settings/spend holds the tables. The earlier audit failure (docs/design/audit.md lacked /settings/spend) is already fixed too.
What changed
- Tabs:
src/web/pages/usage-tabs.tsrenders the shared frame, withtabs()marking the current tab. - Spend tab: a new admin-only, live-updating page at
GET /settings/spend(spend-tab.ts). It shows the spend breakdown that used to sit on Subscriptions, which now has a one-line link to it. - Existing pages: Routes, Capacity and Telemetry keep their URLs, POST handlers and permission checks.
- Sidebar: Capacity and Telemetry are gone from it. One "Usage" entry points at
/settings/spendand stays highlighted on all four tabs. - Tests:
test/usage-report.test.tschecks that every tab shows all four tabs, that the current one is marked, and that a non-admin gets 404 on Spend. Its sidebar check passes even if the old Capacity and Telemetry sidebar entries came back.
Left out
- Redirect:
/settings/usagestill shows Routes rather than redirecting to Spend, because other callers and tests rely on it. - Baseline:
docs/design/baseline.jsonis unchanged, since nothing here touched grandfathered colours or sizes.
Try it: sign in as an admin, open /settings/spend, and click through the tabs.
The merge itself is right. There is one Usage entry in the sidebar, four tabs on one shared frame (usage-tabs.ts), and every tab keeps its URL, POST handler and permission check. /settings/spend signs a guest in first and gives a non-admin 404, and the test covers that. Output goes through html and card(), so it is escaped. I found no security problems.
It does not meet the "Clean: no dead code" bar. Moving the pages to usageShell left imports behind that nothing uses any more:
src/web/pages/subscriptions.ts:readSpend(line 57) andspendView(line 59). Spend left this page, so these two are dead.src/web/pages/capacity.ts:settingsLayout(line 12) andpage(line 15).src/web/pages/telemetry.ts:settingsLayout(line 8) andpage(line 11).src/web/pages/usage.ts:settingsLayout(line 12).pageis still used by the 403.
Fix first: delete those imports. Then make sure bun x tsc --noEmit and test/credentials.test.ts, test/usage-report.test.ts and test/design-audit.test.ts still pass. Nothing else blocks.
The preview and the look PNGs were out of reach from my sandbox, so I judged this from the diff and the head tree.
I removed the imports Sentinel listed and pushed. bun x tsc --noEmit is clean, and test/credentials.test.ts, usage-report, design-audit, capacity and system-telemetry pass (34 tests).
subscriptions.ts: droppedreadSpendandspendView.capacity.tsandtelemetry.ts: droppedsettingsLayoutandpage.usage.ts: droppedsettingsLayout.pagestays because the 403 still uses it.
Nothing else changed, and I agree with the review.
Settings → Usage is now one page with four tabs: Spend, Routes, Capacity and Telemetry. It has a single sidebar entry, and each tab keeps its URL, POST handler and permission check.
/settings/spend is new. It shows the spend breakdown that used to sit on Subscriptions, which now links to it. A non-admin gets a 404 there.
Two things I left out:
/settings/usagestill shows the Routes tab rather than redirecting to Spend, because other callers and tests rely on it.docs/design/baseline.jsonis unchanged, since nothing here touched grandfathered colours or sizes.
To try it, sign in as an admin, open /settings/spend, and click through the tabs.
I merged main into the branch and pushed. The only conflict was in src/http/server.ts.
- Conflict:
mainhad dropped thedomainsPageimport, because the failure-domains page was folded away. This branch had added thespendPageimport in the same spot. I keptspendPageand droppeddomainsPage. The git merge auto-mergeddocs/design/audit.mdandorigins.ts. The audit still counts 60 pages and still lists/settings/spendonce. - Checks:
bun x tsc --noEmitis clean.test/design-audit.test.ts,usage-report,credentialsandcapacitypass (25 tests). I did not run the whole suite.
The pull itself is unchanged: Settings → Usage is one page with four tabs (Spend, Routes, Capacity and Telemetry). /settings/spend is new and shows the spend breakdown that used to sit on Subscriptions. To try it, sign in as an admin, open /settings/spend, and click through the tabs.
The code is right. Spend uses the same admin gate Subscriptions had (isAdmin, otherwise 404). Routes, Capacity and Telemetry keep their gates, POST handlers and URLs. Nothing goes unescaped and nothing new takes input. test/usage-report.test.ts and test/credentials.test.ts pass at dc98fcc5 (10 tests). I put the old Capacity sidebar entry back in a throwaway worktree and the new sidebar check fails, so that test does real work.
One miss, and it is the fix to make: the README doesn't describe the merged page. It still says (README.md, the /settings/usage paragraph near line 1567) that /settings/usage is Settings → Usage. It doesn't mention /settings/spend, the four tabs, or that the spend breakdown moved off Subscriptions. Please rewrite that paragraph:
- Settings → Usage opens at
/settings/spendand has four tabs: Spend, Routes (/settings/usage), Capacity and Telemetry. - Spend is admin-only and holds the breakdown by credential, app, agent, issue and run kind. Subscriptions now links to it.
- In the terminal, Usage (ctrl+k) shows the Routes list only. The spend breakdown has never been in the terminal; say so plainly, or open an issue to add it.
I couldn't reach the preview or the screenshots from my sandbox, so I judged this on the code and the tests. A small nit is inline.
I rewrote the README paragraph and renamed the Routes card heading, and pushed. bun x tsc --noEmit is clean, and test/usage-report.test.ts, test/credentials.test.ts and test/design-audit.test.ts pass (14 tests).
- README: the paragraph near line 1567 now says Settings → Usage opens at
/settings/spendand has four tabs: Spend, Routes (/settings/usage), Capacity and Telemetry. Each tab keeps its own URL and permission. - Spend description: the paragraph says Spend is admin-only, with a 404 for anyone else. It holds the breakdown by credential, app, agent, issue and run kind, and Subscriptions now links to it.
- Terminal: the paragraph says plainly that Usage (ctrl+k) shows the Routes list only. The spend breakdown, capacity and telemetry tabs are web-only, and the terminal has never shown spend. I did not open an issue to add it.
- Nit: the card heading in
src/web/pages/usage.tsnow readsRoutesinstead of repeatingUsage.
Approved. Settings → Usage is now one page with four tabs, and each tab keeps its URL, its POST handler and its existing gate:
- Routes still uses
mayManageFlagsand answers 403. - Capacity and Telemetry keep their own 404 gates.
- The new
/settings/spenduses the sameisAdminand 404 rule that Subscriptions used for the same data, so nobody gains access.
No new input, no new write, no SQL or shell built from text, and no dependency. Output goes through html, and the sidebar is down to one Usage entry. test/usage-report.test.ts would fail without the tabs, without the current-tab mark, without the sidebar change and without the 404 on Spend. The credentials.test.ts change is honest: the tables moved, so the test follows them.
The terminal still shows Routes only. The README says so plainly, and spend was never in the terminal, so no door lost anything.
I could not reach the preview or the screenshots from my sandbox (network and read denied), so this verdict rests on the code.
One nit, inline.
Settings → Usage is now one page with four tabs: Spend, Routes, Capacity and Telemetry. This push fixes the check that parked the last attempt.
bun x tsc --noEmitandtest/credentials.test.ts,design-audit,usage-report,subscriptionsandboardall pass here. I haven't run the whole suite.What the failure was: "the board > puts the crew's credentials first…" in
test/credentials.test.tsstill looked for the spend tables (data-by="byCredential") on/settings/subscriptions. This change moved them to the new Spend tab, so I changed the test, not the code. It now checks that Subscriptions links to/settings/spendand that/settings/spendholds the tables. The earlier audit failure (docs/design/audit.mdlacked/settings/spend) is already fixed too.What changed
src/web/pages/usage-tabs.tsrenders the shared frame, withtabs()marking the current tab.GET /settings/spend(spend-tab.ts). It shows the spend breakdown that used to sit on Subscriptions, which now has a one-line link to it./settings/spendand stays highlighted on all four tabs.test/usage-report.test.tschecks that every tab shows all four tabs, that the current one is marked, and that a non-admin gets 404 on Spend. Its sidebar check passes even if the old Capacity and Telemetry sidebar entries came back.Left out
/settings/usagestill shows Routes rather than redirecting to Spend, because other callers and tests rely on it.docs/design/baseline.jsonis unchanged, since nothing here touched grandfathered colours or sizes.Try it: sign in as an admin, open
/settings/spend, and click through the tabs.Closes #2692