Repository navigation
test(cli): keep the packed-gather-cache CLI from installing the published Core in the background - #13134
Conversation
…shed Core in the background
|
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.
Changes requested: the fix is correct, but the worker removal should go through the shared CLI-copy helpers, and one note in the description needs correcting.
usePackedClideletesfoundation/release/core-worker.mjsitself (packages/cli/test-utils/packed-gather-cache-fixture.mjs:563-565), repeating whatplaceClidoes for itscoreStepoption (packages/cli/test-utils/global-local-fixtures.mjs:520-524), so please givepackPublishedClithe samecoreStepoption, backed by one helper thatbuildCopyalso calls, and callpackPublishedCli(work, {coreStep: false})here.- The Unsure note says
packed-search-catalog.test.mjsandpacked-help-imports.test.mjs"can reach the registry in the same way", but in CI they cannot, becausemaybeFetchCorereturns early whenCIis set (packages/cli/foundation/release/global-state.mjs:332),packed-help-imports.test.mjssetsCI: '1'(line 98) andpacked-search-catalog.test.mjskeeps the runner'sCI, so please reword the note.
The stated cause matches the failing CI log, the publish time and the code path from the background Core step to meta.answeredBy. The fixture's 12 test files pass with the change. Keeping packPublishedCli's default is right: with the worker removed there, the store test in packed-search-catalog.test.mjs gets 4 kept gathers instead of 1.
Claims and files checked
Review mode: full; reason: no-earlier-review
- With the fix, all 12 packed-gather-cache test files pass (95 tests, 1 skipped): verified by a run at this head.
- The failure needs registry access and does not reproduce offline: verified; offline the background install fails on the base and the head alike.
- The npm-packed test failed on the main branch with the kept run naming Core 0.7.17 and the fresh run naming none: verified in that run's test log.
- The fixture unpacks the CLI with
packPublishedCli, which keeps the background Core step: verified,pack-published-cli.mjs:22-46. run()clearsCI, so each run's exit starts the step with the kept temp folder as the user cache: verified,packed-gather-cache-fixture.mjs:120-121,:145andhandoff.mjs:241-247.- Core 0.7.17 was published a few minutes before the test ran: verified against the registry's publish time.
- Later kept runs read the cached Core while a fresh folder has none: verified by the code path (
run-context.mjs:111-180) and the failing assertion. - The failure repeats on every run that reaches the registry while the version is published: consistent with the code; not reproducible offline.
placeClileaves the worker out by default: verified,global-local-fixtures.mjs:392-394,:520-524.- With the worker removed, no run of this fixture starts a background install, so kept and fresh runs share the same release cache: verified,
global-state.mjs:356-357. - Removing the step inside
packPublishedCliinstead breaks the stored-catalog test (4 kept entries, not 1): verified by trying it. packed-search-catalog.test.mjsandpacked-help-imports.test.mjscan reach the registry the same way: false in CI (see above).packages/cli/test-utils/packed-gather-cache-fixture.mjs: the shared-helper finding above.
|
|
There was a problem hiding this comment.
Approved pending CI: the heavy CI checks have not run on this head yet; they run once review passes, before merge.
Both earlier points are addressed: the fixture now opts out through packPublishedCli(work, {coreStep: false}), which shares removeCoreWorker with placeCli, and the Unsure note now matches how the other two suites behave in CI. The stated cause matches the failing test log, the registry's publish time and the code path from the background Core step to meta.answeredBy. One optional wording fix: the new JSDoc says a coreStep: false copy "cannot start a download", but a Core-reading command outside a project still installs Core in the foreground (packages/cli/foundation/fs/paths.mjs:190), so "no run of this copy starts the background Core install" is more exact.
Claims and files checked
Review mode: full; reason: author-not-engowner
- The fixture's 12 files, the stored-catalog suite and the help-imports suite pass after the change: verified on this head.
- The original fix already passed the fixture's 12 files: consistent; those 12 files pass on this head with the same counts.
- The failure needs registry access and does not reproduce offline: verified.
- On the earlier head, the heavy CI contexts failed only because they were deferred until review: verified from that run's job steps.
- The npm-packed test failed on the main branch with the kept run naming Core 0.7.17 and the fresh run naming none: verified in that run's test log.
- Before the fix the fixture's copy kept the background Core step: verified,
pack-published-cli.mjsat the base. run()clearsCI, so each run's exit starts the step with the kept temp folder as the user cache: verified,packed-gather-cache-fixture.mjs:121,:145,handoff.mjs:236-247.- Core 0.7.17 was published about four minutes before the file ran: verified against the registry's publish time.
- Later kept runs read the cached Core while a fresh folder has none: verified,
run-context.mjs:111-136,:157-164. - The failure repeats on every networked run while the version is published: consistent with the code; not reproducible offline.
usePackedClinow asks for a copy without the worker: verified,packed-gather-cache-fixture.mjs:561.packPublishedCliandbuildCopyshare one removal helper: verified,pack-published-cli.mjs:46,global-local-fixtures.mjs:512-516,:530.- No run of the fixture starts a background install: verified,
global-state.mjs:356-357. placeClistill drops the worker by default andpackPublishedClistill keeps it: verified.- Dropping the worker by default in
packPublishedClibreaks the stored-catalog test (4 kept entries, not 1): verified by trying it. - The stored-catalog and help-imports suites still use copies with the worker: verified.
- Neither of those suites starts the background fetch in CI: verified,
global-state.mjs:332,packed-help-imports.test.mjs:98,packed-search-catalog.test.mjs:83. - Only the gather-cache fixture opts out of the worker: verified.
packages/cli/test-utils/global-local-fixtures.mjs: clear.packages/cli/test-utils/pack-published-cli.mjs: clear; one optional JSDoc wording note.packages/cli/test-utils/packed-gather-cache-fixture.mjs: clear.
| * install would place them. `coreStep: false` leaves out the background Core | ||
| * step so this copy cannot start a download. |
There was a problem hiding this comment.
Optional wording: without the worker, a run can still download Core in the foreground. A Core-reading command outside a project calls carriedCore({fetch: true}) (foundation/fs/paths.mjs:190), which installs through ensureRelease. Maybe:
* install would place them. `coreStep: false` leaves out the background Core
* step, so no run of this copy starts the background Core install.
validation: ran
pnpm exec vitest run --project node packages/cli/test/packed-gather-cache packages/cli/test/packed-search-catalog.test.mjs packages/cli/test/packed-help-imports.test.mjsafter the review changes: all 14 files passed (113 tests passed, 1 skipped).The original fix passed all 12 packed-gather-cache files (95 tests passed, 1 skipped) with
pnpm exec vitest run --project node packages/cli/test/packed-gather-cache. The failure needs registry access, which the fix environment does not have, so it was not reproduced locally; the evidence is the CI log and the publish time below.PR CI follow-up
At the original fix head f8469b3, CI run 44825778646 reported
test,build, anddocsite-testas failed only because each stopped atHeavy CI deferred: runs when review passes and before merge (spec:AST-030 FR20).No test or build ran in those jobs. This was the required review-gate behavior, not a failure of the fixture change.What failed
packages/cli/test/packed-gather-cache.npm-packed.test.mjs › npm's list, kept for a package's check of itself › is read back after an edit inside a file, in place or by rename, and asked again after each change that can change itfailed in thetest-node(11/12) job of the deploy run at 938dbc4. The kept check's answer namedmeta.answeredBy.core: "0.7.17". The fresh check's answer namedcore: null.Cause
Before the fix, the packed-gather-cache fixture unpacked the published CLI with
packPublishedCli, and that copy kept the background Core step (foundation/release/core-worker.mjs).run()clearsCI, somaybeFetchCorestarts that step for the run's version, with the kept temp folder as the user cache. Before 0.7.17 was on npm, the install always failed, so the test passed.@astryxdesign/[email protected]was published about four minutes before this job ran this file. After that, the step installed the real 0.7.17 release into the kept temp folder's release cache. The later runs from that folder then found a carried Core (carriedCore→cachedRelease), andansweredBynamed it. A fresh temp folder has no cached release, so it namesnull, and the two answers differ. The failure occurs on every run while the repository's version is the published one and the runner can reach the registry.Fix
usePackedClicallspackPublishedCli(work, {coreStep: false}). The packing helper andplaceCli'sbuildCopyuse the same worker-removal helper. No run of the gather-cache fixture starts a background Core install, so the kept and fresh runs see the same release cache.placeClistill omits the worker by default, andpackPublishedClistill keeps it by default.Unsure
Omitting the worker by default in
packPublishedClibreakspacked-search-catalog.test.mjs › keeps a reference to the store, not a copy(4 kept entries instead of 1), so the gather-cache fixture opts out explicitly.packed-search-catalog.test.mjsandpacked-help-imports.test.mjsstill use copies with the worker, but neither starts the background fetch in CI:maybeFetchCorereturns early whenCIis set, the search test inherits the runner'sCI, and the help-imports test setsCI: '1'itself.See also #13070. See also #13127.