Skip to content

fix(indexer): dotted .cceignore patterns and directory targets - #167

Open
KM-IA-Agency wants to merge 1 commit into
elara-labs:mainfrom
KML-C:fix/cceignore-leading-dot
Open

KM-IA-Agency wants to merge 1 commit into
elara-labs:mainfrom
KML-C:fix/cceignore-leading-dot

Conversation

@KM-IA-Agency

Copy link
Copy Markdown

Closes #165.

1. Dotted patterns never matched at the project root

matches_any normalized with rel.lstrip("./"). str.lstrip strips a character set, so .env became env, .pytest-tmp-ci became pytest-tmp-ci, and every .cceignore pattern starting with . was a no-op for root-level entries. The fix strips only a ./ prefix (repeated) and leading /.

2. cce index --path <dir> bypassed directory exclusions

The directory-target branch walked <dir> with <dir> as the matcher root:

  • a rule matching <dir> itself or one of its ancestors (data/ with --path data or --path data/sub) was never tested;
  • root-relative rules such as src/gen/ were evaluated against <dir>-relative paths.

The fix skips a directory target when it, or an ancestor, is excluded (by ignore_set names or .cceignore). _iter_project_files also gains a relative_to argument, so paths stay project-relative when the walk starts below the root.

Tests

  • test_dotted_patterns_match_root_entries (5 cases) and test_leading_dot_is_not_dropped_from_the_name.
  • test_directory_target_respects_cceignore: --path data, --path data/sub and --path src with src/gen/ excluded.
  • tests/indexer/test_ignorefile.py, test_pipeline_target_path.py, test_pipeline_secret_target.py: 32 passed with the fix; 7 of the new cases fail without it.
  • One failure in both runs, test_target_path_through_symlinked_project_root: Path.symlink_to is not permitted on my Windows machine, which is unrelated to this change. Run locally on Windows / Python 3.13 with -n0; I have not run the full suite locally.

Related: #163, #164 / #166.

🤖 Generated with Claude Code

…-labs#165)

- matches_any normalized paths with rel.lstrip("./"), which strips a
  character set: ".env" became "env", so patterns starting with "."
  never matched root-level entries. Strip only a "./" prefix and "/".
- `cce index --path <dir>` walked <dir> with <dir> as the matcher
  root: rules matching <dir> or an ancestor were never tested, and
  root-relative rules were evaluated against <dir>-relative paths.
  Skip an excluded directory target and keep paths project-relative.

Closes elara-labs#165

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

.cceignore: patterns starting with '.' never match root entries (lstrip("./")), and cce index --path bypasses directory exclusions

1 participant