fix: escape glob-special characters in directory paths#984
Conversation
Parentheses and square brackets in project directory paths broke fast-glob matching, causing glob-based artifact outputs to silently return empty results. Escape these characters in the directory portion before passing to fast-glob, preserving glob semantics in the generates pattern. Co-Authored-By: Claude Opus 4.6 <[email protected]>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughAdjusts artifact output resolution: non-glob Changes
Sequence Diagram(s)(Skipped — changes are local resolution logic and tests, not multi-component sequential flows.) Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/core/artifact-graph/outputs.ts (1)
13-21: Residual edge cases: brace expansion and leading!in directory names.The targeted
()[]escape covers the reported bug and keeps the implementation minimal, which is good. The doc comment correctly notes that isolated{...}does not break picomatch (brace expansion requires,or..inside), which is why the{workspace}test passes. However, directory names that actually contain brace-expansion syntax (e.g.foo{a,b}) or start with!(negation) will still misbehave. If you want to close that gap now, escaping{,}, and a leading!on each path segment would cover the remaining picomatch metacharacters without changing behavior for the existing tests. Otherwise, the current scope is a reasonable, bug-focused fix.picomatch metacharacters that must be escaped in literal filesystem paths (parentheses brackets braces negation)🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/core/artifact-graph/outputs.ts` around lines 13 - 21, escapeGlobPath currently only escapes parentheses and square brackets which leaves brace-expansion sequences and leading negation chars unescaped; update escapeGlobPath to also escape '{' and '}' and ensure any path segment that begins with '!' has that leading '!' escaped (or prefixed) so picomatch won't treat it as negation—locate the escapeGlobPath function and modify its replacement logic to handle braces and to process each path segment to escape a leading '!' while preserving existing behavior for other characters.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@src/core/artifact-graph/outputs.ts`:
- Around line 13-21: escapeGlobPath currently only escapes parentheses and
square brackets which leaves brace-expansion sequences and leading negation
chars unescaped; update escapeGlobPath to also escape '{' and '}' and ensure any
path segment that begins with '!' has that leading '!' escaped (or prefixed) so
picomatch won't treat it as negation—locate the escapeGlobPath function and
modify its replacement logic to handle braces and to process each path segment
to escape a leading '!' while preserving existing behavior for other characters.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 302138ad-1f4e-45cd-bab0-8ac3dcd37153
📒 Files selected for processing (2)
src/core/artifact-graph/outputs.tstest/core/artifact-graph/outputs.test.ts
* fix: escape glob-special chars in directory paths (Fission-AI#974) Parentheses and square brackets in project directory paths broke fast-glob matching, causing glob-based artifact outputs to silently return empty results. Escape these characters in the directory portion before passing to fast-glob, preserving glob semantics in the generates pattern. Co-Authored-By: Claude Opus 4.6 <[email protected]> * fix: use cwd for artifact output globs --------- Co-authored-by: furao <[email protected]> Co-authored-by: Claude Opus 4.6 <[email protected]> Co-authored-by: Tabish Bidiwale <[email protected]> Co-authored-by: TabishB <[email protected]>
Summary
fast-glob, so they are treated as literal path characters instead of extglob syntaxescapeGlobPath()helper that targets only()and[]— characters proven to breakfast-glob/picomatchmatching in filesystem pathsTest plan
vitest run test/core/artifact-graph/outputs.test.ts)(),[],{}generates(e.g.proposal.md) still works viafs.statSyncpathCloses #974
🤖 Generated with Claude Code
Summary by CodeRabbit
Bug Fixes
Tests