Skip to content

fix: match **/ globs against top-level files - #634

Open
agustin18 wants to merge 1 commit into
boxed:mainfrom
agustin18:fix/cache-invalidation-glob
Open

agustin18 wants to merge 1 commit into
boxed:mainfrom
agustin18:fix/cache-invalidation-glob

Conversation

@agustin18

Copy link
Copy Markdown

Fixes #627

cache_invalidation_files patterns are matched with fnmatch, where **/ requires a literal slash. A pattern like tests/**/*.py therefore misses tests/test_ops.py, even though Path.glob includes it when the baseline is built. The file stays in the baseline but is filtered out when changes are restricted to the configured globs, so edits to top-level test files do not trigger a rerun.

This adds a small matcher that also tries the zero-directory variant of **/, and uses it for cache_invalidation_files and cache_invalidation_exclude. Patterns without **/ keep the existing fnmatch behavior. The new test covers both tests/test_ops.py and tests/sub/test_deep.py.

Tests

  • uv run pytest -q: 479 passed, 4 skipped
  • uv run pytest tests/mutation/test_mutation.py -q: 257 passed, 1 skipped
  • uv run pre-commit run --all-files: passed

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.

cache_invalidation_files with ** doesn't catch files at the top of the directory

1 participant