fix(cli): verify Chrome can execute during preflight - #3802
Merged
Conversation
jrusso1020
approved these changes
Sep 9, 2026
jrusso1020
left a comment
Collaborator
There was a problem hiding this comment.
Read the full preflight.ts and its test file at head, plus the render path that consumes the outcome.
Strengths
- Both call sites that satisfy the new contract are covered.
chromeLaunchOutcomereplaceschromeSharedLibOutcomeat the explicit-browserPathbranch (packages/cli/src/browser/preflight.ts:232) and the discovery branch (:262), and the new test exercises both by loopingfor (const browserPath of [undefined, process.execPath]). Auditing every site rather than the one that produced the report is the step most PRs of this shape skip. - Precedence ordering is right, and the body's claim about it is verifiable.
chromeLaunchOutcomecallschromeSharedLibOutcomefirst and returns early when it fails, so a Linux box with missing libraries still gets the specific per-distro install command instead of a generic "Chrome cannot start". "Existing Linux missing-library diagnostics retain precedence" — confirmed in code, not just asserted. - The probe is stricter than the file's own precedent. It reuses the same
timeout: 5000as the existing FFmpeg check (:64-68) but addskillSignal: "SIGKILL", a boundedmaxBuffer, and explicitstdio. Consistent with the surrounding code while being harder to hang. - The happy path is retained rather than assumed: the Chrome-ok tests at
:221and:237now run through the new probe, so success isn't only covered by the new failure cases. - The blocking claim is real —
packages/cli/src/commands/render.ts:823-829callsfailCommand()on any!outcome.ok, so an unusable binary now stops the render before any work is done. That is the point of the change, andresult.browseris correctly leftundefinedbecause it is only populated whenchrome.ok(preflight.ts:327-334).
Notes, not blockers
- This is now a hard gate on every
hyperframes render. The 5s bound matches the FFmpeg precedent so it is internally consistent, but the new failure mode is "a working install refuses to render" if a cold first spawn exceeds it — Windows AV scanning a freshly downloaded binary, a network-mounted executable, or a heavily loaded CI runner. The common case is ~100ms, so if that ever shows up in the field the cheap mitigation is a single retry rather than a longer timeout. chromeLaunchFailureDetailsreturns""for a non-object throw, leaving the detail asFailed to run "<path>" --version.with no cause. That reads fine; noting only that the empty-string path is deliberate.
Head reviewed: c2702e4c76d9c55f12a44641efd14e66c3749702
Verdict: APPROVE
Reasoning: Narrow, well-scoped fix that closes a real gap between "binary exists" and "binary runs", both call sites are audited and tested, and it follows the existing preflight conventions rather than inventing new ones.
— Rames Jusso
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.
What
Chrome preflight now runs the selected binary with
--versionbefore reporting it usable. Refs PRINFRA-344.Why
Cached and explicitly configured binaries could exist but fail to execute, while doctor/render preflight reported Chrome OK. This hid architecture, permission, and startup-crash failures.
How
Use a shell-free, five-second bounded probe with captured output. Failed probes produce a blocking outcome containing the exit code, signal, or OS error and working-browser/reinstall guidance. Existing Linux missing-library diagnostics retain precedence. This verifies executability, not full rendering compatibility or the initiating macOS crash cause.
Test plan
CLI typecheck, changed-file oxlint/oxfmt, diff check and fallow gate passed.