Repository navigation
perf(dash): fix four page-overflow defects and serve the UI assets gzipped - #169
Merged
Merged
Conversation
added 5 commits
September 1, 2026 13:22
dash/ui.go set Cache-Control, ETag and a CSP and never looked at Accept-Encoding, so all ~705 KB of JS and ~91 KB of CSS went over the wire raw on every dashboard load. Be clear about what this buys, because the obvious framing is wrong. On loopback the four scripts cost ~31 ms of DOMContentLoaded but ~99 ms of main-thread CPU, 98% of it app.js — so compression is not the local bottleneck, execution is, and a local user will not feel this. What it fixes is the hosted multi-tenant service, where the same bytes cross a WAN. Measured at 1.6 Mbit/s / 150 ms RTT, 1440x900, 5 cold loads each, median: FCP 1276 ms -> 600 ms, DCL 4388 ms -> 1570 ms, js+css wire 760K -> 232K Compressed once at process start rather than per request: the bytes never change for the life of the process, so a gzip.Writer per response would burn CPU to produce an identical body. compress/gzip is stdlib, so there is still no build step, no dependency and no CDN. An asset that does not shrink is left out of the map and served raw, as is a client that does not accept gzip or refuses it with gzip;q=0. Vary: Accept-Encoding on every asset response and a distinct ETag for the compressed representation, so a shared cache cannot answer a raw client's revalidation with a gzip body it stored earlier. Cache-Control and the CSP are unchanged. Raw / gzip -9 / brotli -11 for reference (brotli is not shipped: no stdlib support and a dependency is not worth 5 points of ratio): app.js 473222 145814 119037 tools.js 108553 33414 28021 kvcache.js 76175 23211 19823 campaigns.js 46744 14176 12162 style.css 74610 19754 16658 tools.css 12415 3919 3260 kvcache.css 4586 1862 1492 index.html 55749 15762 13251 TOTAL 852054 257912 213704 (-70% / -75%) Signed-off-by: Osher-Elhadad <[email protected]>
They already sit at the end of <body> and none of them needs to block paint,
so this removes ~705 KB of JS from the parser's critical path and satisfies the
"no synchronous JS before first paint" budget line.
Measured honestly: it changes nothing you can see today. Medians over 9-10 cold
loads per arm, against the gzip commit as the baseline:
6x CPU throttle, loopback DCL 667 ms (580..877) -> 587 ms (538..660)
slow-4G, 1x CPU DCL 1570 ms -> 1549 ms
1440x900 loopback, 10 runs DCL/FCP/contentReady all move less than the
run-to-run spread, in inconsistent directions
DESIGN 4.3 item 2 predicted this would take "~380 ms of throttled parse+eval
off the pre-paint path". It does not, and the reason is worth writing down: a
deferred script still executes before DOMContentLoaded and still before first
paint if the paint has not happened. defer changes when a script runs relative
to PARSING, and these four already run after the last byte of markup, so there
was no parse work left for them to block. Keep the change because it is
correct-by-default -- a script that later moves above content cannot silently
become parser-blocking -- not because it is a speedup.
Mount order still holds: defer preserves document order, so tools.js,
kvcache.js and campaigns.js still splice their tabs in after their named
siblings. Verified from the live DOM, all 17 tabs in the documented order:
overview usage tools keepalive kvcache components sessions requests benchmarks
archive setup settings feedback tenants strategies campaigns config.
The kvcache test matched the literal tag text, so it read `defer` as the tag
having been removed; it now matches the src alone, which is what it meant.
Signed-off-by: Osher-Elhadad <[email protected]>
index.html:583 wrapped the keep-alive live table in <div class="scroll-x">, and
.scroll-x is defined in no stylesheet -- grep -n 'scroll-x' dash/ui/*.css
returned nothing. The class that works is .tblwrap. Computed overflow-x was
therefore `visible`, an 1114 px table sat in a 390 px body, and the page
scrolled sideways, which the design brief forbids outright. Two more tables had
the same defect underneath it.
Measured with the sweep harness's overflow audit, all 17 tabs, dark, 390x844:
before after
keepalive body +753 px no
kvcache body +16 px no
strategies body +183 px no
(14 others) no no
Three fixes and two root causes:
- keepalive: .scroll-x -> .tblwrap, and the ladder table at app.js:8722 was
appended bare. Fixing only the live table exposed the ladder at +179 px --
the second defect had been hiding behind the larger number. Nine more bare
appendChild(tbl) sites remain in app.js (4028, 6081, 6454, 6494, 6598, 7028,
7084, 8533, 8623); none of them overflows any tab today, and app.js is being
restructured on another branch, so they are left for that diff.
- kvcache: the feature-importance tables were the only ones in the file not
wrapped (compare :712, :822, :1077, :1139, :1275, :1317). Wrapping them alone
was not enough: a grid child defaults to min-width:auto, so the .tblwrap's own
parent refused to shrink and the table pushed the column instead of scrolling
inside it. .grid-2 > * { min-width: 0 } is the actual fix, and it matches the
.panel > * / .card > * rules two lines above it.
- strategies: a <select> is as wide as its widest option and a <fieldset> will
not shrink below its own min-content, so one long option in the strategy form
made a 544 px fieldset in a 390 px viewport. fieldset { min-inline-size: 0 }
plus max-width: min(520px, 100%) on the form controls, which keeps the 520 px
cap on a wide screen.
Every wrapper gets tabindex="0", as the existing eight in index.html do, so the
new scroll containers are reachable from the keyboard.
Signed-off-by: Osher-Elhadad <[email protected]>
…ndant Found by re-running the overflow audit against the seeded corpus after it grew to 16,444 requests: the Inventory tab only breaks once the tool tables actually have rows, so the earlier sweep on a sparse corpus reported it clean. Two `1fr`/auto grid tracks that floor at min-content: - .inv-group's implicit auto track took its width from the longest line of the `white-space: pre` removal snippet, so the card grew past the viewport and .inv-snippet's own overflow-x never got to scroll. - .cg-item's `1fr` track took its width from an unbreakable tool name (mcp__sentry__analyze_issue_with_seer). The @media (max-width: 560px) block re-declares the same track, so it has to agree or it wins at 390px. minmax(0, 1fr) in all three places. Measured, dark, 390x844, two runs each, both with the tables populated (1,556 text nodes -- a run reporting 24 is an empty render, not a pass): clippedOff 48 -> 0 unreachable content, the audit's worst category bodyScrollsX +159 -> +138 px The clipping is fixed; the sideways scroll is NOT. 138 px still remain and the audit attributes them to no element -- `overflowPage` is empty while `bodyScrollsX` still says yes, with 1,678 elements correctly excluded as inside a scroller. That disagreement needs resolving before the rest can be diagnosed, and what is left of the row layout is a question about what should truncate at mobile width rather than another grid track. Left for whoever owns Inventory; `tools` is the one tab of 17 still failing the constraint. Both classes are tools.js-only, so the blast radius is the Inventory view. Verified no regression on `components` or on tools at 1440x900. Signed-off-by: Osher-Elhadad <[email protected]>
…ngth net/http's serveContent skips Content-Length once Content-Encoding is set, so the compressed assets go out chunked; the comment claimed the opposite. Names the trap too, because the obvious fix breaks Range: ServeContent answers a Range request with a 206 body but will not overwrite a Content-Length we set ourselves, so a full-body length there is a broken response rather than a missing progress bar. Signed-off-by: Osher-Elhadad <[email protected]>
Closes the last of the 17 tabs still scrolling the page body sideways at
390px. The offender is `.inv-removal-fold > summary { white-space: nowrap }`
(tools.css:202) holding "Remove just mcp__postgres__describe_table" — one
unbreakable 414px line in a 390px viewport.
The nowrap is there for a reason the comment states: the fold also sits in a
table cell, where wrapping would stretch the row. In the card layout there is
no row to stretch. So the override is scoped to the narrow breakpoint and
placed AFTER the original — same specificity, and a media query adds none, so
an override sitting in the earlier @media block at :102 silently loses.
Measured, two runs each, dark and light, both with the tables populated
(1,556 text nodes and 115 items; a run reporting 24 nodes is an empty render):
bodyScrollsX +138px -> no, body.scrollWidth exactly 390 at 390px
clippedOff 0 -> 0 (already fixed by the minmax(0, 1fr) tracks)
1440x900 unaffected
Finding this needed a different predicate than the audit's. `overflowPage`
compares bounding rects; `bodyScrollsX` reads body.scrollWidth, which includes
descendants' scrollable overflow region. A box with overflow-x:visible whose
content overflows keeps its own rect inside the viewport, so a rect scan finds
nothing at any tolerance — which is why 138px sat unattributed. Reach is
`left + max(scrollWidth, width)`, and the check must skip any element with a
scrolling ancestor or every cell inside a .tblwrap reads as page overflow.
Signed-off-by: Osher-Elhadad <[email protected]>
OsherElhadad
pushed a commit
that referenced
this pull request
Sep 1, 2026
…x constraint Correcting my own correction. I reported that impl-perf's three `minmax(0, 1fr)` tracks were a no-op on this branch, on the strength of an isolation test that injected each rule's pre-fix value back with `!important` and read `body.scrollWidth`. That test is unsound: actually removing the commits gives a different answer. Two builds, same corpus, same harness, back to back, only those two commits differing: with 9fc2835 + 65e7b6d tools @390: clippedOff 0, reachOver 0, no without them tools @390: clippedOff 48, reachOver 4, YES +159px So the tracks ARE load-bearing here, my "no-op" claim was wrong, and impl-perf's original measurement stands unamended. I do not know why the `!important` simulation reported 390 — most likely an explicit `auto` track is not equivalent to the implicit one it replaced — but the mechanism does not matter next to the result: simulating a revert is not reverting it, and I should have rebuilt. The cherry-picks are dropped anyway, because ownership is the better argument and it is impl-perf's call on its own rules: #169 is where they are measured against `main`, and one rule wants one owner. The consequence is a real dependency rather than a masked one: THIS BRANCH MUST NOT MERGE BEFORE #169. On its own it reports clippedOff 48 and bodyScrollsX +159px at 390 on the Inventory tab, which violates the BRIEF's hard constraint. With #169 in, all four theme x viewport combinations report 0 / 0 / no. My own two rules stay deleted: those really were no-ops, measured by both of us independently, and dropping them is not what broke this. No file changes. This commit exists so the dependency is in the history and not only in a PR comment. Signed-off-by: Osher-Elhadad <[email protected]>
OsherElhadad
added a commit
that referenced
this pull request
Sep 1, 2026
…ions (#172) * fix(dashboard): re-order the Inventory tab to the reader's five questions The owner's verdict on this tab was "it's too loaded and users cannot understand anything from it", against a build in which every feature they asked for already existed. So this changes no feature: it changes the order and the weight. Measured before, at 1440x900 over a 30-session corpus: 8,402 px, 9.3 screens, 2,280 words, and 1,964 px of it — five of the first six blocks — carrying no atom a reader can act on. The first name on the page was at 2,552 px. The panel answering the most specific ask, the system prompt broken into the regions that own it, was 254 px and rendered nothing until clicked, while the panel that merely summarised the same prefix into five legend numbers had 1,005 px: the summary of the prompt was four times the size of the prompt. The projection ($2.16) sat in 100 pt type in the first screen and its outcome ("what we actually saved") 155 px at 66% depth, so the reader never met the pair. The same 39 declarations were re-answered at four granularities across 5,436 px of four tables and 31 columns. What changed, in the reader's order: - The decision comes second, after the headline: the named groups, each with what it is worth across every session that carried it AND per session, in that order, with the command that removes it. A "Do this" block leads it with the ordered names and one combined snippet per mechanism, built by merging the server's own removal documents rather than composing syntax here. - Every group card now renders its benefit, its cost and a signed net as one component (DESIGN 3.7). The cost — one prompt-prefix rebuild at cache-creation rates — existed only in the third paragraph of a collapsed note, so eleven cards each led with a dollar to save and none showed the dollar it costs to save it. On this corpus the net is negative over the first session for every group. - "Realized by your removals" moves next to the projection. Honesty rule 2 was right and was executed as size, which hides a claim rather than distinguishing it; adjacency distinguishes it, and the empty state is now one line instead of a panel. - The composition panel is deleted and its bar moves into the prompt panel, which now renders all 63 regions and the system prompt's 17 named parts without a click, grouped by owner, each with its share drawn. One panel, one denominator, the bar above the thing it summarises. - The four re-answers (flat table, per-server rollup, skills table, self-removals, per-token rates) fold, each stating its own row count on the closed summary. Nothing is deleted. The per-skill opt-out switch is rendered inert with its reason stated: internal/skills/skills.go drops 15 of this corpus's 39 skills into the previous surviving row, so POST /api/toolfilter would remove a run of skills and report one. The skillOverrides snippet never touches that parser and is the route the page leads with. SKILL_SWITCH_SAFE flips when the parser fix lands. After, same corpus and viewport: 7,139 px (-15%), 7.9 screens, 2,074 words, first name at 808 px (-68%), five named things with their figures in the first screen where there were none, 648 px of zero-atom blocks, 63 prompt regions and 17 system-prompt parts rendered at load where there were none. Long tasks over 50 ms: 62 ms -> 0. No horizontal body scroll at 390, contrast 0 failures over 16 pairs in both themes, no focus stop without an indicator, touch targets under 44 px 73 -> 43. go test ./dash/ passes; every existing data-testid is kept. Signed-off-by: Osher-Elhadad <[email protected]> * fix(dashboard): make the Inventory row's name readable, and lock the page at 390 Re-measured on the seeded 200-session corpus (16,444 requests, 69,062 declarations, 132 distinct MCP tools, $247.20 of never-called tokens) rather than the 30-session replay, and three things fell out of the realistic table size that the small corpus hid. The name is the row's identity. This page exists so a reader can decide whether to remove the capability a row names, so a clipped name is not cosmetic: it is two rows a reader cannot tell apart while being asked to delete one. Nine names clipped at 34ch, all of the form mcp__playwright__browser_network_requests. Fixed by dropping the mcp__<server>__ prefix wherever the row already shows its server in its own cell (the prefix is the part that distinguishes nothing, and these names differ at the END, which is exactly what an ellipsis eats), keeping the full name in title, and letting whatever is still long wrap instead of truncate. Nine clipped names becomes zero, and it stays zero with all 815 disclosures forced open. The page scrolled sideways 159 px at 390 on origin/main — the removal snippet asserts min-width 260px, and 22rem for the folded one, inside a card already nested in two levels of padding, while its own <pre> scrolls internally. Zero on narrow screens: body scrollWidth 549 -> 393 with no element in the view past the viewport edge. A long run of prompt regions folds its tail. 132 MCP tools puts 72 regions in one owner group, so the heaviest twelve stay open and the rest fold with their count and share stated — the same shape as the decision list's tail. Two honesty fixes found by rendering real mixed-pricing data: - The system-prompt tile said "System prompt" over what the server computes as the MAXIMUM across captured sessions. This panel now gives that figure more room than it had, so an unqualified label would be a redesign promoting a max as a typical value. It reads "System prompt — largest seen", "the biggest of 170 recorded, not a typical one". - A group whose sessions include an unpriced model rendered n/a with the reason "this scope has no model rates", which is false on a corpus that has a price list and 17 unpriced sessions out of 200. An n/a whose stated reason is wrong is worse than an unreasoned one. It now names the actual absence. Verified on the corpus: 20 n/a marks, every one carrying a reason in both title and aria-label; 313 unpriced pills where the bob/premium tier has no rates; and the 24 remaining $0 cells are rows whose "read for nothing" is literally 0, identical on both builds — a true zero, not an unknown. Before/after, same corpus, both proxies, one browser: 14,920 -> 8,101 px (-46%), 16.6 -> 9.0 screens, 3,653 -> 2,207 words (-40%), first named thing 2,569 -> 823 px (-68%), 0 -> 4 named things with their figures in the first screen, 0 -> 96 prompt regions rendered at load, 2,151 -> 0 elements past the 390 px viewport, 9 -> 0 clipped names, contrast 0 failures in both themes, no focus stop without an indicator. go test ./dash/ passes. Signed-off-by: Osher-Elhadad <[email protected]> * fix(dashboard): lock the Inventory body at 390, and stop "fixing" a deliberate ellipsis Three changes, one of them a revert of my own. REVERTED: the `#view-tools .comp-name.trunc` override that made long names wrap instead of ellipsis. `.trunc` is deliberate, non-lossy truncation — style.css caps it at 34ch and tools.js builds every one of those spans with `title: t.name`, so the value is reachable and nothing is unreachable. Overriding it was fixing working code and losing the ellipsis. The audit finding that sent me there was a false positive of the same shape as the visually-hidden idiom already on the harness's known-false-positive list, and my own probe reproduced it: its predicate tested `scrollWidth > clientWidth` without checking for `text-overflow: ellipsis` together with a `title`. Corrected to `textOverflow === 'ellipsis' && el.title`, the count is 0 before and 0 after — there was never a clipping defect on this tab. shortName() STAYS, on usability grounds rather than accessibility. Every tool of one MCP server shares the `mcp__<server>__` prefix, it consumes most of the 34ch budget, and these names differ at the END — so a reader comparing two rows of the same server sees two identical strings and has to hover each one to tell them apart. A title makes a value reachable; it does not make rows distinguishable at a glance, which is what a table is for. FIXED, and it closes the BRIEF's hard constraint: the page body no longer scrolls horizontally at 390. It was +159 px on origin/main and +3 px after my grid work, and the +3 px was mine. Attribution, because "no element accounts for it" is not a diagnosis: hiding each top-level panel in turn pinned it to the tile band, and a scan of scrollable overflow rather than bounding rects pinned it to `div.v` inside the Avoidable tile — the unpriced fallback renders `645,662,264 tok`, 15 unbreakable characters of 26 px mono, 175 px of content in a 143 px tile. compact() is this file's own convention for exactly these counts (see readTd) and one word fixes it: `646M tok`. The exact figure is in the tables below it. Measured: body scrollWidth 549 -> 390 at 390 px, zero elements past the viewport edge by either bounding rect or scrollable overflow, both themes. 1440 unchanged at 1440. go test ./dash/ passes. Note for reviewers of the metric: a bounding-rect scan and a scrollWidth check disagree whenever content overflows an `overflow: visible` box, because only the second sees it. That is not a harness gap; it is two different questions, and the second one is the one the constraint is about. Signed-off-by: Osher-Elhadad <[email protected]> * fix(dashboard): price the Inventory headline off the priced population, not totals.priced `totals.priced` is false whenever ANY part of the population is unpriced, so on a corpus with 17 unpriced sessions out of 200 it is false in steady state and never flips — while `totals.unused_usd` is a correct $247.20. Two tiles gated their dollar on that flag, so the correct figure rendered as "645,662,264 tok / no dollar: some models here are unpriced", permanently. A number that is right, shown as unknown, is its own kind of dishonesty, and this change had made it worse by moving that figure into the reader's first screen. Both now gate on the priced POPULATION, which is what the dollar actually covers, and name it: coverage.sessions minus coverage.unpriced_sessions. The headline reads "$247.20 — if none of it had been carried, over the 183 of 200 sessions that ran on a priced model". Only when NOTHING is priced does the token fallback apply, because then there is no subset to report and a $0 over an empty set would be a claim. Per-row and per-group dollars are untouched: they already consult their own row's `priced`, which is the right flag at that scale, and they still render `unpriced` through money() rather than a $0 — 313 of them on this corpus. Second defect the same change fixes: the skills-listing cost tile said "unpriced" where the honest answer is "$0". unused_listing_reads is 0 here because every session carrying a listing invoked at least one skill, so the listing was never waste. It now reads $0, which agrees with the "Listing read for nothing: 0" tile beside it, instead of claiming ignorance we do not have. No new field, no client-side derivation — both figures already ship in coverage. The 390 px constraint is closed, confirmed by shots.mjs now that it has a readiness gate, on a rendered view in all four theme x viewport combinations: origin/main reports clippedOff 48, reachOver 4, bodyScrollsX YES +159px against 1,547 text nodes; this branch reports 0, 0, no. textClip is 0 on BOTH, which confirms the .trunc ellipses were never a defect. Signed-off-by: Osher-Elhadad <[email protected]> * fix(dashboard): drop two no-op overflow rules of mine, and correct their attribution I credited 549 -> 393 px at 390 to `.inv-removal { min-width: 0 }`. That was wrong: the two numbers came from two different builds, and I attributed the delta to the rule I had just added rather than isolating it. Isolated properly — injecting each rule's pre-fix value back with !important, on one page, in both the default and the fully-expanded state — all of it is a no-op on this branch: default state, all three rules disabled: 390 px, 0 offenders expanded state, all three rules disabled: 397 px, same 11 offenders as with them enabled What actually locks the default state at 390 is the folding (the 1,221 px flat table is no longer rendered at load) plus compact() on the unpriced tile value. impl-perf independently measured my min-width rule a no-op on its corpus too, so it is a no-op on both and it goes. The summary white-space rule goes with it as a duplicate: impl-perf's 65e7b6d owns that fix, measured against the 414 px "Remove just mcp__postgres__describe_table" line, and carries the comment about the source-order trap that makes it work. One rule, one owner. Signed-off-by: Osher-Elhadad <[email protected]> * docs(dashboard): record that this branch depends on #169 for the 390px constraint Correcting my own correction. I reported that impl-perf's three `minmax(0, 1fr)` tracks were a no-op on this branch, on the strength of an isolation test that injected each rule's pre-fix value back with `!important` and read `body.scrollWidth`. That test is unsound: actually removing the commits gives a different answer. Two builds, same corpus, same harness, back to back, only those two commits differing: with 9fc2835 + 65e7b6d tools @390: clippedOff 0, reachOver 0, no without them tools @390: clippedOff 48, reachOver 4, YES +159px So the tracks ARE load-bearing here, my "no-op" claim was wrong, and impl-perf's original measurement stands unamended. I do not know why the `!important` simulation reported 390 — most likely an explicit `auto` track is not equivalent to the implicit one it replaced — but the mechanism does not matter next to the result: simulating a revert is not reverting it, and I should have rebuilt. The cherry-picks are dropped anyway, because ownership is the better argument and it is impl-perf's call on its own rules: #169 is where they are measured against `main`, and one rule wants one owner. The consequence is a real dependency rather than a masked one: THIS BRANCH MUST NOT MERGE BEFORE #169. On its own it reports clippedOff 48 and bodyScrollsX +159px at 390 on the Inventory tab, which violates the BRIEF's hard constraint. With #169 in, all four theme x viewport combinations report 0 / 0 / no. My own two rules stay deleted: those really were no-ops, measured by both of us independently, and dropping them is not what broke this. No file changes. This commit exists so the dependency is in the history and not only in a PR comment. Signed-off-by: Osher-Elhadad <[email protected]> --------- Signed-off-by: Osher-Elhadad <[email protected]> Co-authored-by: Osher-Elhadad <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Merge order: this must land before #172.
feat/inventory-hierarchy-0901fails the390 px constraint on the Inventory tab without the two
tools.csscommits here — measured onthat branch by actually removing them (
clippedOff 48,+159 px), not by simulating it.Six commits: two defect fixes, two cheap wins, one comment correction. Measured with the
sweep harness (
perf.mjs/shots.mjs) throughout, on a copy of the seeded corpus withboth janitor rules disabled (
--dashboard-retention 0 --dashboard-max-bytes 0).1. Three tabs scrolled the page body sideways at 390 px. Now zero.
index.html:583wrapped the keep-alive live table in<div class="scroll-x">, and.scroll-xis defined in no stylesheet —grep -n 'scroll-x' dash/ui/*.cssreturnednothing. The working class is
.tblwrap(already onmain). Computedoverflow-xwastherefore
visible, an 1114 px table sat in a 390 px body, and the page scrolled sideways,which the design brief forbids outright.
Overflow audit, all 17 tabs, dark, 390×844:
Three fixes, and only one of them was the rename:
.scroll-x→.tblwrap, and the ladder table atapp.js:8722wasappended bare. Fixing the live table exposed the ladder at +179 px.
kvcache.js:1173was not enough. A grid child defaults tomin-width: auto, so the new.tblwrap's own parent refused to shrink and the tablepushed the column instead of scrolling inside it.
.grid-2 > * { min-width: 0 }is theactual fix, matching the
.panel > */.card > *rules two lines above.<select>is as wide as its widest option and a<fieldset>will not shrink below its own min-content, so one long option made a 544 pxfieldset in a 390 px viewport.
fieldset { min-inline-size: 0 }plusmax-width: min(520px, 100%)on the form controls.Process note: fixing the biggest overflow reveals the next one. Two of the three tabs had
a second defect hidden behind the first, so the audit has to be re-run after each fix rather
than once at the end.
2. Inventory (
tools) — 48 elements were clipped out of reachFound by re-running the audit after the seeded corpus grew to 16,444 requests: the tab only
breaks once the tool tables have rows, so the earlier sweep on a sparse corpus called it
clean. Two grid tracks flooring at min-content —
.inv-group's implicit auto track takingits width from the longest line of the
white-space: preremoval snippet, and.cg-item's1frtrack taking it from an unbreakable name likemcp__sentry__analyze_issue_with_seer.The
@media (max-width: 560px)block re-declares the same track, so it has to agree or itwins at 390 px.
minmax(0, 1fr)in all three places.Not a defect, for whoever picks up the rest: the
span.comp-name.truncfindings on this tabare deliberate.
style.css:572isoverflow: hidden; text-overflow: ellipsisandtools.js:961,1073carry the full value in atitle, so the name is truncated on purpose andrecoverable. Same shape as the
.vhfalse positive in the harness README's §6 list.The residual 138 px is also closed, in a third commit. It sat unattributed because the
audit's two checks answer different questions, which is worth recording:
overflowPagecompares bounding rects, while
bodyScrollsXreadsbody.scrollWidth, which includesdescendants' scrollable overflow region. A box with
overflow-x: visiblewhose contentoverflows keeps its own rect inside the viewport, so a rect scan finds nothing at any
tolerance. The predicate that finds it is
left + max(scrollWidth, width) > viewport, and itmust skip any element with a scrolling ancestor or every cell inside a
.tblwrapreads aspage overflow — the mistake two of us made independently.
It named
.inv-removal-fold > summary { white-space: nowrap }(tools.css:202) holding"Remove just mcp__postgres__describe_table", one unbreakable 414 px line. The nowrap is
deliberate — the fold also sits in a table cell, where wrapping stretches the row — so the
override is scoped to the narrow breakpoint and placed after the original. Same
specificity, and a media query adds none, so an override in the earlier
@mediablock at:102 silently loses; that cost a build to discover.
All 17 tabs now pass the constraint,
body.scrollWidthexactly 390 at 390 px, verifiedtwice per theme with the tables populated (1,556 text nodes, 115 items — a run reporting 24
nodes is an empty render, not a pass).
3. The embedded assets are served gzipped
dash/ui.gosetCache-Control,ETagand a CSP and never looked atAccept-Encoding, so~705 KB of JS and ~91 KB of CSS went over the wire raw on every load. Compressed once at
process start with stdlib
compress/gzip, served from memory, raw as the fallback. No buildstep, no dependency, no CDN.
This is a WAN win, not a local one. On loopback the four scripts cost ~31 ms of DCL but
~99 ms of main-thread CPU, 98% of it
app.js— compression is not the local bottleneck,execution is. At 1.6 Mbit/s and 150 ms RTT, 1440×900, 5 cold loads, median (range):
Independently measured end to end at 5 Mbit: 831 KB → 252 KB, ~1,362 ms → ~412 ms.
Brotli is deliberately not shipped, and this should not be re-opened: Go has no stdlib
brotli, so it means a new third-party dependency in a product whose whole constraint is that
it works air-gapped with no CDN and no build step — for 5 percentage points of ratio over
gzip. Bad trade.
Caching correctness, since this is the part that breaks quietly:
Vary: Accept-Encodingon every asset response, not only compressed ones. A sharedcache that stored the raw body under an unvaried key would later hand it to a client that
asked for gzip, and vice versa.
"<v>-gzip"ETag. A differentContent-Encodingis a different representation,so it needs a different validator, or a cache revalidating with one can 304 a raw client
into a compressed body.
gzip;q=0is an explicit refusal and is honoured.process, so a
gzip.Writerper response would burn CPU to produce an identical body.One caveat, documented at the site:
net/http'sserveContentskipsContent-LengthonceContent-Encodingis set, so compressed assets go out chunked and show no download progress.Do not "fix" it by setting
Content-Length—ServeContentanswers a Range request with a206 whose body is only the requested slice and will not overwrite a length we set, so a
full-body length there is a broken response rather than a missing progress bar.
4.
deferon the four scripts — shipped, and it is NOT a speedupDESIGN §4.3 item 2 says
defer"removes all ~380 ms of throttled parse+eval from thepre-paint path". Measured, it does not. A deferred script still runs before
DOMContentLoadedand still before first paint if the paint has not happened;deferonlychanges timing relative to parsing, and these four scripts already sit after the last byte
of markup, so there was no parse work left for them to block.
Why n=9 rather than n=5: a 5-run pass showed 6× DCL going 517 → 753 ms, which reads as a
serious regression. At n=9 it reversed. The delta was inside the run-to-run spread the whole
time and the scary number was noise. Every figure above is quoted as a range for that reason.
Kept because it is correct-by-default — a script that later moves above content cannot
silently become parser-blocking — not because it makes anything faster.
Mount order verified from the live DOM rather than assumed: 17 tabs, in the documented order
(
overview usage tools keepalive kvcache components sessions requests benchmarks archive setup settings feedback tenants strategies campaigns config).deferpreserves documentorder, so the three self-mounters still splice their tabs in after their named siblings.
What this PR does NOT do
These changes do not address the dominant cost of this dashboard. That is server-side
query time:
Overviewalone measures 434–659 ms at 16k requests and extrapolates to ~3.6 sat production's 133k, and
/api/facetscosts ~637 ms for a 1 KB response on every tabswitch (
app.js:4468callsloadFacets()from everygo()). I measured/api/componentscold at 2,192 ms and, on a second run of the same probe, 3,718 ms — the largest single number
on the page. Against that, the whole four-file JS payload is ~99 ms of CPU and ~31 ms of DCL.
That work is tracked in
perf/dash-query-cost-0901. Nothing here makes this dashboardfast on a real deployment.
Scorecard on DESIGN §4.3
Its five no-build techniques were a reasonable set of hypotheses. Measured: one pays as
prescribed, one pays in a placement the doc did not name, and three measure as nothing where
they were applied.
item 2,
defer— no measurable effect in any of four conditions (above).item 3, lazy-load the three self-mounting views —
kvcache.jscosts 0.5 ms of CPUagainst
app.js's 80.6 of 82.5 ms (98%), and the tab it belongs to spends ~992 ms in oneAPI call. Lazy-loading it would optimise a 0.5 ms cost on a page waiting a second for data.
After item 1 most of the byte win (~71 KB gzipped) is already taken. Not built.
item 5,
content-visibility: auto— inert where the doc prescribes it, effectiveelsewhere. On inactive views it does nothing:
style.css:161is[hidden] { display: none !important; }, all 16 inactive views computedisplay: nonewithzero client rects, and the property has no effect on a box that is not generated. Measured
at 6× throttle, n=9: FCP 272 → 260 ms, DCL 587 → 569 ms, both inside overlapping ranges.
Not shipped here. But
impl-trafficmeasured it on a long list inside a rendered view— paired A/B in one page, rule swapped via
insertRule, three runs each, 1,200 blocksexpanded — and got 1,022/957/997 ms against 3,175/3,130/3,248 ms at identical DOM node
counts (86,327), a ~3.2× win. So the property works; placement decides whether it does
anything, and a flat item list cannot express that. Note also that node count and time
measure different fixes there: the diff view's 915k → 17k node drop is entirely the deferred
render, and
content-visibilitycontributes zero nodes and ~2.2 s.If you apply it:
contain-intrinsic-sizemust be the measured collapsed height percomponent, not a shared constant.
impl-traffic's diff blocks areauto 37px; the 44px wehad agreed on by eye inflated the scroll height ~18%.
So of the five, gzip (item 1) pays as prescribed and over a WAN;
content-visibilitypays ina placement item 5 does not name; items 2, 3 and 5-as-written measure as nothing.
Deferred, with owners
app.jssplit — sequenced afterimpl-nav, which defines the module seams;app.js:4218on that branch now names all four. Doing it twice is wasted work.appendChild(tbl)sites inapp.js— known-latent, none overflows any tabtoday. "Today" is doing real work in that sentence: a table with no scroll container is
only visibly broken once its content is wide enough, so this is a statement about the
current data, not about the code. Demonstrated twice on this branch —
ka-ladderwasinvisible until the larger keep-alive overflow in front of it was fixed, and
toolsauditedclean on a 14,876-request corpus and failed at 16,444. Routed:
impl-navtakes 6081loadMachines, 6454loadTokens, 6494loadAudit,6598
loadTenants, 7028loadVariants, 7084loadArchive(all Admin-group, its ownseam);
impl-tabstakes 4028toggleBenchTasks, 8533loadKAArmed, 8623loadKABehaviour..tblwrapis already onmain, so none of them depends on this branch.X-Cache: hit|miss— proposed, not built; it touches the API surface. Handed toimpl-querywith the paired probe, because the 5 s cache is the only thing hiding a 637 mscall. The cache is also why every perf number here needs a stated cache side: Overview
contentReadyranged 247..922 ms over 10 cold runs (273% spread) on that alone.total_saving_knownrenderingn/a— not taken, and the premise does not hold onthis branch. The field does not exist on
main; it arrives withorigin/fix/dash-money-formulas-0901(kvcachesuggest.go:183). Its consumer iscampaigns.js, notkvcache.js, and nothing in the front end renders the figure at all —the only mention is
campaigns.js:659deliberately dropping it from a POST, with a commentsaying why. So there is no number on screen to turn into
n/a. It belongs to whoever landsthe money-formulas branch.
Pre-existing bug found, not fixed
ui.go:186gives every asset the sameETag("<assetVersion>"). A client revalidatingstyle.csswith anIf-None-Matchit obtained fromapp.jsgets a 304 and then serves thewrong file. Browsers key
If-None-Matchper URL so it does not fire in practice, but ashared cache or a hand-rolled client can. Behaviour left intact as briefed; this PR only
splits raw from gzip.
Tests
New
dash/uigzip_test.gocovers the negotiation, ETag distinctness,Vary, andgzip;q=0.uikvcache_test.go:216matched the literal<script src="kvcache.js">and so readdeferas the tag having been removed; it now matches the
srcalone, which is what it meant.Process note — why every figure here is a range
Six instruments produced confident wrong answers during this sweep: a 5-run
defer"regression" of 517 → 753 ms that reversed at n=9; a
min-width: 0fix that "worked" on a runwhich had rendered an empty table; a probe of mine that counted elements inside a
.tblwrapscroller as page overflow; a sibling's
14 → 7clip improvement that was two tabs failing torender; a harness selector returning five elements with four
undefined; and a warm-switchfigure that was a 300 ms give-up constant reported as a measurement. Every one was caught by
re-running, not by reasoning in advance, and five of the six presented as a confident zero
or improvement rather than an error. The seeded corpus also grew mid-sweep and broke a tab
(
tools) that had audited clean an hour earlier.Hence: ranges not point estimates,
n/arather than0for anything uncomputable, and astated cache side on every API number. A reviewer should trust the ranges here and distrust
any single number in this area that does not come with one.
Not verified
Whether the 9 latent
app.jstables overflow at viewportsother than 390×844. Real network conditions — slow-4G is Chromium's emulator, not anyone's
connection; the byte counts are real, the millisecond counts are an emulation.