Description
codeindex.Index accepts exclusion patterns in Options.Exclusions, but isExcluded ignores path.Match errors. A malformed glob pattern is treated as a non-match, so indexing proceeds silently and policy/configuration mistakes are never surfaced.
Steps to Reproduce
- Create a temp repo with a file like
skip.md and a valid commit.
- Call:
snap, err := codeindex.Index(context.Background(), repoPath, codeindex.Options{Exclusions: []string{"["}})
- Inspect
snap.Manifest.SkippedExcluded and listed documents.
Expected Behavior
Index should return an error for malformed exclusion patterns (or at least fail deterministic validation) so callers can reject invalid config and avoid silently indexing paths that were meant to be excluded.
Actual Behavior
Malformed patterns are ignored and excluded paths are indexed as if the patterns never existed.
isExcluded currently uses error-ignoring path.Match calls, so this becomes a silent no-op.
Environment
- Repository code path:
internal/codeindex/codeindex.go
- Function:
isExcluded()
Description
codeindex.Indexaccepts exclusion patterns inOptions.Exclusions, butisExcludedignorespath.Matcherrors. A malformed glob pattern is treated as a non-match, so indexing proceeds silently and policy/configuration mistakes are never surfaced.Steps to Reproduce
skip.mdand a valid commit.snap.Manifest.SkippedExcludedand listed documents.Expected Behavior
Indexshould return an error for malformed exclusion patterns (or at least fail deterministic validation) so callers can reject invalid config and avoid silently indexing paths that were meant to be excluded.Actual Behavior
Malformed patterns are ignored and excluded paths are indexed as if the patterns never existed.
isExcludedcurrently uses error-ignoringpath.Matchcalls, so this becomes a silent no-op.Environment
internal/codeindex/codeindex.goisExcluded()