Skip to content

fix(filters): make directory-only unanchored gate explicit - #5904

Merged
oferchen merged 1 commit into
masterfrom
fix/uts-dd-exclude-3-dironly-gate
Jun 18, 2026
Merged

oferchen merged 1 commit into
masterfrom
fix/uts-dd-exclude-3-dironly-gate

Conversation

@oferchen

Copy link
Copy Markdown
Owner

Summary

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).

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 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.

Test plan

  • cargo fmt --all clean.
  • CI: fmt+clippy.
  • CI: nextest (stable).
  • CI: Windows (stable).
  • CI: macOS (stable).
  • CI: Linux musl (stable).
  • CI: interop suite (exclude / exclude-lsh upstream testsuite parity).

Files

  • crates/filters/src/compiled/mod.rs - explicit is_directory_only_unanchored_wildcard predicate 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 upstream exclude / exclude-lsh exclude-from fixture.

@github-actions github-actions Bot added the bug Something isn't working label Jun 17, 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.
@oferchen
oferchen force-pushed the fix/uts-dd-exclude-3-dironly-gate branch from 788cd23 to 9835688 Compare June 17, 2026 21:23
@oferchen
oferchen merged commit 1c0471a into master Jun 18, 2026
34 of 64 checks passed
@oferchen
oferchen deleted the fix/uts-dd-exclude-3-dironly-gate branch June 18, 2026 03:32
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant