Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions lib/core/extensions/harness/extension_harness.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import 'package:querya_desktop/core/extensions/harness/extension_protocol_profil
import 'package:querya_desktop/core/extensions/rpc/json_rpc_stdio_client.dart';
import 'package:querya_desktop/core/extensions/sandbox/sandbox_launch_command.dart';
import 'package:querya_desktop/core/extensions/sandbox/sandbox_scratch_directory.dart';
import 'package:querya_desktop/core/util/log_ignored.dart';

/// How to start the plugin process.
final class HarnessLaunchRequest {
Expand Down Expand Up @@ -135,7 +134,7 @@ final class _OsPluginProcess implements HarnessPluginProcess {
try {
await _process.exitCode.timeout(const Duration(seconds: 2));
} catch (e) {
logIgnored('extension_harness', e);
_ignored('extension_harness', e);
}
}

Expand Down Expand Up @@ -541,7 +540,15 @@ Future<int?> _rssKb(int pid) async {
return r.exitCode == 0 ? int.tryParse('${r.stdout}'.trim()) : null;
}
} catch (e) {
logIgnored('extension_harness', e);
_ignored('extension_harness', e);
}
return null;
}

/// A failure the harness goes on from (killing a process that already exited,
/// reading `ps`). This file is compiled into the standalone `querya-ext-tester`
/// from `lib/core/extensions` alone, so it cannot use `logIgnored` (Flutter and
/// the app's log): the line goes to stderr.
void _ignored(String where, Object error) {
stderr.writeln('[$where] ignored: $error');
}
37 changes: 37 additions & 0 deletions test/core/extensions/harness/ext_tester_pure_dart_test.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import 'dart:io';

import 'package:flutter_test/flutter_test.dart';

/// `querya-ext-tester` is built by `scripts/ci/build_ext_tester.sh` from
/// `lib/core/extensions` and `package:path` alone, in a throwaway package. An
/// import of Flutter or of anything outside that folder breaks the release
/// build, and no other job builds the tester: beta.2 stopped on `logIgnored`.
void main() {
test('the tester imports only dart:, package:path and core/extensions', () {
final importRe = RegExp(r'''^import\s+'([^']+)';''', multiLine: true);
final seen = <String>{};
final queue = <String>['bin/querya_ext_tester.dart'];
final bad = <String>[];

while (queue.isNotEmpty) {
final file = queue.removeLast();
if (!seen.add(file)) continue;
final text = File(file).readAsStringSync();
for (final m in importRe.allMatches(text)) {
final uri = m.group(1)!;
if (uri.startsWith('dart:') || uri.startsWith('package:path/')) {
continue;
}
const own = 'package:querya_desktop/';
if (uri.startsWith('${own}core/extensions/')) {
queue.add('lib/${uri.substring(own.length)}');
} else {
bad.add('$file imports $uri');
}
}
}

expect(bad, isEmpty, reason: bad.join('\n'));
expect(seen.length, greaterThan(3));
});
}
Loading