You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add unit coverage for src/terminal (currently 0%) #182
npm run coverage reports src/terminal/ at 0% across the board (bridge.ts, chat.ts 574 lines, cli.ts, input.ts, renderer.ts, types.ts). Terminal chat (headlesscode chat) is a shipped, documented feature with saved/resumed/forked sessions, so a regression there ships silently.
Architecture (independent solution)
Add unit coverage for the pure seams first; do not attempt full interactive TTY automation:
Inventory src/terminal/ for pure functions (message rendering, input parsing, bridge framing) vs TTY-bound code. Test only the pure seams with the repo idiom: plain node:assert/strict scripts run via tsx, auto-discovered as src/terminal/__tests__/*.test.ts (that dir already exists — check what's in it first).
For TTY-bound modules, extract the smallest pure helper needed to make the logic testable (no behavior change) rather than mocking process.stdin/stdout wholesale.
Keep each test file under the 250-line standards limit; mirror src/engine/__tests__/loop.test.ts Fake-client patterns where a session is needed.
Scope / non-goals
No interactive/playwright TTY harness, no chat UX changes, no coverage-threshold raise in this issue (report the new number; ratcheting is a follow-up).
Acceptance
npm run coverage -- --filter terminal shows non-zero, honestly-measured coverage for bridge/renderer/input pure logic.
npm test -- terminal green; npx tsc --noEmit green.
Tests (happy / sad / bad)
Happy: render/parse of a normal message round-trips.
None (investigation + honest measurement; no code change warranted).
Baseline (before)
Issue premise: npm run coverage reports src/terminal/ at 0% across the board.
Baseline (after)
Honestly measured via node scripts/coverage.mjs --filter terminal (c8, same invocation the suite uses):
src/terminal/ overall: 87.21% lines (bridge 100%, chat 87.63%, cli 77.21%, input 93.33%, renderer 90.49%; types.ts 0% — a types-only file with no runtime code).
Existing suites: src/terminal/__tests__/bridge.test.ts, chat.test.ts (14 tests), runtime.test.ts — all green under npm test -- terminal (4 files passed).
Pure-seam inventory: every exported pure seam is already covered — sanitizeTerminalText, wrapPlainText, decisionSuggestions (renderer.ts), readComposedInput + TerminalInput queue/overflow bounds (input.ts), createChatTurnRunner archive/turn wiring (bridge.ts), parseChatArgs/parseSlashCommand (chat.ts), plus renderer event/budget/status-cap bounds (happy: message round-trip; sad: empty input, truncated stream, missing session file; bad: malformed escape sequences, 50k+ oversized input, queue overflow — all asserted, no mocks of stdin/stdout wholesale).
npx tsc --noEmit clean. Full npm test: run-tests: all 341 file(s) passed.
Boot check
npm test -- terminal green; filtered coverage run green; full suite green (above). No coverage-threshold change made (ratcheting explicitly out of scope per the issue).
Residual risk / notes
The 0% premise was stale — terminal coverage landed before this issue was worked (prior commits added chat/bridge/runtime tests). Closing as resolved-by-prior-work with evidence rather than adding redundant tests to chase a number that is already 87%. TTY-bound paths (real PTY Ctrl-C) remain environment-gated by design (script/sandbox probe skips). If the intent was a higher bar (e.g. ratchet the floor), that is a follow-up issue.
Activity
w4ffl35 commentedon Dec 5, 2026
Issue 182 — Closing Report
Files changed
None (investigation + honest measurement; no code change warranted).
Baseline (before)
Issue premise:
npm run coveragereportssrc/terminal/at 0% across the board.Baseline (after)
Honestly measured via
node scripts/coverage.mjs --filter terminal(c8, same invocation the suite uses):src/terminal/overall: 87.21% lines (bridge 100%, chat 87.63%, cli 77.21%, input 93.33%, renderer 90.49%; types.ts 0% — a types-only file with no runtime code).src/terminal/__tests__/bridge.test.ts,chat.test.ts(14 tests),runtime.test.ts— all green undernpm test -- terminal(4 files passed).sanitizeTerminalText,wrapPlainText,decisionSuggestions(renderer.ts),readComposedInput+TerminalInputqueue/overflow bounds (input.ts),createChatTurnRunnerarchive/turn wiring (bridge.ts),parseChatArgs/parseSlashCommand(chat.ts), plus renderer event/budget/status-cap bounds (happy: message round-trip; sad: empty input, truncated stream, missing session file; bad: malformed escape sequences, 50k+ oversized input, queue overflow — all asserted, no mocks of stdin/stdout wholesale).npx tsc --noEmitclean. Fullnpm test:run-tests: all 341 file(s) passed.Boot check
npm test -- terminalgreen; filtered coverage run green; full suite green (above). No coverage-threshold change made (ratcheting explicitly out of scope per the issue).Residual risk / notes
The 0% premise was stale — terminal coverage landed before this issue was worked (prior commits added chat/bridge/runtime tests). Closing as resolved-by-prior-work with evidence rather than adding redundant tests to chase a number that is already 87%. TTY-bound paths (real PTY Ctrl-C) remain environment-gated by design (
script/sandbox probe skips). If the intent was a higher bar (e.g. ratchet the floor), that is a follow-up issue.PR: #204
Merge pull request #204 from Capsize-Games/issues/w12-2026-12-05