Remove misleading TreeNodeFilter test added by PR #7415#8663
Merged
Conversation
The `LiteralSegment_RequiresWildcardToMatchNodesWithAdditionalSuffix` test was added in PR #7415 to `document a current limitation'' for #7300. The premise was incorrect: TUnit (the framework that surfaced the issue) does not append `()'' or any suffix to its test node IDs - its `TestFilterService.BuildPath` emits a clean `/{asm}/{namespace}/{class}/{methodName}` path. Direct reflection probe against Microsoft.Testing.Platform 2.0.2 (the version TUnit currently bundles) confirms `TreeNodeFilter` matches all the patterns from the issue, including `/*/*/*/(MyTest1)`, against `/YourTestProjectNameHere/YourTestProjectNameHere/MyTests/MyTest1`. The remaining cases in #7300 are a pre-filter bug in TUnit's `MetadataFilterMatcher.ExtractFilterHints` (filed upstream as thomhurst/TUnit#6026); MTP behaves correctly. The deleted test asserted `MatchesFilter` returns false for path `/A/B/C/MyTest1()`, which is just standard anchored-regex behaviour already covered by `MatchWildcard_MatchesSubstrings` and unrelated to issue #7300, so its presence (with the misleading comment + issue link) hurts more than it helps. The genuinely useful regression test added by the same PR (`OrExpression_WorksForSinglePathSegmentInsideParentheses`) is kept. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the Microsoft.Testing.Platform unit tests by removing a TreeNodeFilter regression test that was documenting an incorrect “limitation” tied to issue #7300, while retaining the genuinely useful OR-expression and actionable-error coverage.
Changes:
- Removes
LiteralSegment_RequiresWildcardToMatchNodesWithAdditionalSuffixfromTreeNodeFilterTeststo avoid preserving misleading behavior documentation tied to #7300. - Keeps existing regression coverage for single-segment OR inside parentheses and for the improved diagnostic when full-path OR is used inside parentheses.
Show a summary per file
| File | Description |
|---|---|
| test/UnitTests/Microsoft.Testing.Platform.UnitTests/Requests/TreeNodeFilterTests.cs | Removes a misleading TreeNodeFilter test while keeping the valid regression/diagnostic tests. |
Copilot's findings
- Files reviewed: 1/1 changed files
- Comments generated: 0
Evangelink
commented
May 28, 2026
Evangelink
left a comment
Member
Author
There was a problem hiding this comment.
Expert Review — PR #8663
| # | Dimension | Verdict | Notes |
|---|---|---|---|
| 1 | Correctness | ✅ | Removing a test whose assertions were based on a false premise (TUnit appending () suffixes). The removed assertions are vacuously "correct" but mislead readers about MTP's actual behavior. |
| 2 | Public API | ✅ | No public API changes. |
| 3 | Backward Compatibility | ✅ | Test-only change; no production code touched. |
| 4 | Thread Safety | ✅ | N/A. |
| 5 | Test Quality | ✅ | The removed test documented a non-existent limitation. The behavior it was supposedly testing (anchored regex semantics) is already covered by MatchWildcard_MatchesSubstrings. Removing it improves the overall test suite honesty. The kept regression tests (OrExpression_WorksForSinglePathSegmentInsideParentheses, FullPathOrInsideParenthesizedExpressions_IsNotSupported_ThrowsActionableMessage) are correct and valuable. |
| 6 | Analyzer Correctness | ✅ | N/A. |
| 7 | Localization | ✅ | N/A. |
| 8 | Null Safety | ✅ | N/A. |
| 9 | TODO Hygiene | ✅ | No TODOs introduced. |
| 10 | Performance | ✅ | N/A. |
| 11 | Build / Packaging | ✅ | N/A. |
| 12 | Documentation | ✅ | The removed comment was actively misleading ("documents a current limitation" that doesn't exist). Removing it is strictly better for maintainability. |
| 13 | Style & Conventions | ✅ | N/A — only lines removed. |
| 14 | Security | ✅ | N/A. |
| 15 | Error Handling | ✅ | N/A. |
| 16 | CLI Options | ✅ | N/A. |
| 17 | MSBuild SDK | ✅ | N/A. |
| 18 | Resource Pipeline | ✅ | N/A. |
| 19 | Parallelism | ✅ | N/A. |
| 20 | Agentic Workflows | ✅ | N/A. |
| 21 | PR Description Quality | ✅ | Exemplary: clear root-cause analysis, reference to the upstream TUnit bug, reflection probe evidence, and precise description of what is kept vs. removed. |
Overall verdict: COMMENT — PR is clean.
The change is well-motivated and strictly improves the test suite. The PR description provides thorough evidence (reflection probe against MTP 2.0.2, upstream TUnit issue thomhurst/TUnit#6026) that the removed test was based on a false premise. No issues found across all 21 review dimensions.
Generated by Expert Code Review (on open) for issue #8663 · sonnet46 1.4M
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.
Context
PR #7415 (commit
32a26954f) addressed--treenode-filterissues reported in #7300:(/*/*/*/MyTest1)|(/*/*/*/MyTest2)crashing with a confusing message) — correctly fixed withFullPathOrInsideParenthesizedExpressions_IsNotSupported_ThrowsActionableMessage./*/*/*/(MyTest1)and friends silently matching zero tests) — hypothesised to be caused by the framework appending a parameter-list suffix (e.g.MyTest1()) to test node IDs, and "documented as a limitation" viaLiteralSegment_RequiresWildcardToMatchNodesWithAdditionalSuffix.Why this is wrong
The premise behind the new "limitation" test is incorrect, and the test should not stay as-is referencing #7300:
TestFilterService.BuildPathemits clean/{assembly}/{namespace}/{className}/{methodName}paths — no().TreeNodeFilteractually matches all the patterns from the issue. A direct reflection probe againstMicrosoft.Testing.Platform 2.0.2(the version TUnit currently bundles) returnedTruefor every failing case in the issue, including/*/*/*/(MyTest1)against/YourTestProjectNameHere/YourTestProjectNameHere/MyTests/MyTest1. The kept regression testOrExpression_WorksForSinglePathSegmentInsideParenthesesalready proves this.MetadataFilterMatcher.ExtractFilterHints. It does a naivefilterString.Split('/')and treatsparts[4]as a literal method-name hint unlessIsWildcardreturns true.IsWildcardonly checks for*/?, so"(MyTest1)"is treated as a literal method name;AotTestDataCollector.CouldDescriptorMatchthen rejects every descriptor before MTP's filter ever sees them. Filed upstream as MetadataFilterMatcher.ExtractFilterHints misinterprets parenthesised path segments as literal method names thomhurst/TUnit#6026.What this PR does
LiteralSegment_RequiresWildcardToMatchNodesWithAdditionalSuffix. Its only behavioural assertion (anchored-regex matching:MyTest1does not matchMyTest1()) is already covered byMatchWildcard_MatchesSubstringsand is unrelated to --treenode-filter pattern matching is at least non obvious, potentially errored #7300; the misleading comment and#7300link were the main reason it existed.OrExpression_WorksForSinglePathSegmentInsideParenthesesand the actionable-error testFullPathOrInsideParenthesizedExpressions_IsNotSupported_ThrowsActionableMessage.Validation
Microsoft.Testing.Platform.UnitTestsbuild: ✅TreeNodeFilterTests(filterFullyQualifiedName~TreeNodeFilterTests): 52 passed, 0 failed (was 53 before removal of the misleading test).Related