Files
clide/app/test/builtin/claude/session_naming_test.dart
T
jpmschweitzerandClaude b9fbcd43a2
test / unit + widget + golden + a11y (push) Failing after 45s
test / integration_test (xvfb) (push) Has been skipped
test / bundle smoke (xvfb 5s) (push) Has been skipped
test / daemon subprocess + web WASM smoke (push) Has been skipped
implement builtin.claude per D-041
Tier-0 stub flipped to the real Claude pane. Primary-per-repo
semantics: session name is `clide-claude-<hash>` where <hash> is
FNV-1a over the workspace root path, so reopening clide attaches
to the same `claude` process through `tmux new-session -A`.

Primary has no close button — closing the tab disposes the widget
but deliberately does NOT call pane.close, so the tmux session
survives until the user actually exits claude or clide is shut
down. Secondary sessions (spawned via the claude.new-secondary
command registered here, UI wiring lands next) close normally and
the pane.close cascades into tmux kill-session.

Graceful fallback when tmux isn't on PATH: retries the spawn with
argv=['claude'], surfaces "no-tmux · fresh every launch" in the
header subtitle so the user knows persistence is off.

Session-naming unit tests cover determinism + uniqueness per repo.
Full app suite: 174 tests passing.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-04-22 09:40:30 +02:00

28 lines
910 B
Dart

import 'package:clide_app/builtin/claude/src/session_naming.dart';
import 'package:flutter_test/flutter_test.dart';
void main() {
group('claude session naming', () {
test('primary name is deterministic per repo path', () {
final a = primarySessionName('/home/me/clide');
final b = primarySessionName('/home/me/clide');
expect(a, b);
expect(a, startsWith('clide-claude-'));
});
test('different repos yield different primaries', () {
final a = primarySessionName('/home/me/clide');
final b = primarySessionName('/home/me/other');
expect(a, isNot(b));
});
test('secondary names carry the N suffix', () {
final p = primarySessionName('/home/me/clide');
final s1 = secondarySessionName('/home/me/clide', 1);
final s2 = secondarySessionName('/home/me/clide', 2);
expect(s1, '$p-1');
expect(s2, '$p-2');
});
});
}