Skip to content

test(cli): keep the packed-gather-cache CLI from installing the published Core in the background - #13134

Closed
astracat-bot[bot] wants to merge 2 commits into
mainfrom
codebunny/fix/test-cli-keep-the-packed-gather-cache-cli-from-installing-the-published-core-in-the-background-cc0b70
Closed

astracat-bot[bot] wants to merge 2 commits into
mainfrom
codebunny/fix/test-cli-keep-the-packed-gather-cache-cli-from-installing-the-published-core-in-the-background-cc0b70

Conversation

@astracat-bot

@astracat-bot astracat-bot Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

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.mjs after 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, and docsite-test as failed only because each stopped at Heavy 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 it failed in the test-node (11/12) job of the deploy run at 938dbc4. The kept check's answer named meta.answeredBy.core: "0.7.17". The fresh check's answer named core: 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() clears CI, so maybeFetchCore starts 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), and answeredBy named it. A fresh temp folder has no cached release, so it names null, 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

usePackedCli calls packPublishedCli(work, {coreStep: false}). The packing helper and placeCli's buildCopy use 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. placeCli still omits the worker by default, and packPublishedCli still keeps it by default.

Unsure

Omitting the worker by default in packPublishedCli breaks packed-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.mjs and packed-help-imports.test.mjs still use copies with the worker, but neither starts the background fetch in CI: maybeFetchCore returns early when CI is set, the search test inherits the runner's CI, and the help-imports test sets CI: '1' itself.

See also #13070. See also #13127.

@vercel

vercel Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
astryx Ready Ready Preview Nov 20, 2026 10:45pm UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Nov 20, 2026
@astracat-bot

astracat-bot Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor Author

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 20, 2026, 10:53 PM UTC

@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · b1bda8b

This branch's preview address cannot be known in advance; open it from Vercel's comment.

Current run: Heavy CI deferred: runs when review passes and before merge. Lint, typecheck and any path-filtered checks ran on this push.


Generated by PR Enrichment workflow | View current CI run

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

  • usePackedCli deletes foundation/release/core-worker.mjs itself (packages/cli/test-utils/packed-gather-cache-fixture.mjs:563-565), repeating what placeCli does for its coreStep option (packages/cli/test-utils/global-local-fixtures.mjs:520-524), so please give packPublishedCli the same coreStep option, backed by one helper that buildCopy also calls, and call packPublishedCli(work, {coreStep: false}) here.
  • The Unsure note says packed-search-catalog.test.mjs and packed-help-imports.test.mjs "can reach the registry in the same way", but in CI they cannot, because maybeFetchCore returns early when CI is set (packages/cli/foundation/release/global-state.mjs:332), packed-help-imports.test.mjs sets CI: '1' (line 98) and packed-search-catalog.test.mjs keeps the runner's CI, 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() clears CI, 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, :145 and handoff.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.
  • placeCli leaves 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 packPublishedCli instead breaks the stored-catalog test (4 kept entries, not 1): verified by trying it.
  • packed-search-catalog.test.mjs and packed-help-imports.test.mjs can 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.

Automated review (maintainer link)

@astracat-bot

astracat-bot Bot commented Nov 20, 2026

Copy link
Copy Markdown
Contributor Author

packPublishedCli and buildCopy now share the Core-worker removal helper. Only the packed gather-cache fixture opts out of the worker in packPublishedCli; other callers keep it by default, including the stored-catalog test. The PR description now distinguishes that default from whether the worker can actually start in CI.

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.mjs at the base.
  • run() clears CI, 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.
  • usePackedCli now asks for a copy without the worker: verified, packed-gather-cache-fixture.mjs:561.
  • packPublishedCli and buildCopy share 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.
  • placeCli still drops the worker by default and packPublishedCli still keeps it: verified.
  • Dropping the worker by default in packPublishedCli breaks 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.

Automated review (maintainer link)

Comment on lines +18 to +19
* install would place them. `coreStep: false` leaves out the background Core
* step so this copy cannot start a download.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@cixzhang

Copy link
Copy Markdown
Contributor

(Posted by Cindy's agent.) Superseded by #13136: the same change, re-cut with astracat-bot credited as co-author, plus a check that fails the fixture if the background step is ever renamed. CI on #13136 (run 44841859081) passes with registry access.

@cixzhang cixzhang closed this Nov 21, 2026
@github-actions
github-actions Bot deleted the codebunny/fix/test-cli-keep-the-packed-gather-cache-cli-from-installing-the-published-core-in-the-background-cc0b70 branch November 21, 2026 06:04

This branch was successfully deployed

1 active deployment
Preview — b1bda8bc Deployed Nov 20, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant