Repository navigation
fix(filters): make directory-only unanchored gate explicit - #5904
Merged
Merged
Conversation
1 of 3 tasks
Refactor the descendant-suppression gate in `CompiledRule::new` so the directory-only unanchored wildcard case (`foo/*/`, `**/node_modules/`) is named explicitly rather than hidden inside the broader `has_glob_wildcard && (slash_anchored || directory_only)` condition. The new predicate `is_directory_only_unanchored_wildcard` is greppable, self-documenting, and pinned by dedicated wire-byte parity tests so a future refactor cannot silently re-introduce the synthetic `foo/*/**` descendant that upstream `exclude.c:rule_matches()` never emits (FILTRULE_DIRECTORY, line 938-939). Add wire-byte parity tests on the compiled-rule level that assert the exact direct- and descendant-matcher sets for `foo/*/`, `**/node_modules/`, and the negative literal `cache/` case, plus a new integration test that pins the upstream `exclude` / `exclude-lsh` exclude-from fixture so the sibling include `+ foo/s?b/` continues to keep `foo/sub/file1` instead of being stolen by `- foo/*/`. Regression for UTS-DD-exclude.3 - the test surfaced as "Only in to: new" and "Only in to/foo: down" over-deletion in CI before PR #5880 landed; this change keeps the existing fix and locks the gate down behind an explicit predicate plus wire-byte assertions.
oferchen
force-pushed
the
fix/uts-dd-exclude-3-dironly-gate
branch
from
June 17, 2026 21:23
788cd23 to
9835688
Compare
oferchen
added a commit
that referenced
this pull request
Aug 24, 2026
Refactor the descendant-suppression gate in `CompiledRule::new` so the directory-only unanchored wildcard case (`foo/*/`, `**/node_modules/`) is named explicitly rather than hidden inside the broader `has_glob_wildcard && (slash_anchored || directory_only)` condition. The new predicate `is_directory_only_unanchored_wildcard` is greppable, self-documenting, and pinned by dedicated wire-byte parity tests so a future refactor cannot silently re-introduce the synthetic `foo/*/**` descendant that upstream `exclude.c:rule_matches()` never emits (FILTRULE_DIRECTORY, line 938-939). Add wire-byte parity tests on the compiled-rule level that assert the exact direct- and descendant-matcher sets for `foo/*/`, `**/node_modules/`, and the negative literal `cache/` case, plus a new integration test that pins the upstream `exclude` / `exclude-lsh` exclude-from fixture so the sibling include `+ foo/s?b/` continues to keep `foo/sub/file1` instead of being stolen by `- foo/*/`. Regression for UTS-DD-exclude.3 - the test surfaced as "Only in to: new" and "Only in to/foo: down" over-deletion in CI before PR #5880 landed; this change keeps the existing fix and locks the gate down behind an explicit predicate plus wire-byte assertions.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Refactor the descendant-suppression gate in
CompiledRule::newso the directory-only unanchored wildcard case (foo/*/,**/node_modules/) is named explicitly rather than hidden inside the broaderhas_glob_wildcard && (slash_anchored || directory_only)condition. The new predicateis_directory_only_unanchored_wildcardis greppable, self-documenting, and pinned by dedicated wire-byte parity tests so a future refactor cannot silently re-introduce the syntheticfoo/*/**descendant that upstreamexclude.c:rule_matches()never emits (FILTRULE_DIRECTORY, line 938-939).Adds wire-byte parity tests on the compiled-rule level that assert the exact direct- and descendant-matcher sets for
foo/*/,**/node_modules/, and the negative literalcache/case, plus a new integration test that pins the upstreamexclude/exclude-lshexclude-from fixture so the sibling include+ foo/s?b/continues to keepfoo/sub/file1instead of being stolen by- foo/*/.Regression for UTS-DD-exclude.3 - the test surfaced as "Only in to: new" and "Only in to/foo: down" over-deletion in CI before PR #5880 landed; this change keeps the existing fix and locks the gate down behind an explicit predicate plus wire-byte assertions.
Test plan
cargo fmt --allclean.Files
crates/filters/src/compiled/mod.rs- explicitis_directory_only_unanchored_wildcardpredicate plus three new compiled-level wire-byte parity tests.crates/filters/tests/uts_dd_exclude_3_dir_only_unanchored.rs(new) - integration tests over the upstreamexclude/exclude-lshexclude-from fixture.