Fix codebase indexing for plain text files#938
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughPlain-text files now use shared fallback-extension detection and line-based chunks. Tree-sitter bypasses non-structural extensions, while tests cover metadata, deduplication, case-insensitive matching, empty content, and parser bypassing. ChangesPlain-text indexing
Estimated code review effort: 2 (Simple) | ~10 minutes Sequence Diagram(s)sequenceDiagram
participant CodeIndexer
participant CodeParser
participant TreeSitter
CodeIndexer->>CodeParser: Parse .txt content
CodeParser-->>CodeIndexer: Return fallback_chunk blocks
CodeIndexer->>TreeSitter: Request structural definitions
TreeSitter-->>CodeIndexer: Return undefined for non-structural extensions
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 2 | ❌ 3❌ Failed checks (3 warnings)
✅ Passed checks (2 passed)
✨ 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 |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
Plain text files can also reach |
edelauna
left a comment
There was a problem hiding this comment.
Nice! Looks great, thank you for this contribution, has some suggestions around the test case, and if we could also extend return undefined behavior to the other extensions while we're making this change.
|
Thank you, @edelauna, for taking the time to review this and for the thoughtful feedback. I’ve addressed the suggestions and pushed the updates. I’m really glad to contribute and be part of the effort to make the project better |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/services/code-index/processors/__tests__/parser.spec.ts (1)
274-287: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueRemove unnecessary
awaitbefore synchronous method.
_chunkTextByLinesis a synchronous method that returnsCodeBlock[], not a Promise. Theawaitkeywords are unnecessary and can be removed.♻️ Proposed refactor
- const firstResult = await parser["_chunkTextByLines"]( + const firstResult = parser["_chunkTextByLines"]( lines, "manual.txt", "hash", "fallback_chunk", seenSegmentHashes, ) - const duplicateResult = await parser["_chunkTextByLines"]( + const duplicateResult = parser["_chunkTextByLines"]( lines, "manual.txt", "hash", "fallback_chunk", seenSegmentHashes, )🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/services/code-index/processors/__tests__/parser.spec.ts` around lines 274 - 287, Remove the unnecessary await keywords from both _chunkTextByLines calls assigned to firstResult and duplicateResult, since the synchronous method returns CodeBlock[] directly; preserve the existing arguments and result handling.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@src/services/code-index/processors/__tests__/parser.spec.ts`:
- Around line 274-287: Remove the unnecessary await keywords from both
_chunkTextByLines calls assigned to firstResult and duplicateResult, since the
synchronous method returns CodeBlock[] directly; preserve the existing arguments
and result handling.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 152e8628-59fe-4200-b150-a4d04bfebb5c
📒 Files selected for processing (7)
src/services/code-index/processors/__tests__/parser.spec.tssrc/services/code-index/processors/__tests__/parser.txt.spec.tssrc/services/code-index/processors/parser.tssrc/services/code-index/shared/supported-extensions.tssrc/services/shared/fallback-extensions.tssrc/services/tree-sitter/__tests__/plainTextIntegration.spec.tssrc/services/tree-sitter/index.ts
🚧 Files skipped from review as they are similar to previous changes (3)
- src/services/tree-sitter/tests/plainTextIntegration.spec.ts
- src/services/code-index/processors/tests/parser.txt.spec.ts
- src/services/tree-sitter/index.ts


Summary
.txtto the extensions scanned by codebase indexing.txtparsing and case-insensitive extension matchingFixes #931
Testing
cd src && npx vitest run services/code-index/processors/__tests__/parser.txt.spec.tsREADME.mdandmanual.txt; content unique to both files was returned after full reindexing.txtsupport and confirming that only the Markdown content was indexedSummary by CodeRabbit
.txt) in code indexing, including consistent handling of uppercase.TXT..txt) and other non-structural extensions now bypass structural code-definition parsing and use fallback chunking.contentoverride no longer triggers an unintended disk read.