-
-
Notifications
You must be signed in to change notification settings - Fork 396
[llm-auto-fix] fixed code search where filePattern includes multiple values #159
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
""" WalkthroughThe update changes how multiple file patterns are handled in the Changes
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/tools/search.ts (1)
120-123
: Remove stray blank lines added inside thecatch
block.The three empty lines add noise without value and break the otherwise consistent style in this file. Deleting them improves readability and keeps the diff minimal.
- - -
Hmm, good catch, need some kind of test for it |
I told Goose (agent) to call a tool with various filePatterns & verified it works. But surely I cant tell it to write a proper test too! Will update. |
heh, yeah I do that too, ask Claude to test tools itself :D There is folder with tests, just ask AI to check it out around edit/search tools |
…*.ts|*.js|*.py|*.java|*.go`
…t contains multiple file extensions separated via `|`
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (2)
test/test-search-code-edge-cases.js (2)
370-377
: Create test fixtures concurrently for better I/O throughputThe six
fs.writeFile
calls are awaited sequentially, slowing the suite (~40-50 ms on fast SSD, more on CI).
Bundling them inPromise.all
keeps code short and shaves time.- await fs.writeFile(path.join(EDGE_CASE_TEST_DIR, 'file1.ts'), 'export const myTsVar = "patternTs";'); - await fs.writeFile(path.join(EDGE_CASE_TEST_DIR, 'file2.js'), 'const myJsVar = "patternJs";'); - await fs.writeFile(path.join(EDGE_CASE_TEST_DIR, 'file3.py'), 'my_py_var = "patternPy"'); - await fs.writeFile(path.join(EDGE_CASE_TEST_DIR, 'file4.java'), 'String myJavaVar = "patternJava";'); - await fs.writeFile(path.join(EDGE_CASE_TEST_DIR, 'file5.go'), 'var myGoVar = "patternGo"'); - await fs.writeFile(path.join(EDGE_CASE_TEST_DIR, 'file6.txt'), 'This is a text file.'); + await Promise.all([ + fs.writeFile(path.join(EDGE_CASE_TEST_DIR, 'file1.ts'), 'export const myTsVar = "patternTs";'), + fs.writeFile(path.join(EDGE_CASE_TEST_DIR, 'file2.js'), 'const myJsVar = "patternJs";'), + fs.writeFile(path.join(EDGE_CASE_TEST_DIR, 'file3.py'), 'my_py_var = "patternPy"'), + fs.writeFile(path.join(EDGE_CASE_TEST_DIR, 'file4.java'),'String myJavaVar = "patternJava";'), + fs.writeFile(path.join(EDGE_CASE_TEST_DIR, 'file5.go'), 'var myGoVar = "patternGo"'), + fs.writeFile(path.join(EDGE_CASE_TEST_DIR, 'file6.txt'), 'This is a text file.') + ]);Minor, but keeps the ever-growing test file snappy.
414-420
: Add a positive assertion for the “no-match” scenarioThe last check only verifies that certain filenames are absent.
If the search unexpectedly returns matches in other files, the test still passes.
Strengthen it by asserting the “no matches” message (or empty result).- assert(!text.includes('file1.ts'), 'Should not find any matches with only empty patterns'); - assert(!text.includes('file2.js'), 'Should not find any matches with only empty patterns'); + assert(!text.includes('file1.ts'), 'Should not find any matches with only empty patterns'); + assert(!text.includes('file2.js'), 'Should not find any matches with only empty patterns'); + assert( + text.includes('No matches') || text.trim() === '', + 'Expected explicit “no matches” feedback when filePattern resolves to nothing' + );Tightens the expectation and protects against silent false positives.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
src/tools/search.ts
(3 hunks)test/test-search-code-edge-cases.js
(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- src/tools/search.ts
🧰 Additional context used
🧬 Code Graph Analysis (1)
test/test-search-code-edge-cases.js (4)
test/run-all-tests.js (2)
colors
(16-25)result
(140-140)test/test-search-code.js (23)
colors
(22-28)result
(136-139)result
(160-164)result
(179-183)result
(200-204)result
(221-225)result
(263-267)result
(287-291)result
(310-314)result
(333-336)result
(355-358)result
(409-412)text
(145-145)text
(166-166)text
(185-185)text
(206-206)text
(231-231)text
(269-269)text
(293-293)text
(319-319)text
(342-342)text
(362-362)text
(414-414)test/test.js (1)
fs
(41-41)src/handlers/edit-search-handlers.ts (1)
handleSearchCode
(25-90)
Added a test that verifies filePattern with various combinations:
|
Cha-ching: ready for review. |
Search code with a single filePattern extension works:
*.js
.However when LLM specifies multiple (e.g.:
*.ts|*.js|*.py|*.java|*.go
) search breaks.This is LLM-auto-fix that fixed that.
Summary by CodeRabbit