Repository navigation
Extract MSTest's explicit-token tuple predicate - #12045
Conversation
There was a problem hiding this comment.
🧪 Test quality review — PR #12045
Compared merge base 780c775d357d6ca25eee67b9469133dae3ee1730 with head
e8d8290561542b8dea1dd782ac128f521ece8f91. Evidence applies to this head, not
every intermediate commit.
Test-value evidence
This PR touches exactly one contract: TestDataSourceHelpers.IsDataConsideredSingleArgumentValue. The change is a pure extract-method refactor — the inline negated condition !(parameters.Length == 2 && data.Length == 1 && TryHandleTupleDataSource(...) && IsDataWithExplicitCancellationToken(...)) is moved verbatim into a new private helper IsSingleTupleArgumentWithExplicitCancellationToken, with no change to operand order, short-circuit evaluation, or the boolean expression itself. Diffing the extracted body against the removed inline code confirms a textual/semantic match (same operators, same operand order, same helper calls).
- Scenario: single-argument-value detection for a 2-parameter test method (data,
CancellationToken) where the sole supplied data item is a tuple. - Counterfactual: not applicable — there is no behavioral ablation to construct since no branch, operand, or guard changed; this is a structural refactor only.
- Expected result: unchanged outcome before and after for all existing cases (explicit-token tuples, preserved tuple-as-object-array data, explicit/implicit object-array shapes), matching the refactor-test expectation that behavior is identical pre/post.
- Evidence available:
test/UnitTests/MSTestAdapter.PlatformServices.UnitTests/Helpers/TestDataSourceHelpersTests.csalready exercisesIsDataConsideredSingleArgumentValueacross the relevant shapes (IsDataConsideredSingleArgumentValue_RejectsExplicitTokenTuplesForObjectArrayArgument,_PreservesTupleAsObjectArrayData,_PreservesExplicitAndImplicitObjectArrayShapes) and was not modified by this PR, so it continues to protect the now-extracted branch indirectly through the public entry point. This is a static prediction, not executed evidence collected by this workflow — this review does not run tests. The PR description reports an executed green-before/green-after comparison (438 tests passing on both revisions) as author-supplied evidence; that claim was not independently reproduced here. - No new test method was added or needed for a behavior-preserving extraction of this kind; the unchanged existing suite is the correct instrument.
🧵 Parallel safety
PARALLEL-SAFETY RESULT
STATUS: NOT_APPLICABLE
ASSEMBLIES:
none
COUNTS: A=0; B=0; C=0; D=0; Critical=0; High=0; Warning=0; Info=0
TOP_ACTIONS:
none
FINDINGS:
none
NOTES: No changed tests or parallelization configuration were in scope (has_parallel_scope=false, test_count=0, config_count=0).
END PARALLEL-SAFETY RESULT
Per-test assessment
No test methods were added or modified by this PR (test_count = 0). There is nothing to grade.
This advisory review is heuristic and non-blocking.
Re-run the combined review with /review-tests, or only the parallel-safety
specialist with /parallel-audit.
🤖 Automated content by GitHub Copilot. Generated by the Test Quality Review on PR (on open / sync) workflow. · copilot · auto · 39.4 AIC · ⌖ 8.43 AIC · ⊞ 22.3K · ◷
There was a problem hiding this comment.
🟢 Approval recommended
The narrow private extraction preserves existing logic and introduces no identified blocking issues.
No open issues 🎉
What changed in this PR
Improves readability of MSTest’s argument classification without changing behavior.
Changes:
- Extracts the tuple-and-explicit-token condition into a private helper.
- Preserves guards, short-circuit order, and shared token detection.
- Adds a comment explaining why these tuples represent full rows.
Test-value evidence: The PR reports 438 tests passing on both 780c775 and e8d8290. Execution artifacts were not independently verified.
🟢 Confidence at a glance: adapter refactor
The supplied diff preserves the original predicate and evaluation order. No actionable issues remain.
| File | Description |
|---|---|
| src/Adapter/MSTestAdapter.PlatformServices/Helpers/TestDataSourceHelpers.cs | Extracts and documents the explicit-token tuple predicate. |
Review effort: Balanced
This comment has been minimized.
This comment has been minimized.
🔍 Build Failure AnalysisAnalysis incomplete — all 13 application-model acceptance binlogs completed successfully with zero MSBuild errors, but Please inspect the originating [Azure DevOps build]((dev.azure.com/redacted) for the authoritative errors. No inline suggestions or automated changes were emitted because no compiler or MSBuild error could be recovered from the affected logs. 🤖 Generated by the Build Failure Analysis workflow using (a href="(dev.azure.com/redacted) · commit
|
This comment has been minimized.
This comment has been minimized.
|
Final test-triage resolution — Azure Pipelines build 1642025 Analysis is final (completed build, mode Affected build legs: Windows Debug (failed). Windows Release and Linux Release unaffected. Failure signatures (7 failed/retried records):
Conclusion: No actionable regression or durable flaky pattern identified. The one real product-test failure (
|
Resolve the overlap between #12043 and #12045 by retaining one unchanged IsSingleTupleArgumentWithExplicitCancellationToken definition. Removing the duplicate restores compilation, which otherwise fails with CS0111. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: ba332d0f-f512-4fa7-80b6-9731c87a2c96
Pull request
Summary
Make MSTest's single-argument data check easier to read by extracting
IsSingleTupleArgumentWithExplicitCancellationToken. The private helper replaces only the inline negated condition; tuple expansion, supported token values, and short-circuit evaluation are unchanged.Fixes: #12017
Replaces closed #12020. The display-name predicate proposed there is already covered by #12021, so its shared implementation is preserved rather than duplicated.
Design and decision record
No separate record is needed for this private, behavior-preserving extraction. Preserve the existing parameter-count and row-length guards before tuple expansion and explicit-token detection. No public/internal API declarations, package layout, or scheduling configuration change.
Demonstration
Media is not applicable: no user-visible output changes. The focused green-before/green-after comparison below checks unchanged argument binding and display names.
Validation and regression proof
Baseline:
780c775d357d6ca25eee67b9469133dae3ee1730. Tested head:e8d8290561542b8dea1dd782ac128f521ece8f91. Debug configuration, using the repo-local SDK bootstrapped byeng\build.ps1.TestDataSourceHelpersTests,TestMethodInfoTests,MethodInfoExtensionsTestsDataRowAttributeTests,CombinatorialDataAttributeTestsAll runs exited 0 with zero failed or skipped tests. The sorted test identities and outcomes match between the baseline and refactor reports. The following exact head commands were also rerun before publication; each exited 0:
Build result: 0 warnings and 0 errors across net462, net8.0, net9.0, net10.0, net11.0, net8.0-windows10.0.18362.0, and net9.0-windows10.0.17763.0. Legacy UAP was excluded; runtime tests on the other TFMs and package-consuming acceptance tests were not run.
TRX reports are retained locally under
artifacts\TestResults\predicate-pr\asadapter-net8.trx,adapter-net462.trx, andframework-net8.trx; baseline/comparison reports are retained in the session artifacts. These local artifacts have not been uploaded.Test-value evidence
Executed green-before/green-after evidence: the same 438 tests pass on both revisions above. Existing cases distinguish full-arity
Tuple/ValueTuplerows from ordinary single-array data, including explicit tokens,null,Type.Missing, invalid token values, extra tuple elements, argument packing, and display-name shapes. Both modernITupleand legacy reflection tuple paths are exercised. No new behavior or regression test is introduced; a failing baseline is not expected for this extraction.