Skip to content

test(cli): packed-docs-routes starts no background Core download - #13634

Merged
cixzhang merged 1 commit into
meta:mainfrom
vjeux:test/packed-docs-routes-no-background-core
Nov 23, 2026
Merged

cixzhang merged 1 commit into
meta:mainfrom
vjeux:test/packed-docs-routes-no-background-core

Conversation

@vjeux

@vjeux vjeux commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Maintainer impact

A local run of packages/cli/test/packed-docs-routes.test.mjs can fail in afterAll with ENOTEMPTY, or leave a folder behind in the temporary directory. It happens only where CI is not set, as in a local pnpm preflight. GitHub Actions sets CI, so CI runs are not affected.

Intended invariant

This test's runs of the packed CLI leave no process that writes into its folders after the run. packages/cli/test/packed-help-imports.test.mjs already sets CI for the runs it starts.

Change

hookMiss runs the CLI from the unpacked tarball. That copy sits in a node_modules folder whose owner holds no package.json, so the CLI reads it as a global copy (isGlobalCopy).

As a global copy's run exits, it starts a detached download of its own Core into the user cache (maybeFetchCore in foundation/release/global-state.mjs). CI stops that download, and NO_UPDATE_NOTIFIER does not.

The test points the cache at its own folder, so the download writes there after the run has exited. A write that lands while afterAll removes the folder fails the removal.

The change sets CI: '1' beside NO_UPDATE_NOTIFIER in the environment of hookMiss's runs. No product code changes, so the change has no changeset.

Evidence

  • Failure before the change: a scratch copy of the test with main's environment waited in afterAll for background work before it removed its folder. One detached core-worker.mjs ran for the test's cache. It wrote no-cache/astryx/releases/.failed-0.7.18.json 935 ms after the last CLI run had exited. In six earlier local runs of the unchanged test, one failed with ENOTEMPTY, and one left that file behind.
  • Success after the change: the same scratch copy with CI set saw no worker, and nothing was written after the runs. The changed test passed 3 of 3 runs, and only Node's compile cache was left in the run's temporary folder. The same change also passed six earlier local runs, with nothing left.
  • Product/runtime behavior verified unchanged: only the environment of the test's CLI runs changes. Every run uses --json, and the test's assertions pass unchanged.
  • CI impact: none. GitHub Actions already sets CI, so CI runs take the same path as before.

Scope

Components: CLI tests

  • No intended public API, product behavior, visual direction, or policy change.
  • Product changes discovered during the work were removed or split.
  • Public text and artifacts contain no internal Meta context.

Testing

  • pnpm build, then pnpm exec vitest run --project node packages/cli/test/packed-docs-routes.test.mjs three times with CI unset: 4 of 4 tests pass each time.
  • The scratch copy described above, run once with CI unset and once with CI=1. It is not part of this change.
  • ASTRYX_STRICT_LINT=1 pnpm preflight at the head, from a clean tree: all 8 steps pass, and it reports "ready to flip". Vitest passes 27,363 tests in the ui project and 30,248 in the node project, this test among them.
  • Prettier passes on the changed file. The public text check passes on the commit and this description.

hookMiss runs the packed CLI without CI set. Outside CI, a global copy
starts a detached download of its own Core as the run exits. That
download writes into the test's cache folder after the run, while
afterAll removes the folder, so the removal can fail with ENOTEMPTY.

Set CI in the run's environment, as packed-help-imports.test.mjs
does. GitHub Actions sets CI, so CI runs already skip the download.
@vercel

vercel Bot commented Nov 23, 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 23, 2026 4:39am UTC

Request Review

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

astracat-bot Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 23, 2026, 4:47 AM UTC

@cixzhang cixzhang added the ci:run A maintainer lets this outside contributor's pull request run CI (AST-030 FR17) label Nov 23, 2026
@cixzhang

Copy link
Copy Markdown
Contributor

/approve-spec dffd72a

@github-actions

github-actions Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · dffd72a

Storybook · Sandbox · built from this PR's head

Package size: no published package changed; no new dependencies.

