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
2 issues
Low
getEffectivePrunePatterns drops wrong prune entry via unbounded substring match on directory name - `packages/warden/src/cli/files.test.ts:13`
In getEffectivePrunePatterns, the negation check neg.includes(${dirName}/) || neg.includes(/${dirName}) is an unbounded substring test, so a user negation whose directory name merely starts with a prune name removes the wrong prune entry. For example !src/output/** drops **/out/** (since /output contains /out), and !builder/** drops **/build/**, so that build/output tree is no longer pruned at traversal time and can be fully enumerated—reintroducing the memory pressure / WardenGlobExpansionError the prune list exists to prevent.
Also found at:
packages/warden/src/cli/files.test.ts:140-143packages/warden/src/cli/files.ts:268packages/warden/src/cli/files.ts:403
Glob expansion guard uses >= instead of >, rejecting exactly-at-limit projects against its own 'more than' contract - `packages/warden/src/cli/files.ts:29`
The guard files.length >= MAX_GLOB_FILE_RESULTS throws WardenGlobExpansionError when a project matches exactly 10,000 files, but the class docstring says it is thrown only when expansion returns "more than MAX_GLOB_FILE_RESULTS candidates" and the error message states "limit is 10,000". A legitimate project with exactly 10,000 source files is rejected with the self-contradictory message; use > to match the stated semantics.
2 skills analyzed
| Skill | Findings | Duration | Cost |
|---|---|---|---|
| security-review | 0 | 5.5s | $0.07 |
| code-review | 2 | 13m 39s | $3.51 |
⏱ 13m 45s · 1.6M in / 114.5k out · $3.58