Repository navigation
perf(cli): store Core's component list and imports at publish, used while the installed Core is unchanged - #11617
Conversation
…hile the installed Core is unchanged
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
There was a problem hiding this comment.
Changes requested. Storing Core's component list at publish is a clear speed-up, and its output is identical on an unchanged install. Five issues need fixing first.
- The store check drops packing-style names (
Notice,License,Readme,Changelog,node_modules,*.generated.json) from Core folder states (stored-component-list.mjs:62, throughPACKING_NAMESinstored-self-audit.mjs), so asrc/Button/Notice.tsxadded with its doc to an installed Core keeps the store answering andcomponent --listomits it; give the Core store a folder state that drops onlynode_modules. publishedCoreFilesand its copy loop (scripts/generate-component-list.mjs:31-57) and the input check (stored-component-list.mjs:61-65) copy the self-audit'spublishedFilesandstoredSelfAuditloop, so share one helper for each to keep the two stores from drifting.clients/cli/commands/component.mjs:394makes the command handler read Core's files, whicharchitecture:cli-surfaceINV22 rules out for handlers, so run the check on the API side or drop the handler pre-check.packages/cli/.gitignoreignores every other prepack output but notassets/component-list.generated.json, so a failed pack or a direct generator run leaves a file that is easy to commit by mistake.- The changeset says any edit to Core's files reads Core live, but an edit to a file the list never reads (such as
src/Button/Button.tsx) keeps the store, so say "a change to any Core file or folder the list reads" instead.
The description's package-growth figures also differ from this head after a standard install (37.8 KB, 12.4 KB gzipped, 399 inputs).
Claims and files checked
Claims:
- Changeset: the published CLI stores Core's component list and imports at publish. Verified (
package.jsonprepack,scripts/generate-component-list.mjs). - Changeset: it uses them while the installed Core's files are unchanged. Verified, with one gap: added files with packing-style names go undetected (first finding).
- Changeset:
component --listanswers about 30 to 60 ms sooner without integrations. Verified: 29 to 68 ms faster across the list views measured here. - Changeset: another Core version or any edit to Core's files reads Core live. False: edits to files the list never reads keep the store (last finding).
- Description: without a store, every list walks Core's tree, regex-reads docs, parses family docs and searches for imports. Verified in
component-discovery.mjs; the millisecond split was not measured. - Description: the store is used only while every file (by content hash) and folder (by the names it holds) that the work read is unchanged. Partly false: folder states drop packing-style names.
- Description: another version, a patched install, an added or removed file, or a dev checkout reads Core live. Verified for versions, in-place edits, new folders and checkouts; false for packing-named additions.
- Description: output is byte-identical either way. Verified for seven list and detail commands on an unchanged install; false in the first finding's case.
- Description: the generator copies Core's published files, runs discovery and import resolution while recording reads, and writes groups, imports and input states. Verified.
- Description: the file is not committed, like the other stored files. Verified that it is not committed, but unlike the others it is not git-ignored.
- Description: the store is checked once per operation, and the reuse helper never checks by itself. Verified (
oncePerListing,onceComputed). - Description: discovery uses stored groups, and imports use the store only after a check, so a single component lookup never pays for it. Verified;
component Button --jsonandcomponent HStack --jsontimings are unchanged. - Description: the text list's import column checks once. Verified; this is the handler finding.
- Description: the listing cache gains a read-only memo accessor. Verified.
- Description: pack stages and prepack/postpack run the generator, and the doc-loads runner list names its two spawns. Verified; the doc-loads test passes.
- Description: no difference in output. Verified for unchanged installs.
- Description: package growth of 31.9 KB (11.0 KB gzipped), 324 inputs, 78 groups and 174 imports. Groups and imports verified; size and folder count not reproduced (37.8 KB, 12.4 KB gzipped, 399 inputs here).
- Description: packed-CLI timings. Direction and size reproduced;
search buttonand the store-miss cells were not measured. - Description: the new test covers shipping, answering, byte-identity, an in-place edit miss, a new-folder miss and re-hits. Verified by reading it; it passes.
- Description: the CLI suites pass. The targeted suites pass here; the full suites are CI's.
- Description: no public API, product behaviour or policy change. API verified (no rows); behaviour is identical except in the first finding's case.
Files:
.changeset/stored-core-component-list.md: over-broad fallback claim.packages/cli/clients/cli/commands/component.mjs: the handler reads Core's files.packages/cli/foundation/discovery/component-discovery.mjs: clear.packages/cli/foundation/discovery/stored-component-list.mjs: folder state drops packing names, and the check loop is copied.packages/cli/foundation/doc-compiler/doc-loads.test.mjs: clear.packages/cli/foundation/fs/listing-cache.mjs: clear.packages/cli/package.json: clear (the missing ignore entry belongs inpackages/cli/.gitignore).packages/cli/scripts/generate-component-list.mjs: publish-file listing and copy are copied from the self-audit generator.packages/cli/test-utils/pack-cli.mjs: clear.packages/cli/test/packed-component-list.test.mjs: clear.
PR Analysis Report🔎 Preview ·
|
…ublish-copy and input-check helpers; drop the handler pre-check; ignore the stored list
There was a problem hiding this comment.
Changes requested. The five points from the last review are fixed, and the stored list matches a live read byte for byte under an English locale. One issue remains.
- Miss: the stored groups keep the key order the generator's locale gave, while a live read sorts keys with
localeComparein the running locale (component-discovery.mjs:381vs:539), so withLANG=cs_CZ.UTF-8thecomponent --list --json,--detail compactand--detail full --jsonoutput listsChatandCheckboxin a different place whenever the store hits; re-sort the stored keys at read time with the same comparator and add a non-EnglishLANGcase totest/packed-component-list.test.mjs.
Claims and files checked
Claims:
- Changeset: the published CLI stores Core's component list and imports at publish. Verified (
package.jsonprepack,scripts/generate-component-list.mjs). - Changeset: it uses them while the installed Core's files are unchanged. Verified (
stored-component-list.mjs:51-71, probes). - Changeset:
component --listanswers about 30 to 60 ms sooner without integrations. Verified in direction: 65 to 80 ms faster here on a variable machine. - Changeset: another Core version, or a change to any Core file or folder the list reads, reads Core live. Verified (probes and the new test).
- Description: without a store, each list walks Core's tree, regex-reads docs, parses family docs and searches for imports. Verified in
component-discovery.mjs; the millisecond split was not measured. - Description: the store is used only while every file and folder the work read is unchanged, folders by every name except
node_modules. Verified;package.jsonis compared by its packer-stable fields, which includeexports, the only field the list reads. - Description: another version, a patched install, an added or removed file, or a dev checkout reads Core live. Verified for edits, added files and folders, and a checkout.
- Description: output is byte-identical either way. False under a non-English collation (the finding above); verified under an English locale.
- Description: the generator copies Core's published files, runs discovery and import resolution while recording reads, and writes groups, imports and input states; the file is not committed. Verified, and it is now git-ignored.
- Description: the store is checked once per operation, and the reuse helper never checks by itself. Verified (
oncePerListing,onceComputed). - Description: discovery uses the stored groups, and an import uses the store only after a check, so a single component lookup never pays for it. Verified.
- Description: the command handler is unchanged, so the text list's import column resolves live. Verified; the handler equals the base.
- Description: the listing cache gains a read-only memo accessor. Verified.
- Description: the pack stages and prepack/postpack run the generator, and the doc-loads runner list names its spawns. Verified; the doc-loads test passes.
- Description: package growth of 37.8 KB (12.9 KB gzipped), 399 inputs, 78 groups and 174 imports. Verified exactly.
- Description: packed-CLI timings, and unchanged cells where the store misses. Direction reproduced;
search buttonand the miss timings were not measured. - Description: no public API, product behaviour or policy change. API verified (no rows); behaviour holds except under the finding above.
- Description: the new test covers shipping, answering, byte-identity for seven asks, an in-place edit, a notice-named file, a new folder and re-hits. Verified by reading; it passes here.
- Description: the CLI suites pass. The targeted suites pass here; the full suites are CI's.
Files:
.changeset/stored-core-component-list.md: clear.packages/cli/.gitignore: clear.packages/cli/foundation/discovery/component-discovery.mjs: the stored groups keep the generator's key order.packages/cli/foundation/discovery/stored-component-list.mjs: clear; the re-sort can live here.packages/cli/foundation/discovery/stored-self-audit.mjs: clear.packages/cli/foundation/doc-compiler/doc-loads.test.mjs: clear.packages/cli/foundation/fs/listing-cache.mjs: clear.packages/cli/package.json: clear.packages/cli/scripts/generate-component-list.mjs: clear.packages/cli/scripts/generate-self-audit.mjs: clear.packages/cli/scripts/published-files.mjs: clear.packages/cli/test-utils/pack-cli.mjs: clear.packages/cli/test/packed-component-list.test.mjs: no case under a non-English locale.
…, as a live read does
There was a problem hiding this comment.
Approved pending CI: the Node and UI test shards and the docsite browser check are still running on this head.
The stored component list now re-sorts its keys with the same comparator as a live read, so component --list prints the same bytes stored or live under every collation tried, and the new Czech test fails without the fix. Every earlier review point is resolved.
- Miss: non-blocking, the generator runs discovery from the package itself (
scripts/generate-component-list.mjs:81), so a leftoverassets/component-list.generated.jsonfrom a direct run or a failedprepackis copied forward instead of recomputed; deleting that file at the start ofcomponentListText()keeps the stored list a function of the current code.
Claims and files checked
Claims:
- Changeset: the published CLI stores Core's component list and imports at publish. Verified (
package.jsonprepack,scripts/generate-component-list.mjs). - Changeset: it uses them while the installed Core is unchanged. Verified (
stored-component-list.mjs:51-72; the new tests). - Changeset:
component --listanswers about 30 to 60 ms sooner without integrations. Verified: 45 to 59 ms sooner on an unchanged copy of Core. - Changeset: another Core version, or a change to a Core file or folder the list reads, reads Core live. Verified (the new test; a repository checkout of Core misses).
- Description: without a store, each list walks Core's tree, reads docs, parses family docs and searches for imports. Verified in
component-discovery.mjs; the millisecond split was not measured. - Description: the store is used only while every file (by content) and folder (by names except
node_modules) the work read is unchanged. Verified;package.jsonis compared by its packer-stable fields, which includeexports, the only field the list reads. - Description: any mismatch reads Core live. Verified for edits, added files and folders, and a repository checkout.
- Description: output is byte-identical either way. Verified for six asks under seven collations, and by the new tests.
- Description: the generator copies Core's published files and runs discovery and import resolution while recording reads. Verified (
generate-component-list.mjs:35-99). - Description: it writes groups, imports and input states to an uncommitted asset. Verified; the asset is git-ignored.
- Description: the store is checked once per operation, and the reuse helper never checks by itself. Verified (
oncePerListing;stored-component-list.mjs:81-87). - Description: discovery uses the stored groups when the check passes. Verified; the keys are re-sorted in the running locale.
- Description: an import uses the store only after a check in the same operation, so a single component lookup never pays for it. Verified:
component Buttonandcomponent HStacknever read the store. - Description: the command handler is unchanged, so the text list's import column resolves live. Verified; the handler equals the base.
- Description: the listing cache gains a read-only memo accessor. Verified (
listing-cache.mjs:100-102). - Description: the pack helper and prepack/postpack run the generator, and the doc-loads list names its spawns. Verified; the doc-loads test passes.
- Description: no difference in output. Verified, as above.
- Description: package growth of 37.8 KB (12.9 KB gzipped) with 399 inputs, 78 groups and 174 imports. Verified exactly.
- Description: packed-CLI timings. Direction reproduced; full
--jsonandsearch buttonwere not timed. - Description: where the store misses, timings are unchanged. Not measured; a miss stops at the first differing input.
- Description: no public API, product behavior, visual or policy change. Verified (no API rows; identical output).
- Description: product changes found during the work were removed or split. Verified; no tag-along change.
- Description: public text has no internal context. Verified.
- Description: the new test covers shipping, answering, byte-identity, an in-place edit, a notice-named file, a new folder and re-hits. Verified; it also covers Czech collation, and it passes.
- Description: the CLI suites pass. The targeted suites pass; the full suites are still running in CI.
Files:
.changeset/stored-core-component-list.md: clear.packages/cli/.gitignore: clear.packages/cli/foundation/discovery/component-discovery.mjs: clear; stored keys are re-sorted with the live comparator.packages/cli/foundation/discovery/stored-component-list.mjs: clear.packages/cli/foundation/discovery/stored-self-audit.mjs: clear.packages/cli/foundation/doc-compiler/doc-loads.test.mjs: clear.packages/cli/foundation/fs/listing-cache.mjs: clear.packages/cli/package.json: clear.packages/cli/scripts/generate-component-list.mjs: non-blocking: a leftover stored list is copied forward.packages/cli/scripts/generate-self-audit.mjs: clear.packages/cli/scripts/published-files.mjs: clear.packages/cli/test-utils/pack-cli.mjs: clear.packages/cli/test/packed-component-list.test.mjs: clear; the Czech case fails without the fix.
There was a problem hiding this comment.
Changes requested: one shared-helper fix stands between this and approval.
Storing Core's component list at publish works as described: on an unchanged install component --list answers about 40 ms sooner with identical output, and a linked or different Core reads live.
- Miss:
scripts/generate-component-list.mjs:61-66re-implementsselfAuditInputsfromfoundation/discovery/stored-self-audit.mjs:93-103instead of extending it, so the two stores' input recorders can drift; give it arootandskiplikeinputStateandinputsUnchanged(testingnode_modulesrelative to the root), call it from both generators, and drop the inline loop.
Non-blocking: the generator still copies a leftover assets/component-list.generated.json forward (see the earlier inline comment), and, missed in the last review, three description numbers do not reproduce here: the asset gzips to 12.4 KB, search button gets about 34 ms faster rather than staying unchanged, and the listed imports take about 15 ms.
Claims and files checked
Claims:
- Changeset: the published CLI stores Core's component list and imports at publish. Verified (
package.jsonprepack,scripts/generate-component-list.mjs). - Changeset: it uses them while the installed Core is unchanged. Verified (
stored-component-list.mjs:156-177; the new tests). - Changeset:
component --listanswers about 30 to 60 ms sooner without integrations. Verified: 39 to 42 ms sooner on an unchanged copy of Core. - Changeset: another Core version, or a change to a Core file or folder the list reads, reads Core live. Verified (the new tests; another version and a linked checkout miss).
- Description: without a store, each list walks Core's tree, regex-reads docs, parses family docs and searches for imports. Verified (
component-discovery.mjs:147-248,:669-847). - Description: about 70 ms of discovery plus about 33 ms of import lookups. Partly: discovery measures 66 ms; the listed imports take 15 ms in the same operation.
- Description: the store is used only while each file (by content) and folder (by names except
node_modules) the work read is unchanged. Verified;package.jsonis compared by seven packer-stable fields, which includeexports, the only field the list reads. - Description: any mismatch reads Core live. Verified for edits, added files and folders, another version and a linked checkout.
- Description: output is byte-identical either way. Verified for eight asks and by the new tests.
- Description: the generator copies Core's published files and runs discovery and import resolution while recording reads. Verified (
generate-component-list.mjs:45-99,published-files.mjs). - Description: it writes groups, imports and input states, with the self-audit's state function, to an uncommitted asset. Verified; the asset is git-ignored.
- Description: the store is checked once per operation, and the reuse helper never checks by itself. Verified (
stored-component-list.mjs:156-192). - Description: discovery uses the stored groups when the check passes. Verified (
component-discovery.mjs:379-386). - Description: an import uses the store only after a check in the same operation, so a single component lookup never pays for it. Verified:
component Buttonandcomponent HStacknever read the store. - Description: the command handler is unchanged, so the text list's import column resolves live. Verified (no handler change; it resolves in a new operation).
- Description: the listing cache gains a read-only memo accessor. Verified (
listing-cache.mjs:100-102). - Description: the pack helper and prepack/postpack run the generator, and the doc-loads list names its spawns. Verified; the doc-loads test passes.
- Description: no difference in output. Verified, as above.
- Description: the asset is 37.8 KB unpacked and 12.9 KB gzipped. Partly: 37.8 KB is exact; it gzips to 12.4 KB.
- Description: it records 399 inputs (223 folders, 176 files), 78 groups and 174 imports. Verified exactly.
- Description: packed timings for the list asks. Direction and size reproduced (17 to 42 ms faster).
- Description:
component Button,Button --json,HStack --jsonandsearch buttonare unchanged. Verified for the three component lookups;search buttonis 34 ms faster with the store. - Description: where the store misses, timings are unchanged. Verified for a linked checkout (within 2 ms); a large integration was not measured.
- Description: no public API, product behavior, visual or policy change. Verified (no API rows; identical output).
- Description: product changes found during the work were removed or split. Verified; no tag-along change.
- Description: public text has no internal context. Verified.
- Description: the new test covers shipping, answering, byte-identity, an in-place edit, a new file, a new folder and re-hits. Verified; it also covers Czech collation, and it passes.
- Description: the CLI suites pass. The targeted suites pass (224 tests); CI's Node legs had not finished.
Files:
.changeset/stored-core-component-list.md: clear.packages/cli/.gitignore: clear.packages/cli/foundation/discovery/component-discovery.mjs: clear.packages/cli/foundation/discovery/stored-component-list.mjs: clear.packages/cli/foundation/discovery/stored-self-audit.mjs:selfAuditInputsis the input recorder the component list copies.packages/cli/foundation/doc-compiler/doc-loads.test.mjs: clear.packages/cli/foundation/fs/listing-cache.mjs: clear.packages/cli/package.json: clear.packages/cli/scripts/generate-component-list.mjs: blocking: copied input recorder; non-blocking: a leftover stored list is copied forward.packages/cli/scripts/generate-self-audit.mjs: clear.packages/cli/scripts/published-files.mjs: clear.packages/cli/test-utils/pack-cli.mjs: clear.packages/cli/test/packed-component-list.test.mjs: clear.scripts/vitest-node-durations.json: clear.
… ignores a leftover store and runs beside the self-audit
There was a problem hiding this comment.
Approved pending CI: four of the five Node test legs, two of the four UI legs and the docsite browser check are still running on this head.
Both stores now record their inputs through selfAuditInputs, a leftover store is removed before generating, and the stored list still prints exactly what a live read prints; on an unchanged copy of Core, component --list answers about 50 ms sooner.
Non-blocking: the comment at packages/cli/test-utils/pack-cli.mjs:163-165 still describes the second stage as the two generators that read the stores, but it now runs the component list too (see the inline comment).
Claims and files checked
Claims:
- Changeset: the published CLI stores Core's component list and imports at publish. Verified (
package.jsonprepack,scripts/generate-component-list.mjs). - Changeset: it uses them while the installed Core's files are unchanged. Verified (
stored-component-list.mjs:51-71; the new tests). - Changeset:
component --listanswers about 30 to 60 ms sooner without integrations. Verified for the default list: 48 ms sooner as text and 51 ms with--jsonon an unchanged copy of Core; the compact and full details gain 16 to 26 ms. - Changeset: another Core version, or a change to a Core file or folder the list reads, reads Core live. Verified (the new tests; the version is one of the recorded
package.jsonfields). - Description: without a store, each list walks Core's tree, regex-reads docs, parses family docs and searches for imports. Verified (
component-discovery.mjs:415-544,:815-846). - Description: about 70 ms of discovery plus 15 to 33 ms of import lookups. Verified approximately: 91 ms and 21 to 24 ms here, 66 ms and 15 ms in the last measurement.
- Description: the store is used only while each file (by content) and folder (by names except
node_modules) the work read is unchanged. Verified;package.jsonis compared by seven packer-stable fields, which includeexports, the only field the list reads. - Description: any mismatch reads Core live. Verified for edits, added files and added folders.
- Description: output is byte-identical either way. Verified for the test's seven asks and five packed asks with and without the store.
- Description: the generator copies Core's published files and runs discovery and import resolution while recording reads. Verified (
generate-component-list.mjs:35-61,published-files.mjs). - Description: it writes groups, imports and input states, with the self-audit's state function, to an uncommitted asset. Verified; the asset is git-ignored.
- Description: the store is checked once per operation, and the reuse helper never checks by itself. Verified (
stored-component-list.mjs:51-87). - Description: discovery uses the stored groups when the check passes. Verified (
component-discovery.mjs:379-386). - Description: an import uses the store only after a check in the same operation, so a single component lookup never pays for it. Verified (
component-discovery.mjs:816-819;component Button --jsonwithin 2 ms). - Description: the command handler is unchanged, so the text list's import column resolves live. Verified (no handler change).
- Description: the listing cache gains a read-only memo accessor. Verified (
listing-cache.mjs:94-102). - Description: the pack helper and prepack/postpack run the generator, and the doc-loads list names its two spawns. Verified; the doc-loads test passes.
- Description: no difference in output. Verified, as above.
- Description: the asset is 37.8 KB unpacked and about 12.4 to 12.9 KB gzipped, depending on the level. Partly: 37.8 KB and 12.4 KB at the default level are exact; the fastest levels reach 13.3 to 13.5 KB.
- Description: it records 399 inputs (223 folders, 176 files), 78 groups and 174 imports. Verified exactly.
- Description: packed timings for the list asks. Direction and size reproduced (16 to 51 ms faster).
- Description: single-component lookups are unchanged. Verified for
component Button --jsonhere and all three in the last measurement. - Description: where the store misses, timings are unchanged. Verified for a linked checkout in the last measurement, on unchanged runtime code; a large integration was not measured.
- Description: no public API, product behavior, visual or policy change. Verified (no API rows; identical output).
- Description: product changes found during the work were removed or split. Verified; no tag-along change.
- Description: public text has no internal context. Verified.
- Description: the new test covers shipping, answering, byte-identity, an in-place edit, a new file, a new folder and re-hits. Verified; it passes, with the Czech-locale case.
- Description: the CLI suites pass. The targeted suites pass (227 tests); CI's Node legs had not finished.
Files:
.changeset/stored-core-component-list.md: clear.packages/cli/.gitignore: clear.packages/cli/foundation/discovery/component-discovery.mjs: clear.packages/cli/foundation/discovery/stored-component-list.mjs: clear.packages/cli/foundation/discovery/stored-self-audit.mjs: clear; now the one input recorder for both stores.packages/cli/foundation/doc-compiler/doc-loads.test.mjs: clear.packages/cli/foundation/fs/listing-cache.mjs: clear.packages/cli/package.json: clear.packages/cli/scripts/generate-component-list.mjs: clear.packages/cli/scripts/generate-self-audit.mjs: clear.packages/cli/scripts/published-files.mjs: clear.packages/cli/test-utils/pack-cli.mjs: non-blocking: the stage comment at lines 163-165 is out of date.packages/cli/test/packed-component-list.test.mjs: clear.scripts/vitest-node-durations.json: clear.
| 'scripts/generate-command-list.mjs', | ||
| ], | ||
| ['scripts/generate-self-audit.mjs', 'scripts/generate-manifest.mjs'], | ||
| // The two that copy a package's published files run side by side, each |
There was a problem hiding this comment.
Non-blocking: this stage now holds the component-list store beside the two generators that read the stores, but the comment at lines 163-165 still says "the stores, then the two that read them". Running them side by side is safe (the self-audit's audit reads no stored component list, and the manifest describes commands only), so only the comment needs to say the second stage also holds the component list, which reads none of the earlier stores.
There was a problem hiding this comment.
Approved pending CI: this head's first CI attempt was refused for capacity ("CI is full") before its build and test jobs ran, and CI is running again; those jobs must pass before merge. Lint, the CLI smoke test and the Storybook build passed.
The merge of main is clean, and the stored component list still prints exactly what a live read prints against the merged Core and CLI; on an unchanged copy of Core, component --list answers about 45 ms sooner, and a store miss costs at most 2 ms.
Non-blocking: the comment at packages/cli/test-utils/pack-cli.mjs:163-165 still describes the second stage as the two generators that read the stores, but that stage also runs the component list (see the earlier inline comment).
Claims and files checked
Claims:
- Changeset: the published CLI stores Core's component list and imports at publish. Verified (
package.jsonprepack; the packed test's shipping case). - Changeset: it uses them while the installed Core's files are unchanged. Verified (
stored-component-list.mjs:51-71; the packed test). - Changeset:
component --listanswers about 30 to 60 ms sooner without integrations. Verified for the default list: 45 ms sooner as text and 43 ms with--jsonon an unchanged copy of Core; the compact and full details gain 36 and 18 ms. - Changeset: another Core version, or a change to a Core file or folder the list reads, reads Core live. Verified (the packed test; the version is one of the recorded
package.jsonfields). - Description: without a store, each list walks Core's tree, regex-reads docs, parses family docs and searches for imports. Verified (
component-discovery.mjslive read and import lookup). - Description: about 70 ms of discovery plus 15 to 33 ms of import lookups. Verified: 67 ms and 15 ms here.
- Description: the store is used only while each file (by content) and folder (by names except
node_modules) the work read is unchanged. Verified (stored-self-audit.mjs:59,CORE_FOLDER_SKIP);package.jsonis compared by seven packer-stable fields, which includeexports. - Description: any mismatch reads Core live. Verified for edits, added files and added folders.
- Description: output is byte-identical either way. Verified for the test's seven asks and for five packed asks with and without the store.
- Description: the generator copies Core's published files and runs discovery and import resolution while recording reads. Verified (
generate-component-list.mjs:35-61,published-files.mjs). - Description: it writes groups, imports and input states, with the self-audit's state function, to an uncommitted asset. Verified; the asset is git-ignored.
- Description: the store is checked once per operation, and the reuse helper never checks by itself. Verified (
stored-component-list.mjs:51-87,listing-cache.mjs:100). - Description: discovery uses the stored groups when the check passes. Verified (
component-discovery.mjs:379-386). - Description: an import uses the store only after a check in the same operation, so a single component lookup never pays for it. Verified (
component-discovery.mjs:816-819;component Button --jsonwithin 3 ms). - Description: the command handler is unchanged, so the text list's import column resolves live. Verified; the column is filled after the list operation's cache scope ends (
component.mjs:390). - Description: the listing cache gains a read-only memo accessor. Verified (
listing-cache.mjs:94-102). - Description: the pack helper and prepack/postpack run the generator, and the doc-loads list names its two spawns. Verified; the doc-loads test passes after the merge.
- Description: no difference in output. Verified, as above.
- Description: the asset is 37.8 KB unpacked and about 12.4 to 12.9 KB gzipped. Approximately: 37.9 KB and 12.4 KB at the default level at this head; the fastest level reaches 13.5 KB.
- Description: it records 399 inputs (223 folders, 176 files), 78 groups and 174 imports. Approximately: 400 inputs (224 folders, 176 files) at this head, one folder more from Core's new
Swipefolder; groups and imports are exact. - Description: packed timings for the list asks. Direction and size reproduced (18 to 45 ms faster).
- Description: single-component lookups are unchanged. Verified for
component Button --json. - Description: where the store misses, timings are unchanged. Verified for an added Core file: 1 to 2 ms over live; a large integration was not measured.
- Description: no public API, product behavior, visual or policy change. Verified (no API rows; identical output).
- Description: product changes found during the work were removed or split. Verified; no tag-along change.
- Description: public text has no internal context. Verified.
- Description: the new test covers shipping, answering, byte-identity, an in-place edit, a new file, a new folder and re-hits. Verified; it passes at this head, with the Czech-locale case.
- Description: the CLI suites pass. Partly: the 11 targeted suites pass here (213 tests); CI's test jobs did not run at this head.
Files:
.changeset/stored-core-component-list.md: clear.packages/cli/.gitignore: clear.packages/cli/foundation/discovery/component-discovery.mjs: clear.packages/cli/foundation/discovery/stored-component-list.mjs: clear.packages/cli/foundation/discovery/stored-self-audit.mjs: clear.packages/cli/foundation/doc-compiler/doc-loads.test.mjs: clear; merges cleanly with the runner entries frommain.packages/cli/foundation/fs/listing-cache.mjs: clear.packages/cli/package.json: clear.packages/cli/scripts/generate-component-list.mjs: clear.packages/cli/scripts/generate-self-audit.mjs: clear.packages/cli/scripts/published-files.mjs: clear.packages/cli/test-utils/pack-cli.mjs: non-blocking: the stage comment at lines 163-165 is out of date.packages/cli/test/packed-component-list.test.mjs: clear.scripts/vitest-node-durations.json: clear; merges cleanly with the record frommain.
There was a problem hiding this comment.
Approved pending CI: test-node (2/5) stopped at its shard time limit with every finished test passing, so it needs a re-run, and three more Node test legs have not finished; all of them must pass before merge. The overrun is not caused by this change: the same code passed that leg at an earlier head, and a file that ran three times its recorded time there takes the same time with and without this change.
The stored component list prints exactly what a live read prints on a copy of Core's published files, and an edited, added or removed Core file or folder falls back to the live read; the default component --list answers about 44 ms sooner here, and a miss costs about 1 ms.
Non-blocking:
- The comment at
packages/cli/test-utils/pack-cli.mjs:163-165still describes the second stage as the two generators that read the stores, but that stage also runs the component-list generator. - The description's figures trail this head: the asset records 400 inputs (224 folders) in 37.9 KB, and the text list gains about 44 ms here rather than 26 ms.
Claims and files checked
Claims:
- Changeset: the published CLI stores Core's component list and imports at publish. Verified (
packages/cli/package.jsonprepack; the packed test's shipping case). - Changeset: it uses them while the installed Core's files are unchanged. Verified (
stored-component-list.mjs:51-72; the packed test). - Changeset:
component --listanswers about 30 to 60 ms sooner in a project with no integrations. Verified: 44 ms sooner as text and 43 ms with--jsonon an unchanged copy of Core. - Changeset: another Core version, or a change to a Core file or folder the list reads, reads Core live. Verified in effect: an edited doc, an added file and an added folder miss;
package.jsonis compared by the seven fields a packer keeps,versionandexports(the only field discovery reads) among them. - Description: Without a store, each list walks Core's tree, regex-reads docs, parses family docs and searches the tree for imports. Verified (
component-discovery.mjslive read and import lookup). - Description: About 70 ms of discovery plus 15 to 33 ms of import lookups. Verified: 67 ms and 15 ms here.
- Description: The store is used only while each file the work read (by content) and each folder (by its names except
node_modules) is unchanged. Verified (stored-self-audit.mjs:59-81,CORE_FOLDER_SKIP), withpackage.jsoncompared by its packer-stable fields. - Description: Any mismatch reads Core live. Verified for an edited doc, an added file and an added folder.
- Description: Output is byte-identical either way. Verified for the test's seven asks and five more asks with and without the asset.
- Description: The generator copies exactly the files Core publishes and runs discovery and import resolution while recording reads. Verified (
generate-component-list.mjs:45-96,published-files.mjs). - Description: It writes groups, imports and input states, with the self-audit's state function, to an asset that is not committed. Verified; the asset is git-ignored (
packages/cli/.gitignore:31-34). - Description: The store is checked once per operation, and the reuse helper never checks by itself. Verified (
stored-component-list.mjs:51-87,listing-cache.mjs:94-102). - Description: Discovery uses the stored groups when the check passes. Verified (
component-discovery.mjs:379-386). - Description: An import uses the store only after a check in the same operation, so a single component lookup never pays for it. Verified (
component-discovery.mjs:816-819;component Button --jsonwithin 1 ms). - Description: The command handler is unchanged, so the text list's import column resolves live. Verified; that column is filled after the list operation's cache scope ends (
clients/cli/commands/component.mjs:390). - Description: The listing cache gains a read-only memo accessor. Verified (
listing-cache.mjs:94-102). - Description: The pack helper and prepack/postpack run the new generator, and the doc-loads list names its spawns. Verified; the doc-loads test passes.
- Description: No difference in output. Verified, as above.
- Description: The asset is 37.8 KB unpacked and about 12.4 to 12.9 KB gzipped. Approximately: 37.9 KB, and 12.4 KB at the default level to 13.5 KB at the fastest.
- Description: It records 399 inputs (223 folders, 176 files), 78 groups and 174 imports. Approximately: 400 inputs (224 folders, 176 files) at this head; groups and imports are exact.
- Description: Packed timings for
--json, compact and full detail. Direction and size reproduced: 43, 33 and 15 ms faster. - Description: The text list gains about 26 ms. Understated: 44 ms here.
- Description: Single-component lookups are unchanged. Verified for
component Button --json. - Description: Where the store misses, timings are unchanged. Verified for an added Core file (1 ms); a large integration was not measured.
- Description: No public API, product behavior, visual or policy change. Verified (no API rows; identical output).
- Description: Product changes found during the work were removed or split. Verified; no tag-along change.
- Description: Public text has no internal context. Verified.
- Description: The new test covers shipping, answering, byte-identity, a same-size in-place edit, a new file, a new folder and re-hits. Verified; it passes at this head, with a Czech-locale case besides.
- Description: The CLI suites pass. Partly: the 11 targeted suites (213 tests) pass here; CI's Node test legs have not all passed at this head.
Files:
.changeset/stored-core-component-list.md: clear.packages/cli/.gitignore: clear.packages/cli/foundation/discovery/component-discovery.mjs: clear.packages/cli/foundation/discovery/stored-component-list.mjs: clear.packages/cli/foundation/discovery/stored-self-audit.mjs: clear.packages/cli/foundation/doc-compiler/doc-loads.test.mjs: clear.packages/cli/foundation/fs/listing-cache.mjs: clear.packages/cli/package.json: clear.packages/cli/scripts/generate-component-list.mjs: clear.packages/cli/scripts/generate-self-audit.mjs: clear.packages/cli/scripts/published-files.mjs: clear.packages/cli/test-utils/pack-cli.mjs: non-blocking: the stage comment at lines 163-165 is out of date.packages/cli/test/packed-component-list.test.mjs: clear.scripts/vitest-node-durations.json: clear; one added entry, inmain's order.
There was a problem hiding this comment.
Approved pending CI: CI's first run at this head was refused for capacity ("CI is full") before its build and test jobs ran; a second attempt is now waiting for room, and those jobs must pass before merge. Lint, the CLI smoke test and the dependency check passed.
The stored component list prints exactly what a live read prints on a copy of Core's published files, and an edited, added or removed Core file or folder falls back to the live read; on an unchanged copy the default component --list answers about 43 ms sooner, and a miss costs about 2 ms.
Non-blocking:
- The comment at
packages/cli/test-utils/pack-cli.mjs:163-165still describes the second stage as the two generators that read the stores, but that stage also runs the component-list generator. - The description's figures trail this head: the asset records 400 inputs (224 folders) in 37.9 KB, gzips to 12.4–13.5 KB, and the text list gains about 43 ms here rather than 26 ms.
- The header of
packages/cli/foundation/discovery/stored-self-audit.mjsstill says only Doctor reads it, though its recorder and checker now also decide when the component list is used.
Claims and files checked
Claims:
- Changeset: the published CLI stores Core's component list and imports at publish. Verified (
packages/cli/package.jsonprepack; the packed test's shipping case). - Changeset: it uses them while the installed Core's files are unchanged. Verified (
stored-component-list.mjs:51-72; the packed test). - Changeset:
component --listanswers about 30 to 60 ms sooner in a project with no integrations. Verified for the default list: 43 ms sooner as text and 48 ms with--json; the compact and full details gain 40 and 24 ms. - Changeset: another Core version, or a change to a Core file or folder the list reads, reads Core live. Verified (the packed test's miss cases; the version is one of the recorded
package.jsonfields). - Description: without the store each run walks Core's source, reads each doc, parses family docs and searches the tree for each import. Verified (
component-discovery.mjs:206-248,:415-544,:815-847). - Description: the stored answer is used only while every file the work read keeps its content and every folder keeps its names except
node_modules. Verified (stored-self-audit.mjs:59-81,stored-component-list.mjs:36). - Description: any mismatch reads Core live, and output is byte-identical either way. Verified (the packed test; five asks compared with and without the asset).
- Description: the generator copies the files Core publishes, works the list and imports out under the read recorder, and writes them with the state of each input; the file is not committed. Verified (
generate-component-list.mjs:45-96;packages/cli/.gitignore:34). - Description: the store is checked once per operation, and the import lookup reuses a check without making one, so a single
component <Name>never pays for it. Verified (stored-component-list.mjs:51-87;listing-cache.mjs:100-102;component Button --jsonunchanged). - Description: the command handler is unchanged, so the text list's import column still resolves live. Verified (the handler is not in the diff, and its lookup runs after the API's listing scope ends).
- Description: the listing cache gains a read-only memo lookup; the pack helper and
prepack/postpackrun the new generator; the doc-loads test lists its two spawns. Verified (listing-cache.mjs:94-102;pack-cli.mjs:36-39,:74-78;package.json:123-124;doc-loads.test.mjs:507-518). - Description: package growth of 37.8 KB, 12.4–12.9 KB gzipped, 399 inputs (223 folders, 176 files), 78 groups and 174 imports. Partly stale: 37.9 KB, 12.4–13.5 KB, 400 inputs (224 folders, 176 files); groups and imports exact (non-blocking).
- Description: the timings for the list asks, unchanged single-component asks, and misses within about 3 ms. Consistent in direction here: list asks 24 to 48 ms faster,
component Button --jsonunchanged, a miss 2 ms slower. - Description: no public API, product behavior or visual change, and no internal context. Verified (no exported module or command doc changes; no internal references in added lines, commits, title or body).
- Description: the new packed test covers shipping, hits, byte-identical output, an in-place edit with its time restored, a new file, a new folder and restoring each. Verified (
packed-component-list.test.mjs:111-187; passes at this head). - Description: the CLI suites for the component API, foundation, clients and tests pass. Partly verified: the discovery, file-system, doc-loads, component API and command suites and the packed component-list, self-audit and gather-cache suites pass here; the full suites wait on CI.
Files:
.changeset/stored-core-component-list.md: clear.packages/cli/.gitignore: clear.packages/cli/foundation/discovery/component-discovery.mjs: clear.packages/cli/foundation/discovery/stored-component-list.mjs: clear.packages/cli/foundation/discovery/stored-self-audit.mjs: header not updated (non-blocking).packages/cli/foundation/doc-compiler/doc-loads.test.mjs: clear.packages/cli/foundation/fs/listing-cache.mjs: clear.packages/cli/package.json: clear.packages/cli/scripts/generate-component-list.mjs: clear.packages/cli/scripts/generate-self-audit.mjs: clear.packages/cli/scripts/published-files.mjs: clear.packages/cli/test-utils/pack-cli.mjs: stale stage comment (non-blocking).packages/cli/test/packed-component-list.test.mjs: clear.scripts/vitest-node-durations.json: clear.
Maintainer impact
In a project with no integrations nothing is kept between runs, so every
component --listworks Core's list out from scratch: it walks Core's source tree, regex-reads each doc, parses family docs with Babel for their member names, and resolves each component's import by searching the tree. That is about 70 ms of discovery plus 15–33 ms of import lookups.Intended invariant
The stored answer is used only for an installed Core whose every file and folder that the work read is in the state recorded at publish: each file by its content hash, each folder by every name it holds except
node_modules. Any mismatch (another Core version, a patched or hand-edited install, an added or removed file, a dev checkout) reads Core live, as before. Output is byte-identical either way.Change
scripts/generate-component-list.mjs(atprepack) copies exactly the files Core publishes (npm pack --dry-runin Core) and runsdiscoverComponentsplusresolveImportPathfor each listed component underrecordReads. It writes the groups, the imports, and the state of every file and folder under Core that the work read (inputState, the same function the stored self-audit uses) toassets/component-list.generated.json. The file isn't committed, like the other stored files.foundation/discovery/stored-component-list.mjs:storedComponentList(coreDir)checks every recorded input once per operation and returns the stored list or null.checkedComponentList(coreDir)reuses a check this operation already made and never checks by itself.discoverComponentsuses the stored groups when the check passes.resolveImportPathuses a stored import only when the operation already checked the store, so a singlecomponent <Name>never pays for the check. The command handler is unchanged, so the text list's import column still resolves live.listing-cache.mjsgainsonceComputed(key)(read a memo without computing it).pack-cli.mjsandprepack/postpackrun the new generator; doc-loads lists its two spawns.Declared difference
None in output.
Package growth:
assets/component-list.generated.jsonis 37.8 KB unpacked, about 12.4–12.9 KB gzipped (depending on the compression level). It records 399 inputs (223 folders, 176 files), 78 groups and 174 imports.Evidence
Packed CLI, core-only project with a published Core (the files
npm packof Core holds), warm, medians of 15:component --list --json: 320 → 270 mscomponent --list --detail compact: 458 → 425 mscomponent --list --detail full --json: 420 → 403 mscomponent --list(text): about −26 ms (its import column resolves live)component Button,component Button --json,component HStack --json: unchangedWhere the store misses (Core linked from a checkout, or a project with a large TypeScript integration), every cell is unchanged (±3 ms). Output is byte-identical in every case.
Scope
Components: CLI component discovery (stored Core list)
Testing
New
test/packed-component-list.test.mjs, using the packed CLI and a project holding a copy of Core's published files:component --list(names,--json, compact, compact--json, full--json),component Button --jsonandcomponent HStack --jsonare byte-identical to the checkout CLI, which works them out live;src/Button/Notice.tsx) misses the store;The CLI suites for
api/component,foundation,clientsandtestpass.