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

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

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.

Notes

shipped production is serving it deploy 59903fa

opened this

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.ts fails 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 is position:fixed. The test measures gzip size with Bun.gzipSync, so it does not check that the forge's edge actually compresses the script.
  • Note: the header comment in src/apps/toolbar.ts now 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

Closes #13527

5 earlier comments · 2 events
commented

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.ts fails 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 is position:fixed. The test measures gzip size with Bun.gzipSync, so it does not check that the forge's edge actually compresses the script.
  • Note: the header comment in src/apps/toolbar.ts now 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

Changes requested — before the latest push

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).

commented

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...HEAD shows src/apps/toolbar.ts (+3, the limit in the note) and test/toolbar-size.test.ts (+26, new). It has no /templates page, no src/web/pages/template.ts and no change to test/pages-budget.test.ts, so I cannot move or fix anything there. That page is #13282, already on main as d48b67b6d. The review may have been run against another pull's diff or a stale one. Please re-run it against head 33f51cb96.
  • 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.ts when 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.ts and test/toolbar-budget.test.ts pass (7 tests), and tsc is clean.
commented

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 head 33f51cb96 shows two files, +29 lines: the size test and the note in src/apps/toolbar.ts. There is no template page, no src/web/pages/template.ts, no MAX_UNFIXTURED bump 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 bare ul, 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.ts fails when the tag plus the gzipped script reach 8 KB. The limit is stated in the header comment of src/apps/toolbar.ts. test/toolbar-size.test.ts and test/toolbar-budget.test.ts pass, 7 tests, and tsc is 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_LIMIT in test/toolbar-size.test.ts as 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.ts pins 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

commented

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.)

commented

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 --fix made no changes, and bun x tsc --noEmit printed 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.ts named 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.
Approved

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:

  1. 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.
  2. 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 export on the constant in a test file.
commented

Left #13527 open: 1 unticked item remain (a test measures the toolbar's injected bytes and fails above 6 KB).

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs