Skip to content

test(core): fix Windows path separator sort in search test - #66

Merged
quickbeard merged 1 commit into
mainfrom
fix-windows-search-sort
Jul 14, 2026
Merged

quickbeard merged 1 commit into
mainfrom
fix-windows-search-sort

Conversation

@quickbeard

Copy link
Copy Markdown
Owner

Problem

CI test job has been failing on main (Windows unit runner). The failing test is FileSystemSearch ripgrep fallback > returns entries for an empty query in packages/core/test/filesystem/search.test.ts.

The test sorts the received entries but compares against a fixed-order expected array:

- Expected: ["README.md", "src\", "src/match.ts"]
+ Received: ["README.md", "src/match.ts", "src\"]

Directory entries carry the OS path separator (\ = 0x5C on Windows) while ripgrep returns file paths with forward slashes (/ = 0x2F). Since / sorts before \, the .sort()ed received order differs from the hardcoded expected order, which only matches the Unix sort. This is a pre-existing latent bug surfaced on the Windows runner.

Fix

Sort the expected array with the same comparator so the assertion is platform-independent. No production code changes; the mixed separators are intentional (directory entries append path.sep by design).

Verification

  • bun test test/filesystem/search.test.ts passes locally (macOS).
  • Logic verified for Windows: both sides sort to ["README.md", "src/match.ts", "src\"].

🤖 Generated with Claude Code

The empty-query search test sorted the received entries but compared
against a fixed-order expected array. On Windows directory entries carry
a backslash separator (0x5C) which sorts after the forward slash (0x2F)
in file paths, so the received order differed from the hardcoded
expected order and the test failed. Sort the expected array too for a
platform-independent comparison.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@quickbeard
quickbeard merged commit 35de8e3 into main Jul 14, 2026
5 checks passed
@quickbeard
quickbeard deleted the fix-windows-search-sort branch July 14, 2026 01:47
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