From 5e6e88663b8dc09441c2e4c7e1f4e21ee832b46a Mon Sep 17 00:00:00 2001 From: dormouse-bot <287024035+dormouse-bot@users.noreply.github.com> Date: Sun, 25 Oct 2026 11:40:16 +0000 Subject: [PATCH] Correct stale comments and test names in the image viewer, tool host, quit and design tests - zoomAt takes an absolute zoom, not a factor. - tool-host's header now lists the dor open ops it serves. - design.test: the header-crossfade comment moves to the block it describes. - ScanInvitation story: an expired code for this server reads differently. - quit.test: the header names the quit_* commands and every mocked collaborator; an orphan comment over no mock is gone. - LathHost and mouse-selection test names stop claiming an old eight-browser cap and an editor the case never sets. - direct-endpoint, frame-socket, atomic-save: a comment that claimed an unmade check, a wrong script path, an unused import. - terminal-context.md: Source of truth moves to the section's end. Co-Authored-By: Claude Opus 5.5 --- docs/specs/terminal-context.md | 4 ++-- dor-tools-builtin/test/atomic-save.test.mjs | 2 +- dor-tools-builtin/viewer/image/view.ts | 2 +- lib/src/components/design.test.ts | 10 +++++----- lib/src/components/wall/LathHost.test.tsx | 2 +- lib/src/host/tool-host.ts | 4 ++-- lib/src/lib/mouse-selection.test.ts | 2 +- lib/src/remote/direct/direct-endpoint.test.ts | 2 +- lib/src/stories/ScanInvitation.stories.tsx | 3 ++- remote-lib-common/test/harness/frame-socket.mjs | 2 +- standalone/src/quit.test.ts | 11 ++++------- 11 files changed, 21 insertions(+), 23 deletions(-) diff --git a/docs/specs/terminal-context.md b/docs/specs/terminal-context.md index aae8bbcdd..a2b87efe4 100644 --- a/docs/specs/terminal-context.md +++ b/docs/specs/terminal-context.md @@ -52,10 +52,10 @@ Source of truth: `context` in `standalone/sidecar/pty-core.js`; `terminalContext Port action overflow follows `docs/specs/layout.md` → "Header context menu". -Source of truth: `TerminalContextView` in `lib/src/components/wall/TerminalContextView.tsx`. - The Window-host workspace picker follows `docs/specs/layout.md` → Moving Surfaces between Workspaces. +Source of truth: `TerminalContextView` in `lib/src/components/wall/TerminalContextView.tsx`. + ## Tool context **Must show a Tool's primary Session in Terminal Context instead of creating an auxiliary helper**; one whose run ended is a plain terminal with a helper (`docs/specs/dor-tool.md` → Run end). Reuse the title explanation, directory, port, and alert presentation, showing Tool command status without helper Modify, Reset, or Promote controls; a preview slot's adds Keep open (`docs/specs/layout.md` → Pane header). Pending approval cannot open context. diff --git a/dor-tools-builtin/test/atomic-save.test.mjs b/dor-tools-builtin/test/atomic-save.test.mjs index 067046e30..130f27447 100644 --- a/dor-tools-builtin/test/atomic-save.test.mjs +++ b/dor-tools-builtin/test/atomic-save.test.mjs @@ -5,7 +5,7 @@ import { join, win32 } from 'node:path'; import { spawn } from 'node:child_process'; import { once } from 'node:events'; import { beforeEach, afterEach, test } from 'node:test'; -import { saveFileOperations, windowsReplaceCommand } from '../dist/atomic-save.js'; +import { windowsReplaceCommand } from '../dist/atomic-save.js'; import { editorStore } from '../dist/editor-store.js'; import { readText, saveText } from '../dist/editor-routes.js'; let root, file; diff --git a/dor-tools-builtin/viewer/image/view.ts b/dor-tools-builtin/viewer/image/view.ts index 6e97e04c5..f6ba490c9 100644 --- a/dor-tools-builtin/viewer/image/view.ts +++ b/dor-tools-builtin/viewer/image/view.ts @@ -17,7 +17,7 @@ export function center(zoom: number, w: number, h: number, viewW: number, viewH: return { zoom, x: Math.round((viewW - w * zoom) / 2), y: Math.round((viewH - h * zoom) / 2), fit }; } -/** `view` scaled by `factor` about the device point (cx, cy), which stays put. */ +/** `view` zoomed to `zoom` (clamped) about the device point (cx, cy), which stays put. */ export function zoomAt(view: View, zoom: number, cx: number, cy: number): View { zoom = Math.max(MIN_ZOOM, Math.min(MAX_ZOOM, zoom)); const k = zoom / view.zoom; diff --git a/lib/src/components/design.test.ts b/lib/src/components/design.test.ts index 96348758c..7d5b90bd9 100644 --- a/lib/src/components/design.test.ts +++ b/lib/src/components/design.test.ts @@ -49,11 +49,7 @@ describe('terminal radius constants', () => { }); }); -// The header palette crossfade must resolve on the same timing as the focus -// ring's travel. Tailwind can't build a class from a JS constant, so the class -// is a hand-written literal — this ties it back to FOCUS_MOTION_MS and the house -// curve so the two can't silently drift apart. -// Same reason as above: Tailwind scans source statically, so the viewport caps +// Tailwind scans source statically, so the viewport caps // are hand-written literals. These tie them back to the constants they are // derived from — `clampOverlayPosition`'s margin, and the modal overlay's own // inset — so a change to either can't silently leave the cap behind. @@ -89,6 +85,10 @@ describe('viewport-bounded overlay caps', () => { }); }); +// The header palette crossfade must resolve on the same timing as the focus +// ring's travel. Tailwind can't build a class from a JS constant, so the class +// is a hand-written literal — this ties it back to FOCUS_MOTION_MS and the house +// curve so the two can't silently drift apart. describe('focus-ring motion timing', () => { it('header crossfade duration + curve track FOCUS_MOTION_MS', () => { expect(FOCUS_MOTION_MS).toBe(220); diff --git a/lib/src/components/wall/LathHost.test.tsx b/lib/src/components/wall/LathHost.test.tsx index 117a1ff06..cb387ca9a 100644 --- a/lib/src/components/wall/LathHost.test.tsx +++ b/lib/src/components/wall/LathHost.test.tsx @@ -169,7 +169,7 @@ describe('LathHost — node identity (the no-re-parent guarantee)', () => { }); describe('LathHost — parked leaves', () => { - it('retains the same document after more than eight browsers are minimized', () => { + it('retains a parked leaf\'s document however many leaves park after it', () => { const meta = leafMeta({ component: 'terminal' }); const store = seeded(rowOf('a', 'b'), [['a', meta], ['b', meta]]); mount(store); diff --git a/lib/src/host/tool-host.ts b/lib/src/host/tool-host.ts index dd7696c7b..ed7acf0f0 100644 --- a/lib/src/host/tool-host.ts +++ b/lib/src/host/tool-host.ts @@ -4,8 +4,8 @@ * `tool-host.cjs` and imported directly by the VS Code extension host. * * One method: resolve a tool name against the nearest `dormouse.yml`, list - * the Tools there, read browser settings, and record a trust decision a human - * made in Dormouse's own chrome. Everything crossing back to the webview is + * the Tools there, resolve and list `dor open` handlers, read browser + * settings, and record a trust decision a human made in Dormouse's own chrome. Everything crossing back to the webview is * plain JSON — the standalone path goes through Rust. */ import { dirname } from 'node:path'; diff --git a/lib/src/lib/mouse-selection.test.ts b/lib/src/lib/mouse-selection.test.ts index b057bf73f..dc4c79276 100644 --- a/lib/src/lib/mouse-selection.test.ts +++ b/lib/src/lib/mouse-selection.test.ts @@ -50,7 +50,7 @@ describe('mouse-selection: default state', () => { }); describe('mouse-selection: shadowed program drags', () => { - it('drops a shadowed drag, with its editor, when the program stops reporting', () => { + it('drops a shadowed drag when the program stops reporting', () => { setMouseReporting('a', 'vt200'); setSelection('a', { startRow: 0, startCol: 0, endRow: 0, endCol: 4, shape: 'linewise', dragging: false, startedInScrollback: false, owner: 'program' }); setMouseReporting('a', 'none'); diff --git a/lib/src/remote/direct/direct-endpoint.test.ts b/lib/src/remote/direct/direct-endpoint.test.ts index ddc2b61c7..5da4b0699 100644 --- a/lib/src/remote/direct/direct-endpoint.test.ts +++ b/lib/src/remote/direct/direct-endpoint.test.ts @@ -210,7 +210,7 @@ describe('DirectEndpoint', () => { expect(run.offerer.sent).toEqual([]); expect(run.answerer.peers).toEqual([]); - // And the attempt is spent: a signal arriving later cannot start one. + // The session stays relayed. expect(run.offerer.endpoint.path).toBe('relay'); }); diff --git a/lib/src/stories/ScanInvitation.stories.tsx b/lib/src/stories/ScanInvitation.stories.tsx index 919ab556c..493704490 100644 --- a/lib/src/stories/ScanInvitation.stories.tsx +++ b/lib/src/stories/ScanInvitation.stories.tsx @@ -70,7 +70,8 @@ export const CameraUnsupported: Story = { }; // A pasted string that is not a setup code for this server. One fixed line — -// the parser answers a complete invitation or nothing, never a reason. +// the parser answers a complete invitation or nothing, never a reason; only an +// expired code for this server reads differently. export const PastedCodeRejected: Story = { play: async ({ canvasElement }) => { const canvas = within(canvasElement); diff --git a/remote-lib-common/test/harness/frame-socket.mjs b/remote-lib-common/test/harness/frame-socket.mjs index de818dde0..f3ec45564 100644 --- a/remote-lib-common/test/harness/frame-socket.mjs +++ b/remote-lib-common/test/harness/frame-socket.mjs @@ -9,7 +9,7 @@ */ /** - * The most frames either log keeps. A test case sends tens; `scripts/fake-burrow.mjs` + * The most frames either log keeps. A test case sends tens; `relay/scripts/fake-burrow.mjs` * is a long-running dev stand-in driving a live echo terminal, and would * otherwise retain every relayed PTY byte for the life of the process. */ diff --git a/standalone/src/quit.test.ts b/standalone/src/quit.test.ts index 88d953678..170ea910f 100644 --- a/standalone/src/quit.test.ts +++ b/standalone/src/quit.test.ts @@ -2,10 +2,10 @@ import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"; import type { TauriAdapter } from "./tauri-adapter"; // The orchestrator is pure webview-side glue: it listens for one Rust event, -// calls adapter/updater primitives, and invokes three Rust commands. Mock the -// Tauri surface (core invoke + event listen) like updater.test.ts, plus the two -// collaborators (countRunningSessions, the updater install pair) so ordering is -// observable. The adapter is injected into initQuitFlow, so it needs no module +// calls adapter/updater primitives, and invokes the `quit_*` Rust commands. +// Mock the Tauri surface (core invoke + event listen) like updater.test.ts, plus +// its collaborators (countRunningSessions, the session flush, the workspace +// store, the updater install pair) so ordering is observable. The adapter is injected into initQuitFlow, so it needs no module // mock. quit.ts imports TauriAdapter as a type only (erased) — no runtime dep. const mocks = vi.hoisted(() => ({ invoke: vi.fn(async (_cmd: string) => undefined as unknown), @@ -22,9 +22,6 @@ vi.mock("@tauri-apps/api/event", () => ({ listen: mocks.listen })); vi.mock("dormouse-lib/lib/terminal-registry", () => ({ countRunningSessions: mocks.countRunningSessions, })); -// The Rust command the close path removes a snapshot with; the quit path never -// calls it (a quit keeps every window's blob, which is what a relaunch reads). - // The aggregator's write step. Mocked for the same reason as the registry: what // this file tests is where it sits in the order. vi.mock("dormouse-lib/lib/window-session-aggregator", () => ({