ci: exclude Windows-only ConPTY FFI from the Linux coverage denominator

windows_pty.dart's Win32 structs, kernel32 bindings, and the WindowsPty
session (CreatePseudoConsole / CreateProcessW / WaitForSingleObject) cannot
execute on the ubuntu-latest runner that produces the coverage report —
there is no kernel32 to bind. They were being counted as 214 uncovered
lines (the file sat at 13.7%), dragging total line coverage to 94.17% and
failing the 95% gate for code the gate's platform structurally cannot reach.

Wrap exactly that FFI span in `// coverage:ignore-start/end` (flutter test
--coverage honours the markers, verified). The pure, platform-agnostic spawn
helpers — resolveExecutable / quoteArg / composeEnvironmentBlock — sit after
the ignore-end and stay measured (covered by windows_pty_args_test.dart on
every platform). FFI-path behaviour is validated on the Windows runner
(windows.yml) and end-to-end in the Windows VM soak (tools/windows-verify/).

Gate back to green: 95.16% (floor 95%). Floor unchanged — the exclusion
restores the denominator to Linux-runnable code rather than lowering the bar.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-15 00:28:25 +02:00
co-authored by Claude Opus 4.8
parent 425a87ae9f
commit 1114db1c06
+17
View File
@@ -48,6 +48,21 @@ import 'errors.dart';
import 'pty_session.dart';
import 'pty_size.dart';
// coverage:ignore-start
//
// Everything from here to the `resolveExecutable` helper below is the
// Windows-only ConPTY FFI path: Win32 structs, kernel32 bindings, and the
// `WindowsPty` session that calls CreatePseudoConsole / CreateProcessW /
// WaitForSingleObject. None of it can execute on the Linux CI runner that
// produces the coverage report — there is no kernel32 to bind, so these
// lines are structurally uncoverable off-Windows and would otherwise drag
// the line-coverage gate down for code the gate's platform can't reach. The
// pure, platform-agnostic spawn helpers (resolveExecutable / quoteArg /
// composeEnvironmentBlock) sit AFTER the ignore-end below and ARE covered by
// test/pty/windows_pty_test.dart on every platform. Behaviour of the FFI
// path is validated on the Windows runner (windows.yml) and, end-to-end, in
// the Windows VM soak (tools/windows-verify/).
// -- structs ----------------------------------------------------------------
/// Win32 `COORD` — passed BY VALUE to Create/ResizePseudoConsole.
@@ -583,6 +598,8 @@ class WindowsPty implements PtySession {
if (!_out.isClosed) await _out.close();
}
// coverage:ignore-end
// -- spawn helpers ------------------------------------------------------
/// Resolve a bare command name against the environment's PATH +