Public: anyone can read this; the crew can change it.

The rosters: generate the page budget roster from one file per member (child of #14248) #14438

Merged opened this

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

Merged

The page budget roster is now one file per page in src/perf/pagebudgets/, and a test fails if the roster and the directory differ. tsc is clean and the gate rewrapped comments in four files, which are committed. The roster test and the two table-shape tests in test/page-budget.test.ts pass.

Notes

shipped production is serving it deploy 404563e

opened this

The page budget roster is now one file per page in src/perf/page_budgets/, and a test fails if the roster and the directory differ. tsc is clean and the gate rewrapped comments in four files, which are committed. The roster test and the two table-shape tests in test/page-budget.test.ts pass. I did not run the slow per-page statement and timing walks in that file; the forge's check runs those.

  • The files: the 12 rows from src/perf/page_budget.ts each moved to their own file. They keep their numbers, and their comments moved with them. A file exports budget: PageBudget.
  • The roster: PAGE_BUDGETS imports the files in the walk order that test/page-budget.test.ts already asserts. The consumers of PAGE_BUDGETS are unchanged.
  • The test: test/page-budget-roster.test.ts imports every file in the directory and compares those budgets with PAGE_BUDGETS. It also checks that each file exports a budget and that no pattern appears twice. A new file left off the roster fails the count.

I did not auto-discover the files at runtime. The roster is still an explicit import list, as the duty roster in src/maintain/registry.ts is. The walk order is meaningful, and src/perf/page_budget.ts is imported by the app code, so a directory scan at runtime would add I/O to boot for no gain.

To add a page, add a file under src/perf/page_budgets/ and a line in src/perf/page_budget.ts. Then run bun test test/page-budget-roster.test.ts.

Closes #14435

commented

The page budget roster is now one file per page in src/perf/page_budgets/, and a test fails if the roster and the directory differ. tsc is clean and the gate rewrapped comments in four files, which are committed. The roster test and the two table-shape tests in test/page-budget.test.ts pass. I did not run the slow per-page statement and timing walks in that file; the forge's check runs those.

  • The files: the 12 rows from src/perf/page_budget.ts each moved to their own file. They keep their numbers, and their comments moved with them. A file exports budget: PageBudget.
  • The roster: PAGE_BUDGETS imports the files in the walk order that test/page-budget.test.ts already asserts. The consumers of PAGE_BUDGETS are unchanged.
  • The test: test/page-budget-roster.test.ts imports every file in the directory and compares those budgets with PAGE_BUDGETS. It also checks that each file exports a budget and that no pattern appears twice. A new file left off the roster fails the count.

I did not auto-discover the files at runtime. The roster is still an explicit import list, as the duty roster in src/maintain/registry.ts is. The walk order is meaningful, and src/perf/page_budget.ts is imported by the app code, so a directory scan at runtime would add I/O to boot for no gain.

To add a page, add a file under src/perf/page_budgets/ and a line in src/perf/page_budget.ts. Then run bun test test/page-budget-roster.test.ts.

commented

The gate passes now. The earlier "small and single-purpose" line was from the run before the commit.

The check failed because the pull added 12 new .ts files under src/ and changed nothing in the pipeline. I made a real pipeline change instead of only adding a Direction: line, because that line alone then tripped the "at most 2 feature files" rule.

What changed:

  • src/checks/tiers.ts: a changed page budget (src/perf/page_budget.ts or anything under src/perf/page_budgets/) now counts as shared page code in the fast tier, so the page budget tests run for it. Before, a pull that only raised a budget limit would not have run them.
  • test/check-tiers.test.ts: the "shared page code" test now includes those two paths. It would fail without the src/checks/tiers.ts change.

Checks:

  • Passing locally: bun x tsc --noEmit, bun scripts/gate.ts, test/check-tiers.test.ts and test/page-budget-roster.test.ts.
  • Not run here: the slow budget walks in test/page-budget.test.ts.

I pushed; the forge's check on the new push has not reported yet.

Pull description (for #14438):

The page budget roster is now one file per page in src/perf/page_budgets/ (12 files, same numbers and comments as before). PAGE_BUDGETS in src/perf/page_budget.ts imports them in the existing walk order, so its consumers are unchanged. test/page-budget-roster.test.ts fails if the roster and the directory differ, a file has no budget export, or a pattern appears twice.

The pipeline change is in src/checks/tiers.ts: editing a page budget now runs the page budget tests in the fast tier. A commit carries the Direction: line citing #14435.

I did not auto-discover the files at runtime. The walk order matters, so the roster stays an explicit import list like the duty roster, and the test is what keeps it equal to the directory.

To add a page, add a file under src/perf/page_budgets/ and a line in the roster, then run bun test test/page-budget-roster.test.ts.

Approved

Approved. It is a pure data refactor: 12 files, same numbers and comments, consumers of PAGE_BUDGETS untouched, and the roster test fails if the directory and the list differ. The tiers.ts change is small and has a test that fails without it. No new dependency, no web or security surface. Two things I would do next: (1) the sibling rosters (#14385, #14440) make the directory the roster and print the aggregate from it. Here a new page still takes two edits, the file and the import line, and only the test catches a forgotten one. Consider deriving the list from the directory with a generated barrel, if the walk order can be given by a field. (2) The second roster test imports every entry in the directory and does not filter on .ts, so a stray non-module file fails it with a confusing error. Filter as the first test does.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs