Repository navigation
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
PR Analysis Report🔎 Preview ·
|
There was a problem hiding this comment.
The measurement change looks right: sizes come out identical and the new test pins the no-scratch-file rule. One thing is needed before approval: since this changes a CI script, the description needs the CI impact: line that AST-030 FR19 and the maintenance template ask for (runner class, job-minutes per update, runner-pool usage and time to green, even when all are unchanged).
[Automated review]
12d6491 to
ef8f66c
Compare
There was a problem hiding this comment.
The measurement change looks right, and the CI impact: line is now in place; one wording fix is needed before approval.
- The commit message and the description say measured sizes are unchanged, but
ContextMenuItem(an alias measured through the package entry) moves from 53,875 to 19,577 B gzip JavaScript and from 10,137 to 5,716 B gzip CSS, because the new entry-chunk lookup no longer picks the lazily loadedTimestampHoverCardchunk; please say so in both.
Optional: a fixture whose lazily loaded module is the first entry output would pin that fix, and the CI impact: line could also name deploy.yml's typecheck job, which runs the same script on main pushes.
[Automated review]
| .join('/'); | ||
| const entryOutput = Object.keys(outputs).find( | ||
| key => outputs[key].entryPoint !== undefined, | ||
| key => outputs[key].entryPoint === entryPoint, |
There was a problem hiding this comment.
This lookup also changes one measured figure. ContextMenuItem is an alias, so it is measured through the package entry, where the old lookup took the lazily loaded TimestampHoverCard chunk (53,875 B gzip JavaScript); this takes the import's own chunk (19,577 B). The new figure is right; the description and the commit message should say that this component's size changes.
There was a problem hiding this comment.
Fixed in 90e86f1. The full main record (232 components, old and new lookup on the same build) shows four figures change, each to the import's own chunk: ContextMenuItem, Chart, ChartLegend and ChartTooltip. The commit message and the description list them; the other 228 are unchanged. With eight or more import() targets, a target's chunk comes first in esbuild's outputs; a new test with eight targets fails on the old lookup. The CI impact line names deploy.yml's typecheck job too.
The PR report's component size measurement wrote a one-line entry file for each import into a fresh directory under the system temp directory, and bundled it with esbuild. esbuild reads the listing of every directory above each file it bundles, so every measurement read the temp directory's listing. On a shared machine whose temp directory holds 184,000 entries, that read took 140 to 270 ms per build unloaded, and about 2 s with two cores shared by four processes; the build itself takes 5 ms. component-size.test.mjs runs ten such builds, and timed out at 30 s on a loaded machine. The entry now reaches esbuild as stdin, read as if it were a file beside the measured entry, and the outputs stay in memory: nothing is written. The tests keep their fixture trees under the repository's node_modules/.cache, so the directories above the measured files are small too. The import's own chunk is now the output whose entry point is the import. Each import() target is an entry point too, and the old lookup took the first entry point in esbuild's outputs. With eight or more import() targets, a target's chunk can come first. So four figures in the main record change, each to the import's own chunk: ContextMenuItem (19,577 B of gzip JavaScript, from 53,875), Chart (133,664, from 64,413), ChartLegend (34,779, from 53,665) and ChartTooltip (102,303, from 53,670). The other 228 components' figures are unchanged.
ef8f66c to
90e86f1
Compare
There was a problem hiding this comment.
This looks ready to approve: the measurement no longer touches the system temp directory, the new import-chunk lookup is right, and the description and commit message now name the four figures that move (ContextMenuItem, Chart, ChartLegend, ChartTooltip); the other 228 of 232 are unchanged. Both new tests fail against the old measurement and pass with this change.
Optional: the CI impact: line gives the runners as ubuntu-latest or 4-core-ubuntu, but deploy.yml's typecheck job runs on ubuntu-24.04-arm; it is still a standard GitHub-hosted runner, so only the label is off.
[Automated review]
Maintainer impact
.github/scripts/lib/component-size.test.mjstimes out at 30 s on a loaded machine, while it passes alone in about 2 s.The PR size report's component measurement wrote a one-line entry file for each import into a fresh directory under the system temp directory, then bundled it with esbuild. The tests also build their fixture trees there.
/dev/shm, 6.0 ms inside the repository.The measurement also took the wrong chunk for four components. Each
import()target is an entry point too, and the old lookup took the first entry point in esbuild's outputs. With eight or moreimport()targets, a target's chunk can come first, so the report counted a lazily loaded chunk (TimestampHoverCard's) in place of the import's own.Intended invariant
A component's measured size counts the import's own chunk and the chunks it imports statically, and depends only on the import being measured. How long measuring it takes does not depend on what else is in the system temp directory.
Change
bundleImportWithInputsgives esbuild the import as stdin, read as if it were a file beside the measured entry (resolveDir), and keeps the outputs in memory. It writes nothing.bundleInputsByEntrykeeps its outputs in memory without creating a temp directory for them.node_modules/.cache, so the directories above the measured files are small as well.import()targets is measured by its own chunk.Evidence
Load A/B on a 2-thread pin (one physical core), two busy loops beside it, 4 workers, ten rounds alternating which arm runs first; both arms use a temp directory of 184,000 entries with 16 processes creating and removing small trees in it, as a suite's fixtures do:
scripts/i18n-english-fallback.test.mjs)component-size.test.mjs:85Listings of the temp directory (strace, those two tests once): 9 on main, 0 on this branch.
Same-time comparison, pinned to two cores, four copies of the test file in parallel, three rounds, box load 87 to 92:
Sizes, the whole main record (
analyze-pr.js --main-record, 232 components, old lookup and new on the same built tree; the old one gives the same record on a second run): 228 figures are unchanged. Four change, each to the import's own chunk:ContextMenuItem(core; measured through the package entry)Chart(charts)ChartLegend(charts)ChartTooltip(charts)Before, each of the four took
TimestampHoverCard's lazily loaded chunk as the import's own. Six other real Core entries (Button, Tooltip, Dialog, TextInput, ProgressBar, DateInput) give byte-identical sizes; measuring them took 0.4 s instead of 4.1 s on the shared machine above.Failure before the change: with main's measurement, "writes no file to measure an import" fails (
mkdtempSyncwas called), and "measures the import's own chunk when an import() target's chunk comes first" fails: the figure is a lazily loaded module's chunk.Success after the change: the file passes 10 of 10, each case in 1 to 100 ms.
CI impact: the changed script runs in
ci.yml'sbuild-storybookjob (the PR report's size measurement inanalyze-pr.js) and indeploy.yml'stypecheckjob (the main record), each on its unchanged runner:ubuntu-latest, standard GitHub-hosted, or4-core-ubuntufor a dispatched release-check. A fresh hosted runner's temp directory is small, so a measurement takes about as long as before there.Scope
Testing
.github/scripts/lib/component-size.test.mjsin thenodeVitest project, plus the six-entry size comparison above against a built Core.Local gates at 12d6491:
Local gates at 90e86f1, merged with main 1790062:
pnpm review:pre: no findings;pnpm build, thenpnpm test:node: 16,112 passed, 76 skipped, 0 failed (3,270 files).The load A/B above ran on ef8f66c, whose measurement code is this head's.