Skip to content

[Bug] codeindex.isExcluded silently ignores malformed glob patterns #128

Description

@morluto

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

  1. Create a temp repo with a file like skip.md and a valid commit.
  2. Call:
snap, err := codeindex.Index(context.Background(), repoPath, codeindex.Options{Exclusions: []string{"["}})
  1. 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()

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions