fix(testmode): skip the fd-inheritance probe when its helper is absent

The probe spawns a hand-built /tmp/checkfd binary that exists only on
machines where the T-438-era investigation ran; everywhere else it
failed the whole harness with a ProcessException. Absence is now an
explicit skip line, and the helper path is a named constant in both
the io and web-stub variants.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-13 18:48:48 +02:00
co-authored by Claude Fable 5
parent d9d06cf98e
commit 7b395c5a0a
3 changed files with 15 additions and 2 deletions
+5 -1
View File
@@ -12,6 +12,10 @@ import 'package:ffi/ffi.dart' as pkg_ffi;
import 'src/pty/ffi/libc.dart' as libc; import 'src/pty/ffi/libc.dart' as libc;
/// The hand-built helper binary the probe spawns. Not part of the repo — the
/// harness skips this probe when it is absent.
const fdCheckHelperPath = '/tmp/checkfd';
/// Probe whether `Process.start` inherits socket fds (the macOS question the /// Probe whether `Process.start` inherits socket fds (the macOS question the
/// testmode harness answers). Returns a human-readable result line. /// testmode harness answers). Returns a human-readable result line.
Future<String> fdInheritanceCheck() async { Future<String> fdInheritanceCheck() async {
@@ -20,7 +24,7 @@ Future<String> fdInheritanceCheck() async {
final parent = sv[0]; final parent = sv[0];
final child = sv[1]; final child = sv[1];
pkg_ffi.calloc.free(sv); pkg_ffi.calloc.free(sv);
final proc = await Process.start('/tmp/checkfd', [], environment: {...Platform.environment, 'PTYC_SOCK_FD': '$child'}); final proc = await Process.start(fdCheckHelperPath, [], environment: {...Platform.environment, 'PTYC_SOCK_FD': '$child'});
final stderr = await proc.stderr.transform(utf8.decoder).join(); final stderr = await proc.stderr.transform(utf8.decoder).join();
final exit = await proc.exitCode; final exit = await proc.exitCode;
libc.close(parent); libc.close(parent);
+3
View File
@@ -1,4 +1,7 @@
/// Web stub (T-438 web fence, D-100): no FFI fd-inheritance probe on web. /// Web stub (T-438 web fence, D-100): no FFI fd-inheritance probe on web.
library; library;
/// Mirrors [fd_check_io.dart]; never exists on web, so the probe is skipped.
const fdCheckHelperPath = '/tmp/checkfd';
Future<String> fdInheritanceCheck() async => 'skipped (no FFI on web)'; Future<String> fdInheritanceCheck() async => 'skipped (no FFI on web)';
+6
View File
@@ -381,7 +381,13 @@ class _ClideTestAppState extends State<ClideTestApp> {
// Test: does Dart's Process.start inherit socket fds on macOS? (T-438: the // Test: does Dart's Process.start inherit socket fds on macOS? (T-438: the
// FFI body lives in fd_check_io.dart so the web build can stub it out.) // FFI body lives in fd_check_io.dart so the web build can stub it out.)
// The probe needs the hand-built /tmp/checkfd helper; on machines without
// it, skip explicitly rather than failing the whole harness.
if (File(fdCheckHelperPath).existsSync()) {
await _testAsync('fd inheritance check', fdInheritanceCheck); await _testAsync('fd inheritance check', fdInheritanceCheck);
} else {
_say('skip | fd inheritance check | $fdCheckHelperPath not present (hand-built probe helper — see fd_check_io.dart)');
}
_say(''); _say('');
} }