fix(files): prune dependency dirs in expandFileGlobs before fast-glob traversal#410
fix(files): prune dependency dirs in expandFileGlobs before fast-glob traversal#410dcramer wants to merge 4 commits into
1 issue
code-review: Found 1 issue (1 medium)
Medium
`MAX_GLOB_FILE_RESULTS` guard counts pre-gitignore results, throwing false errors on repos with large gitignored dirs outside the prune list - `packages/warden/src/cli/files.ts:284-287`
The files.length >= MAX_GLOB_FILE_RESULTS check runs right after fg(), before gitignore rules are applied. A repo with a gitignored directory that is not in BUILTIN_PRUNE_DIRECTORY_PATTERNS (e.g. Python .venv/, target/, __pycache__/) containing 10,000+ matching files trips the guard and throws WardenGlobExpansionError, causing warden to exit 1 even though gitignore filtering would have reduced the result to the real source files. Move the guard after the gitignore filtering step (or after the !useGitignore/no-git-root returns) so it bounds the final result set.
⏱ 6m 37s · 898.2k in / 61.0k out · $2.09
Annotations
Check warning on line 287 in packages/warden/src/cli/files.ts
sentry-warden / warden: code-review
`MAX_GLOB_FILE_RESULTS` guard counts pre-gitignore results, throwing false errors on repos with large gitignored dirs outside the prune list
The `files.length >= MAX_GLOB_FILE_RESULTS` check runs right after `fg()`, before gitignore rules are applied. A repo with a gitignored directory that is not in `BUILTIN_PRUNE_DIRECTORY_PATTERNS` (e.g. Python `.venv/`, `target/`, `__pycache__/`) containing 10,000+ matching files trips the guard and throws `WardenGlobExpansionError`, causing warden to exit 1 even though gitignore filtering would have reduced the result to the real source files. Move the guard after the gitignore filtering step (or after the `!useGitignore`/no-git-root returns) so it bounds the final result set.