Repository navigation
fix(tool): break glob mtime ties by path - #809
Merged
Ishaan Gangwani (ishaan1124) merged 2 commits intoSep 29, 2026
Merged
Ishaan Gangwani (ishaan1124) merged 2 commits into
Ishaan Gangwani (ishaan1124) merged 2 commits into
Conversation
ANIRUDDHA ADAK (aniruddhaadak80)
requested review from
Aayam Bansal (aayambansal) and
Ishaan Gangwani (ishaan1124)
as code owners
September 28, 2026 18:53
|
ANIRUDDHA ADAK (@aniruddhaadak80) is attempting to deploy a commit to the InkVell Team on Vercel. A member of the Team first needs to authorize it. |
ANIRUDDHA ADAK (aniruddhaadak80)
force-pushed
the
fix/glob-deterministic-order
branch
from
September 29, 2026 04:50
29d427a to
2f5e750
Compare
The comparator had no tiebreak, so files sharing an mtime kept ripgrep traversal order and two identical searches could return the same files in a different sequence. The tool documents the list as sorted by modification time; equal timestamps now fall back to the path.
ANIRUDDHA ADAK (aniruddhaadak80)
force-pushed
the
fix/glob-deterministic-order
branch
from
September 29, 2026 10:02
2f5e750 to
92f5a8c
Compare
# Conflicts: # CHANGELOG.md
Ishaan Gangwani (ishaan1124)
merged commit Sep 29, 2026
34b2a9a
into
synthetic-sciences:main
8 of 9 checks passed
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.
What
globsorts matches newest-first with no tiebreak:Array.prototype.sortis stable, so files with an identical mtime keep ripgrep's traversal order — which is filesystem enumeration order. The tool's own description (glob.txt:3) promises "Returns matching file paths sorted by modification time".Why it matters
A checkout, a build, a clone, or a script that writes files in one burst gives every file the same mtime. That isn't an edge case; it's what a fresh clone looks like.
Then the ordering is decided by the filesystem, so two identical
globcalls over an unchanged tree can return the same files in a different sequence. The model diffs two "same" results, sees files apparently appearing and vanishing, and either re-runs the search or reports a change that never happened.Verified on this machine with four files pinned to one mtime: the pre-fix order was filesystem order (
bravo, alpha, delta, charlie).Verification
test/tool/glob.test.tsdid not exist —test/tool/hadgrep,ls-tree, andread, but nothing forglob. Fails before, passes after:The first test pins the mtime explicitly with
fs.utimesand assertsnew Set(mtimes).size === 1, so it cannot silently degrade into testing the ordinary path on a filesystem with coarse timestamps. It also runs the tool twice and requires identical output, which is the property that was actually missing. The second test uses genuinely distinct mtimes so the primary newest-first behaviour stays pinned.The expected order is derived from the same comparator the fix uses rather than hardcoded, so the test states the rule instead of a locale's idea of alphabetical order.
The change
bun run typecheckclean; touched files are Prettier-clean (checked on LF-normalized copies — this checkout hascore.autocrlf=true, which makes Prettier flag every file in the repo).Related, deliberately not changed here
The 100-file cap is applied during traversal, before the sort, so a truncated result is an arbitrary filesystem-order prefix rather than the 100 most recently modified matches. That is a truthful
truncated: true; choosing between "sort before slicing" (memory cost) and "say so in the note" is a design call rather than a bug fix, so it is left alone.Fixes #808