Repository navigation
Description
One IPC channel has to be declared in six places. #622 is what happens when someone declares it in five.
Measured coupling
Every commit touching electron/preload.js since 2026-08-01, and what changed with it:
electron/preload.js 90 commits (baseline)
electron/ipc.js 86 96%
src/devCoder.ts 70 78%
src/shared/ipc.ts 64 71%
src/wireClient.ts 61 68%
test/support/fakeCoder.ts 52 58%
Six files that change together 58–96% of the time are one concept, not six. The percentages that are not 100% are where the defects live: wireClient.ts and preload.js implement the same CoderApi and co-change only 68% of the time — that 32% is exactly the gap #622 fell into.
Current surface:
handlers in ipc.js 139
bindings in preload.js 137
CoderApi interface (ipc.ts) 894 lines
devCoder.ts 4618 lines
fakeCoder.ts (140 methods) 1923 lines
wireClient.ts 562 lines
Every new channel means: a type in ipc.ts, a handler in ipc.js, a binding in preload.js, a call() in wireClient.ts, a fixture in devCoder.ts, a stub in fakeCoder.ts. Five of the six are pure transcription — the same channel name and the same argument, retyped.
What this actually costs
- Drift that no layer detects. Verify is broken on desktop: threads.setVerifyCommand/runVerify are missing from preload (web and dev have them) #622: verify shipped working in browser dev, working in web mode, and broken in the desktop app for three days. Every layer that had it worked, so nothing failed loudly.
- A test file that grows one name at a time.
ipc-seam.test.jshard-codes spot checks ("preload must expose sourceControl.discover", an explicitcreatePr/prStatus/prCheckslist). Each was added after someone noticed a specific gap. - Five-sixths of the transcription is unreviewable. A reviewer cannot tell a correct binding from a missing one by reading the diff; only by reading a different file.
Proposal: one channel table, derive the transcription
A single declarative table — channel name, namespace, method name, arg/return types — from which preload.js and wireClient.ts are generated (or built at runtime by iterating the table). ipc.js keeps the handler bodies, which are the only part with real logic. CoderApi is derived from the table rather than hand-maintained alongside it.
Scope note, deliberately: do not try to generate devCoder.ts or fakeCoder.ts. Those return plausible fixture data, which is real content, not transcription — devCoder.ts's own header says it is "NOT a second implementation" and is allowed to disagree with main. Generating the two thin clients is where the whole defect class lives; the fixtures are a separate, lower-value problem.
Smaller step if the full table is too much at once: keep both clients hand-written but add the reverse seam assertion from #622 (enumerate wireClient.ts's methods, assert each exists on the bridged window.coder). That closes the bug class without a refactor and can ship this week — the table is the answer if the pattern recurs after that.
Why now
The board has #453 (named provider instances), #458 (generic CLI provider), #514 (multi-folder projects), #552 (pane workspace) queued — all of which add channels. The per-channel cost is paid on every one of them, and the drift risk compounds with the number of people and agents editing in parallel.
Related
#622 (the bug this class produced), #418 (Electron architecture umbrella — agent-host utility process; the bridge table belongs in the same conversation), #245 (headless — a third client of the same surface, which makes hand-transcription a three-way sync).
Activity
currentbits commentedon Aug 20, 2026
Implementing the table, not the smaller reverse-seam-only step.
Approach:
src/shared/ipcChannels.tsis the one invoke-channel table (ns+method; channel name is alwaysns:method).wireClient.tsbuilds its surface at runtime by iterating the table (bindCoderApi).electron/preload.jscannotrequirea local module (sandbox: true), so a tinyscripts/sync-ipc-preload.jsinlines the same table between markers.--checkis wired into typecheck so a stale copy fails CI.electron/ipc.js(IPC_HANDLERS).CoderApistays the documented type (JSDoc lives there). A compile-time lock inipcChannels.tsfailstscif a method exists on one side and not the other.devCoder.ts/fakeCoder.ts.Side effect:
threads.setVerifyCommand/runVerifyjoin the table, which is the #622 desktop hole.currentbits commentedon Aug 20, 2026
Done in this worktree.
One table:
src/shared/ipcChannels.ts(144 invoke channels).wireClient.tsiterates it at runtime (bindCoderApi). Sandbox preload cannotrequirea local module, soscripts/sync-ipc-preload.jsinlines the same table between markers;--checkis part ofnpm run typecheck/npm run build.Not generated, as scoped:
devCoder.ts/fakeCoder.ts.CoderApistays the documented type (JSDoc);IPC_CHANNEL_LOCKfailstscif a name exists on one side only.#622 is fixed as a side effect:
threads.setVerifyCommand/runVerifyare in the table, so they land onwindow.coder. The ipc-seam spot-check lists are gone — the test iterates the table in both directions.Adding a channel now: handler body in
ipc.js, one{ ns, method }row, CoderApi JSDoc, run the sync script, fixture only if browser-dev/tests need data.