ci(test): download the Electron binary once before unit specs run

pnpm skips Electron's postinstall (electron is deliberately not in
onlyBuiltDependencies), so the binary is downloaded lazily on the first
require('electron'). Since Tier A projects run concurrently (#1701),
several electron-backend and database specs resolve and exec it at the
same time; one process execs it while another is still extracting it
and fails with `spawnSync .../electron ETXTBSY`.

tools/testing/ensure-electron-binary.mjs downloads the binary once and
fails unless it runs under ELECTRON_RUN_AS_NODE and reports the pinned
version. The unit job runs it right after pnpm install, coverage:unit:ci
runs it first for local runs, and the performance journeys job runs it
before its ldd check, which passed vacuously while no binary existed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
4grayandClaude Opus 5.5 committed 2026-09-27 21:47:03 +02:00
1 parent 887ac64d18
commit dd28911ee4
4 files changed
+87 -1

No files matched your search

+12
View File
@@ -285,9 +285,12 @@ jobs:
# and never launch a Playwright browser, so no `playwright
# install`. The runner image ships Electron's shared libraries and
# xvfb; fail fast with a clear message if an image update drops one.
# pnpm skips Electron's postinstall, so download the binary first;
# otherwise ldd sees no file and the check passes vacuously.
- name: Check Electron runtime dependencies
run: |
command -v xvfb-run || { echo "::error::xvfb-run is missing on the runner"; exit 1; }
node tools/testing/ensure-electron-binary.mjs || { echo "::error::Electron binary download failed"; exit 1; }
missing="$(ldd node_modules/electron/dist/electron | grep 'not found' || true)"
if [ -n "$missing" ]; then
echo "::error::Electron is missing shared libraries:"
@@ -368,6 +371,15 @@ jobs:
- name: Install dependencies
run: pnpm install --frozen-lockfile
# pnpm skips Electron's postinstall (it is not in
# onlyBuiltDependencies), so the binary is fetched on the first
# require('electron'). Specs that run SQLite under
# ELECTRON_RUN_AS_NODE resolve it that way while Tier A projects
# run concurrently, and one exec'ing it mid-extraction fails with
# ETXTBSY. Download and verify it once, before any test starts.
- name: Download Electron binary
run: node tools/testing/ensure-electron-binary.mjs
- name: Validate agent guidance
run: pnpm run agents:validate