fix(rigor): make --changed-only dir filtering work outside POSIX - #473
Open
Tyagiquamar wants to merge 1 commit into
Open
fix(rigor): make --changed-only dir filtering work outside POSIX#473Tyagiquamar wants to merge 1 commit into
Tyagiquamar wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
benchmarks rigor --ci --changed-onlysilently degenerates on Windows. Two independent POSIX-only assumptions infilterChangedBenchmarkDirs()(src/rigor-report.ts):`${resolve(dir)}/`— a hardcoded forward slash appended to a native-separated absolute path. On Windowsresolve()yields backslashes, soC:\repo\bench-a\filenever starts withC:\repo\bench-a/, every genuinely touched benchmark dir is filtered out, and CI checks nothing (the opposite failure mode of the documented fail-open fallback, and much quieter).shell: "/bin/sh") to get2>/dev/null+||chaining./bin/shdoesn't exist on Windows, so the whole lookup throws and the function falls back to "everything changed".Found by running the test suite on Windows: both
tests/rigor-ci.test.mjscases — "keeps exactly the dirs touched since the base ref" (actual[], expected[...bench-a]) and "resolves git's repo-root-relative paths correctly from a subdirectory cwd" — fail at these lines.Fix
file === resolve(dir)orfile.startsWith(resolve(dir) + sep)so the boundary respects the platform separator.execSynccalls (git merge-base HEAD origin/main, falling back togit rev-parse HEAD~1on failure) with no explicit shell. Same resolution order as before; Node's default shell handles both commands on POSIX and Windows.POSIX behavior is unchanged: identical base-ref selection, identical dir ordering, same fail-open catch.
Testing
On Windows 11, Node 24: