Add factory:setup + upfront prerequisite checks for pnpm factory:go#5591
Open
lukemelia wants to merge 2 commits into
Open
Add factory:setup + upfront prerequisite checks for pnpm factory:go#5591lukemelia wants to merge 2 commits into
lukemelia wants to merge 2 commits into
Conversation
A fresh checkout could not run pnpm factory:go without four undocumented manual fixes, each surfacing as a separate opaque crash from deep inside a run: no working Node pin, an unbuilt boxel-cli dist/api.js, a host build lacking dev-mode test entries, and a missing Playwright browser binary. - Add src/preflight.ts: detects all four prerequisites (Node >= 24, boxel-cli/dist/api.js, host/dist/tests/index.html, Playwright chromium-headless-shell) without importing boxel-cli, so the check runs before the dist/api.js import that would otherwise crash first. - factory-entrypoint.ts now runs preflight up front and defers the boxel-cli import until it passes, reporting every missing prerequisite at once and pointing at pnpm factory:setup. --help still works. - Add scripts/factory-setup.ts (pnpm factory:setup): idempotent bootstrap that builds the missing artifacts and installs the Playwright browser, skipping anything already present (--force rebuilds all). - Add a real volta pin to the root package.json so the existing volta.extends chain in software-factory resolves a Node version. - Document the one-time setup and Node requirement in the README. CS-12186 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
Host Test Results 1 files ± 0 1 suites ±0 2h 26m 1s ⏱️ + 2h 15m 25s Results for commit f582171. ± Comparison against earlier commit b57fec9. Realm Server Test Results 1 files ±0 1 suites ±0 12m 58s ⏱️ + 1m 21s Results for commit f582171. ± Comparison against earlier commit b57fec9. |
preflight locates the Playwright browser cache via homedir(). Two factory-entrypoint integration tests override HOME to isolate the boxel-cli profile, which hid the browsers CI installed under the real home — preflight reported the Chromium headless-shell binary missing and aborted factory:go before either test reached the behavior it asserts. Export preflight's browser-cache resolver and pass its result to the spawned factory:go via PLAYWRIGHT_BROWSERS_PATH (which preflight honors ahead of homedir()), so the check finds the browsers regardless of the child's HOME. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
On a fresh
pnpm install-only checkout,pnpm factory:gocould not run end-to-end. It failed with a chain of four distinct blockers, each surfacing as a separate opaque crash from deep inside a run, and each requiring monorepo-internals knowledge to fix:package.jsonrequiresnode >=24, but the only pin was.nvmrc(Volta doesn't read it);software-factory'svolta.extends: "../../package.json"dead-ended because the root had novoltablock.boxel-cli/dist/api.js— the entrypoint imports@cardstack/boxel-cli/api, which resolves to a gitignoreddist/api.jsthat nothing in thefactory:gopath builds →ERR_MODULE_NOT_FOUNDat module load.boxel test's harness needshost/dist/tests/index.html, only emitted by a dev-mode host build.boxel testlaunches headless Chromium; the binary was never downloaded.None were documented, and no error pointed at the next blocker in the chain.
Fix
Attacks the root cause (
factory:godid zero upfront validation) rather than committing build artifacts:src/preflight.ts(new) — detects all four prerequisites. Imports nothing from boxel-cli, so it can run before thedist/api.jsimport that used to crash first.src/cli/factory-entrypoint.ts— runs preflight up front and defers the boxel-cli import until it passes. Missing prerequisites produce one consolidated message pointing atpnpm factory:setup; every missing item is listed with its individual fix command.--helpstill works.scripts/factory-setup.ts+factory:setupscript (new) — idempotent bootstrap that builds the missing artifacts and installs the Playwright browser, skipping anything already present.--forcerebuilds everything.package.json— added a realvoltapin (node: 24.17.0, matching.nvmrc/devEngines) so the existingvolta.extendschain resolves.Verification
--help→ usage, exit 0.dist/api.js→ clean consolidated message + exit 1 (noERR_MODULE_NOT_FOUND).factory:setupno-op run skips all three steps, exit 0.ember-tsc --noEmitclean.Out of scope
This handles missing artifacts on a fresh checkout. A stale
dist/api.js(present but built from older source) still passes the existence check yet can crash on a missing named export;factory:setup --forcefixes it, but automatic staleness detection is a possible follow-up.🤖 Generated with Claude Code