From 7b395c5a0aaaa94a5fcf471df7219e4076f12284 Mon Sep 17 00:00:00 2001 From: Jeroen Schweitzer Date: Mon, 13 Jul 2026 18:48:48 +0200 Subject: [PATCH] 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 --- lib/fd_check_io.dart | 6 +++++- lib/fd_check_stub.dart | 3 +++ lib/test_app.dart | 8 +++++++- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/lib/fd_check_io.dart b/lib/fd_check_io.dart index d155944c..4495e116 100644 --- a/lib/fd_check_io.dart +++ b/lib/fd_check_io.dart @@ -12,6 +12,10 @@ import 'package:ffi/ffi.dart' as pkg_ffi; 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 /// testmode harness answers). Returns a human-readable result line. Future fdInheritanceCheck() async { @@ -20,7 +24,7 @@ Future fdInheritanceCheck() async { final parent = sv[0]; final child = sv[1]; 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 exit = await proc.exitCode; libc.close(parent); diff --git a/lib/fd_check_stub.dart b/lib/fd_check_stub.dart index 367a0cac..b9158ba5 100644 --- a/lib/fd_check_stub.dart +++ b/lib/fd_check_stub.dart @@ -1,4 +1,7 @@ /// Web stub (T-438 web fence, D-100): no FFI fd-inheritance probe on web. library; +/// Mirrors [fd_check_io.dart]; never exists on web, so the probe is skipped. +const fdCheckHelperPath = '/tmp/checkfd'; + Future fdInheritanceCheck() async => 'skipped (no FFI on web)'; diff --git a/lib/test_app.dart b/lib/test_app.dart index 48fa612f..0e2ee000 100644 --- a/lib/test_app.dart +++ b/lib/test_app.dart @@ -381,7 +381,13 @@ class _ClideTestAppState extends State { // 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.) - await _testAsync('fd inheritance check', fdInheritanceCheck); + // 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); + } else { + _say('skip | fd inheritance check | $fdCheckHelperPath not present (hand-built probe helper — see fd_check_io.dart)'); + } _say(''); }