Not run on this PR: add ci:run-visual for Visual, ci:run-a11y for Accessibility, ci:run-rtl for RTL.


Generated by PR Enrichment workflow | View full report

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approved pending CI: CI has not run on this head yet because the pull request is a draft, and it runs once the pull request is marked ready for review.

Setting CI for hookMiss's runs is the right fix, since maybeFetchCore checks only CI and NO_UPDATE_NOTIFIER turns off only the update check (global-mode spec FR6). A copy of the old test showed the tarball run's detached Core worker writing into the test cache after that run had exited; with CI set, no worker starts and all four tests still pass.

Claims and files checked

Review mode: full; reason: no-earlier-review

  • Claim: a local run without CI can fail in afterAll with ENOTEMPTY or leave files behind, and CI runs are not affected. Verified: a copy of the old test shows a detached worker writing into the test cache 750 ms after the tarball run exits; GitHub Actions sets CI and no workflow overrides it.
  • Claim: the unpacked tarball copy counts as a global copy because the owner of its folder has no package.json. Verified: foundation/release/choose.mjs:373-385, test lines 42-50.
  • Claim: a global copy starts a detached Core download as its run exits. Verified: foundation/release/handoff.mjs:241-247, foundation/release/global-state.mjs:325-360 and :427-435.
  • Claim: CI stops that download and NO_UPDATE_NOTIFIER does not. Verified: global-state.mjs:332 against :383.
  • Claim: the test points the cache at its own folder, so the download writes there. Verified: test line 114, foundation/env/user-dirs.mjs:62-65.
  • Claim: packed-help-imports.test.mjs already sets CI for its runs. Verified: line 98.
  • Claim: the change only adds CI beside NO_UPDATE_NOTIFIER, changes no product code and needs no changeset. Verified: one test file, 3 added lines (test lines 109-111).
  • Claim: every run uses --json and the assertions are unchanged. Verified: test line 101; no assertion changes in the diff.
  • Claim: with CI set, no worker runs and nothing is written after the runs. Verified: no worker after any run and no releases/ folder in the test cache.
  • Claim: the changed test passes with CI unset. Verified: 4 of 4 tests pass.
  • Claim: Prettier passes on the changed file. Verified.
  • Claim: the author's local failure counts (one ENOTEMPTY in six runs; a write 935 ms after the last run). These are the author's own local observations and were not re-measured; the write after exit that causes them is verified above.
  • Claim: a full local preflight passes, with all of its test suites. This was not re-run here; CI runs those suites once the draft is ready.
  • Claim: no public API, product or policy change, and no internal context in public text. Verified: the diff is test-only, and the title, description, branch and commit text are clean.
  • File packages/cli/test/packed-docs-routes.test.mjs: clear.

Automated review (maintainer link)

@cixzhang
cixzhang marked this pull request as ready for review November 23, 2026 04:50

@cixzhang cixzhang left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Engineering-owner approval at this exact head (dffd72a), posted by Cindy's agent (agent-made, not a human review) under her standing instruction. Test-only change. CodeBunny approved this head, CI is green at this head, and Specs records it as test-only.

@cixzhang
cixzhang merged commit 7032abf into meta:main Nov 23, 2026
201 of 204 checks passed
@vjeux
vjeux deleted the test/packed-docs-routes-no-background-core branch November 23, 2026 05:45
cixzhang added a commit that referenced this pull request Nov 23, 2026
…nd Core download (#13639)

test(cli): packed-search-catalog's kept-store case starts no background Core download

The case runs an installed copy, a global copy, without CI set, so outside CI its run starts the background Core step. Run alone, that step wrote releases/.failed-0.7.18.json into the case's cache 2.7 s after the test run ended, while the run folder was being removed: the race #13634 fixed in packed-docs-routes. CI: '1' in the case's env keeps the step from starting; the case does not test it. The case that does ('starts the global copy's background Core step ... with CI unset') is unchanged and waits for the step's outcome.

This branch was successfully deployed

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

Labels

ci:run A maintainer lets this outside contributor's pull request run CI (AST-030 FR17) 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.

2 participants