fix: treenode filter pre-filter rejects parenthesised segments (#6026) by thomhurst · Pull Request #6027 · thomhurst/TUnit (original) (raw)
MetadataFilterMatcher.IsWildcard only recognised * and ? as non-literal,
so segments like (MyTest1), (A|B), !A, or Foo\.Bar were stored as
literal hints. AotTestDataCollector's string-equality pre-filter then
rejected every descriptor before MTP's TreeNodeFilter ever ran, returning
zero tests for valid filters.
Rename to IsNonLiteralSegment and check the full MTP operator/escape set (* ? ( ) | & ! ). When a segment is non-literal the hint is skipped and MTP's TreeNodeFilter does the authoritative match downstream — no correctness loss, only the optimization is bypassed for that segment.
Adds direct unit tests against ExtractFilterHints (none existed before) plus end-to-end integration tests covering the patterns from the issue.
[](/apps/claude)
…hars
Address PR #6027 review feedback:
- MetadataFilterMatcherTests now throws InvalidOperationException with a clear message if the non-public TreeNodeFilter(string) ctor disappears, instead of a confusing NullReferenceException at .Invoke.
- Expand the _filterOperatorChars comment to call out characters that are deliberately NOT in the set (+ . < > , space ^) so future maintainers don't wonder if they were forgotten.
[](/apps/claude)
[](/apps/claude)
thomhurst deleted the fix/6026-treenode-filter-parentheses branch
claude Bot mentioned this pull request
1 task
This was referenced
May 28, 2026
This was referenced
Jun 13, 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
[ Show hidden characters]({{ revealButtonHref }})