Repository navigation
perf(cli): keep template discovery for component and template in projects with no integration - #12585
Conversation
|
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: the caching change itself checks out (warm lookups hit, answers match fresh runs, and adding an integration later leaves no stale template list), but three small fixes are needed first.
packages/cli/test/packed-gather-cache.records.test.mjs:41-52copies the fixture's exportedtemplatesEntries, so delete the localtemplateEntriesand asserttemplatesEntries(tmp).sizeinstead.packages/cli/foundation/integrations/may-have-integrations.mjs:17-20still sayscomponentandtemplateskip the recorder in a project with no integration, andpackages/cli/foundation/fs/gather-cache.mjs:50-52still says onlydoctornever makes the folder, so update both headers to the new rule.- The new bare-project case only counts template entries, so it proves neither the warm hit the description claims nor the "keeps only template discovery" in its title (a warm
component Buttonalso keeps a doc parse); run the warm asks throughexpectWarmHitand assert or reword what is kept.
The changeset's "about 55–60 ms" measured 20–31 ms at the median here, so consider saying what was measured. Repository CI has not run on this head yet.
Claims and files checked
Review mode: full; reason: no-earlier-review
- Claim (changeset): a warm
componentortemplatemiss in a Core-only project is about 55–60 ms faster. Direction verified (20–31 ms median faster here); magnitude not reproduced. - Claim (changeset): template discovery is now kept for those commands. Verified (
gather-cache.mjs:320-338; test fails on the base atrecords.test.mjs:357, passes on the head). - Claim (changeset and description): every answer is unchanged. Verified: kept runs match fresh runs for four lookups and after the project gains an integration.
- Claim: the two commands record into an existing catalogs folder and never create it. Verified (
gather-cache.mjs:331,:334; test:351-353). - Claim: a lookup miss creates the folder. Verified (name index,
name-index.mjs:110-136). - Claim: later misses read the kept summary instead of every template doc. Verified in code (
template-adapter.mjs:1547) and by a warm-hit check. - Claim: the test checks that a warm miss reads the kept summary. False: it checks that one summary is kept, not that it is read.
- Claim: the test checks that the commands never create the folder. Verified for
template --listandcomponent Button. - Claim: search, lookups, docs, build, typo and stale-cache cases match the base. Partly checked: the kept-catalog suite has identical results on base and head; the other comparisons are not in the repository.
- Claim: the first recording call pays about 50 ms once. Consistent (about 45 ms in one sample).
- Claim: projects with integrations are unchanged. Verified (same path when an integration can load).
- Claim: stacked on #12538. Verified.
- File
.changeset/warm-miss-core-only-templates.md: clear (timing note above). - File
packages/cli/foundation/fs/gather-cache.mjs: gate logic clear; header at:50-52stale. - File
packages/cli/test/packed-gather-cache.records.test.mjs: copied helper at:41-52; case at:344-357proves less than claimed.
There was a problem hiding this comment.
Approved pending CI: CI has not run on this head yet; it runs once this pull request targets main.
The three earlier fixes are in: the bare-project case uses the fixture's templatesEntries, checks the warm hit with expectWarmHit and lists every kind of entry kept, and both headers describe the new recording rule. One optional point: the changeset's "about 55–60 ms" measured 20–31 ms at the median in our runs, so consider describing the saving without a fixed figure.
Claims and files checked
Review mode: incremental; reason: none
- Claim: on the base, a warm
componentortemplatemiss in a Core-only project re-read every template doc. Verified: the base recorder skipped both commands there, and the head's test fails on the base atpacked-gather-cache.records.test.mjs:382. - Claim: the two commands now record template discovery into an existing catalogs folder and never create it. Verified (
gather-cache.mjs:323-336; test:371-373,:382). - Claim: a lookup miss creates the folder. Verified: the not-found name index makes it, and the test exempts the miss at
:371. - Claim: later misses read the kept records instead of every template doc. Verified: the warm reruns at
:380rewrite no entry. - Claim (changeset and description): every answer is unchanged. Verified: kept and warm answers equal fresh runs (
:351-356,:374-376,:381). - Claim: stacked on #12538. Verified: its branch is the base, and the kept kinds include its summaries.
- Claim: the test checks the warm miss and that the commands never create the folder. Verified (
:371-373,:380). - Claim: search, lookups, docs forms, build answers, the typo grid and stale-cache cases match the base. Consistent: the kept-catalog suites give the same results on base and head; the full replay was not rerun.
- Claim (changeset and description): about 55–60 ms faster, and about 50 ms once for the first record. Direction verified (20–31 ms faster at the median, about 45 ms once); magnitude not reproduced.
- Claim: projects with integrations are unchanged. Verified: the gate takes the base path where an integration can load.
- File
.changeset/warm-miss-core-only-templates.md: clear (timing note above). - File
packages/cli/foundation/fs/gather-cache.mjs: clear. - File
packages/cli/foundation/integrations/may-have-integrations.mjs: clear. - File
packages/cli/test/packed-gather-cache.records.test.mjs: clear.
…ith no integration A warm component or template miss in a project with only Core read each of the CLI's template docs on every call: those commands recorded nothing there, so template discovery was never kept. They now record into the per-user catalogs folder once it exists (a lookup miss makes it), and never make it.
…egration Use the fixture's templatesEntries, update the headers that still said component and template skip the recorder there, and check the warm hit and every kind of entry the bare project keeps.
5021f9a to
8243a7c
Compare
There was a problem hiding this comment.
Approved pending CI: CI has not finished on this head yet.
component and template now keep template discovery in Core-only projects once the catalogs folder exists, which the global-mode spec's write rules allow, and the bare-project test proves it by failing on the base. One optional point: the changeset's "about 55–60 ms" measured 30–37 ms faster on warm misses in a side-by-side run, so consider describing the saving without a fixed figure.
Claims and files checked
Review mode: full; reason: rebase
- Claim: on the base, a warm
componentortemplatemiss in a Core-only project re-read every template doc. Verified: the base recorder skipped both commands there, and the head's test fails on the base atpacked-gather-cache.records.test.mjs:382. - Claim: the two commands now record template discovery into an existing catalogs folder and never create it themselves. Verified (
gather-cache.mjs:323-340; test:371-373,:382). - Claim: a lookup miss creates the folder. Verified: the not-found name index creates it on base and head alike; the test exempts the miss at
:371. - Claim: later misses read the kept records instead of every template doc. Verified: the warm reruns at
:380rewrite no entry. - Claim (changeset and description): every answer is unchanged. Verified: kept and warm answers equal fresh runs (
:351-356,:374-376,:381), and 15 timed rounds per command gave identical output on base and head. - Claim: stacked on #12538. Verified: #12538 is merged and is this pull request's base; the kept kinds at
:386-393include its summaries. - Claim: the test checks, on the packed CLI, the warm miss and that the commands never create the folder. Verified (
:371-373,:380-393). - Claim: search, lookups, docs forms, build answers, the typo grid and the stale-cache cases match the base. Consistent: every kept-catalog suite passes on the head and compares kept answers with fresh ones; the full replay was not rerun.
- Claim (changeset and description): about 55–60 ms faster, and about 50 ms once for the first record. Direction verified: 30–37 ms faster on warm misses and about 40–43 ms once, side by side.
- Claim: projects with integrations are unchanged. Verified: where an integration can load, the gate takes the base path.
- File
.changeset/warm-miss-core-only-templates.md: clear (timing note above). - File
packages/cli/foundation/fs/gather-cache.mjs: clear. - File
packages/cli/foundation/integrations/may-have-integrations.mjs: clear. - File
packages/cli/test/packed-gather-cache.records.test.mjs: clear.
PR Analysis Report🔎 Preview ·
|
User need
An agent in a project that uses only Core often asks
astryx componentorastryx templatefor a name that does not exist. Each such miss read every one of the CLI's template docs again, so a warm miss cost as much as a cold one.Problem and solution fit
componentandtemplatenow record template discovery into the per-user catalogs folder once that folder exists (a lookup miss makes it), and they never make the folder themselves. Later misses read the kept summary instead of every template doc. Every answer is unchanged.Stacked on #12538, which keeps the stored-list check and Core's match views; this pull request keeps template discovery for the same commands.
Testing
packages/cli/test/packed-gather-cache.records.test.mjschecks, on the packed CLI, that a warm miss in a Core-only project reads the kept summary and that the commands never create the catalogs folder.