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(ui): pin that the pill never runs the full sweep; one obstacle rect

enes9cafa411a2fb
diff --git a/src/renderer/canvas/Canvas.tsx b/src/renderer/canvas/Canvas.tsx
index 043304540..89171d53e 100644
--- a/src/renderer/canvas/Canvas.tsx
+++ b/src/renderer/canvas/Canvas.tsx
@@ -7891,8 +7891,11 @@ export function Canvas() {
z-index (5 collapsed, 13 with the popover open) competes in the same context as the
sidebar and the open popover wins. Neither uses React Flow hooks, and .flow-wrap is
position:relative, so the cluster's absolute left/bottom anchor is unchanged.
- The cluster itself deliberately has NO z-index — see .canvas-pills in styles.css. */}
- <div className="canvas-pills">
+ The cluster itself deliberately has NO z-index — see .canvas-pills in styles.css.
+ `data-canvas-chrome` is fit-view's own documented opt-in: it makes the whole cluster ONE
+ obstacle rect (instead of one per pill, overlapping after inflation), so fitView never
+ parks a node underneath either pill. */}
+ <div className="canvas-pills" data-canvas-chrome>
<UsageIndicator overBoard={kanbanOpen} />
<SystemResourcePill overBoard={kanbanOpen} />
</div>
diff --git a/src/renderer/canvas/fit-view.ts b/src/renderer/canvas/fit-view.ts
index f5cb9381d..30fc57b0f 100644
--- a/src/renderer/canvas/fit-view.ts
+++ b/src/renderer/canvas/fit-view.ts
@@ -19,8 +19,10 @@ export const CANVAS_CHROME_SELECTOR = [
'.dock',
'.minimap',
'.react-flow__controls',
- '.usage-indicator',
- '.sysres-indicator',
+ // The bottom-left pill cluster (usage + system resources) opts in via `data-canvas-chrome` on its
+ // wrapper, so the two pills are ONE obstacle rect instead of two overlapping inflated ones. The
+ // wrapper's border box is exactly their union (they are its only, in-flow, children), and an
+ // empty cluster measures 0 and is dropped by the size filter below.
'.controls-cluster',
'.sessions-sidebar',
'.sessions-icon-cluster',
diff --git a/src/renderer/components/SystemResourcePill.test.tsx b/src/renderer/components/SystemResourcePill.test.tsx
index 4f7c12604..f937020b3 100644
--- a/src/renderer/components/SystemResourcePill.test.tsx
+++ b/src/renderer/components/SystemResourcePill.test.tsx
@@ -33,12 +33,18 @@ let host: HTMLDivElement
let root: Root
let startHostPoll: Mock<(scopeKey: string, projectId?: string) => void>
let stopHostPoll: Mock<() => void>
-
-/** Mount with the store's poll actions stubbed — the real ones would talk to a session registry
- * that does not exist in a jsdom test, and `refreshHost` would clear the `mem` fixture on the way
- * through `enterScope`. */
+let refreshFull: Mock<(scopeKey: string, projectId?: string) => Promise<void>>
+
+/** Mount with the store's actions stubbed — the real ones would talk to a session registry that
+ * does not exist in a jsdom test, and `refreshHost` would clear the `mem` fixture on the way
+ * through `enterScope`.
+ *
+ * `refreshFull` is stubbed for a different reason: it must be OBSERVABLE. The real one swallows
+ * every failure, so a future edit that put the full process-table sweep on this pill's 30 s timer
+ * would leave the suite green and show no symptom — while costing an ssh exec plus a remote `ps`
+ * every 30 seconds on an SSH scope. */
function mount(mem: MemInfo | null, overBoard = false): void {
- useSessionMemory.setState({ mem, startHostPoll, stopHostPoll })
+ useSessionMemory.setState({ mem, startHostPoll, stopHostPoll, refreshFull })
host = document.createElement('div')
root = createRoot(host)
act(() => root.render(<SystemResourcePill overBoard={overBoard} />))
@@ -47,6 +53,7 @@ function mount(mem: MemInfo | null, overBoard = false): void {
beforeEach(() => {
startHostPoll = vi.fn<(scopeKey: string, projectId?: string) => void>()
stopHostPoll = vi.fn<() => void>()
+ refreshFull = vi.fn<(scopeKey: string, projectId?: string) => Promise<void>>(async () => {})
useProjects.setState({ projects: [project()], activeProjectId: 'p1' })
useSshConn.setState({ byProject: {} })
})
@@ -117,6 +124,20 @@ describe('SystemResourcePill', () => {
})
expect(startHostPoll).toHaveBeenCalledTimes(2)
expect(startHostPoll).toHaveBeenLastCalledWith('enes@box', 'ssh1')
+ // The connect-up path is the likeliest place for someone to "just also refresh the rows".
+ expect(refreshFull).not.toHaveBeenCalled()
+ })
+
+ it('never runs the full sweep — the cheap read is the pill´s, the expensive one the panel´s', () => {
+ // `refreshFull` walks the whole process table, and on an SSH scope that is an ssh exec plus a
+ // remote `ps`. On this component's 30 s timer that would be a background cost nobody asked for,
+ // and the real action swallows its failures, so it would show no symptom at all.
+ mount(MEM)
+ expect(refreshFull).not.toHaveBeenCalled()
+ // Not even when the pill is clicked: opening the panel is what triggers the sweep, and the
+ // panel does it itself (Task 9).
+ act(() => host.querySelector<HTMLButtonElement>('.sysres-pill')!.click())
+ expect(refreshFull).not.toHaveBeenCalled()
})
it('renders nothing and polls nothing without an active project', () => {