You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Normalize relative working directories in glob searches - #1725
Relative cwd spellings such as "." or "./src" do not match the project's normalized file paths, so glob can silently return no files that actually exist.
Changes
Normalize cwd once, convert native separators to "/", and treat "." as the project root. Apply this filter to the current listProjectFiles selection path, preserving upstream ripgrep enumeration, cancellation, result limits and partial-scan diagnostics. The branch incorporates main through fef9b86.
Verification
The existing real-filesystem cwd regression fails on current main and passes after the fix.
Related glob tests: 4 pass / 5 existing failures, compared with 3 pass / 6 failures on unmodified main with the same regression. The same five injected-filesystem fixtures fail on both; no new failing case.
The five cwd spellings also pass through real ripgrep (10 assertions).
Production glob.ts passes Prettier. The existing regression has a checkout line-ending discrepancy; normalized source/test comparison has no formatting differences.
SDK build remains blocked by the unchanged declaration-generator ts.sys dependency; no binary/smoke or cross-platform CI pass is claimed.
Scope / Tradeoffs
Existing regression unchanged; no new cases or dependencies added. This keeps cwd project-relative and does not define new absolute-cwd behavior. Local validation is Windows/Bun 1.3.14.
Good catch and a clean fix. The root bug is real: the old prefix-matching logic in glob.ts never special-cased cwd === '.' (so it filtered against './' and dropped every file), and it never normalized the cwd string, so ./src and src/../src didn't match the project-relative /-separated paths produced by flattenTree. Using path.normalize + converting path.sep to / + special-casing '.' as "no filter" is the right, small fix for this.
The new test in glob-cwd.test.ts is appropriately scoped — it builds a real temp project, writes nested files, and checks several equivalent relative cwd spellings including the native separator case (path.join('src','nested','..')). That's exactly the kind of regression coverage this fix needs, and the PR description is honest about pre-existing unrelated SDK fixture failures on your Windows environment (good diligence, not hiding anything).
Two things worth double-checking before this lands:
Behavior for an absolute cwd (outside the project root) isn't addressed — probably fine since that's out of scope for this bug, but worth a one-line comment confirming it's an explicit non-goal.
path.normalize uses the OS-native separator semantics; on Windows this correctly produces backslash-normalized paths before you convert to /, but it'd be good to confirm this behaves identically if cwd is ever constructed with mixed separators from a config file rather than a CLI arg.
Overall this is a focused, well-tested fix in the right file. Worth porting as-is, pending a maintainer glance at the absolute-path edge case.
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
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 / Why
Relative cwd spellings such as "." or "./src" do not match the project's normalized file paths, so glob can silently return no files that actually exist.
Changes
Normalize cwd once, convert native separators to "/", and treat "." as the project root. Apply this filter to the current listProjectFiles selection path, preserving upstream ripgrep enumeration, cancellation, result limits and partial-scan diagnostics. The branch incorporates main through fef9b86.
Verification
Scope / Tradeoffs
Existing regression unchanged; no new cases or dependencies added. This keeps cwd project-relative and does not define new absolute-cwd behavior. Local validation is Windows/Bun 1.3.14.