Repository navigation
fix(electron): attach error listener to spawned node process in readiness fixture - #3165
Conversation
…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.
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
|
| ["-e", "setTimeout(() => {}, 100)"], | ||
| { stdio: "ignore" }, | ||
| ); | ||
| child.on("error", () => undefined); |
There was a problem hiding this 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.
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!
|
Thanks @greptile-apps! The |
|
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 |
|
That context is reasonable. Since |
|
@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! |
|
Welcome! |
Summary
In
tests/conformance/readiness/electron/main.js,spawn()is invoked withprocess.env.REA_ELECTRON_NODE_EXECUTABLE ?? "node". If the node executable is unavailable on PATH or in custom verification environments, Node'sChildProcessemits anerrorevent. 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
REA_ELECTRON_NODE_EXECUTABLE.'error'event emitted bychild_process.spawn()terminates the test runner process.shell.openExternal(...).catch(() => undefined)error boundary on line 35.Change and scope
child.on("error", () => undefined);immediately after spawning the background helper process.Contract and boundary impact
tests/conformance/readiness/electron/main.js.Expected effects:
Evidence and regression coverage
tests/conformance/readiness/electron/main.js.'error'event.For evidence-bearing changes:
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
Before merge
type(scope): outcome.