Match required glob tokens by any word under ByWordAll [patch] - #96
Merged
matt-edmondson merged 1 commit intoSep 23, 2026
Merged
Conversation
DoesMatchGlob picked AllTokensMatchGlobFilter for required tokens whenever the match option was not ByWordAny, so a "+world" token asked whether *every* word in the text matched the glob "world" rather than whether "world" appeared among them. Any multi-word text failed, making +token filters unusable under ByWordAll. Required tokens now always use AnyTokenMatchesGlobFilter, matching the excluded-token branch a few lines above, which asks the same question and never varied by match option. Fixes #95 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UscjStBJdW3uHm5NR289DX
|
matt-edmondson
deleted the
claude/textfilter-95-required-token-bywordall
branch
September 23, 2026 00:01
matt-edmondson
pushed a commit
that referenced
this pull request
Sep 23, 2026
PR #96 landed after this branch was cut and rewrote the same requiredMatchFunc selection in DoesMatchGlob that the method-group-to- lambda change here touches, leaving the PR conflicted. Resolved as the PR described: keep #96's always-Any choice for required tokens, and retain the captured caseSensitivity argument so the required call site still honours the sensitivity. Both sides' tests survive the resolution: 84 pass, 0 fail (this branch's 79 plus #96's 5). Restoring this branch's side of the hunk fails 2 of #96's ByWordAll required-token tests, which is what pins the choice. Release build clean across all five TFMs, 0 warnings. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017wK8pxTxpgg3R2m3siPY3Y
This was referenced Sep 23, 2026
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.



Fixes #95
DoesMatchGlobchose its required-token matcher from the match option:Under
ByWordAllthat asks whether every word in the text matches the globworld, rather than whetherworldappears among them. SoDoesMatchGlob("hello world", "hello* +world", ByWordAll)returnedfalse—"hello"does not matchworld. Any text with more than one word fails, which makes+tokenunusable in that mode.The fix
Required tokens now always use
AnyTokenMatchesGlobFilter, as the issue suggests, and theByWordAllbranch is gone.The asymmetry the issue points at is the argument for it: excluded tokens, six lines above, have always used
AnyTokenMatchesGlobFilterunder every match option. A required token and an excluded token ask the same question — does this token appear among the text's words — and only differ in what they do with the answer. There was never a reason for one to vary by match option while the other did not, which is why this reads as a copy/paste slip rather than a decision. A comment at the call site now says so, since "always Any" is otherwise the kind of line a later reader would try to make symmetric with the optional-token branch just above it.The match option still does its job for the optional tokens, whose
Any/Allbranch is untouched:ByWordAllmeans the text must match all of the optional tokens, not every word must match each required token.Tests
Three cases in
TextFilterTests, all underByWordAll, which the issue notes had no+tokencoverage at all — every existing required-token test passesByWordAny.DoesMatchGlobWithRequiredTokenByWordAllReturnsTrue"hello world"against"hello* +world"istrueDoesMatchGlobWithAllRequiredTokensByWordAllReturnsTrueDoesMatchGlobWithMissingRequiredTokenByWordAllReturnsFalsefalse— the fix widens what matches, and this is what stops it widening to everythingConfirmed the tests depend on the change by substituting the original
requiredMatchFuncback in and re-running: 2 failed, 69 passed, both as assertion failures on the two positive cases.The third passes either way, by design —
+missingmatches no word, soAnyandAllagree. It is kept as the regression guard for the direction this change could have broken, and is not evidence for the fix.Full suite green on the fix: 71 total, 0 failed (68 before, 3 added). Release build clean, zero warnings.
Not covered
AllTokensMatchGlobFilteris public API and keeps its own tests; this only stopsDoesMatchGlobreaching for it in a place where it answered the wrong question.DoesMatchRegexhas no token types at all, so itsAny/Allbranch is a different thing that happens to look similar, and is untouched.🤖 Generated with Claude Code
https://claude.ai/code/session_01UscjStBJdW3uHm5NR289DX
Generated by Claude Code