Skip to content

feat(bin): detect a real Chromium binary in bootstrap - #857

Closed
Freudator86 wants to merge 2 commits into
kunchenguid:mainfrom
Freudator86:fm/chromium-detect-q2v
Closed

feat(bin): detect a real Chromium binary in bootstrap#857
Freudator86 wants to merge 2 commits into
kunchenguid:mainfrom
Freudator86:fm/chromium-detect-q2v

Conversation

@Freudator86

Copy link
Copy Markdown
Contributor

Intent

Add real Chromium binary detection to bin/fm-bootstrap.sh's tool-detection machinery. Chromium was documented (chromium-toolchain-r7k, PR #704) as a required toolchain item for chrome-devtools-axi's headless launches but bootstrap never actually checked for it. Added a chromium_binary_present() helper that checks candidate binary names (chromium, chromium-browser, google-chrome, google-chrome-stable) since no single name is universal across install methods (system package vs Playwright-managed install), wired into the existing install_cmd/MISSING: reporting convention used by every other tool in the script (install command is 'npx --yes playwright install-deps chromium', matching the doc PR's documented manual remediation). This is a fleet-wide framework change scoped only to the detection gap - it deliberately does not touch docs/configuration.md, which is owned by the separate still-open PR #704. Extended tests/fm-bootstrap.test.sh with a new test_chromium_binary_detection covering missing, present, and each alternate binary name, and stubbed a fake chromium binary into the shared make_fake_toolchain fixture so existing silent-output test cases remain silent. Ran bin/fm-lint.sh (shellcheck 0.11.0) clean before committing.

What Changed

  • Added a chromium_binary_present() helper to bin/fm-bootstrap.sh that checks for any of chromium, chromium-browser, google-chrome, or google-chrome-stable on PATH, since no single binary name is universal across install methods (system package vs. Playwright-managed install).
  • Wired the check into the existing install_cmd/MISSING: reporting convention, emitting MISSING: chromium (install: npx --yes playwright install-deps chromium) when no candidate binary is found.
  • Extended tests/fm-bootstrap.test.sh with test_chromium_binary_detection, covering the missing case, the present case, and each alternate binary name, and stubbed a fake chromium binary into the shared make_fake_toolchain fixture so existing silent-output test cases remain silent.

Risk Assessment

✅ Low: Small, well-bounded addition (one detection helper + one MISSING line + matching tests) that follows the script's existing install_cmd/MISSING conventions, is unconditional in a way consistent with chrome-devtools-axi already being a universal COMMON_TOOLS entry, and matches every constraint in the stated intent (candidate names, install command, non-touching of docs/configuration.md, test fixture updates).

Testing

Ran the full fm-bootstrap test suite (22/22 pass, including the new test_chromium_binary_detection covering missing/present/alternate-name cases), then independently reproduced the end-user CLI experience by invoking bin/fm-bootstrap.sh directly with a fake toolchain: with no Chromium-family binary on PATH it prints MISSING: chromium with the documented playwright install command, and adding a chromium-browser stub makes that line disappear while other MISSING lines stay unaffected — confirming the detection helper and its wiring into the MISSING: reporting convention work end-to-end as the author intended.

Evidence: Manual CLI transcript: bootstrap output with/without a chromium-family binary on PATH
=== Scenario A: no chromium binary on PATH ===
MISSING: treehouse (install: curl -fsSL https://kunchenguid.github.io/treehouse/install.sh | sh)
MISSING: no-mistakes (install: curl -fsSL https://raw.githubusercontent.com/kunchenguid/no-mistakes/main/docs/install.sh | sh)
MISSING: tasks-axi (install: npm install -g tasks-axi)
MISSING: quota-axi (install: npm install -g quota-axi)
MISSING: chromium (install: npx --yes playwright install-deps chromium)

=== Scenario B: a real-shaped chromium-browser binary added to PATH ===
MISSING: treehouse (install: curl -fsSL https://kunchenguid.github.io/treehouse/install.sh | sh)
MISSING: no-mistakes (install: curl -fsSL https://raw.githubusercontent.com/kunchenguid/no-mistakes/main/docs/install.sh | sh)
MISSING: tasks-axi (install: npm install -g tasks-axi)
MISSING: quota-axi (install: npm install -g quota-axi)

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

⚠️ **Review** - 1 info
  • ℹ️ bin/fm-bootstrap.sh:8 - The file header comment documents every special-cased MISSING behavior (treehouse's lease-support check, no-mistakes' version check, tasks-axi/quota-axi's version+feature gate) but wasn't updated to mention the new unconditional 'MISSING: chromium' check, which is likewise a bespoke check outside the COMMON_TOOLS/BACKEND_TOOLS loop. Worth a one-line addition alongside the existing treehouse/no-mistakes/tasks-axi notes so the header remains a complete contract of the script's output lines.
✅ **Test** - passed

✅ No issues found.

  • bash tests/fm-bootstrap.test.sh — full suite, 22/22 tests pass including new test_chromium_binary_detection (missing/present/each alternate name)
  • Manual CLI run of bin/fm-bootstrap.sh (not via test harness) with a fake toolchain and no chromium-family binary on PATH: real output includes MISSING: chromium (install: npx --yes playwright install-deps chromium)
  • Same manual run after adding a chromium-browser stub to PATH: the MISSING: chromium line disappears while unrelated MISSING lines (treehouse, no-mistakes, tasks-axi, quota-axi) are unchanged
  • Confirmed no chromium/chromium-browser/google-chrome/google-chrome-stable exists on this machine's real PATH, so Scenario A reflects genuine (non-stubbed) absence
  • git status --porcelain after testing — worktree left clean, no stray artifacts
⚠️ **Document** - 1 info
✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

chrome-devtools-axi's headless launches need a real Chromium binary
underneath, but bootstrap only documented the requirement without ever
checking for it (chromium-toolchain-r7k). Report MISSING: chromium the
same way every other toolchain gap is reported, checking every binary
name actually seen across install methods.
The missing-binary case only removed the fake stub, so a CI image with a
real chromium-browser/google-chrome already on PATH made the case
non-hermetic and let it silently pass or fail depending on the runner.
Mask every candidate name the same way the git-required case masks a
real git.
@Freudator86

Copy link
Copy Markdown
Contributor Author

Closing this ourselves. The gap it addresses is real - bootstrap never checked for a browser - but
the change tests the wrong capability and its remedy cannot clear the line it prints.

  1. Wrong predicate. It probes four binary names on PATH. The consumer, chrome-devtools-axi,
    does not resolve a binary by name - it resolves a Chrome channel, and it also honours
    CHROME_DEVTOOLS_AXI_BROWSER_URL and an auto-connect setting, so a host with a perfectly working
    remote browser would still be reported as missing.
  2. Wrong remedy. The suggested command installs operating-system dependencies, not a browser. A
    person who runs it sees success and still has no browser.
  3. Unclearable blocker. It emits an unconditional missing-tool line that blocks dispatch, and its
    own printed fix can never satisfy the check.

All ten checks pass on this PR, which is worth stating plainly: green means the checks ran, not that
the change is correct.

A correct successor is a different change and belongs with the tool rather than here: a capability
probe owned by chrome-devtools-axi that reports what it can actually reach, consumed by bootstrap,
honouring the remote-browser settings. That is gated on the tool exposing such a probe, so it is not
a rewrite of this diff.

@Freudator86 Freudator86 closed this Aug 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants