You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(ui): warn when include patterns defeat directory pruning (#162)
## What
Both places a user edits exclusion rules - the add-source wizard's
Exclusions step and the per-source inline editor in Settings > Sources -
now show a small amber warning box under the **Include patterns**
textarea whenever an entered include pattern would stop the scanner from
pruning excluded directories.
The scanner can only skip descending into an excluded folder
(`node_modules`, etc.) when it can prove no include pattern could match
inside it. That proof needs a root-anchored pattern of bounded depth
(`/repo/.env`, `/*/.env`, `/a/*/b/.env`). A relative pattern (`.env`,
`*/.env`, `blah/.env`) matches at any depth, and one containing `**`
spans any number of levels - either forces the walk into every excluded
directory just in case, which is what makes a scan crawl.
## How
- `ui/src/stores/exclusionPreview.ts` (where the other pattern helpers
live) gains `isUnconstrainedIncludePattern` /
`unconstrainedIncludePatterns`: a trimmed, non-empty pattern is
unconstrained iff it does not start with `/` **or** it contains `**`.
`splitPatterns` is now exported from the same module and both editors
use it instead of their own private copies, so the warning splits input
exactly the way the saved rules do (newline **or** comma separated).
- Each editor renders the box reactively off a `computed` over its
textarea text, so it appears/disappears as the user types - the preview
walk still only re-runs on blur. The box names the offending patterns
and links to the anchored forms; styling matches the existing amber
warning surfaces (`AccountList` reauth banner, `PausedBanner`).
- New i18n keys nested under `settings.addSource.includeWarning`
(`title`, `hint`), shared by both editors like the existing
`includePatternsLabel`.
## Tests
- `exclusion-preview-store.test.ts`: a vector table for the helper
(`.env`, `*/.env`, `blah/.env`, `/*/x/**/.env` warn; `/x/.env`,
`/*/.env`, `/a/*/b/.env` do not), plus trimming, blank lines, and comma
vs newline splitting.
- `settings-components.test.ts`: one test per editor asserting the box
is absent with no rules, appears listing **only** the offending patterns
once an unconstrained rule is typed, and disappears when the rules are
anchored - without a blur or a re-preview.
`npx vitest run` 454 passed, `prettier --check src` clean, `vue-tsc
--noEmit` and `eslint .` clean.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01JLB3E2Jm7knNJd37fVpH8X
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
"hint": "Patterns without a leading / (or containing **) force the scanner to search inside every excluded folder such as node_modules. Anchor them to fixed depths instead, e.g. /*/.env, /path/to/.env, or /path/*/deploy/.env."
197
+
},
194
198
"placeholderPolicyLabel": "Back up OneDrive cloud-only files",
195
199
"placeholderPolicyCaption": "Applies to OneDrive / cloud-only placeholder files on Windows (harmless elsewhere). When on, Driven downloads and backs up files that are stored only in the cloud.",
0 commit comments