Repository navigation
fix(orcad): answer host paths honestly and ship the watcher child - #16369
Conversation
ccd8a67 to
f1a4adc
Compare
1930a92 to
96506e0
Compare
orcad's AppEnvironment implemented three of seven AppPathNames and returned the userData directory for the rest — including 'exe', where a data directory is not an executable. Every name now has a Node answer: 'appData' is the platform's per-user application-data root, 'logs' lives inside the data root so a headless deployment stays one removable directory, 'downloads' honours XDG_DOWNLOAD_DIR, and 'exe' is the Node binary. getAppPath() is the directory orcad was launched from rather than cwd, so children resolve against the bundle instead of wherever the supervisor happened to be. The watcher child was the load-bearing consequence: resolveWatcherProcessEntryPath probed for the adjacent entry only when !isPackaged, so orcad resolved a desktop out/main path that no deployment has — and build-orcad never emitted the child anyway. isPackaged stays true (consumers read it as "production, not a dev checkout" and it gates HTTPS-only skill downloads); the resolver now asks whether the app root is an asar archive, which is the question it actually meant. The child ships beside orcad.js, and the build forks it to prove it runs.
96506e0 to
6b26520
Compare
📝 WalkthroughWalkthroughThe PR adds centralized Orcad path resolution with environment and platform-specific fallbacks. The Orcad entry point now uses these resolvers for runtime paths and installation-root detection. Packaged non-asar hosts can resolve an adjacent watcher entry. The build bundles the watcher separately and smoke-tests it through a forked IPC child. Tests cover path resolution, deployment layouts, watcher entry selection, and watcher startup. Merge Risk: 🔵 Low · up to The build helper can currently report success if the watcher child exits before confirming startup, allowing a prematurely terminated child to be treated as healthy. This is a bounded startup-validation risk that warrants explicit owner follow-up but does not otherwise block merging. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Description checkExplanation The description provides detailed context, change rationale, implementation details, trade-offs, and test results. However, it omits required template sections, including the mandatory linked issue, visual proof or an explicit N/A statement, Testing, Review, Notes, Agent skill upstream boundary, and Checklist. Resolution Add the missing required template sections. Provide a valid issue reference after ✨ Finishing Touches 💡 1📝 Generate docstrings 💡
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 98216f8e-3bf1-4832-b723-0a453925cae8
📒 Files selected for processing (7)
config/scripts/build-orcad.mjssrc/main/ipc/parcel-watcher-entry-path.test.tssrc/main/ipc/parcel-watcher-entry-path.tssrc/main/orcad/orcad-app-paths.test.tssrc/main/orcad/orcad-app-paths.tssrc/main/orcad/orcad-entry.tssrc/main/orcad/orcad-forked-child-paths.test.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 6 remain after this review.
| child.on('exit', (code, signal) => | ||
| settle(code === 0 ? null : `exit code=${code} signal=${signal}\n${stderr.slice(0, 2000)}`) | ||
| ) |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Require subscribe-started before accepting a clean exit.
Line 217 returns success for any zero exit, including one before the acknowledgement. Track acknowledgement receipt and fail a clean exit until subscribe-started arrives. The IPC protocol defines subscribe-started as the startup acknowledgement.
…ablyai#16369) orcad's AppEnvironment implemented three of seven AppPathNames and returned the userData directory for the rest — including 'exe', where a data directory is not an executable. Every name now has a Node answer: 'appData' is the platform's per-user application-data root, 'logs' lives inside the data root so a headless deployment stays one removable directory, 'downloads' honours XDG_DOWNLOAD_DIR, and 'exe' is the Node binary. getAppPath() is the directory orcad was launched from rather than cwd, so children resolve against the bundle instead of wherever the supervisor happened to be. The watcher child was the load-bearing consequence: resolveWatcherProcessEntryPath probed for the adjacent entry only when !isPackaged, so orcad resolved a desktop out/main path that no deployment has — and build-orcad never emitted the child anyway. isPackaged stays true (consumers read it as "production, not a dev checkout" and it gates HTTPS-only skill downloads); the resolver now asks whether the app root is an asar archive, which is the question it actually meant. The child ships beside orcad.js, and the build forks it to prove it runs. (cherry picked from commit 20c1a61)
…ablyai#16369) orcad's AppEnvironment implemented three of seven AppPathNames and returned the userData directory for the rest — including 'exe', where a data directory is not an executable. Every name now has a Node answer: 'appData' is the platform's per-user application-data root, 'logs' lives inside the data root so a headless deployment stays one removable directory, 'downloads' honours XDG_DOWNLOAD_DIR, and 'exe' is the Node binary. getAppPath() is the directory orcad was launched from rather than cwd, so children resolve against the bundle instead of wherever the supervisor happened to be. The watcher child was the load-bearing consequence: resolveWatcherProcessEntryPath probed for the adjacent entry only when !isPackaged, so orcad resolved a desktop out/main path that no deployment has — and build-orcad never emitted the child anyway. isPackaged stays true (consumers read it as "production, not a dev checkout" and it gates HTTPS-only skill downloads); the resolver now asks whether the app root is an asar archive, which is the question it actually meant. The child ships beside orcad.js, and the build forks it to prove it runs.
…ablyai#16369) orcad's AppEnvironment implemented three of seven AppPathNames and returned the userData directory for the rest — including 'exe', where a data directory is not an executable. Every name now has a Node answer: 'appData' is the platform's per-user application-data root, 'logs' lives inside the data root so a headless deployment stays one removable directory, 'downloads' honours XDG_DOWNLOAD_DIR, and 'exe' is the Node binary. getAppPath() is the directory orcad was launched from rather than cwd, so children resolve against the bundle instead of wherever the supervisor happened to be. The watcher child was the load-bearing consequence: resolveWatcherProcessEntryPath probed for the adjacent entry only when !isPackaged, so orcad resolved a desktop out/main path that no deployment has — and build-orcad never emitted the child anyway. isPackaged stays true (consumers read it as "production, not a dev checkout" and it gates HTTPS-only skill downloads); the resolver now asks whether the app root is an asar archive, which is the question it actually meant. The child ships beside orcad.js, and the build forks it to prove it runs.
Plan item 1, stacked on #16368. Two symptoms, one cause: the host port answered plausibly-wrong instead of refusing, and something downstream believed it.
The port lied by omission
AppPathNamehas seven members.orcadimplemented three and returned the userData directory for the other four — including'exe'. A data directory is not an executable path. That is the bundler-shim anti-pattern the design explicitly rejects.Now every name answers for a Node host or throws:
userData/home/tempappDatalogsuserData/logs— a headless deployment's whole state is one removable directory, and a service account often has no~/Libraryto write intoexeprocess.execPath— the Node binary running the bundle; there is no app executable to point atdownloadsXDG_DOWNLOAD_DIR, else the cross-platform defaultThe watcher was unreachable, and
isPackagedwas the wrong leverresolveWatcherProcessEntryPathconsulted the adjacent child only when!isPackaged. Withorcadclaiming packaged it skipped that and resolved a desktop-build path that does not exist in anorcaddeployment — andbuild-orcademitted one entry, so the child was never built either.isPackaged: () => trueis kept deliberately. Consumers read it as "production build, not a dev checkout": it gates HTTPS-only skill downloads, the real CLI command name, and shell-PATH hydration. Answeringfalseto satisfy a path resolver would relax a security posture to fix a layout bug.So the resolver now asks the question it actually means — is the app root an asar archive — rather than is this packaged. Only the asar layout nests the child under
out/main;orcadis a packaged non-Electron host whose root holdsorcad.jsand the child side by side.build-orcadnow ships the child, the same way it already ships theagent-browserbinary.Proof
Reverting the resolver fix fails three tests:
out/orcad/now containsorcad.js,agent-browser-*, andparcel-watcher-process-entry.js. Ratchet 0,build-orcadgreen (including item 0's plain-Node smoke-load),smoke:orcad-terminalpasses, typecheck and lint clean.Trade-offs
Zero user-facing. The desktop path is unchanged —
usesAsarArchiveisisPackaged && appPath.includes('app.asar'), which is exactly the old condition for a real packaged Electron app.