add ClaudePane + session-host widget-test harness (T-269 coverage)

claude_pane.dart had no widget-test harness, so the T-269 wiring (primary
rebind on workspace switch, host tab-reset) shipped uncovered — and the
moment any test mounts ClaudePane its 230 lines enter the coverage
denominator, which is what sank the gate earlier.

Add a real harness: a fake ClaudeSessionOrchestrator (no real `claude`
process) plus a connected fake IPC answering files.root, with spawn/respawn
driven inside tester.runAsync so the transcript-probe File I/O resolves.
Covers spawn-binds-to-repo, in-place rebind, same-repo no-op, send, /clear
(in place), /fork, /resume (picker open + cancel), mode cycle, draft
round-trip, init-event status, can_use_tool prompt swap, secondary spawn +
dispose-close, tap-to-focus, and the disconnected-daemon error path.
claude_pane.dart 25% -> 84%; session-host tab-reset covered too.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-07 13:45:24 +02:00
co-authored by Claude Opus 4.8
parent 0c434b7b77
commit c28d3d31d3
3 changed files with 380 additions and 0 deletions
@@ -77,6 +77,11 @@ class ClaudeSessionHostState extends State<ClaudeSessionHost> {
super.dispose();
}
/// Ids of the open tabs, oldest-first. Exposed for tests that assert the
/// host resets to a lone primary on an in-place workspace switch (T-269).
@visibleForTesting
List<String> get tabIds => _controller.entries.map((e) => e.id).toList();
/// Public entry point used by the `claude.new-secondary` command.
void addSecondary() {
final index = _nextSecondary++;