Skip to content

Fix never-run Windows assertions in TestLocationEquality; un-skip on Windows#349

Merged
folbricht merged 3 commits into
masterfrom
investigate-windows-locationmatch
May 18, 2026
Merged

Fix never-run Windows assertions in TestLocationEquality; un-skip on Windows#349
folbricht merged 3 commits into
masterfrom
investigate-windows-locationmatch

Conversation

@folbricht
Copy link
Copy Markdown
Owner

Resolves the deferred follow-up from #347: TestLocationEquality was t.Skip-ped on Windows because cmd/desync had never run in CI and its never-executed Windows assertions were failing.

Investigation method

Added a temporary diagnostic (a non-short-circuiting test that evaluated all 63 locationMatch cases and dumped the filepath.Abs/filepath.Match internals) plus a throwaway Windows-only workflow, so a single Windows CI run revealed every divergence at once instead of peeling one require failure per run. Both the diagnostic and the temp workflow were removed after the analysis; the net change here is test-only.

Finding: locationMatch is correct — the test was wrong

Only 5 of 63 cases failed on Windows, all in the local-path branch, and in every case the implementation behaves correctly and consistently with the test's own POSIX assertions:

Case Old assertion Why it was wrong
//path vs /path true (unconditional) POSIX-only. On Windows // is a UNC root, so it is legitimately different from the drive-relative /path. locationMatch intentionally uses OS-native local-path semantics (its documented contract).
c:\path\to\* vs c:\path\to\ true (win block) Contradicts the POSIX case /path/* vs /path == false (already in this test). dir\* must not match the bare dir.
/path/to/* vs \path\to\ true (win block) Same as above.
c:\path\to\? vs c:\path\to\123\ true (win block) ? matches exactly one character; 123 is three.
/path/to/? vs \path\to\123\ true (win block) Same as above.

Change

  • //path vs /path: asserted per-OS — true on POSIX, false on Windows — with a comment explaining the UNC semantics.
  • The four bogus require.True in the "Not equal paths with globs" Windows block → require.False (where they always belonged).
  • Removed the Windows t.Skip. locationMatch is now covered on Linux, macOS, and Windows.

No change to location.go — it was never buggy.

Verified: TestLocationEquality passes on Windows (confirmed via the temporary workflow before its removal, including the if runtime.GOOS == "windows" blocks); passes locally on Linux. This PR's CI exercises all three OSes.

folbricht added 3 commits May 18, 2026 12:57
Not for merge. Evaluates every TestLocationEquality locationMatch
case without short-circuiting and dumps filepath.Abs/filepath.Match
internals so one Windows CI run reveals all divergences at once.
…Windows

Investigation (via a temporary Windows CI diagnostic) showed
locationMatch itself is correct on Windows. All Windows failures
were incorrect, never-executed test expectations:

- //path vs /path was asserted equal unconditionally, but that is a
  POSIX-only assumption: on Windows // is a UNC root, so it is
  legitimately not equal to the drive-relative /path. locationMatch
  intentionally uses OS-native local-path semantics. Now asserted
  per-OS.
- The Windows block under "Not equal paths with globs" asserted
  True for dir\* vs dir\ and dir\? vs dir\123\. Both are wrong
  and inconsistent with the POSIX cases: dir\* does not match the
  bare dir (cf. /path/* vs /path), and ? matches exactly one
  character so it does not match "123". Corrected to False.

Remove the Windows t.Skip; locationMatch is now covered on all
three platforms. (Diagnostic test and temp workflow are removed
before merge.)
Investigation complete: TestLocationEquality passes on Windows with
the corrected assertions (verified via this workflow before removal).
@folbricht folbricht merged commit 5904461 into master May 18, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant