Repository navigation
Accelerate affected-test collection and prepare isolated CTS comparison - #12191
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Retain both independent unit-project source links and record merged-source validation. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟡 Changes recommended
Teardown can be marked complete while an owned child process is still running, allowing the shared NuGet cache to be deleted before descendant termination is confirmed.
1 open issue
What changed in this PR
This PR accelerates Windows affected-test map collection while preserving ordinary validation and PR test selection. It also adds MTP timing data and prepares an isolated CTS comparison that remains disabled by default.
Changes:
- Introduces bounded, refill-on-completion module scheduling and marked per-run/module NuGet cache reuse.
- Emits available UTC start/stop timestamps from both JSON-RPC serializers, with regression coverage.
- Adds CTS comparison tooling, pipeline gates, artifact checks, and documented validation evidence.
Test-value evidence: For head 2a2240bfeaaaa044b0a41cd5ac4b49e86b341bce, the supplied record reports paired timing/cache/failure-handling checks and complete 74-module collection. These results were not independently executed during this review; live CI and public CTS package flow remain unverified.
| File | Description |
|---|---|
test/Utilities/Microsoft.Testing.TestInfrastructure/WellKnownEnvironmentVariables.cs |
Prevents nested hosts from inheriting the cache opt-in. |
test/UnitTests/Microsoft.Testing.Platform.UnitTests/TestInfrastructure/CollectionPackageCacheTests.cs |
Tests fresh, marked, and invalid cache selection. |
test/UnitTests/Microsoft.Testing.Platform.UnitTests/ServerMode/TestNodeTimingData.cs |
Defines shared timing boundary and state cases. |
test/UnitTests/Microsoft.Testing.Platform.UnitTests/ServerMode/JsonTests.cs |
Tests modern serializer timing output. |
test/UnitTests/Microsoft.Testing.Platform.UnitTests/ServerMode/FormatterUtilitiesTests.cs |
Tests formatter timing output and updates expectations. |
test/UnitTests/Microsoft.Testing.Platform.UnitTests/Microsoft.Testing.Platform.UnitTests.csproj |
Links the cache helper into applicable unit-test targets. |
test/IntegrationTests/MSTest.Acceptance.IntegrationTests/MSTest.Acceptance.IntegrationTests.csproj |
Shares the cache helper with MSTest acceptance tests. |
test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/Helpers/CollectionPackageCache.cs |
Validates explicit, marked collection caches. |
test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/Helpers/AcceptanceFixture.cs |
Enables opt-in cache reuse while retaining fresh-cache defaults. |
src/Platform/Microsoft.Testing.Platform/ServerMode/JsonRpc/SerializerUtilities.TestNodeSerializers.cs |
Adds available UTC endpoints to dictionary serialization. |
src/Platform/Microsoft.Testing.Platform/ServerMode/JsonRpc/Json/Json.TestNodeSerializer.cs |
Adds matching UTC endpoints to modern serialization. |
eng/validate-collection-module-pool.ps1 |
Exercises scheduling budgets, failures, and cleanup. |
eng/validate-affected-tests.ps1 |
Validates CTS isolation and rollout gates. |
eng/pipelines/steps/test-cts-comparison.yml |
Restores CTS, runs comparison, and publishes test results. |
eng/pipelines/steps/test-affected-tests.yml |
Routes Windows collection through the module pool. |
eng/pipelines/steps/build-test-windows.yml |
Separates CTS execution from ordinary test dispatch. |
eng/collection-test-modules.ps1 |
Selects exact module inputs and checks duplicate hashes. |
eng/collection-module-pool.ps1 |
Implements bounded scheduling and process/output cleanup. |
eng/collect-cts-comparison.ps1 |
Runs isolated CTS collection and validates artifacts. |
eng/collect-affected-test-maps.ps1 |
Coordinates collection, metadata, and cache ownership. |
docs/affected-test-selection.md |
Records decisions, measurements, regression evidence, and limitations. |
azure-pipelines.yml |
Adds validation steps and the opt-in CTS job. |
.config/cts/dotnet-tools.json |
Pins CTS in a separate tool manifest. |
Review effort: Balanced
Assign SDK processes to Windows jobs at creation and join retained member handles on completion and failure. Preserve native exits, cleanup diagnostics, process budgets, and existing collection behavior. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Copilot review overview
10 open issues
IfInvoke-CollectionModulePoolfails before successfully creating$resultsDirectory(e.g.,… · New Compiling with/langversion:previewincreases the chance that the script breaks when the… · New Flushing the log writer on every line can significantly increase I/O overhead during long-running… · New The marker filename/content and environment variable name are duplicated here as string literals,… · New These Win32 constants (job limit flags, PROC_THREAD_ATTRIBUTE_* values, CreateProcess flags) are… · New These Win32 constants (job limit flags, PROC_THREAD_ATTRIBUTE_* values, CreateProcess flags) are… · New These Win32 constants (job limit flags, PROC_THREAD_ATTRIBUTE_* values, CreateProcess flags) are… · New These Win32 constants (job limit flags, PROC_THREAD_ATTRIBUTE_* values, CreateProcess flags) are… · NewStreamReader.ReadLineAsync()is used later, but theseFileStreaminstances are created in… · New Verify each input module has exactly one matching map
2 resolved since last review
Review effort: Lite
There was a problem hiding this comment.
🧪 Test quality review — PR #12191
Compared merge base 165333f32123111b70b3ead7f53e40e431c02055 with head e7fb415ebd6900f0717e3a62abd5b690a1890608. Evidence applies to this head only.
Test-value evidence
All entries are static predictions; no paired execution records were available.
-
time.start-utc/time.stop-utcserialization (both serializers).- Tests:
Serialize_TestNodeTiming_PreservesUtcPresenceDurationAndStateinFormatterUtilitiesTestsandJsonTests, plus the updatedAssertSerializeexpectations. - Counterfactual: if either property is dropped, or the
MinValuecheck is removed, the exact JSON equality fails (static prediction: likely killed). - The data cases cover culture, presence and absence of each endpoint, and state.
- Tests:
-
CollectionPackageCache.Select.- Tests:
CollectionPackageCacheTestscover the fresh cache, the marked shared cache, invalid paths, and unmarked or incompatible markers. - Counterfactual: removing the marker check or the path validation is likely killed (static prediction).
AcceptanceFixturewiring is not exercised by a unit test. Unverified.
- Tests:
-
Pipeline, PowerShell and docs changes (
eng/*,azure-pipelines.yml). Not applicable. They are non-executable here and were not assessed.
🧵 Parallel safety
STATUS: PARTIAL. The parallel-safety specialist was not run in this session, so coverage is incomplete and this is not a clean result.
Manual observations:
- The timing tests change
CultureInfo.CurrentCultureand restore it infinally.CurrentCultureis ExecutionContext-local, so this is reasonably safe. CollectionPackageCacheTestsuse unique temp directories per test, so they do not share paths.- The two
.csprojconfiguration changes were not analyzed.
Per-test assessment
Pseudo-mutation evidence below consists of static predictions, not executed mutation results.
<table>
<thead>
<tr><th>Result</th><th>Quality</th><th>Test</th><th>Notes</th><th>How to improve</th></tr>
</thead>
<tbody>
<tr><td>Pass</td><td>A (90–100)</td><td>new <code>FormatterUtilitiesTests.<br>Serialize_<br>TestNodeTiming_<br>PreservesUtcPresenceDurationAndState</code></td><td>Data-driven cases assert dictionary entries and exact JSON.</td><td>None</td></tr>
<tr><td>Pass</td><td>A (90–100)</td><td>new <code>JsonTests.<br>Serialize_<br>TestNodeTiming_<br>PreservesUtcPresenceDurationAndState</code></td><td>Exact JSON equality per timing case and culture.</td><td>None</td></tr>
<tr><td>Pass</td><td>B (80–89)</td><td>new <code>CollectionPackageCacheTests.<br>CollectionSharesOnlyExplicitMarkedRunCache</code></td><td>Asserts the selected path, and that the directory is not deleted.</td><td>None</td></tr>
<tr><td>Pass</td><td>B (80–89)</td><td>new <code>CollectionPackageCacheTests.<br>UnmarkedOrIncompatibleCacheIsRejected</code></td><td>Covers both the missing marker and the wrong marker content.</td><td>None</td></tr>
<tr><td>Pass</td><td>B (80–89)</td><td>new <code>CollectionPackageCacheTests.<br>InvalidCollectionCachePathIsRejected</code></td><td>Empty, whitespace and relative paths all throw.</td><td>None</td></tr>
<tr><td>Pass</td><td>B (80–89)</td><td>new <code>CollectionPackageCacheTests.<br>NormalAcceptanceKeepsFreshPackageCache</code></td><td>Exact path equality for the null shared path.</td><td>None</td></tr>
</tbody>
</table>
No inline comments: no verified, actionable findings were found.
<sub>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.</sub>
🤖 Automated content by GitHub Copilot. Generated by the Test Quality Review on PR (on open / sync) workflow. · copilot · auto · ~29 AIC · ⌖ ~1 AIC · ⊞ 8K
There was a problem hiding this comment.
🔵 Needs a closer look
The new Win32 launcher and concurrent map publication need Windows-maintainer validation, with final-revision execution artifacts unavailable and live Azure multi-agent coordination unverified.
No open issues 🎉
9 resolved since last review
StreamReader.ReadLineAsync()is used later, but theseFileStreaminstances are created in… These Win32 constants (job limit flags, PROC_THREAD_ATTRIBUTE_* values, CreateProcess flags) are… These Win32 constants (job limit flags, PROC_THREAD_ATTRIBUTE_* values, CreateProcess flags) are… These Win32 constants (job limit flags, PROC_THREAD_ATTRIBUTE_* values, CreateProcess flags) are… These Win32 constants (job limit flags, PROC_THREAD_ATTRIBUTE_* values, CreateProcess flags) are… The marker filename/content and environment variable name are duplicated here as string literals,… Flushing the log writer on every line can significantly increase I/O overhead during long-running… Compiling with/langversion:previewincreases the chance that the script breaks when the… IfInvoke-CollectionModulePoolfails before successfully creating$resultsDirectory(e.g.,…
Review effort: Balanced
This comment has been minimized.
This comment has been minimized.
|
Final test-triage resolution — Azure Pipelines build 1662909 Result: inconclusive on recurrence; no issue created. Evidence is incomplete (1 artifact download failure, and history collection hit its download budget), so I can't claim the absence of earlier occurrences. Main failure signature (high confidence on cause):
Classification: a dependency advisory against the NativeAOT compiler package, surfacing as a restore failure under warnings-as-errors. It is not a test-logic defect and is probably not caused by this PR's changes. The failures are deterministic (retries failed identically) and span unrelated tests. I found no passing retry, so there is no flakiness evidence. Not a failure: Not found: no crash or hang diagnostics, no duration regressions (0), and no matching open or closed issue for NU1903/ILCompiler or ModernUwp. Next step: check whether other recent main or scheduled builds fail with the same NU1903 error. If they do, fix it centrally, for example by updating the
|


Pull request
Summary
Affected-test map collection spent 224.42 minutes processing 74 module/framework inputs sequentially, while discovery took only 90 seconds. This reduces repeated startup/setup work without excluding tests or replacing ordinary authoritative validation.
Public SDK/product dependency pins and PR selection/fallback behavior are unchanged. The newer coverage producer's adaptive feedback/batching implementation is not part of this diff; final composed measurements use its committed local packages. CTS activation still requires approved public tool availability. No source issue was supplied.
Design and decision record
Maintained investigation, contracts, decisions, experiments and evidence.
Separate SDK invocations avoid the SDK's unsupported in-invocation parallel-collection option. Exact relative module paths and the repository working directory preserve Git/storage identity. The shared cache is bounded to a parent-owned run/module, not a persistent cache across repacks. Missing/invalid timing is not invented or treated as zero-cost data.
Both serializers also feed the source-only server client package. Larger adaptive batches belong to the coverage producer and conservatively widen associations; they can increase false-positive selections, not omit UIDs. Native collection exits and ordinary test-validation outcomes remain separate.
Demonstration
The scheduling change is demonstrated with reproducible CLI measurements; text is clearer than screenshots for comparing work and elapsed time.
Controlled interleaved samples use the same 2,052-identity startup-heavy fixture across .NET 10 and .NET Framework 4.6.2:
All samples returned 0, retained exact per-module UID/source inventories and every baseline association. Both final samples reported zero timing fallback. This synthetic fixture is not a forecast for the full CI workload.
The complete rebuilt Windows solution was also collected locally: 74/74 modules, 70,935 exact discovered/mapped module identities, 39.444 minutes, 828 measured batches, zero fallback, parent exit 0 and confirmed cleanup. The earlier 224-minute CI run differs in machine/source and is not a controlled full-suite speedup comparison.
Validation and regression proof
PR head:
2a2240bfeaaaa044b0a41cd5ac4b49e86b341bce; merge base:b150f7d75b285c55d49b553d6d143d969be761f0. Implementation commit:24644925e47e5c8d8f55bb8c71e37a8b9d1b9a80. Later commits update this decision/evidence document only. The 22-file implementation/configuration/test identity is771FB071D0C6C76CB5FE78008F4A3A4B6F507EACAC63765952C27167877F545A; the record describes its hashing convention and retained source states.Pinned SDK:
12.0.100-alpha.1.26509.101. Focused execution used .NET 10.0.13 and the installed Windows .NET Framework CLR; acceptance hosts use net12.0/x64 and method-level CPU-count parallelism.Executed commands/results:
The recorded timing commands use
$project = 'test\UnitTests\Microsoft.Testing.Platform.UnitTests\Microsoft.Testing.Platform.UnitTests.csproj'and$timingFilter = 'FullyQualifiedName~FormatterUtilitiesTests|FullyQualifiedName~JsonTests'.$Eis the run-owned result directory used in the retained evidence, not a shared cache/output directory.pwsh -NoProfile -File .\eng\validate-collection-module-pool.ps1pwsh -NoProfile -File .\eng\collect-cts-comparison.ps1 -SelfTestpwsh -NoProfile -File .\eng\validate-affected-tests.ps1 -SelfTest -EnableAffectedTests true -EnableNonWindowsAffectedTests false.\eng\common\dotnet.ps1 build $project -c Debug -v:q "-bl:$E\parent-final-clean-build.binlog"& .\eng\common\dotnet.ps1 test --project $project --framework net10.0 -c Debug --filter $timingFilter -p:UsingDotNetTest=true "-p:ArtifactsTestResultsDir=$E\guard-fixed-timing-net10" "-bl:$E\guard-fixed-timing-net10.binlog" --show-test-results failed& .\eng\common\dotnet.ps1 test --project $project --framework net462 -c Debug --filter $timingFilter -p:UsingDotNetTest=true "-p:ArtifactsTestResultsDir=$E\guard-fixed-timing-net462" "-bl:$E\guard-fixed-timing-net462.binlog" --show-test-results failedpwsh -NoProfile -File .\eng\collect-affected-test-maps.ps1 -Repository Q:\.tmp\testfx-full-collection-ca37d966 -Configuration Release -ChildBudget 4 -MaximumParallelModules 2 -ResultsDirectory Q:\.tmp\testfx-full-corrected-results-ca37d966git --no-pager diff --checkThe isolated full build/pack used the same committed TestFx code with validation-only local storage/feed configuration,
FastAcceptanceTest=true, the final coverage package version18.13.0-local.acceleration.20261031.2and short local product suffixpreview.full1; it completed with zero warnings/errors. Detailed exact expanded commands, config/source identities, archive hashes and all before/after outcomes are preserved in the decision record.Final committed-source MTP binary/source packages were repacked, their nuspec source commits read back, and fresh-cache
project.assets.jsonplus actual consumer DLLs matched the archive payloads. Real final CTS executed/passed both independently planned 1,026-case framework inventories, with UTC TRX values and canonical execution gates passing. Actual built acceptance fixture/DotnetCli/TestHost composition verified eight restores, current package bytes, cache isolation and no nested opt-in leak.Limitations: a successful map collection accepts failed-test batch exit 2 by contract; it does not mean the entire acceptance suite is green. Initial missing-tool/feed/layout and duplicate local-package setup failures were repaired and are excluded from performance/red proof. Live main CI, public dependency flow/CTS restore, Azure multi-agent publishing, release servicing, ARM64/native rebuild and Unix collection are not claimed.
Test-value evidence
Serialize_TestNodeTiming_PreservesUtcPresenceDurationAndStatefixturesCollectionSharesOnlyExplicitMarkedRunCacheModulePoolPreservesNativeFailureDuringOutputErrorModulePoolDrainsEveryPeerAfterCleanupErrorModulePoolRefillsWithoutWaveBarrier,ModulePoolNeverMultipliesChildBudgetManagedModulesAvoidApphostDeduplication,CTSComparisonSharedResultDirectoryIsRejectedThe retained UTC test-set identity, cache/pool mutation hashes, source-only consumer provenance, and profiling evidence distinguishing repeated fixture work from noisy compiler timings are recorded with the implementation. The profiling probes and subsequent acceptance-efficiency subsession changes are not shipping changes in this PR.