Skip to content

fix(electron): attach error listener to spawned node process in readiness fixture - #3165

Merged
morluto merged 1 commit into
morluto:mainfrom
qorvr:fix/electron-readiness-spawn-error
Oct 14, 2026
Merged

morluto merged 1 commit into
morluto:mainfrom
qorvr:fix/electron-readiness-spawn-error

Conversation

@qorvr

@qorvr qorvr commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Summary

In tests/conformance/readiness/electron/main.js, spawn() is invoked with process.env.REA_ELECTRON_NODE_EXECUTABLE ?? "node". If the node executable is unavailable on PATH or in custom verification environments, Node's ChildProcess emits an error event. Without an explicit "error" event listener, Node throws an unhandled exception that prematurely crashes the Electron fixture.

Evaluated and error found by SubQ by Qorvr.

Problem and expected behavior

  • Smallest trigger: Running Electron readiness verification in environments without a node binary on PATH, or with an invalid REA_ELECTRON_NODE_EXECUTABLE.
  • Observed failure: Unhandled 'error' event emitted by child_process.spawn() terminates the test runner process.
  • Expected behavior: Child process spawn errors should be absorbed gracefully with an error listener, matching the existing shell.openExternal(...).catch(() => undefined) error boundary on line 35.

Change and scope

  • Attached child.on("error", () => undefined); immediately after spawning the background helper process.

Contract and boundary impact

  • Semantic owner and earliest changed stage: tests/conformance/readiness/electron/main.js.
  • Contribution scope fit and linked maintainer decision: not applicable (test fixture resilience fix).
  • CLI and MCP/tool-catalog contract: none.
  • Provider, bridge, target-format, or platform compatibility: improves electron readiness test reliability across CI/local containers.
  • Evidence, artifact, provenance, or reconstruction contract: none.
  • Target selection, authority, upstream behavior, and cleanup details (if applicable): none.
  • Generated metadata impact: none.

Expected effects:

  • Read existing files or captured data.
  • Launch or attach to a process.
  • Inject instrumentation or run scripts/code.
  • Change process memory, registers, files, or configuration.
  • Contact network services.
  • Recover protected code or work around protections.
  • Documentation or usability only; no target interaction.
  • Not sure yet; investigation or maintainer guidance needed.

Evidence and regression coverage

  • Tests added or updated: tests/conformance/readiness/electron/main.js.
  • Base reproduction or other evidence: Spawning an invalid executable emits an unhandled 'error' event.
  • Remaining proof gaps: none.

For evidence-bearing changes:

  • Observed, derived, and inferred claims remain distinguishable.
  • Artifact identity, source provenance, and failed attempts remain preserved.
  • Unsupported, incomplete, unavailable, or uncertain outcomes remain visible.

Validation performed

  • npm run format:check — oxfmt passed on all files.
  • npm run lint — oxlint passed with 0 errors; module boundary checks passed.
  • turbo run typecheck lint — passed.

Compatibility, safety, and release

  • Breaking changes or migration steps: none.
  • Real Hopper/Ghidra, browser, or OS coverage: cross-platform safe.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: safe error handler.

Before merge

  • This PR addresses a concrete problem or an agreed enhancement.
  • Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff.
  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.

…ness fixture

In environments where REA_ELECTRON_NODE_EXECUTABLE or node is unavailable,
unhandled error events on the spawned child process can crash the Electron
runtime before readiness checks complete.

This attaches an explicit error handler to absorb ENOENT and spawn failures.

Evaluated and error found by SubQ by Qorvr.
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@qorvr qorvr changed the title fix(electron): attach error listener to spawned node process in readi… fix(electron): attach error listener to spawned node process in readiness fixture Oct 14, 2026
@greptile-apps

greptile-apps Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 4/5

[Low impact] Adds error handling to a test utility process.

The PR appears safe to merge, with a non-blocking request to test the missing-executable case.

Findings

  1. P2 Crash fix lacks regression coverage ▶
