Skip to content

fix: include-list review fixes — last-match negation, empty file, shared helper - #349

Merged
flupkede merged 1 commit into
developfrom
fix/include-list-review-fixes
Oct 17, 2026
Merged

flupkede merged 1 commit into
developfrom
fix/include-list-review-fixes

Conversation

@flupkede

Copy link
Copy Markdown
Owner

Three review findings on the .codesearchinclude feature (PR #346), all confirmed against the code:

  1. !-rules were dead under a decisively-included ancestor. The component loop returned at the FIRST decisive match, so src/ + !src/gen.rs still indexed gen.rs — while the code comments, the CHANGELOG bullet and the commit message all promise "last match along the component chain wins". The loop now tracks the last decisive match and decides after it (root-level negation already worked; ancestor+negation is now pinned by a new test).
  2. A present-but-empty (comments-only) .codesearchinclude indexed NOTHING. A zero-rule matcher answers Match::None for every path, silently emptying the index — contradicting the shipped "absent or empty list keeps the historical behavior" claim. A zero-rule build is now treated as inactive (num_ignores() + num_whitelists() both zero), pinned by a new test.
  3. The semantics existed as two ~45-line copies (walker + watcher), so findings 1–2 each needed synchronized fixes. The watcher now delegates to the shared pub(crate) helpers in file/mod.rs — the two gates can no longer drift.

Validation: fmt clean, clippy --all-targets -D warnings clean, cargo test --lib --bins green (941 tests, incl. the 2 new pins).

…red helper

Review findings on the .codesearchinclude feature (PR #346):
- !-rules were dead under a decisively-included ancestor: the component
  loop returned at the FIRST decisive match, so src/ + !src/gen.rs still
  indexed gen.rs while the docs promise last-match-wins. The loop now
  tracks the last decisive match and decides after it.
- a present-but-empty (comments-only) .codesearchinclude built a matcher
  with zero rules and indexed NOTHING, contradicting the shipped
  'absent or empty = historical behavior' claim. A zero-rule build is
  now inactive (num_ignores + num_whitelists both zero).
- the include semantics existed as two ~45-line copies (walker +
  watcher); the watcher now delegates to the shared pub(crate) helpers
  in file/mod.rs so the two gates cannot drift.
- two new pins: ancestor+negation un-includes, present-but-empty indexes
  everything.
@flupkede
flupkede merged commit 8f0b79c into develop Oct 17, 2026
2 of 6 checks passed
@flupkede
flupkede deleted the fix/include-list-review-fixes branch October 17, 2026 20:45
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.

1 participant