Files
clide/test/daemon/pql_commands_errors_test.dart
T
jpmschweitzerandClaude Opus 4.8 6d0ebab721 chore: adopt Dart 3.9 toolchain — honest floor + tall-style reformat (T-353)
Raise the declared minimums in pubspec.yaml to what our deps already
require: Flutter >=3.35.0 / Dart >=3.9.0 (was 3.19.0 / 3.5.0). alchemist
0.12 needs Flutter 3.32; Dart 3.9 first ships in Flutter 3.35, so 3.35 is
the binding floor. Pin the exact build toolchain in .fvmrc (Flutter
3.44.1).

Moving to the Dart 3.9 language level switches `dart format` to the new
"tall" style and enables two new lints. This commit is the resulting
mechanical churn, isolated from any behaviour change:
  - whole-tree `dart format` reformat (tall style)
  - `dart fix` for unnecessary_underscores + use_null_aware_elements

No runtime behaviour change; `make test` green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-11 12:11:53 +02:00

66 lines
2.3 KiB
Dart

/// Drives every pql.* daemon handler with a PqlClient whose toolchain
/// points at a non-existent binary. Each underlying call throws
/// PqlException, exercising the catch branches in
/// `lib/src/daemon/pql_commands.dart` that the happy-path suite can't
/// reach.
library;
import 'dart:io';
import 'package:clide/clide.dart';
import 'package:clide/kernel/src/toolchain_paths.dart';
import 'package:clide/src/daemon/pql_commands.dart';
import 'package:test/test.dart';
void main() {
late DaemonDispatcher dispatcher;
setUp(() {
final toolchain = ToolchainView.resolved(const ResolvedPaths(pql: '/tmp/clide-no-such-pql-binary'));
final pql = PqlClient(workDir: Directory.current, toolchain: toolchain);
dispatcher = DaemonDispatcher();
registerPqlCommands(dispatcher, pql);
});
Future<IpcResponse> call(String cmd, [Map<String, Object?> args = const {}]) {
return dispatcher.dispatch(IpcRequest(id: '1', cmd: cmd, args: args));
}
// Each pql.* command, when the underlying binary is missing, should
// surface a toolError with the pql operation name in the message.
final commandsWithSimpleArgs = [
('pql.files', const <String, Object?>{}),
('pql.meta', const {'path': 'CLAUDE.md'}),
('pql.backlinks', const {'path': 'CLAUDE.md'}),
('pql.outlinks', const {'path': 'CLAUDE.md'}),
('pql.tags', const <String, Object?>{}),
('pql.schema', const <String, Object?>{}),
('pql.query', const {'query': 'SELECT name'}),
('pql.search', const {'terms': 'clide'}),
('pql.doctor', const <String, Object?>{}),
('pql.decisions.sync', const <String, Object?>{}),
('pql.decisions.list', const <String, Object?>{}),
('pql.decisions.read', const {'id': 'D-1'}),
('pql.decisions.show', const {'id': 'D-1'}),
('pql.tickets.list', const <String, Object?>{}),
('pql.tickets.show', const {'id': 'T-1'}),
(
'pql.tickets.status',
const {
'ids': ['T-1'],
'status': 'done',
},
),
('pql.tickets.board', const <String, Object?>{}),
('pql.plan.status', const <String, Object?>{}),
];
for (final (cmd, args) in commandsWithSimpleArgs) {
test('$cmd surfaces PqlException as a toolError', () async {
final r = await call(cmd, args);
expect(r.ok, isFalse, reason: cmd);
expect(r.error?.kind, IpcErrorKind.toolError, reason: cmd);
});
}
}