Repository navigation
test(cli): the node suites rebuild a Core build older than its sources - #8567
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.
Thanks, the freshness check closes a real gap for reused checkouts, but it needs two changes before it can merge.
- The walk counts the locale modules in
packages/core/src/i18n/generated-locales/, which the root Vitest global setup regenerates after the node setup when the CLI suites run on their own (aspnpm -F @astryxdesign/cli testdoes), so a translation edit makes one suite rebuild Core inside its worker while the waiting suites continue before Core's declarations exist and threetsc --noEmitassertions fail inbuild.family.test.mjsandbuild-theme.variants.test.mjs: please skip generated output in the walk and have waiting workers return only after the lock is released. ensure-core-built.test.mjstests a non-command helper insideclients/cli/commands/, whicharchitecture:cli-surfaceINV22 reserves for command handlers, their CommandDocs, and their tests, so please move it out of that directory.
[Automated review]
| // What the build compiles: a file here newer than the built entry means dist | ||
| // is stale. A checkout rewrites the files it changes, so they read as newer. | ||
| const CORE_SOURCES = [ | ||
| path.join(REPO_ROOT, 'packages/core/src'), |
There was a problem hiding this comment.
This root also takes in src/i18n/generated-locales/, which the root Vitest global setup (internal/test-utils/src/globalSetup.ts) regenerates after the node project's setup has called ensureCoreBuilt() whenever only CLI suites run (as pnpm -F @astryxdesign/cli test does). After a translation edit with a fresh build, the build turns stale only once workers have forked, so the first suite rebuilds Core in its worker (deleting dist) and the others return at line 151 as soon as dist/theme/index.js reappears, about 11 s before tsc writes declarations; three tsc --noEmit assertions in build.family.test.mjs and build-theme.variants.test.mjs then fail. Skipping generated output here, and letting waiters wait for the lock to clear, keeps the staleness decision in the global setup.
| @@ -0,0 +1,80 @@ | |||
| // Copyright (c) Meta Platforms, Inc. and affiliates. | |||
There was a problem hiding this comment.
architecture:cli-surface INV22: "Only command handlers, their CommandDoc files, and their tests live in that directory." This file tests a non-command helper, so it belongs outside clients/cli/commands/, for example in scripts/ beside the build-css.* suites that already import the helper by path.
|
The walk now skips the generated output: |
There was a problem hiding this comment.
The generated-output skip, the lock wait and the test's move to scripts/ address the earlier review, but one race introduced by the freshness check needs a change before this can merge. When any Core file changes while the CLI suites run, the next suite's beforeAll finds the build stale and rebuilds Core in its worker, and that build deletes packages/core/dist under suites still reading it, so unrelated build-theme tests fail where the base passes. Please rebuild a stale Core only in the node global setup, before workers fork, and keep the in-suite calls on the missing-build check; keying the lock to the checkout instead of one os.tmpdir() path would also stop one worktree's rebuild from stalling another worktree's suites.
[Automated review]
| * build-theme suite's beforeAll. | ||
| */ | ||
| export function ensureCoreBuilt() { | ||
| ensureBuiltOnce({isBuilt: coreIsBuilt, build: buildCore, lockDir: LOCK_DIR}); |
There was a problem hiding this comment.
A suite's beforeAll reaches this with a stale build whenever a Core file changes after the global setup's check, so the rebuild runs in that worker: pnpm -F @astryxdesign/core build deletes packages/core/dist first, and suites that already returned fail mid-test (Could not resolve "@astryxdesign/core/theme", tsc --noEmit). Touching packages/core/src/Button/Button.spec.md 9 s into a run of the theme-build suites failed 6 tests; the base passes the same sequence. Rebuilding a stale build only from vitest.global-setup.node.mjs, with the in-suite calls kept on the missing-build check, closes this.
There was a problem hiding this comment.
Fixed in 841ce23. A stale Core is now rebuilt only by the node global setup (ensureCoreBuilt({rebuildStale: true}), before the workers fork), and a suite's beforeAll builds only a missing one. Your sequence (touching Button.spec.md 9 s into the build-theme suites) failed 6 tests in 4 files before and passes 104/104 now.
| const deadline = Date.now() + staleLockMs; | ||
| while (Date.now() < deadline) { | ||
| if (fs.existsSync(CORE_THEME_ENTRY)) { | ||
| if (!lockIsHeld(lockDir, staleLockMs) && isBuilt()) { |
There was a problem hiding this comment.
LOCK_DIR (line 56) is one os.tmpdir() path shared by every checkout on the machine, so this condition makes a checkout with a current build wait for any other checkout's Core rebuild (32 s measured, where the base returns at once), and a lock left by a killed holder blocks every call until it is 200 s old. Keying the lock to REPO_ROOT keeps the wait to this checkout's own build.
There was a problem hiding this comment.
Fixed in 841ce23. The lock is now coreBuildLockDir(REPO_ROOT), one per checkout under os.tmpdir(), so a checkout with a current build no longer waits on another checkout's rebuild, and a lock a killed holder leaves blocks only its own checkout. The tests check that two checkouts get different locks, and that a lock held for another checkout returns a current build at once.
There was a problem hiding this comment.
The setup-only rebuild and the per-checkout lock address the earlier review, and a Core edit during a run no longer breaks running suites, but one gap needs a change before this can merge. If the global setup's rebuild is interrupted or fails after Babel writes dist/theme/index.js, the next run treats that half-built Core as current, because coreBuildIsStale dates the build by a file the build writes before its declarations and CSS; the type-check tests then fail as if the CLI had regressed. Please date the build by a marker that only a finished build writes, such as a stamp written after buildCore() returns or dist/astryx.css. Adding the build's own scripts and config (for example scripts/build-css.mjs) to CORE_SOURCES would also let the build-css.* suites see changes to the script they test.
[Automated review]
| export function coreBuildIsStale(entry, roots, generated = []) { | ||
| let built; | ||
| try { | ||
| built = fs.statSync(entry).mtimeMs; |
There was a problem hiding this comment.
This dates the build by dist/theme/index.js, which Core's build:esm writes about 11 s into a 38 s build, before tsc and build:css. If the global setup's rebuild is interrupted (Ctrl-C while the run shows only Vitest's header) or a later step fails, the next run finds this entry newer than every source and skips the rebuild, so the suites test a dist with no declarations or astryx.css. Reproduced here, the rerun failed three tsc --noEmit assertions in build.family and build-theme.variants. Dating the build by a stamp the helper writes after buildCore() returns, or by dist/astryx.css, makes an incomplete rebuild read as stale.
There was a problem hiding this comment.
Fixed in ca95141: a build is now dated by dist/astryx.css, which build:css writes after the modules, declarations and declaration extensions, so a rebuild interrupted or failed before it reads as missing and is rebuilt. With astryx.css removed, as an interrupted rebuild leaves it, the old check called the build current and this one rebuilds; a test pins that the marker is the build's last output step.
| export const CORE_SOURCES = [ | ||
| path.join(REPO_ROOT, 'packages/core/src'), | ||
| path.join(REPO_ROOT, 'packages/core/locales'), | ||
| path.join(REPO_ROOT, 'packages/core/package.json'), | ||
| ]; |
There was a problem hiding this comment.
Core's build also runs scripts/build-css.mjs, scripts/generate-i18n-runtime.mjs, scripts/add-declaration-extensions.mjs and packages/core/scripts/build-pseudo-locale.mjs, and reads packages/core/babel.config.json and tsconfig.build.json; this list covers none of them. After scripts/build-css.mjs is touched, the helper still calls the build current, so the scripts/build-css.* suites, which read dist/astryx.css, keep testing the old stylesheet after a change to the script they test. Adding those files here closes it.
There was a problem hiding this comment.
Fixed in ca95141: the sources now include scripts/build-css.mjs, scripts/generate-i18n-runtime.mjs, scripts/add-declaration-extensions.mjs, packages/core/scripts/build-pseudo-locale.mjs, babel.config.json, tsconfig.build.json and the root tsconfig.json it extends. A test reads Core's build* scripts and fails when a script or config they write output with is missing from the list.
There was a problem hiding this comment.
The last-output marker and the build-script inputs address the earlier review, and an interrupted rebuild now heals, but two gaps need a change before this can merge.
- A second node run started after a Core edit rebuilds Core under a run already in progress: with the 15
build-themetest files running, 6 of 104 tests failed where the base passes, so please let a stale rebuild wait while another run in the checkout is live, or narrow the "never under a running suite" guarantee to a single run. CORE_SOURCESmissespackages/core/babel-plugin-add-extensions.cjs, whichbabel.config.jsonruns on every compiled module, andscripts/stylex-module-resolution.cjs, whichbuild-css.mjshands to StyleX, so please add both and extend the inputs test to the files those configs and scripts load.
[Automated review]
| export const CORE_SOURCES = [ | ||
| path.join(REPO_ROOT, 'packages/core/src'), | ||
| path.join(REPO_ROOT, 'packages/core/locales'), | ||
| path.join(REPO_ROOT, 'packages/core/package.json'), | ||
| path.join(REPO_ROOT, 'packages/core/babel.config.json'), | ||
| path.join(REPO_ROOT, 'packages/core/tsconfig.build.json'), | ||
| path.join(REPO_ROOT, 'tsconfig.json'), | ||
| path.join(REPO_ROOT, 'packages/core/scripts/build-pseudo-locale.mjs'), | ||
| path.join(REPO_ROOT, 'scripts/generate-i18n-runtime.mjs'), | ||
| path.join(REPO_ROOT, 'scripts/add-declaration-extensions.mjs'), | ||
| path.join(REPO_ROOT, 'scripts/build-css.mjs'), | ||
| ]; |
There was a problem hiding this comment.
packages/core/babel.config.json runs the local plugin ./babel-plugin-add-extensions.cjs on every module build:esm compiles, and scripts/build-css.mjs imports ./stylex-module-resolution.cjs and passes it to StyleX when it writes astryx.css. Neither is listed here, so after a build, touching either leaves coreBuildIsStale false and the setup keeps the old build. Adding both paths closes it.
There was a problem hiding this comment.
Fixed in 0a24e46: CORE_SOURCES now lists packages/core/babel-plugin-add-extensions.cjs and scripts/stylex-module-resolution.cjs.
| * setup passes `rebuildStale`, so a build older than Core's sources is rebuilt | ||
| * there, before any worker forks, and never under a running suite. |
There was a problem hiding this comment.
This holds within one run only. With the 15 build-theme test files running, a Core edit followed by a second node run made that run's setup rebuild Core under the first run, which failed 6 of 104 tests; the base passes the same sequence. A run lease that each setup registers and its teardown removes, checked before a stale rebuild, would keep the guarantee; otherwise this sentence should say it covers a single run.
| for (const [, file] of command.matchAll(/\bnode\s+(\S+\.m?js)/g)) { | ||
| // Checks read the build; they write nothing it depends on. | ||
| if (!/\/(check-|clean-dist)/.test(file)) inputs.add(file); | ||
| } | ||
| for (const [, file] of command.matchAll( | ||
| /--(?:config-file|project)\s+(\S+)/g, | ||
| )) { | ||
| inputs.add(file); | ||
| } |
There was a problem hiding this comment.
This collects only node <file> and --config-file/--project arguments, so it passes while the plugin babel.config.json names and the ./stylex-module-resolution.cjs import of build-css.mjs are missing from CORE_SOURCES. Following the configs' local plugins and the listed scripts' relative imports would make the check match its name.
There was a problem hiding this comment.
Thanks: the run leases fix the overlapping-run failure from the last round (the 15 build-theme files now pass 104/104 while a second run waits, then rebuilds), and the two missing build inputs are covered, but the new wait needs one change before this can merge. The stale-rebuild loop in ensure-core-built.mjs polls synchronously with no deadline, so after a Core edit a node run waits for as long as an idle watch-mode run (such as pnpm test:watch) stays open, and Ctrl-C ends only the pnpm wrapper while Vitest keeps waiting and later rebuilds Core in the background. Please make that wait asynchronous and bounded (after a limit, skip the rebuild with a warning or fail naming the live run), and end each lease on process exit as well as in the teardown, since a vitest run stopped with Ctrl-C currently leaves its lease behind.
[Automated review]
| if (rebuildStale && runLeaseDir) { | ||
| let announced = false; | ||
| while ( | ||
| fs.existsSync(entry) && | ||
| coreBuildIsStale(entry, roots, generated) && | ||
| earlierLiveRuns(runLeaseDir, {isAlive}).length > 0 | ||
| ) { | ||
| if (!announced) { | ||
| console.warn( | ||
| '[ensure-core-built] Core changed; waiting for the test run already running in this checkout to end before rebuilding it.', | ||
| ); | ||
| announced = true; | ||
| } | ||
| sleepSync(pollMs); | ||
| } | ||
| } |
There was a problem hiding this comment.
This wait has no deadline and blocks the main thread (sleepSync is Atomics.wait), so Vitest's SIGINT and SIGTERM handlers cannot run while it polls. Behind an idle watch-mode node run, a run started after a Core edit sat here 93 s until the watcher was stopped, and Ctrl-C ended only the pnpm wrapper while Vitest kept waiting and later rebuilt Core in the background. Awaiting a timer instead (Vitest awaits an async global setup) and giving up after a limit, with a warning that the run tests the existing build or an error naming the live run, would keep the run stoppable and bounded.
There was a problem hiding this comment.
Fixed in 3e5ac0d: the node global setup now awaits ensureCoreBuiltForRun, which waits on a timer, so the event loop stays free and Ctrl-C stops the run, and gives up after two minutes: past that, the run tests the build already in dist, with a warning naming the live run. Behind an idle watch-mode run, Ctrl-C now ends every process of the waiting run within about 50 ms, and nothing rebuilds afterwards.
| ensureCoreBuilt(); | ||
| // This run holds a lease for its whole length, so a later run's setup does | ||
| // not rebuild Core under it; the returned teardown ends the lease. | ||
| const endRun = registerTestRun(); |
There was a problem hiding this comment.
If ensureCoreBuilt or the template sync below throws, this lease is never ended, and a vitest run stopped with Ctrl-C exits without calling the returned teardown, so its lease stays too. A later stale rebuild waits on any live process that has that pid, so ending the lease in a finally and on process.once('exit', endRun) would keep leftover leases from holding future runs.
There was a problem hiding this comment.
Fixed in 3e5ac0d: the setup ends its lease on process.once('exit', endRun) and in a catch before rethrowing, besides the returned teardown. A test spawns a process with that pattern, stops it with SIGINT, and checks that its lease is gone.
There was a problem hiding this comment.
Thanks: the earlier-run wait is now an awaited timer bounded at two minutes, and each run's lease ends on exit and on a setup error, which resolves the last round's request; nothing else blocks this change. Two trade-offs remain by design: behind a node run that outlives the two-minute wait (an idle watch-mode run, say) a later run still tests the old Core build with a warning, and while Core's sources do not compile every node run fails in setup with the TypeScript error visible only as bytes in Vitest's serialized error, because buildCore pipes the build's output. Neither needs a change here, though surfacing that output when the setup's rebuild fails would make the second case easier to diagnose.
[Automated review]
PR Analysis Report🔎 Preview ·
|
There was a problem hiding this comment.
Incremental review of 3e5ac0d..4bcac44; prior findings carried: user_impact
Thanks: a run that cannot rebuild a stale Core now stops with an error instead of testing the old build, and the narrowed error handling comes with tests; nothing blocks this change. Two small follow-ups would help: the header of ensure-core-built.mjs (lines 31-32) still says that past the limit the run tests the build it has with a warning, and the new error names any live process that holds a leftover lease's pid as a test run (a run killed by SIGHUP, as closing its terminal does, leaves its lease), so naming the lease file in the message would let someone clear it. The pull request description also still describes the earlier fallback and 28 test cases.
[Automated review]
| * already in progress; past the limit it tests the build it has, with a | ||
| * warning naming the live run. |
There was a problem hiding this comment.
This clause still describes the fallback the latest push removed: past the limit the setup now throws an error naming the live run (lines 464-468), as ensureCoreBuiltForRunAt's comment and the Changeset say. Updating it keeps the header in step with the code, as the documentation standard in AGENTS.md asks.
| }); | ||
| if (stillLive.length > 0) { | ||
| throw new Error( | ||
| `[ensure-core-built] Core's sources changed since packages/core/dist was built, and test run ${stillLive.join(', ')} in this checkout still uses that build after ${Math.round((limitMs ?? EARLIER_RUN_WAIT_MS) / 1000)} s: rebuilding would delete dist under it, and this run would test old code. Run again once it ends.`, |
There was a problem hiding this comment.
processIsAlive counts any live process with the lease's pid as this run, and a run killed by SIGHUP (closing its terminal) or SIGKILL leaves its lease behind. Once another process holds that pid, this error names a test run that does not exist on every run after a Core edit, and nothing in it points at the lease. Naming the lease file here (path.join(leaseDir, String(pid))) would let someone who finds no such run delete it.
There was a problem hiding this comment.
Incremental review of 4bcac44..688f1a1; prior findings carried: user_impact
Thanks: the stop-with-error now names each live run's lease file and the helper's header describes the stop, which resolves both follow-ups from the last round; nothing blocks this change. With a live non-test process holding an earlier lease, a node run failed after 120 s naming that lease file, and once the file was deleted the next run rebuilt Core and passed. No further changes are needed.
[Automated review]
There was a problem hiding this comment.
Thanks: the freshness rule, the setup-only rebuild and the run leases still work on this branch (the helper's 33 tests pass here, and a stale Core is rebuilt once in setup), but main has moved under it, and one change is needed before this can merge.
- Regression:
CORE_SOURCESandCORE_GENERATEDinpackages/cli/clients/cli/commands/ensure-core-built.mjsmissscripts/i18n-english-fallback.mjs,scripts/lib/stylex-generated-variable.mjsandpackages/core/src/i18n/generated-english/, whichmainhas added since, so once merged an edit to either script leaves a stale Core reading as current, 2 of the 33 tests inscripts/ensure-core-built.test.mjsfail, andvitest.global-setup.node.mjsconflicts withmain's new CLI pack step.
Merging main, keeping its pack step beside the lease, and adding those three paths should clear it. Optional: the helper's file header is now 32 lines, where architecture:knowledge-contracts INV29 asks for about 12 with @input, @output and @position; an inline comment suggests one.
[Automated review]
| export const CORE_SOURCES = [ | ||
| path.join(REPO_ROOT, 'packages/core/src'), | ||
| path.join(REPO_ROOT, 'packages/core/locales'), | ||
| path.join(REPO_ROOT, 'packages/core/package.json'), | ||
| path.join(REPO_ROOT, 'packages/core/babel.config.json'), | ||
| path.join(REPO_ROOT, 'packages/core/babel-plugin-add-extensions.cjs'), | ||
| path.join(REPO_ROOT, 'packages/core/tsconfig.build.json'), | ||
| path.join(REPO_ROOT, 'tsconfig.json'), | ||
| path.join(REPO_ROOT, 'packages/core/scripts/build-pseudo-locale.mjs'), | ||
| path.join(REPO_ROOT, 'scripts/generate-i18n-runtime.mjs'), | ||
| path.join(REPO_ROOT, 'scripts/add-declaration-extensions.mjs'), | ||
| path.join(REPO_ROOT, 'scripts/build-css.mjs'), | ||
| path.join(REPO_ROOT, 'scripts/stylex-module-resolution.cjs'), | ||
| ]; | ||
| // Git-ignored output generated from those sources, by the build and again by | ||
| // the Vitest global setup (internal/test-utils/src/globalSetup.ts): rewritten | ||
| // after a build, it would read as newer than that build. | ||
| export const CORE_GENERATED = [ | ||
| path.join(REPO_ROOT, 'packages/core/src/i18n/generated-locales'), | ||
| path.join(REPO_ROOT, 'packages/core/locales/pseudo.json'), | ||
| ]; |
There was a problem hiding this comment.
Regression: main has added build inputs these lists miss. scripts/generate-i18n-runtime.mjs now imports ./i18n-english-fallback.mjs, scripts/build-css.mjs imports ./lib/stylex-generated-variable.mjs, and .gitignore adds packages/core/src/i18n/generated-english/. Merged into main, an edit to either script leaves a stale Core reading as current, and scripts/ensure-core-built.test.mjs fails 2 of 33 ("skip exactly the git-ignored output under them" and "cover every script and config file Core's build scripts write output with"). Adding scripts/i18n-english-fallback.mjs and scripts/lib/stylex-generated-variable.mjs to CORE_SOURCES, and packages/core/src/i18n/generated-english to CORE_GENERATED, should clear both.
| maxBuffer: 32 * 1024 * 1024, | ||
| }, | ||
| ); | ||
| export default async function setup() { |
There was a problem hiding this comment.
Regression: main rewrote this setup to pack the CLI once for the node project (setup(project), project.provide('astryxPackedCliTarball', …), project.onTestsRerun), so merging main conflicts here. The lease and await ensureCoreBuiltForRun() can sit before the pack step, and the unit test's regex over this file will need to accept the project parameter.
| * The node project's global setup also rebuilds a build older than Core's | ||
| * sources, before any test worker forks: a reused worktree checked out to a | ||
| * new head keeps its old dist, and the suites would otherwise test the new CLI | ||
| * against the old theme build. The files the build and the test setup | ||
| * generate from those sources are not sources. A suite's beforeAll builds | ||
| * only a missing Core: rebuilding a stale one mid-run would delete dist under | ||
| * suites still reading it. Each checkout has its own lock, so one worktree's | ||
| * rebuild never holds up another's suites. Each node run also holds a lease in | ||
| * the checkout while it runs (ended by its teardown or its exit), and a stale | ||
| * rebuild waits, on a timer and for at most two minutes, until every run that | ||
| * started before it has ended, so a second run never rebuilds Core under a run | ||
| * already in progress; past the limit it stops with an error naming each | ||
| * live run and its lease file (a run killed by SIGHUP leaves its lease, and | ||
| * another process can take its pid). |
There was a problem hiding this comment.
Non-blocking (architecture:knowledge-contracts INV29): the file header is now 32 lines, where INV29 asks for @input, @output and @position in about 12 lines, and the sentence on lines 27-33 runs past 80 words. A shorter header that keeps the reasons:
/**
* @file Shared test helper: builds @astryxdesign/core once per run, race-free.
* @input Core's sources, translations and build scripts; this checkout's lock
* and run leases in the system temp directory.
* @output A packages/core/dist whose last output is newer than every source.
* @position Called by the node global setup and the build-theme suites.
*
* A Core build deletes dist first. Only the global setup rebuilds a stale
* build, before the workers start, and only after earlier runs end.
*/688f1a1 to
8a3b916
Compare
A reused checkout keeps its old Core build. The CLI's theme-build suites then test the new CLI against an old Core. A suite that rebuilt Core mid-run deleted dist under suites still reading it. The node project's global setup now rebuilds a Core build older than Core's sources, before any test worker forks. A suite's beforeAll builds only a missing Core. Each node run holds a lease in the checkout, and a stale rebuild waits for the runs that started before it, for at most two minutes. Each checkout has its own build lock. The global setup still packs the CLI once for every suite.
8a3b916 to
838d6d3
Compare
There was a problem hiding this comment.
Approved pending CI: CI has not run on this head yet.
The input lists now cover the build scripts and generated output that main added, and the setup keeps main's CLI pack step. On this head, a changed build input rebuilds Core once in setup, and the helper's tests and the theme-build and build-css suites pass. Next: mark the pull request ready for review, and because the branch is in a fork, a maintainer adds the ci:run label so CI runs.
[Automated review]
ensure-core-built.mjs ships in the @astryxdesign/cli tarball, so the change needs a CLI patch changeset, as meta#8567's did for this helper.
* test(cli): run the Core rebuild through cmd.exe on Windows
The node global setup rebuilds a stale Core with execFileSync('pnpm').
On Windows pnpm is a pnpm.cmd batch file, which execFileSync can't start
without a shell, so the setup dies with "spawnSync pnpm ENOENT" and no CLI
test runs whenever Core's sources are newer than its build.
Route the call through cmd.exe /d /s /c on win32, the same way the
vibe-tests helpers do since #5841 and #5843. Every argument is a literal,
so this avoids shell: true and its DEP0190 warning. Other platforms are
unchanged.
* test(cli): keep the Core rebuild to one execFileSync call
doc-loads.test.mjs lists each file's child_process sites, and the
platform branch had made two. Pick the executable and its arguments by
platform and keep the single call.
* chore(changeset): note the Windows Core rebuild in the CLI release
ensure-core-built.mjs ships in the @astryxdesign/cli tarball, so the
change needs a CLI patch changeset, as #8567's did for this helper.
Maintainer impact
A contributor who switches branches can see the CLI's theme-build tests fail, or pass, against an old Core. The suites test the compiled
@astryxdesign/core/theme. The helper that builds it returned as soon as a build existed, however old. A second failure came when a Core file changed during a run: a suite rebuilt Core mid-run and deleted the build other suites were reading. CI builds fresh, so this hits local runs.Intended invariant
The node test project tests the CLI against a Core build as new as Core's sources. No run rebuilds Core under another run.
Change
package.json, and the build's scripts and configs. The rebuild comes before any test worker forks.beforeAllbuilds only a missing Core, so no suite rebuilds Core mid-run.main.Evidence
main54166ff, a Core source was made newer than the build. The setup kept the stale build, whose last output kept its time, and the suites ran against it.mainadds later. The rebase without this head's updates (NOT-FOR-LANDING commit 0c99a74) fails 3 of them on today'smain. They name the new generatedi18n/generated-englishoutput, two new build inputs, and the setup's new shape. This head adds all three.Scope
Testing
At 838d6d3, on
main54166ff:pnpm exec vitest run --project node): 901 files passed, 7 skipped; 16,525 tests;scripts/ensure-core-built.test.mjs: 33 of 33;packages/cli/api/theme/buildand thebuild-themecommand suites): 36 files, 406 tests;CI=true pnpm lint: no errors;pnpm review:pre: no findings.