From 1114db1c066d0c9ee88799a920f59985f6f754cf Mon Sep 17 00:00:00 2001 From: Jeroen Schweitzer Date: Mon, 15 Jun 2026 00:28:25 +0200 Subject: [PATCH] ci: exclude Windows-only ConPTY FFI from the Linux coverage denominator MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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) --- lib/src/pty/windows_pty.dart | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/lib/src/pty/windows_pty.dart b/lib/src/pty/windows_pty.dart index 04b97539..965fa711 100644 --- a/lib/src/pty/windows_pty.dart +++ b/lib/src/pty/windows_pty.dart @@ -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 +