fix(test): stabilize MCP startup and subtitle cancellation checks
Gitea CI / Check code and tests (pull_request) Successful in 6m16s
Gitea CI / Audit and package Windows x64 (pull_request) Successful in 1m31s
Gitea CI / Gitea CI passed (pull_request) Successful in 3s
Gitea CI / Build Android APK (pull_request) Successful in 5m13s
Gitea CI / Build Windows x64 app (pull_request) Successful in 19m20s
Gitea CI / Assemble and validate CI artifacts (pull_request) Successful in 1m1s

Launch the standard-library MCP bridge directly with the Flutter SDK native Dart executable, without shell or pub startup. Verify it works without Dart on PATH and include stderr when its existing response deadline expires.

Share native Dart selection with generated-code checks and wait for subtitle workflow completion notifications instead of a fixed 10 ms delay.
This commit is contained in:
lingjhf committed 2026-10-06 23:34:15 +08:00
1 parent 0343e2f723
commit ab8f3f5bd3
4 files changed
+55 -13

No files matched your search

+16 -7
View File
@@ -1,4 +1,5 @@
import 'support/creation_names.dart';
import 'support/dart_executable.dart';
import 'package:cutdex/app/editor_theme.dart';
import 'package:cutdex/l10n/app_localizations.dart';
@@ -1790,12 +1791,14 @@ void main() {
);
addTearDown(bridge.close);
final process = await Process.start(
'dart',
['run', 'tool/mcp_stdio.dart'],
runInShell: Platform.isWindows,
flutterTestDartExecutable(),
['tool/mcp_stdio.dart'],
environment: {
'CUTDEX_MCP_PORT': '${bridge.port}',
'CUTDEX_MCP_TOKEN': token,
// This standard-library launcher must not need a Dart/Flutter wrapper
// on PATH, or compete with parallel generators for startup/pub locks.
'PATH': root.path,
},
);
addTearDown(process.kill);
@@ -1809,13 +1812,19 @@ void main() {
}),
),
);
final response = jsonDecode(
await process.stdout
final String responseLine;
try {
responseLine = await process.stdout
.transform(utf8.decoder)
.transform(const LineSplitter())
.first
.timeout(const Duration(seconds: 15)),
) as Map;
.timeout(const Duration(seconds: 15));
} on TimeoutException {
process.kill();
await process.exitCode.timeout(const Duration(seconds: 5));
fail('MCP launcher did not respond within 15 seconds.\n${await errors}');
}
final response = jsonDecode(responseLine) as Map;
expect((response['result'] as Map)['isError'], false, reason: '$response');
expect(transform().x, closeTo(320 / session.canvas.width, 1e-9));
await process.stdin.close();