Repository navigation
fix(dev): keep Node-only Quick Open path accumulator out of the renderer - #27372
Conversation
The renderer imports quick-open-listing-limits for the result cap, but the same module also held a Buffer-backed accumulator that imports the CommonJS @orca/process-host dist. Vite dev serves that dist as raw ESM, so the named import failed and the workspace workbench and right sidebar crashed. Move the accumulator to its own main-only module.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ➖ Normal Merge Risk: ⚪ Minimal · up to The change isolates Node-only code from the renderer-imported limits module. No issue requiring a fix before merge is established; normal checks remain appropriate. Pre-merge checks |
|
ELI5
When running Orca from source (
pnpm dev), opening any workspace showed "The workspace workbench hit an error." and the right sidebar crashed too. A small file shared by the app's window and its background process pulled in background-only code, which the dev server can't load in the window. This moves that background-only code into its own file so the window never loads it.What Changed
LazyChunkLoadError, and importingTerminalPane.tsxdirectly failed withThe requested module '.../process-host/dist/growing-byte-buffer.js' does not provide an export named 'GrowingByteBuffer'.src/shared/quick-open-listing-limits.tsheld two things: the result cap (QUICK_OPEN_LISTING_MAX_RESULTS, used by the renderer's Quick Open list) andQuickOpenSubprocessPathAccumulator, aBuffer-based class only the main process uses. Since Extract subprocess handling into @orca/process-host #26963 the class importsGrowingByteBufferfrom@orca/process-host, whose dist is CommonJS. Vite dev serves workspace-linked packages to the renderer as raw ESM without CommonJS conversion, so the named import fails and every lazy chunk that reaches the limits file (terminal pane, right sidebar) fails to load. The accumulator now lives insrc/shared/quick-open-subprocess-path-accumulator.ts, imported only bysrc/main/ipc/filesystem-search-file-paths.ts. The limits file has no imports anymore. Tests split the same way.Bufferclass in itsquick-open-file-listchunk. After this change the renderer bundle has noGrowingByteBuffercode.Why
The renderer should never load a class built on Node's
Buffer. The fix removes that dependency where it starts, instead of making the dev server able to load it. Alternatives I considered:renderer.optimizeDeps.includeworks, but it keeps Node-only code in the renderer graph and each new subpath that leaks in would need its own entry.orca-sourcecondition would load the TypeScript source, butBufferstill doesn't exist in the renderer. It only works today because the code is never run there.src/shared/windows-breakaway-launcher.tsalso imports from process-host, but the renderer can't reach it (it importsnode:fs), so it is left as is.Linked Issue
None. Maintainer fix.
Visual Proof
Same dev server, fresh throwaway profile, folder workspace activated through CDP.
Before (origin/main):

After (this branch):

Testing
Original repro on macOS: background dev launch (
ORCA_BACKGROUND_LAUNCH=1, throwawayORCA_DEV_USER_DATA_PATH), added a folder repo withwindow.api.repos.add, thenfetchReposandsetActiveWorktree. On main: both error boxes,LazyChunkLoadErrorin the console, and theGrowingByteBufferSyntaxError on a directimport('/src/components/terminal-pane/TerminalPane.tsx'). On this branch: the workbench renders, the import resolves, and there are no console errors.Production
electron-vite build: before,out/renderer/assets/quick-open-file-list-*.jscontained theGrowingByteBufferclass. After, no renderer asset contains it.pnpm teston the quick-open limits and accumulator tests,filesystem-search-file-paths, the renderer quick-open list tests, and the relay list-files limit test: all pass.pnpm tc, oxlint, oxfmt,check:code-quality:changed,check:process-host-imports, andcheck:max-lines-ratchetpass.I manually tested these changes locally
Automated tests added/updated, or explained why not below (existing tests moved alongside the code they cover)
Review
Agent skill upstream boundary
Notes
Behavior doesn't change on any platform. The main process and relay still use the same limit and the same accumulator code. SSH and relay are unaffected: the relay imports only
resolveQuickOpenResultLimit, which stays where it was.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)