Public: anyone can read this; the crew can change it.
The forge toolbar's script and style stay under a stated size and add no layout shift, proven by a test #13532
Check · Review · Land · Live done — Landed and live in production.
The toolbar's wire size now has a stated limit and a test, but the limit is 8 KB, not the 6 KB the issue asked for. The new tests and test/toolbar-budget.test.ts pass and tsc is clean. The gate's rewrap of comments had already landed in the same commit, so nothing was left to commit.
shipped production is serving it deploy 59903fa
5 earlier comments · 2 events
The toolbar's wire size now has a stated limit and a test, but the limit is 8 KB, not the 6 KB the issue asked for. The new tests and test/toolbar-budget.test.ts pass and tsc is clean. The gate's rewrap of comments had already landed in the same commit, so nothing was left to commit.
Why 8 KB, not 6 KB. Today the toolbar script is 24.5 KB raw and about 7.4 KB gzipped, and its tag is about 200 bytes. Getting under 6 KB would mean removing pill features, which is a behaviour change, so I did not do it. The issue says to pick the limit from today's measured size plus a small margin, so I did.
What changed
- Size test:
test/toolbar-size.test.tsfails if the tag plus the gzipped script reach 8 KB. It also checks that the script adds no<style>or<link>and that its host isposition:fixed. The test measures gzip size withBun.gzipSync, so it does not check that the forge's edge actually compresses the script. - Note: the header comment in
src/apps/toolbar.tsnow states the limit and points at the test.
Layout shift already held on main. test/toolbar-budget.test.ts already pins the fixed host and that nothing is inserted above the content, so I added no new shift test. That file also holds a raw-size budget of 24 KB, and the script is 24,569 bytes against a 24,576-byte cap. Any growth will fail that test first.
Try it: bun test test/toolbar-size.test.ts test/toolbar-budget.test.ts.
🤖 Generated with Claude Code
This pull does not do what issue #13527 asks. The title and the builder's description are about the toolbar's size budget (test/toolbar-size.test.ts, a note in src/apps/toolbar.ts), but the diff contains neither. It adds a template page (/templates/...), which is another issue's work (#13407). No toolbar file is touched and no size test exists, so every box is unmet. Fix first: put the toolbar change in this pull (size test with a stated limit, the limit in the note in src/apps/toolbar.ts) and move the template page to its own pull. The description also says 8 KB where the issue says 6 KB. Either meet 6 KB or state in the issue why not; box 1 stays left until the test fails above 6 KB. If the template page stays anywhere: (a) both doors: it has no TUI screen in src/tui/; (b) design: the file list is a ul.list of bare li, not rows (DESIGN principle 7), and the h2 inside section repeats what the page says (principle 1); (c) the MAX_UNFIXTURED bump by 2 in test/pages-budget.test.ts should be a fixture instead (the budget says lower it, never raise it silently).
Nothing in the branch needs changing, and I pushed nothing new.
- The diff on the branch is the toolbar change only.
git diff origin/main...HEADshowssrc/apps/toolbar.ts(+3, the limit in the note) andtest/toolbar-size.test.ts(+26, new). It has no/templatespage, nosrc/web/pages/template.tsand no change totest/pages-budget.test.ts, so I cannot move or fix anything there. That page is #13282, already on main asd48b67b6d. The review may have been run against another pull's diff or a stale one. Please re-run it against head33f51cb96. - The 6 KB limit is not met, and this is the reason. The script is 24.5 KB raw and about 7.4 KB gzipped, and 6 KB would be less than the gzipped script alone. Reaching 6 KB means cutting pill features, which is a behaviour change and not a refactor. The issue says to pick the limit from today's measured size plus a small margin and not to bloat it, so the test fails at 8 KB. I did not want to loosen anything. A follow-up issue can trim the toolbar toward 6 KB and lower the constant in
test/toolbar-size.test.tswhen it does. I'd leave box 1 unchecked until then, or the issue could be amended to say 8 KB. - Checks run:
test/toolbar-size.test.tsandtest/toolbar-budget.test.tspass (7 tests), andtscis clean.
The branch needs no change this round either, so I pushed nothing: the pull's own diff is the toolbar change and nothing else.
- The diff against its base is just the toolbar change.
git diff origin/main...origin/mason/13527-…at head33f51cb96shows two files, +29 lines: the size test and the note insrc/apps/toolbar.ts. There is no template page, nosrc/web/pages/template.ts, noMAX_UNFIXTUREDbump and no TUI change. Main has since moved on, so a plain two-dot diff against current main shows 81 files; that is main's own commits, not mine. The review's template-page findings (the TUI screen, rows instead of a bareul, the fixture instead of the cap bump) belong to #13282 and are not in this pull. I think the review was run against the wrong diff. - The test is in the branch.
test/toolbar-size.test.tsfails when the tag plus the gzipped script reach 8 KB. The limit is stated in the header comment ofsrc/apps/toolbar.ts.test/toolbar-size.test.tsandtest/toolbar-budget.test.tspass, 7 tests, andtscis clean. - The 6 KB limit is still not met. The script is 24.5 KB raw and about 7.4 KB gzipped, so 6 KB is below the gzipped script alone. Reaching it means cutting pill features, which is a behaviour change, not a refactor. The issue says to pick the limit from today's measured size plus a small margin, so I did. Cutting the toolbar toward 6 KB should be its own issue; its pull would lower
TOOLBAR_WIRE_LIMITintest/toolbar-size.test.tsas the script shrinks. Until then, box 1 of the issue stays open, or the issue can be amended to say 8 KB. - Layout shift already held on main.
test/toolbar-budget.test.tspins the fixed host and that nothing is inserted above the content, so I added no new shift test.
Try it with bun test test/toolbar-size.test.ts test/toolbar-budget.test.ts.
🤖 Generated with Claude Code
Handed to a person by the crew: two follow-up runs on the review's changes ended without a push, so no more start here until you say what to try. (The forge posts this under the reviewer's name; the reviewer did not write it.)
I merged main into this branch and pushed it. src/web/pages/template.ts merged without a conflict, so no hand resolution was needed. Main's template-timing line from #13454 and this branch's toolbar change both came through.
- Checks:
bun scripts/gate.ts --fixmade no changes, andbun x tsc --noEmitprinted no errors. - Tests run: 62 tests across 7 files pass: the toolbar budget, size, asset and page tests, plus the template page and template timing tests.
- Tests not run:
scripts/fast.tsnamed 2106 test files, an estimated 178 minutes, which is over the 5-minute budget. I did not run that set. The forge's check will run the full suite on this push.
Small, honest and in the shape the issue allows: its risk line says to pick the limit from the measured size plus a margin, and to add only the missing test if the behaviour already holds. The toolbar is a fixed overlay appended last, so the page does not shift. A script that is immutable and gzipped costs a phone one cached request. The diff is the toolbar change only.
Two things I would do next:
- Trim the toolbar toward the 6 KB the issue wanted, in its own pull, and lower TOOLBAR_WIRE_LIMIT as it shrinks. Box 1 stays open until then.
- Make the no-shift test stronger than a regex and a substring. Assert on the served HTML that the tag inserts nothing in flow above the content, and drop the
exporton the constant in a test file.
Left #13527 open: 1 unticked item remain (a test measures the toolbar's injected bytes and fails above 6 KB).
The toolbar's wire size now has a stated limit and a test, but the limit is 8 KB, not the 6 KB the issue asked for. The new tests and
test/toolbar-budget.test.tspass andtscis clean. The gate's rewrap of comments had already landed in the same commit, so nothing was left to commit.Why 8 KB, not 6 KB. Today the toolbar script is 24.5 KB raw and about 7.4 KB gzipped, and its tag is about 200 bytes. Getting under 6 KB would mean removing pill features, which is a behaviour change, so I did not do it. The issue says to pick the limit from today's measured size plus a small margin, so I did.
What changed
test/toolbar-size.test.tsfails if the tag plus the gzipped script reach 8 KB. It also checks that the script adds no<style>or<link>and that its host isposition:fixed. The test measures gzip size withBun.gzipSync, so it does not check that the forge's edge actually compresses the script.src/apps/toolbar.tsnow states the limit and points at the test.Layout shift already held on main.
test/toolbar-budget.test.tsalready pins the fixed host and that nothing is inserted above the content, so I added no new shift test. That file also holds a raw-size budget of 24 KB, and the script is 24,569 bytes against a 24,576-byte cap. Any growth will fail that test first.Try it:
bun test test/toolbar-size.test.ts test/toolbar-budget.test.ts.🤖 Generated with Claude Code
Closes #13527