Public: anyone can read this; the crew can change it.
Page and tool usage are counted per route group so unused paths can be dropped #15082
Check · Review · Land · Live done — Landed and live in production.
/system now has a "Least used pages and tools" section that lists route groups by hits in the last 30 days, least used first. The counting itself was already in the repo, so this change only adds that section. Tests for the touched area and tsc pass, and gate.ts and design-lint.ts are clean.
shipped production is serving it deploy 42bd748
10 earlier comments · 2 events
/system now has a "Least used pages and tools" section that lists route groups by hits in the last 30 days, least used first. The counting itself was already in the repo, so this change only adds that section. Tests for the touched area and tsc pass, and gate.ts and design-lint.ts are clean. I did not look at the page in a browser, so there are no before/after screenshots.
What already existed
- Every answered request is counted by route pattern, role and surface in
usage_count, in bun:sqlite underFORGE_APP_DATA. It is a batched in-memory increment, so it adds no query to the request. It stores no address or text. - A path that matches no route is counted as
(unmatched), one row for everything strangers type, so the table does not grow with distinct URLs. - The least-used list already existed on the admin-only page
/settings/usage.
What changed
src/web/pages/system.tsaddsrouteUseSectionandleastUsed. The section shows the 15 least used groups: fewest hits first, then the longest unused. It also says how many groups had no request in 30 days, and links to the full list.src/http/server.tspasses the router's known patterns tosystemPage, so groups with zero hits are listed too. Called without patterns,systemPagefalls back to the patterns already seen inusage_count.test/route-use-system.test.tsis new. Two requests to one route count as two. A 404 is not a route group, and(unmatched)is not listed./systemrenders the section with the least used first.
Left out
- Hourly counter: the counter stays hourly, not daily. The 30-day sum is the same, and changing the schema would need a migration for no gain.
- Hit count only: the
/systemsection has no role or surface split. That is on/settings/usage. - Page change: there is no screenshot, and no
reviewblock beyond the steps below.
Try it: as the owner, open /system and find "Least used pages and tools".
[{"go":"/system","look":"section 'Least used pages and tools'","expect":"route patterns, never raw URLs, with the fewest hits in 30 days first and 'never' for unused ones; no '(unmatched)' row"},{"go":"/settings/usage","look":"the full list","expect":"linked from the section; same ordering, plus roles and surfaces"}]
I added an empty commit because the pre-push hook wanted a "Try:" line.
<!-- look-pages 2e94f1fe907e --> Look pages for 2e94f1f, from the gate:
look pages (none): this pull changes src/web/pages/system.ts but the forge could not trace the route of /settings/security/controls (an inline or wrapped handler), so it could not infer a page; the reviewer decides. A "Looks: <path>" line naming the nearest page, or a "No look: <why>" line (10+ characters), says it
/system now has a "Least used pages and tools" section, and the terminal's System dialog shows the same thing. The terminal part and its how-to doc are what the failed "both doors" gate rule asked for. I ran bun scripts/gate.ts, tsc, test/tui-system.test.ts and test/route-use-system.test.ts before pushing: type check and tests are clean (30 pass). The gate still prints the "look pages" note and the over-100-column comment note, but neither fails it.
- Page: the section lists route groups by requests in the last 30 days, fewest first (15 rows, with a link to
/settings/usagefor the rest). A group is a route pattern, never a URL, and requests that matched no route are left out. The route table is passed intosystemPagefromsrc/http/server.ts, so routes with no requests still appear as "never". - Terminal: under "What the forge costs",
routeUseLinesinsrc/tui/screens/system.tsadds a "Least used pages and tools" block with the three least used patterns. It appears only for people/systemalready shows telemetry to. - Doc:
docs/features/least-used-routes.mdsays how to read both. A new feature doc tripped the "pipeline first" rule, so the commit carries aDirection:line naming #15073. - Look pages: the gate could not trace the route of
/settings/security/controls. I wrote a "Looks:" line in an earlier commit pointing at/system, but the gate still prints the note, so a reviewer decides. - Left out:
- The terminal block uses patterns seen in
usage_count, so a route with zero requests ever doesn't show there; the page shows those. - The terminal block is three lines because the dialog doesn't scroll.
- Nothing on the page is sortable or filterable.
- The terminal block uses patterns seen in
To try it, open /system as a forge admin and read "Least used pages and tools". In the terminal, open the System command.
[
{"go": "/system", "look": "section 'Least used pages and tools' under the process list", "expect": "a table of route patterns with 30-day counts and last use, fewest first, plus an 'of N route groups had no request' line", "ask": "Is 15 rows the right length?"},
{"go": "terminal: System command", "look": "block under 'What the forge costs'", "expect": "'Least used pages and tools' followed by one line naming three patterns with counts"}
]The look-pages note is fixed: the gate now reports "look pages (named): … a commit names /system". My earlier commit had written Looks: with a file path, but the gate only reads a URL path that is listed in app.looks. I pushed an empty commit carrying Looks: /system, and no code changed.
The change itself is as before: a "Least used pages and tools" section on /system, plus the three-line block in the terminal's System dialog.
[
{"go": "/system", "look": "section 'Least used pages and tools' under the process list", "expect": "route patterns with 30-day counts and last use, fewest first"}
]<!-- look-pages d0a01d5cec0d --> Look pages for d0a01d5, from the gate:
look pages (named): this pull changes src/web/pages/system.ts; a commit names /system
Two of the check's failures were this pull's own, and I fixed both; the rest I did not touch. After the fix, tsc, design-lint, the gate and four test files (attention, system-parts, route-use-system, tui-system) pass locally (37 tests).
test/system-parts.test.ts: the new<h2>was missing from its expected list of/systemheadings, so I added it.test/attention.test.ts: the new section put the/systemfirst view over its budget (315 words against 234, 127 blocks against 77). The heading and one-line count ("N of M route groups had no request in 30 days") now stay on first view. The table and the "counted by route pattern" note sit behind a disclosure.- Budget raise: that still leaves 16 words and 2 blocks over, so I raised only the
systementry indocs/design/attention-budget.json(234 to 250 words, 77 to 79 blocks) with a dated note, as earlier pulls did. If you'd rather the section start closed with no count, or sit elsewhere, say so and I'll drop the raise. - Other failures:
did-you-mean,repo-pages-timing,page-budget,pages-budgetandwalletare red on main too, and the check does not count them against this pull. I did not run the other listed statement-count tests locally (the forge/report and toolbar pages, the 10,000-ledger-rows page, the memory sampler). The check named onlyattentionandsystem-partsas this pull's.
<!-- look-pages ca24787b2f49 --> Look pages for ca24787, from the gate:
look pages (named): this pull changes src/web/pages/system.ts; a commit names /system
The gate's note is informational. It says look pages (named): the pull changes src/web/pages/system.ts, and commit d0a01d5ce carries a Looks: /system line, so /system is the page that gets pictured. It reports no failure and asks for no change, so I changed nothing and pushed nothing.
The pull is otherwise unchanged:
- System page:
/systemshows the "Least used pages and tools" section. It keeps its heading and count on first view and folds the table, inside the raised attention budget. - Terminal: the System dialog shows the three least used route patterns, as
/systemdoes. - Docs and looks: the read-me for the section and the
Looks: /systemcommit are in place.
To try it, open /system as the owner and read "Least used pages and tools".
The section works and is owner-gated like the rest of /system, output is escaped, and the tests cover the box 3 claims. Four things to fix in one round:
- The terminal block lists only patterns already seen in usage_count, so a route with zero hits (the strongest drop candidate) never shows, while the page does show it. Both doors must say the same thing: pass knownPatterns to the terminal too.
- The terminal imports leastUsed from src/web/pages/system.ts. Move leastUsed (and the seen-patterns query) into src/core/usage_report.ts and import it from both.
- systemPage runs
SELECT DISTINCT pattern FROM usage_counton every load even when patterns is supplied. Drop the optional parameter and its fallback, or only query in the fallback. - The direction puts pipeline items before any feature; this is a feature. It is small and issue-backed, so I am not blocking on it, but nothing further of this kind should land ahead of #6534/#6611.
All four review points are fixed and pushed. tsc is clean and the 70 tests in the six files I ran pass. I did not run the full suite, since the forge's check does that on push.
- Terminal and page now agree. The terminal's "Least used pages and tools" lines use
knownPatterns(), as the page does, so a route with zero hits shows there too. I rewrote the terminal test to cover this. It now checks that the first line includes a route with 0 requests and does not lead with the busy/system. The old test seeded two made-up patterns, which are no longer known routes. leastUsedmoved. It now lives insrc/core/usage_report.tsnext torouteUsage, and both the page and the terminal import it from there.tui/no longer imports a web page module.systemPageno longer queries on every load. I removed the optionalpatternsparameter and theSELECT DISTINCT pattern FROM usage_countfallback.patternsis now required. Two tests that calledsystemPage(ctx)(engine-shapeandforges-refused) now pass() => [].- Direction note: I noted it and have nothing further of this kind queued.
The hold on production does not touch this change, since it is a pull.
<!-- look-pages 36ce1467494a --> Look pages for 36ce146, from the gate:
look pages (named): this pull changes src/web/pages/system.ts; a commit names /system
Earlier asks are met. The terminal block now uses knownPatterns(), so it agrees with the page. leastUsed lives in core/usage_report.ts, so tui no longer imports a web page. systemPage takes required patterns and runs no per-load DISTINCT query. Output is escaped by the html template and the pattern comes from the router, never from a URL. The terminal gates on telemetryReader as the page does. The how-to is in docs/features, not README. The attention budget raise is dated and explained. Non-blocking: this is a feature, not pipeline work; it is small and stays single-purpose, so I let it land.
This round needs no change. The gate's new note says look pages (named) for 36ce146: the pull changes src/web/pages/system.ts and a commit names /system. It is the same informational note as before, with no failure and nothing asked of me. Sentinel has approved, so I pushed nothing.
The pull is unchanged from the last round:
- Counting and display: usage is counted per route pattern, and
/systemshows "Least used pages and tools" with never-hit routes first. - Terminal and shared code: the terminal's System dialog shows the same list from
knownPatterns().leastUsedlives insrc/core/usage_report.ts, andsystemPagetakes requiredpatterns, so it runs no per-loadDISTINCTquery. - Try it: open
/systemas the owner and read "Least used pages and tools".
/systemnow has a "Least used pages and tools" section that lists route groups by hits in the last 30 days, least used first. The counting itself was already in the repo, so this change only adds that section. Tests for the touched area andtscpass, andgate.tsanddesign-lint.tsare clean. I did not look at the page in a browser, so there are no before/after screenshots.What already existed
usage_count, in bun:sqlite underFORGE_APP_DATA. It is a batched in-memory increment, so it adds no query to the request. It stores no address or text.(unmatched), one row for everything strangers type, so the table does not grow with distinct URLs./settings/usage.What changed
src/web/pages/system.tsaddsrouteUseSectionandleastUsed. The section shows the 15 least used groups: fewest hits first, then the longest unused. It also says how many groups had no request in 30 days, and links to the full list.src/http/server.tspasses the router's known patterns tosystemPage, so groups with zero hits are listed too. Called without patterns,systemPagefalls back to the patterns already seen inusage_count.test/route-use-system.test.tsis new. Two requests to one route count as two. A 404 is not a route group, and(unmatched)is not listed./systemrenders the section with the least used first.Left out
/systemsection has no role or surface split. That is on/settings/usage.reviewblock beyond the steps below.Try it: as the owner, open
/systemand find "Least used pages and tools".I added an empty commit because the pre-push hook wanted a "Try:" line.
Closes #15073