Fix with agent prompt
### Issue 1
tests/conformance/readiness/electron/main.js:34
No test sets `REA_ELECTRON_NODE_EXECUTABLE` to a missing executable, so existing coverage does not check the failure this new `error` listener fixes. Removing or breaking the listener could bring back the crash without tests catching it. Add a test that launches the fixture with a nonexistent executable and checks that Electron stays alive and `readiness:echo` still responds.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Summary

The fixture now attaches an error listener to the spawned child so a missing executable does not crash Electron.

  • The Electron fixture catches errors from its spawned Node process.

Reviews (1) · Last reviewed commit: "fix(electron): attach error listener to ..." · Reviewed by Greptile

["-e", "setTimeout(() => {}, 100)"],
{ stdio: "ignore" },
);
child.on("error", () => undefined);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Crash fix lacks regression coverage

No test sets REA_ELECTRON_NODE_EXECUTABLE to a missing executable, so existing coverage does not check the failure this new error listener fixes. Removing or breaking the listener could bring back the crash without tests catching it. Add a test that launches the fixture with a nonexistent executable and checks that Electron stays alive and readiness:echo still responds.

Prompt To Fix With AI
This is a comment left during a code review.
Path: tests/conformance/readiness/electron/main.js
Line: 34

Comment:
**Crash fix lacks regression coverage**

No test sets `REA_ELECTRON_NODE_EXECUTABLE` to a missing executable, so existing coverage does not check the failure this new `error` listener fixes. Removing or breaking the listener could bring back the crash without tests catching it. Add a test that launches the fixture with a nonexistent executable and checks that Electron stays alive and `readiness:echo` still responds.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

@qorvr

qorvr commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor Author

Thanks @greptile-apps! The tests/conformance/readiness/electron/main.js script is an external fixture consumed during real Electron conformance verification runs via scripts/verify-real-electron.mjs (which relies on REA_ELECTRON_EXECUTABLE), rather than standard unit test suites. The attached error handler safely absorbs any spawn error (such as a missing or unresolvable executable) from bubbling up as an unhandled exception in the fixture process.

@greptile-apps

greptile-apps Bot commented Oct 14, 2026

Copy link
Copy Markdown
Contributor

That context is fair. Since this file is an external Electron conformance fixture rather than a unit-tested module, adding a conventional regression test would add little value; meaningful coverage would require running the fixture with an unresolvable REA_ELECTRON_NODE_EXECUTABLE. The listener is attached immediately after spawn() and prevents the child-process error from becoming an unhandled exception, so I’m withdrawing the regression-coverage request. No further change is needed.

@greptile-apps

greptile-apps Bot commented Oct 14, 2026

Copy link
Copy Markdown
Contributor

That context is reasonable. Since main.js is an external Electron readiness fixture exercised by verify-real-electron.mjs, rather than a unit-tested module, adding a dedicated missing-executable test would require another real-Electron verification scenario and would not fit the standard test suite. The listener is attached directly to the ChildProcess returned by spawn(), so it covers both missing PATH binaries and invalid REA_ELECTRON_NODE_EXECUTABLE values without changing the successful path. I’m withdrawing the non-blocking regression-coverage request; the change is safe to merge as-is.

@morluto
morluto merged commit 877d404 into morluto:main Oct 14, 2026
1 check passed
@morluto morluto added bug Something isn't working area: runtime Process capture and runtime observation labels Oct 14, 2026
@morluto

morluto commented Oct 15, 2026

Copy link
Copy Markdown
Owner

@qorvr, thanks for handling the missing Node executable in the Electron readiness fixture. The child-process error listener keeps a failed spawn from crashing the fixture. Welcome to REA!

@qorvr

qorvr commented Oct 15, 2026

Copy link
Copy Markdown
Contributor Author

Welcome!

@morluto morluto added area: domain Domain logic, errors, and pure functions provider: electron Analysis provider / engine: electron labels Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: domain Domain logic, errors, and pure functions area: runtime Process capture and runtime observation bug Something isn't working provider: electron Analysis provider / engine: electron

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants