Skip to content

A fixture whose only TAP output is H.Skip is reported PASSED — the skip satisfies the parser's own "did you assert anything?" guard #1061

Closed

Description

Harness.Skip emits a TAP line beginning ok . SelfTestBatch's parser branches on that prefix and sets sawChecksForCurrent = true — the flag that exists specifically to catch a fixture which asserted nothing. So a fixture that skips every check it owns is reported PASSED, with zero not ok lines and a # Total failures: 0 trailer.

The fixture and the parser are each individually correct. The defect is that the TAP stream carries the distinction and the consumer discards it.

Mechanism

Harness.cs:197-200   Skip(name, reason) => Console.WriteLine($"ok {name} # SKIP {reason}");   // no _failures++
       docstring :191-196  "without counting it as a pass OR a failure"

SelfTestBatch.cs:268   else if (line.StartsWith("# Total failures:"))   // checked FIRST; a SKIP line is not '#'
SelfTestBatch.cs:272   else if (line.StartsWith("ok ")) { sawChecksForCurrent = true; }   // <-- SKIP LANDS HERE
SelfTestBatch.cs:274   // "Harness-level pass; ignore payload, just note that current saw checks."
SelfTestBatch.cs:250   var passed = failuresForCurrent.Count == 0 && sawChecksForCurrent;
SelfTestBatch.cs:252   // sawChecksForCurrent exists to produce "fixture emitted no TAP checks"

Measured:

'ok X # SKIP reason'.StartsWith("ok ")      = True
'ok X # SKIP reason'.StartsWith("not ok ")  = False
=> passed = (0 failures) && (sawChecks true) = TRUE

occurrences of "SKIP":  Harness.cs 1 (the emission site)
                        SelfTestBatch.cs 0      <-- the parser never looks for it
                        SelfTestRunner.cs 3     <-- unrelated (AOT/filter path, see #1055)

The parser's own comment states it: "ignore payload" — and # SKIP is the payload.

Two anti-vacuity mechanisms cancel each other. Harness.Skip exists to say "I could not assert this"; sawChecksForCurrent exists to ask "did you assert anything?" The first satisfies the second.

The purest instance is CenterOnCurrent_UsesCursorMonitor

Census over all 188 files in tests/Reactor.AppTests.Host/SelfTest/Fixtures/: 15 H.Skip sites, and they are not one shape.

site shape effect when the skip is taken
Phase1WindowingFixtures.cs:267 CenterOnCurrent_UsesCursorMonitor if/else skip-or-check; the fixture's only check PASSED, asserting nothing
Phase4WindowingFixtures.cs:161 CornerStyle_Apply skip + return; only check; OS-version gate PASSED, asserting nothing (Windows 10)
Phase3WindowingFixtures.cs:199 PersistPlacement_FallbackWhenEmpty if/else; one sibling check survives at :221 PASSED on 1 of 2 checks
DataGridEditFixtures.cs:888 / :1168 / :1285 skip + return; one real check above PASSED on ~1 of 27 checks
NativeDockingA11yFixture.cs:278-283 H.Check(precondition) then skip + return correct idiom — goes red
ControlledOptionalSelfTestHelpers.cs:204 returns from a per-scenario helper, not the fixture benign
7 others one deferred check among many the docstring's intended use

CenterOnCurrent_UsesCursorMonitor is the sharp one, and it is the fixture AGENTS.md holds up as the model remediation:

"Fixed by skipping rather than asserting when the cursor is undeterminable."

It has exactly one check name, emitted either as H.Skip or as H.Check. On the non-interactive sessions AGENTS.md documents as a 100% deterministic failure, not a flake (GetCursorPos → ACCESS_DENIED), its only TAP line is ok CenterOnCurrent_UsesCursorMonitor # SKIP …, and the fixture reports PASSED having verified nothing. The remediation is right; its interaction with the reporting layer is what is not.

NativeDockingA11yFixture.cs:278-283 is the in-repo exemplar of the shape that works — an H.Check on the precondition (which can emit not ok) before the H.Skip + return.

Not a duplicate of #1033 or #1055

Both are adjacent and neither covers this.

The obvious fix is wrong

"Don't set sawChecksForCurrent for a skip line" yields passed = false, so CenterOnCurrent_UsesCursorMonitor and CornerStyle_Apply would fail on exactly the machines their skip was introduced to accommodate — re-creating the regression the skip fixed.

A third state is genuinely needed, and there is no room for one today:

SelfTestBatch.cs:25
private static readonly ConcurrentDictionary<string, (bool Passed, string Detail)> _byFixture = new();

Sketch, in increasing order of change:

  1. Track skipped check names per fixture (parse the # SKIP suffix rather than discarding it).
  2. Widen the tuple to a three-state outcome so a fixture whose checks were all skipped reports SKIPPED with the reasons attached, distinct from both PASSED and FAILED.
  3. Optionally surface a run-level count, so # Total failures: 0 alongside "N fixtures fully skipped" is legible rather than silently reassuring.

Whatever the shape, the acceptance test is that a fixture emitting only skip lines must not be indistinguishable from one that ran and passed.

Why this is worth a separate issue

A skipped selftest is not, by itself, a problem — the skip exists so an unobservable precondition does not produce a vacuous assertion, and that judgement is correct. The problem is that the verdict the batch reports is identical in the healthy and the fully-degraded case, so no consumer downstream — CI, a coverage run, or a contributor reading # Total failures: 0 — can tell them apart. That is the same asymmetry AGENTS.md §Checks that actually prove something describes: the loud direction is a failure someone investigates, the silent direction is a green run nobody does.

Related: #1025, #1033, #1045, #1055.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions