Thin handlers, testable logic

· Decision D006 · How Otto came to be

Why Otto’s IPC handlers only pass requests on, and the one reason we gave.

An Electron app runs as a main process, which has Node, and a renderer, which draws the window. They talk over IPC (inter-process communication). The window sends a named request, and a handler in the main process answers it.

The decision says those handlers, all in src/main/ipc-handlers.ts, are thin. Each one passes its request on to a module that does the work, and all the logic lives in those modules.

The reason is one word and one sentence: “Testable. Vitest tests cover main-process modules directly without going through IPC.” A test calls a module the way its handler would, with no window and no Electron.

We didn’t record what else we considered or what the rule cost. It arrived on 2026-05-05 with ten other decisions, in a commit with no message. On that day the handlers file was 291 lines long.

The entry’s list of modules named github.ts. Git shows that a commit two hours earlier the same day (d99123f9) had deleted that file, together with Otto’s GitHub panel.

Later, on 2026-06-11, we checked the decision against the code. We swapped github.ts for the projects modules in its list and found the rule in force. The handlers file had grown to about 1,200 lines “of thin ipcMain.handle delegations”, typed helpers for the channels had been added, and the rule had joined the conventions we write for agents. Nothing has changed the text since.

Decision D006 · 2026-05-05 · ba6e1975, 9399ca23 (moved to its own file in 94a000a6, wording unchanged)

All posts