Skip to content

The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.

Harness catalog, install panel, identities, start page: full coverage

dee32c237c82b2b
diff --git a/desktop/lib/widgets/dsh_install_panel.dart b/desktop/lib/widgets/dsh_install_panel.dart
index ea7dc966a..5e046b15b 100644
--- a/desktop/lib/widgets/dsh_install_panel.dart
+++ b/desktop/lib/widgets/dsh_install_panel.dart
@@ -39,13 +39,16 @@ class _DshInstallPanelState extends State<DshInstallPanel> {
super.initState();
// The elapsed clock. Not under test: a periodic timer is a pumpAndSettle
// that never settles, and the tests drive the run by hand.
- if (!kUnderTest) {
- _tick = Timer.periodic(const Duration(seconds: 1), (_) {
- if (mounted && widget.run.inProgress) setState(() {});
- });
- }
+ _tick = kUnderTest ? null : _startClock();
}
+ // coverage:ignore-start
+ // Never runs under flutter test (see initState), where coverage is measured.
+ Timer _startClock() => Timer.periodic(const Duration(seconds: 1), (_) {
+ if (mounted && widget.run.inProgress) setState(() {});
+ });
+ // coverage:ignore-end
+
@override
void dispose() {
_tick?.cancel();
@@ -198,11 +201,11 @@ class _DshInstallPanelState extends State<DshInstallPanel> {
}
if (run.phase != phase || !run.inProgress) return null;
if (run.line != null) return run.line;
+ // [phase] is one of the three steps, so the last arm is the check.
return switch (phase) {
'clone' => run.detail ?? 'Fetching…',
'setup' => 'Setting up the toolchain…',
- 'doctor' => 'Checking the machine…',
- _ => null,
+ _ => 'Checking the machine…',
};
}
}
diff --git a/desktop/test/dsh_catalog_test.dart b/desktop/test/dsh_catalog_test.dart
index e64a85927..2954cc7dd 100644
--- a/desktop/test/dsh_catalog_test.dart
+++ b/desktop/test/dsh_catalog_test.dart
@@ -47,6 +47,8 @@ const _circuit = {
void main() {
_authorAndKindTests();
+ _productPageTests();
+ _installRunTests();
test('shared viewer dependencies are optional and validated', () {
expect(
DshEntry.fromJson({..._circuit, 'viewerUse': 'autonomous/cad-viewer'})!
@@ -220,3 +222,206 @@ void _authorAndKindTests() {
expect(DshEntry.fromJson({'id': 'a/b', 'name': 'B'}), isNull);
});
}
+
+void _productPageTests() {
+ test('the product page reads only web links, and trims what it shows', () {
+ final long = 'x' * 400;
+ final entry = DshEntry.fromJson({
+ 'id': 'autonomous/marp',
+ 'engine': 'claude',
+ 'name': ' ${'M' * 50} ',
+ 'description': ' $long ',
+ 'category': ' ${'c' * 30} ',
+ 'author': 'a' * 100,
+ 'license': ' ${'L' * 60} ',
+ 'repo': ' https://github.com/autonomous-ai/autonomous-marp ',
+ 'homepage': 'http://marp.app',
+ 'upstream': 'file:///etc/passwd',
+ 'screenshots': [
+ 'https://example.com/1.png',
+ 'javascript:alert(1)',
+ 'mailto:[email protected]',
+ '//example.com/no-scheme.png',
+ 'https://example.com/${'p' * 2100}.png',
+ 42,
+ for (var i = 2; i <= 10; i++) 'https://example.com/$i.png',
+ ],
+ 'linked': true,
+ 'tier': 12,
+ })!;
+ expect(entry.name, 'M' * 40);
+ expect(entry.description, 'x' * 300);
+ expect(entry.category, 'c' * 24);
+ expect(entry.author, 'a' * 80);
+ expect(entry.license, 'L' * 40);
+ expect(entry.repo, 'https://github.com/autonomous-ai/autonomous-marp');
+ expect(entry.homepage, 'http://marp.app');
+ expect(entry.upstream, isNull, reason: 'never a file: link');
+ expect(entry.screenshots, [
+ 'https://example.com/1.png',
+ for (var i = 2; i <= 8; i++) 'https://example.com/$i.png',
+ ]);
+ expect(entry.linked, isTrue);
+ expect(entry.tier, 0, reason: 'a tier out of range is none');
+
+ final bare = DshEntry.fromJson({
+ 'id': 'autonomous/marp',
+ 'engine': 'claude',
+ 'license': ' ',
+ 'screenshots': 'https://example.com/1.png',
+ 'repo': 7,
+ })!;
+ expect(bare.license, isNull);
+ expect(bare.screenshots, isEmpty);
+ expect(bare.repo, isNull);
+ expect(bare.linked, isFalse);
+ expect(
+ DshEntry.fromJson({'id': 'a/b', 'engine': 'e' * 65}),
+ isNull,
+ reason: 'an engine id past 64 characters is not one',
+ );
+ });
+}
+
+void _installRunTests() {
+ test('every phase reads as a sentence', () {
+ String label(String phase, [String? detail]) =>
+ DshInstallProgress(id: 'a/b', phase: phase, detail: detail).label;
+ expect(label('clone'), 'Fetching…');
+ expect(label('doctor'), 'Checking the machine…');
+ expect(label('done'), 'Installed');
+ expect(label('failed'), 'Install failed');
+ expect(label('failed', ''), 'Install failed');
+ expect(label('failed', 'no space left'), 'no space left');
+ expect(label('queued'), 'Installing…');
+ final done = DshInstallProgress.fromJson({'id': 'a/b', 'phase': 'done'})!;
+ expect(done.done, isTrue);
+ expect(done.inProgress, isFalse);
+ });
+
+ test(
+ 'a push is read defensively: ids, phases, and lines without control characters',
+ () {
+ expect(DshInstallProgress.fromJson(null), isNull);
+ expect(DshInstallProgress.fromJson({'id': '', 'phase': 'setup'}), isNull);
+ expect(DshInstallProgress.fromJson({'id': 'a/b', 'phase': ''}), isNull);
+ expect(DshInstallProgress.fromJson({'id': 1, 'phase': 'setup'}), isNull);
+ final escape = String.fromCharCode(27);
+ final bell = String.fromCharCode(7);
+ final push = DshInstallProgress.fromJson({
+ 'id': 'a/b',
+ 'phase': 'setup',
+ 'detail': ' ',
+ 'line': '$escape[32madded$bell ${'n' * 300}',
+ })!;
+ expect(push.detail, isNull);
+ expect(push.line, hasLength(200));
+ expect(push.line, startsWith('[32madded n'));
+ expect(
+ DshInstallProgress.fromJson({
+ 'id': 'a/b',
+ 'phase': 'setup',
+ 'line': 3,
+ })!.line,
+ isNull,
+ );
+ },
+ );
+
+ test(
+ 'a run keeps its phases in order, a bounded log, and how long each took',
+ () {
+ final t0 = DateTime(2026, 9, 1, 9);
+ final run = DshInstallRun('a/b', startedAt: t0);
+ expect(run.phase, 'clone', reason: 'nothing heard yet is the fetch');
+ expect(run.inProgress, isTrue);
+ expect(run.took('clone'), isNull);
+ run.apply(
+ const DshInstallProgress(id: 'a/b', phase: 'clone', detail: 'Resolving'),
+ now: t0,
+ );
+ run.apply(
+ const DshInstallProgress(id: 'a/b', phase: 'clone', line: 'cloned'),
+ now: t0.add(const Duration(seconds: 2)),
+ );
+ // The same line again is not a new line.
+ run.apply(
+ const DshInstallProgress(id: 'a/b', phase: 'clone', line: 'cloned'),
+ now: t0.add(const Duration(seconds: 3)),
+ );
+ run.apply(
+ const DshInstallProgress(id: 'a/b', phase: 'setup'),
+ now: t0.add(const Duration(seconds: 9)),
+ );
+ expect(run.phases.map((p) => p.phase), ['clone', 'setup']);
+ expect(
+ run.detail,
+ 'Resolving',
+ reason: 'a push without detail keeps the last',
+ );
+ expect(run.log, ['cloned']);
+ expect(run.took('clone'), const Duration(seconds: 9));
+ expect(run.took('setup'), isNull, reason: 'still under way');
+ expect(run.took('doctor'), isNull, reason: 'never began');
+ expect(run.reached('setup'), isTrue);
+ expect(run.reached('doctor'), isFalse);
+
+ for (var i = 0; i < DshInstallRun.maxLog + 5; i++) {
+ run.apply(
+ DshInstallProgress(
+ id: 'a/b',
+ phase: 'doctor',
+ line: i.isEven ? 'ok tool$i' : 'step $i',
+ ),
+ );
+ }
+ expect(run.log, hasLength(DshInstallRun.maxLog));
+ expect(run.log.first, 'step 5');
+ expect(run.checks, everyElement(startsWith('ok ')));
+ expect(run.checks, hasLength(20));
+ },
+ );
+
+ test('a push after a finished run is a new attempt with its own clock', () {
+ final catalog = MachineDsh();
+ final t0 = DateTime(2026, 9, 1, 9);
+ catalog.applyInstall(
+ const DshInstallProgress(id: 'a/b', phase: 'setup'),
+ now: t0,
+ );
+ final first = catalog.runs['a/b']!;
+ expect(
+ first.startedAt,
+ t0,
+ reason: 'another window started it; it is watched all the same',
+ );
+ catalog.applyInstall(
+ const DshInstallProgress(
+ id: 'a/b',
+ phase: 'failed',
+ detail: 'no space left',
+ ),
+ now: t0.add(const Duration(minutes: 1)),
+ );
+ expect(identical(catalog.runs['a/b'], first), isTrue);
+ expect(catalog.installs['a/b']!.failed, isTrue);
+ catalog.applyInstall(
+ const DshInstallProgress(id: 'a/b', phase: 'clone'),
+ now: t0.add(const Duration(minutes: 5)),
+ );
+ expect(identical(catalog.runs['a/b'], first), isFalse);
+ expect(catalog.runs['a/b']!.phase, 'clone');
+ expect(catalog.installs['a/b']!.inProgress, isTrue);
+
+ catalog.error = 'UNSUPPORTED';
+ catalog.replace(const [
+ DshEntry(id: 'a/b', name: 'B', engine: 'claude'),
+ DshEntry(id: 'a/c', name: 'C', engine: 'codex'),
+ ]);
+ expect(catalog.loaded, isTrue);
+ expect(catalog.error, isNull, reason: 'an answer clears the refusal');
+ expect(catalog.entries.map((e) => e.id), ['a/b', 'a/c']);
+ expect(catalog['a/c']!.engine, 'codex');
+ expect(catalog['a/z'], isNull);
+ });
+}
diff --git a/desktop/test/dsh_install_panel_test.dart b/desktop/test/dsh_install_panel_test.dart
new file mode 100644
index 000000000..9e1d7bb74
--- /dev/null
+++ b/desktop/test/dsh_install_panel_test.dart
@@ -0,0 +1,338 @@
+// The install panel the New Harness dialog shows while a harness installs:
+// three steps with the line each is on, the tail of the log, how long each step
+// took, and — when it fails — the machine's own `miss` line as a sentence with
+// the command that fixes it.
+import 'package:flutter/material.dart';
+import 'package:flutter_test/flutter_test.dart';
+import 'package:harness/core/dsh_catalog.dart';
+import 'package:harness/widgets/dsh_install_panel.dart';
+
+final _t0 = DateTime(2026, 9, 1, 9);
+
+/// One push from the machine, [seconds] after the run began.
+(DshInstallProgress, int) _at(
+ String phase,
+ int seconds, {
+ String? line,
+ String? detail,
+}) => (
+ DshInstallProgress(
+ id: 'autonomous/marp',
+ phase: phase,
+ line: line,
+ detail: detail,
+ ),
+ seconds,
+);
+
+DshInstallRun _run(List<(DshInstallProgress, int)> pushes) {
+ final run = DshInstallRun('autonomous/marp', startedAt: _t0);
+ for (final (progress, seconds) in pushes) {
+ run.apply(progress, now: _t0.add(Duration(seconds: seconds)));
+ }
+ return run;
+}
+
+Future<void> _show(WidgetTester tester, DshInstallRun run) => tester.pumpWidget(
+ MaterialApp(
+ home: Scaffold(
+ body: SingleChildScrollView(
+ child: DshInstallPanel(
+ run: run,
+ harnessName: 'Marp',
+ machineName: 'Studio',
+ ),
+ ),
+ ),
+ ),
+);
+
+/// The step row named [name]: its mark and its text.
+Finder _step(String name) => find
+ .ancestor(
+ of: find.text(name),
+ matching: find.byWidgetPredicate(
+ (w) => w is Row && w.crossAxisAlignment == CrossAxisAlignment.start,
+ ),
+ )
+ .first;
+
+enum _Mark { pending, active, done, failed }
+
+_Mark _markOf(WidgetTester tester, String name) {
+ final row = _step(name);
+ if (find
+ .descendant(of: row, matching: find.byType(CircularProgressIndicator))
+ .evaluate()
+ .isNotEmpty) {
+ return _Mark.active;
+ }
+ final icons = tester
+ .widgetList<Icon>(find.descendant(of: row, matching: find.byType(Icon)))
+ .map((i) => i.icon)
+ .toList();
+ if (icons.contains(Icons.check)) return _Mark.done;
+ if (icons.contains(Icons.priority_high)) return _Mark.failed;
+ return _Mark.pending;
+}
+
+void main() {
+ testWidgets('a run nobody has heard from yet is fetching', (tester) async {
+ await _show(tester, DshInstallRun('autonomous/marp'));
+ expect(find.text('Installing Marp on Studio'), findsOneWidget);
+ expect(find.text('0:00'), findsOneWidget);
+ expect(_markOf(tester, 'Fetch Marp'), _Mark.active);
+ expect(find.text('Fetching…'), findsOneWidget);
+ expect(_markOf(tester, 'Set up the toolchain'), _Mark.pending);
+ expect(_markOf(tester, 'Check this machine'), _Mark.pending);
+ expect(
+ find.text(
+ 'The first install takes a few minutes. You can keep using Harness.',
+ ),
+ findsOneWidget,
+ );
+ expect(find.byKey(const Key('dsh-install-failure')), findsNothing);
+ });
+
+ testWidgets('the fetch step says what the machine is doing', (tester) async {
+ await _show(
+ tester,
+ _run([_at('clone', 0, detail: 'Resolving the package')]),
+ );
+ expect(find.text('Resolving the package'), findsOneWidget);
+ });
+
+ testWidgets(
+ 'set up is active with its current line, fetch is done with its time, and the log tail is the last six',
+ (tester) async {
+ final run = _run([_at('clone', 0), _at('setup', 12, line: 'npm ci')]);
+ for (var i = 1; i <= 8; i++) {
+ run.apply(
+ DshInstallProgress(
+ id: 'autonomous/marp',
+ phase: 'setup',
+ line: 'added $i packages',
+ ),
+ now: _t0.add(Duration(seconds: 12 + i)),
+ );
+ }
+ await _show(tester, run);
+ expect(_markOf(tester, 'Fetch Marp'), _Mark.done);
+ expect(
+ find.descendant(of: _step('Fetch Marp'), matching: find.text('12s')),
+ findsOneWidget,
+ );
+ expect(_markOf(tester, 'Set up the toolchain'), _Mark.active);
+ // The current line, under the step and at the foot of the log.
+ expect(find.text('added 8 packages'), findsNWidgets(2));
+ for (var i = 3; i <= 7; i++) {
+ expect(find.text('added $i packages'), findsOneWidget);
+ }
+ expect(find.text('added 2 packages'), findsNothing);
+ expect(find.text('npm ci'), findsNothing, reason: 'older than the tail');
+ expect(_markOf(tester, 'Check this machine'), _Mark.pending);
+ },
+ );
+
+ testWidgets(
+ 'a quiet set up and a quiet check still say what they are doing',
+ (tester) async {
+ await _show(tester, _run([_at('clone', 0), _at('setup', 70)]));
+ expect(find.text('Setting up the toolchain…'), findsOneWidget);
+ expect(
+ find.descendant(of: _step('Fetch Marp'), matching: find.text('1:10')),
+ findsOneWidget,
+ reason: 'a minute or more reads as a clock',
+ );
+
+ await _show(
+ tester,
+ _run([_at('clone', 0), _at('setup', 5), _at('doctor', 9)]),
+ );
+ expect(_markOf(tester, 'Check this machine'), _Mark.active);
+ expect(find.text('Checking the machine…'), findsOneWidget);
+ },
+ );
+
+ testWidgets(
+ 'the check lists its verdicts as they arrive, and trails off until one misses',
+ (tester) async {
+ final passing = _run([
+ _at('clone', 0),
+ _at('setup', 5),
+ _at('doctor', 9, line: 'ok tmux (3.4)'),
+ _at('doctor', 10, line: 'warn node (18; 22 is better)'),
+ ]);
+ await _show(tester, passing);
+ expect(find.text('tmux ✓ · node ! …'), findsOneWidget);
+
+ passing.apply(
+ const DshInstallProgress(
+ id: 'autonomous/marp',
+ phase: 'doctor',
+ line: 'miss marp-cli',
+ ),
+ now: _t0.add(const Duration(seconds: 11)),
+ );
+ await _show(tester, passing);
+ expect(find.text('tmux ✓ · node ! · marp-cli ✗'), findsOneWidget);
+ },
+ );
+
+ testWidgets(
+ 'a finished install marks every step it went through, and stops the clock',
+ (tester) async {
+ await _show(
+ tester,
+ _run([
+ _at('clone', 0),
+ _at('setup', 20),
+ _at('doctor', 100),
+ _at('done', 125),
+ ]),
+ );
+ expect(find.text('Marp installed on Studio'), findsOneWidget);
+ expect(find.text('2:05'), findsOneWidget);
+ expect(_markOf(tester, 'Fetch Marp'), _Mark.done);
+ expect(_markOf(tester, 'Set up the toolchain'), _Mark.done);
+ expect(_markOf(tester, 'Check this machine'), _Mark.done);
+ expect(find.text('Starting the agent…'), findsOneWidget);
+
+ // Already installed toolchain: straight from fetch to done.
+ await _show(
+ tester,
+ _run([_at('clone', 0, line: 'cloned'), _at('done', 3)]),
+ );
+ expect(_markOf(tester, 'Fetch Marp'), _Mark.done);
+ expect(_markOf(tester, 'Set up the toolchain'), _Mark.pending);
+ expect(_markOf(tester, 'Check this machine'), _Mark.pending);
+ expect(
+ find.text('cloned'),
+ findsNothing,
+ reason: 'no log once it is done',
+ );
+ },
+ );
+
+ testWidgets('a failed check names the step, the score and the fix', (
+ tester,
+ ) async {
+ await _show(
+ tester,
+ _run([
+ _at('clone', 0),
+ _at('setup', 4),
+ _at('doctor', 8, line: 'ok tmux'),
+ _at('doctor', 9, line: 'miss codex (npm install -g @openai/codex)'),
+ _at('failed', 12, detail: 'doctor failed'),
+ ]),
+ );
+ expect(_markOf(tester, 'Fetch Marp'), _Mark.done);
+ expect(_markOf(tester, 'Set up the toolchain'), _Mark.done);
+ expect(_markOf(tester, 'Check this machine'), _Mark.failed);
+ expect(find.text('1 of 2 checks passed'), findsOneWidget);
+ final failure = find.byKey(const Key('dsh-install-failure'));
+ expect(
+ find.descendant(
+ of: failure,
+ matching: find.text('Codex is not installed on this machine.'),
+ ),
+ findsOneWidget,
+ );
+ expect(
+ find.descendant(
+ of: failure,
+ matching: find.text('Marp runs on Codex. Install it, then retry.'),
+ ),
+ findsOneWidget,
+ );
+ expect(
+ find.descendant(
+ of: failure,
+ matching: find.text('npm install -g @openai/codex'),
+ ),
+ findsOneWidget,
+ );
+ expect(
+ find.text(
+ 'The download and the toolchain are kept; Retry runs the check again.',
+ ),
+ findsOneWidget,
+ );
+ expect(find.text('0:12'), findsOneWidget);
+ });
+
+ testWidgets('a failure the machine reported at once has only its words', (
+ tester,
+ ) async {
+ await _show(
+ tester,
+ _run([_at('failed', 2, detail: 'kicad-cli not found')]),
+ );
+ final failure = find.byKey(const Key('dsh-install-failure'));
+ expect(
+ find.descendant(of: failure, matching: find.text('kicad-cli not found')),
+ findsOneWidget,
+ );
+ expect(
+ find.descendant(of: failure, matching: find.byType(SelectableText)),
+ findsNothing,
+ reason: 'no command to offer for a failure it does not know',
+ );
+ for (final step in [
+ 'Fetch Marp',
+ 'Set up the toolchain',
+ 'Check this machine',
+ ]) {
+ expect(_markOf(tester, step), _Mark.pending, reason: step);
+ }
+ });
+
+ group('describeInstallFailure', () {
+ InstallFailure describe({List<String> lines = const [], String? detail}) {
+ final run = DshInstallRun('a/b', startedAt: _t0);
+ for (final line in lines) {
+ run.apply(DshInstallProgress(id: 'a/b', phase: 'doctor', line: line));
+ }
+ run.apply(DshInstallProgress(id: 'a/b', phase: 'failed', detail: detail));
+ return describeInstallFailure(run, 'Typst');
+ }
+
+ test('the known misses become a sentence and a command', () {
+ final claude = describe(detail: 'ok tmux · miss claude not on PATH');
+ expect(claude.title, 'Claude Code is not installed on this machine.');
+ expect(claude.body, 'Typst runs on Claude Code. Install it, then retry.');
+ expect(claude.command, 'npm install -g @anthropic-ai/claude-code');
+
+ final uv = describe(lines: ['miss uv (https://docs.astral.sh/uv)']);
+ expect(uv.title, 'uv is not installed on this machine.');
+ expect(uv.command, 'curl -LsSf https://astral.sh/uv/install.sh | sh');
+
+ final node = describe(lines: ['ok git', 'miss node 18.2 < 22']);
+ expect(node.title, 'Node.js is missing or too old.');
+ expect(node.body, 'node 18.2 < 22');
+ expect(node.command, 'brew install node@22');
+ });
+
+ test('a slow check and a failed download are said plainly', () {
+ final slow = describe(detail: 'doctor still running after 300s');
+ expect(slow.title, 'The check is taking longer than five minutes.');
+ expect(slow.command, isNull);
+
+ final clone = describe(detail: 'git clone exited 128');
+ expect(clone.title, 'Could not download Typst.');
+ expect(clone.body, 'git clone exited 128');
+
+ final fetch = describe(detail: 'fetch: clone timed out');
+ expect(fetch.title, 'Could not download Typst.');
+ });
+
+ test('anything else is shown as the machine wrote it', () {
+ final unknown = describe(detail: 'disk full');
+ expect(unknown.title, 'disk full');
+ expect(unknown.body, isNull);
+ expect(unknown.command, isNull);
+ expect(describe().title, 'Install failed');
+ });
+ });
+}
diff --git a/desktop/test/engine_identity_test.dart b/desktop/test/engine_identity_test.dart
new file mode 100644
index 000000000..03f84f0f7
--- /dev/null
+++ b/desktop/test/engine_identity_test.dart
@@ -0,0 +1,131 @@
+// What an engine or a harness is drawn as: the harnesses this build ships a
+// face for, the engine each first-party harness runs on, the fallback for an
+// id nobody here has heard of, and the mark when its picture will not load.
+import 'package:flutter/material.dart';
+import 'package:flutter/services.dart';
+import 'package:flutter_test/flutter_test.dart';
+import 'package:harness/core/models.dart';
+import 'package:harness/widgets/engine_identity.dart';
+
+/// A bundle with no pictures in it: every load fails, as a missing or corrupt
+/// asset would.
+class _NoPictures extends CachingAssetBundle {
+ final asked = <String>[];
+
+ @override
+ Future<ByteData> load(String key) async {
+ asked.add(key);
+ throw FlutterError('no asset $key');
+ }
+}
+
+void main() {
+ test(
+ 'every first-party harness has a face and a base engine this build knows',
+ () {
+ final engines = {for (final engine in allEngines) engine.id};
+ final harnesses = {for (final harness in knownHarnesses) harness.id};
+ expect(harnesses, isNotEmpty);
+ for (final harness in knownHarnesses) {
+ expect(isHarnessId(harness.id), isTrue, reason: harness.id);
+ expect(
+ engines,
+ isNot(contains(harness.id)),
+ reason: 'a harness is never probed as an engine',
+ );
+ expect(
+ harness.asset,
+ startsWith('assets/engine-icons/'),
+ reason: harness.id,
+ );
+ expect(harness.creator, isNotEmpty, reason: harness.id);
+ expect(harness.category, isNotEmpty, reason: harness.id);
+ expect(
+ knownHarnessBase[harness.id],
+ isNotNull,
+ reason: '${harness.id} runs on something',
+ );
+ expect(identical(engineIdentity(harness.id), harness), isTrue);
+ }
+ expect(knownHarnessBase.keys.toSet(), harnesses);
+ for (final base in knownHarnessBase.values) {
+ expect(engines, contains(base));
+ }
+ expect(knownHarnessBase['autonomous/autonomous-workshop'], 'codex');
+ expect(knownHarnessBase['autonomous/marp'], 'claude');
+ expect(
+ engineIdentity('autonomous/text-to-cad').detail,
+ 'CAD · Jake Fitzgerald',
+ );
+ expect(
+ engineIdentity(' Codex ').label,
+ 'Codex',
+ reason: 'ids are trimmed and case-folded',
+ );
+ },
+ );
+
+ test('an id nobody here knows still gets a name, never its owner', () {
+ expect(isHarnessId(null), isFalse);
+ expect(isHarnessId('claude'), isFalse);
+ final arm = engineIdentity('someone/robot-arm');
+ expect(arm.id, 'someone/robot-arm');
+ expect(arm.label, 'Robot-arm');
+ expect(arm.asset, isNull);
+ expect(arm.detail, isNull);
+ expect(
+ engineIdentity('someone/robot-arm', displayName: ' Arm ').label,
+ 'Arm',
+ );
+ expect(engineIdentity('someone/').label, 'Agent');
+ expect(engineIdentity('aider').label, 'Aider');
+ final nothing = engineIdentity(null, displayName: ' ');
+ expect(nothing.id, 'unknown');
+ expect(nothing.label, 'Agent');
+ });
+
+ test('an agent is drawn as its harness when it came from one', () {
+ const plain = Agent(id: 'a', name: 'A', engine: 'codex');
+ expect(agentIdentity(plain).label, 'Codex');
+ const circuit = Agent(
+ id: 'c',
+ name: 'C',
+ engine: 'claude',
+ dsh: 'autonomous/autonomous-circuit',
+ dshName: 'Autonomous Circuit',
+ );
+ expect(agentIdentity(circuit).id, 'autonomous/autonomous-circuit');
+ final mark = EngineMark.forAgent(circuit, size: 20, enabled: false);
+ expect(mark.engine, 'autonomous/autonomous-circuit');
+ expect(mark.displayName, 'Autonomous Circuit');
+ });
+
+ testWidgets('a mark whose picture will not load draws its initial instead', (
+ tester,
+ ) async {
+ final bundle = _NoPictures();
+ await tester.pumpWidget(
+ MaterialApp(
+ home: DefaultAssetBundle(
+ bundle: bundle,
+ child: const Center(
+ child: EngineMark(engine: 'autonomous/marp', size: 24),
+ ),
+ ),
+ ),
+ );
+ await tester.runAsync(
+ () => Future<void>.delayed(const Duration(milliseconds: 20)),
+ );
+ await tester.pump();
+ expect(bundle.asked, isNotEmpty, reason: 'the picture was asked for');
+ final fallback = find.byKey(
+ const ValueKey('engine-fallback-autonomous/marp'),
+ );
+ expect(fallback, findsOneWidget);
+ expect(
+ find.descendant(of: fallback, matching: find.text('M')),
+ findsOneWidget,
+ );
+ });
+}
diff --git a/desktop/test/harness_start_page_test.dart b/desktop/test/harness_start_page_test.dart
index 522f79db5..f51d03627 100644
--- a/desktop/test/harness_start_page_test.dart
+++ b/desktop/test/harness_start_page_test.dart
@@ -1,6 +1,8 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';
+import 'package:harness/shared/theme/appearance_prefs_store.dart';
+import 'package:harness/shared/theme/harness_background.dart';
import 'package:harness/state/swarm_navigation.dart';
import 'package:harness/state/swarm_search.dart';
import 'package:harness/widgets/harness_start_page.dart';
@@ -156,4 +158,94 @@ void main() {
await tester.pump();
expect(opened, 1);
});
+
+ testWidgets('the device card opens the device page outside the app', (
+ tester,
+ ) async {
+ final launched = <String>[];
+ const channel = MethodChannel('plugins.flutter.io/url_launcher');
+ tester.binding.defaultBinaryMessenger.setMockMethodCallHandler(channel, (
+ call,
+ ) async {
+ if (call.method == 'launch') {
+ launched.add((call.arguments as Map)['url'] as String);
+ }
+ return true;
+ });
+ addTearDown(
+ () => tester.binding.defaultBinaryMessenger.setMockMethodCallHandler(
+ channel,
+ null,
+ ),
+ );
+ final app = createApp();
+ addTearDown(app.dispose);
+ final focus = FocusNode();
+ addTearDown(focus.dispose);
+ await tester.pumpWidget(
+ MaterialApp(
+ home: Scaffold(
+ body: HarnessStartPage(
+ focusNode: focus,
+ createSearch: () => SwarmSearchController(app, [], adding: true),
+ onNew: () {},
+ onChoose: (_) {},
+ ),
+ ),
+ ),
+ );
+ await tester.pump();
+ await tester.tap(find.byKey(const ValueKey('harness-device-link')));
+ await tester.pump();
+ expect(launched, ['https://www.autonomous.ai/harness-device']);
+ });
+
+ testWidgets(
+ 'over a picture, Customize is a round button that opens the pane and closes it again',
+ (tester) async {
+ tester.view.devicePixelRatio = 1;
+ tester.view.physicalSize = const Size(1280, 800);
+ addTearDown(tester.view.reset);
+ final previous = appearancePrefsStore.value;
+ addTearDown(() => appearancePrefsStore.value = previous);
+ appearancePrefsStore.value = const AppearancePrefs(
+ background: HarnessBackground.lake,
+ );
+ final app = createApp();
+ addTearDown(app.dispose);
+ final focus = FocusNode();
+ addTearDown(focus.dispose);
+ await tester.pumpWidget(
+ MaterialApp(
+ home: Scaffold(
+ body: HarnessStartPage(
+ focusNode: focus,
+ createSearch: () => SwarmSearchController(app, [], adding: true),
+ onNew: () {},
+ onChoose: (_) {},
+ ),
+ ),
+ ),
+ );
+ await tester.pump();
+ final button = find.byKey(const ValueKey('harness-customize-button'));
+ expect(tester.widget(button), isA<IconButton>());
+ expect(find.byTooltip('Customize Harness'), findsOneWidget);
+ expect(find.text('Customize Harness'), findsNothing, reason: 'no label over the picture');
+ await tester.tap(button);
+ await tester.pumpAndSettle();
+ final pane = find.byKey(const ValueKey('harness-customize-pane'));
+ expect(pane, findsOneWidget);
+ expect(tester.getRect(pane).right, 1280, reason: 'beside the page at this width');
+ await tester.tap(button);
+ await tester.pumpAndSettle();
+ expect(pane, findsNothing);
+ expect(
+ tester.widget<IconButton>(button).focusNode!.hasFocus,
+ isTrue,
+ reason: 'focus returns to the button that opened it',
+ );
+ await tester.pumpWidget(const SizedBox());
+ },
+ );
}
diff --git a/desktop/test/verdict_marks_test.dart b/desktop/test/verdict_marks_test.dart
index 334149d73..03ec2f68a 100644
--- a/desktop/test/verdict_marks_test.dart
+++ b/desktop/test/verdict_marks_test.dart
@@ -110,6 +110,17 @@ void main() {
'Build',
AppColors.success,
),
+ (
+ const AgentVerdict(
+ ready: false,
+ phases: [
+ build,
+ AgentPhase(id: 'fab', name: 'Fab', state: AgentPhaseState.failed),
+ ],
+ ),
+ 'Fab',
+ AppColors.danger,
+ ),
(const AgentVerdict(ready: false), 'Checked', AppColors.mutedStrong),
];
final status = find.byKey(const ValueKey('pane-status'));