Repository navigation
Reduce Markdown discovery output by filtering filenames at the source - #25148
Conversation
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. 🧰 Additional context used📚 Code guidelines (1)No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (1)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review. 📝 WalkthroughWalkthrough
Priority: ⬇️ Low Merge Risk: ⚪ Minimal · up to The change narrows discovery to the intended Markdown extensions without an established behavior regression. It appears mergeable with normal checks. Architecture SummaryArchitecture risk: 🔵 Low · up to The change affects 1 system. Changed systems: Architecture concerns Review detailsSystems and components
Before / after behavior
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
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.
ℹ️ No critical issues — one minor maintainability note inline. Verified the glob behavior against real ripgrep on the repo's own test fixture.
Reviewed changes
- Filter Markdown at the source —
listMarkdownDocumentsnow passes*.{[mM][dD],[mM][dD][xX],[mM][aA][rR][kK][dD][oO][wW][nN]}as its first--globinstead of**, so ripgrep emits only Markdown filenames. Directory exclusions and the finalisMarkdownDocumentNamecheck are unchanged.
I reproduced the markdown-documents-ripgrep-real.test.ts fixture against the exact new argument list with a real rg binary and confirmed: nested files still match, the post-filter accepted set equals the test's included list, non-Markdown files under the re-included .github/ directory are not emitted, and the --iglob variant does reopen hidden directories (.github/.md/hidden.md, docs/.md/hidden.md), validating the case-class rationale in the new comment.
deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏
| // Keep case variants in --glob: --iglob is applied after exclusions and can reopen hidden folders. | ||
| '--glob', | ||
| '**', | ||
| '*.{[mM][dD],[mM][dD][xX],[mM][aA][rR][kK][dD][oO][wW][nN]}', |
There was a problem hiding this comment.
This glob's extension set must stay a superset of isMarkdownDocumentName (line 14): if a fourth extension is ever added there (and to the app.ts picker filters) without updating this pattern, ripgrep drops those files before the final isMarkdownDocumentName(path) check on line 189 can accept them, so they silently vanish from the listing. Worth a one-line note in the comment above, or deriving the pattern from a shared extension list.
Technical details
# Keep the discovery glob a superset of the acceptance predicate
## Affected sites
- `src/main/ipc/markdown-documents.ts:116` — `--glob '*.{[mM][dD],[mM][dD][xX],...}'` duplicates the extension set in `isMarkdownDocumentName` (`:14`).
- `src/main/ipc/app.ts:50` — a third copy of the same extension list (`['md', 'mdx', 'markdown']`).
## Required outcome
- A reader (or future editor) understands the glob is an output-reduction optimization and must remain a superset of the final filter, so the two lists are updated together.
## Suggested approach (optional)
- Extend the existing `:114` comment with the invariant, or export a single `MARKDOWN_EXTENSIONS` list and build both the glob and `isMarkdownDocumentName` from it. The existing real-binary test only pins the three current extensions, so it will not catch a missing update on its own.
ELI5
The Markdown document picker currently receives every filename in the workspace and throws almost all of them away. Ask the scanner to send only Markdown filenames. The document list stays the same.
What Changed
Replace the all-file include glob with Markdown extension alternatives, including upper/lowercase combinations. Keep the existing directory exclusions, hidden-file rules, NUL framing, sorting, and final extension check. No API or remote wire changes.
The pattern deliberately uses
--globcase classes:--iglobis processed after all ordinary globs, even when placed earlier on the command line, and can override the hidden-directory exclusions. Existing real-binary tests caught that issue and pass with the final pattern.Why
On the current Orca checkout, the scan emitted 40,010 records / 2,475,372 bytes to return 293 Markdown documents. The filtered scan emits 293 records / 13,361 bytes: 99.46% less stdout, with identical document objects.
The latency difference is small and noisy; this is a reduction in process communication and JavaScript parsing work, not a claim of a major user-visible speedup. Forcing one scanning thread was also measured and rejected: roughly 58 ms versus 38 ms for the original scan.
Measurements ran serially on native macOS arm64, Node 24.20.0, bundled scanner 15.0.0, with warm filesystem caches. Scan measurements used eight counterbalanced samples after two warmups. Production measurements used ten samples after two warmups, bundling the actual unchanged document parser and replacing only the native spawn/WSL environment boundary to run the bundled executable. Every result was compared for exact parity. No synthetic or remote latency claim.
Linked Issue
N/A — maintainer-requested usage audit.
Visual Proof
N/A — the document list and interactions remain unchanged.
Testing
Existing bundled-binary and lifecycle suites: 20 tests pass. These cover case variants, extension-looking hidden directories,
.github, hidden files, node_modules, ignored files, configuration isolation, symlinks, unusual filenames, cancellation/timeout errors, and WSL routing. No extra implementation-mirroring test was added for this two-line change.pnpm tc:node, changed-code quality gate, and diff whitespace checks pass. Native macOS measurements only; real Windows/WSL/SSH measurements not performed. SSH document inventories use a separate full-inventory path and are unchanged. Full build and remaining suites are left to CI.Review
The producer-filter proposal received adversarial review before coding. The existing real-binary regression suite caught an unsafe flag-order variant; the final case-class pattern preserves the exclusions.
Agent skill upstream boundary
Notes
Applies to native and WSL document discovery in both repository and folder workspaces. Existing bundled binary resolution and lifecycle handling remain unchanged.
Checklist