Skip to content

Node-based terminal manager for AI coding agents — tmux-backed terminals and parallel agent sessions as draggable nodes on an infinite pan/zoom canvas. macOS, Linux, and a browser Server Edition.

test(kanban): guard one node-action builder for canvas, sidebar and boards

Mina Sameh041b01e380dd
diff --git a/CLAUDE.md b/CLAUDE.md
index ac446301f..a6d820628 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -9577,7 +9577,7 @@ For every OTHER test dir, two layers, both needed:
carries the node's actions (search / dictate / AI-name / comments), accepts file drops
(`terminal/file-drop.ts`), renders browser webviews (`BrowserSurface`), and its cards support
right-click actions + `+ New`. When you touch a node's UI, ask "does the board need this too?"
- and wire it through `KanbanView`/`SessionCard`/`CardModal` in the SAME change. Kanban itself is
+ and wire it through `KanbanView`/`SessionCard`/`CardModal` in the SAME change. Node menu rows live in ONE builder, `renderer/lib/nodeActionItems.tsx` (canvas menu, sessions sidebar, both boards' card menus via `kanban/cardMenu.tsx`); a card takes only `BOARD_NODE_ACTION_IDS` and writes through `nodeWritesFor(projectId)`, because the Omni board acts on nodes of projects that are not on the canvas. Kanban itself is
desktop+Server-Edition (pure renderer + `workspace.save`); the iOS board is a separate read/move
mirror (`nodeterm-ios`, `KanbanGrouping`/`ProjectBoardView`).
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index c0ddf27e0..c15dde7c5 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -138,6 +138,16 @@ stacked swimlanes; it is off by default (`settings.omniKanbanEnabled`), has a de
shortcut (`view.globalKanbanToggle`), and can be made the default for Cmd+Shift+B via
`settings.omniKanbanAsDefault` — see CLAUDE.md for the full invariants.
+**Node actions live in one builder.** A row that acts on a canvas node — a menu item, a switch, a
+picker — goes in `renderer/lib/nodeActionItems.tsx`, never inline in `Canvas.tsx`. The canvas node
+menu, the sessions-sidebar row menu and both kanban card menus (through
+`components/kanban/cardMenu.tsx`) build from it. Decide in the same change whether a card offers
+the new row: a card takes only `BOARD_NODE_ACTION_IDS`, and a row that acts on canvas position goes
+in `BOARD_SPATIAL_ROW_IDS` instead. Remember the board acts on nodes of projects that are NOT on the
+canvas (the Omni board): write through `nodeWritesFor(projectId)` (`lib/nodeWriteRouter.ts`), never
+a live-canvas callback, and report a failure with a `nodeterm:toast`.
+`lib/nodeActionItems.guard.test.ts` fails on a second copy of the rows.
+
A board card's **source** is a registry entry, not a branch you add at a call site
(`renderer/lib/kanbanSources.ts`). Declare the source once — filter label, `placement`
(`assignment` = the board's own persisted assignments, `provider` = the provider owns the column),
diff --git a/src/renderer/lib/nodeActionItems.guard.test.ts b/src/renderer/lib/nodeActionItems.guard.test.ts
index 82b4d2e6a..d933fec3e 100644
--- a/src/renderer/lib/nodeActionItems.guard.test.ts
+++ b/src/renderer/lib/nodeActionItems.guard.test.ts
@@ -40,4 +40,21 @@ describe('node actions: one builder for every surface', () => {
expect(body).toContain("...selectionItems([id], undefined, { omit: ['delete'] }),")
expect(body).not.toContain("it.label === 'Delete'")
})
+
+ it('both boards build their card menu with the shared card menu, fed by the builder', () => {
+ expect(read('components/kanban/KanbanView.tsx')).toContain('buildCardMenuItems({')
+ expect(read('components/kanban/GlobalKanbanView.tsx')).toContain('buildCardMenuItems({')
+ expect(read('components/kanban/cardMenu.tsx')).toContain('...(a.nodeActions?.(card.id) ?? []),')
+ expect(callback(canvas, 'boardNodeActionItems')).toContain('{ allow: BOARD_NODE_ACTION_IDS }')
+ })
+
+ it('no other renderer file defines the node rows again', () => {
+ const owned = join(RENDERER, 'lib/nodeActionItems.tsx')
+ const rows = ["label: 'Restart agent'", "label: 'Pause & end session'", "label: 'Switch Claude account'"]
+ const offenders = sources(RENDERER)
+ .filter((f) => f !== owned)
+ .filter((f) => rows.some((r) => readFileSync(f, 'utf8').includes(r)))
+ .map((f) => relative(RENDERER, f))
+ expect(offenders).toEqual([])
+ })
})