Skip to content

Add experimental MSTest JSON-RPC discovery reuse - #11853

Merged
Amaury Levé (Evangelink) merged 5 commits into
mainfrom
dev/amauryleve/mstest-discovery-cache
Oct 9, 2026
Merged

Amaury Levé (Evangelink) merged 5 commits into
mainfrom
dev/amauryleve/mstest-discovery-cache

Conversation

@Evangelink

Copy link
Copy Markdown
Member

Repeated selected-test requests in native MTP server mode currently rediscover the entire assembly. This adds application-scoped reuse of eligible reflection metadata to reduce that cost while preserving live discovery behavior.

Approach and scope

  • Experimental and off by default. Set MSTEST_EXPERIMENTAL_DISCOVERY_CACHE=1 or true to opt in; MSTEST_DISABLE_DISCOVERY_CACHE=1 or true overrides it. Both are read per run request. The default path performs no cache eligibility inspection.
  • Only JSON-RPC server requests selecting GUID UIDs qualify. Catalogs retain allowlisted inert metadata, index UIDs and produce fresh execution descriptors. Test instances, fixture state and data-source results are never cached. Unsafe types, including DynamicData, DataRow and custom attributes, are rediscovered even when unselected.
  • Preserve source ordering, existing filtering, full discovery counts and single-flight discovery telemetry. Assembly/provider identity, file metadata, settings and culture changes invalidate catalogs; application shutdown releases them.
  • Console, VSTest, dotnet-test pipe, non-GUID filters, generated reflection providers, hot reload, custom factories and unsupported runtimes retain baseline discovery. Native MSTest has no treenode-filter option. No new public API.

Validation

All local results below use the final restored payload at 724795be78efc22f0596b6433b159579c27af503 (MSTest 4.6.0-dev, MTP/client 2.6.0-dev), on Windows:

  • Release shipping pack succeeded with zero warnings/errors.
  • Packed acceptance: 3/3 passed, covering Reflection, Rooting and ReflectionFree. Each compares 19 request snapshots across default, enabled, kill-switch and invalid-opt-in modes. Coverage includes changing live data, row identities, settings, fixtures, unknown/empty selections and failure/recovery.
  • Cancellation/recovery waits for the server's correlated terminal response after a real $/cancelRequest, not merely caller cancellation or a settle delay.
  • Console and dotnet-test FQN/GUID routes and VSTest produce identical results and meaningful diagnostic logs with no cache messages. Temporarily removing the protocol guard made the reflection GUID pipe test fail; the guard was restored before the final pack and acceptance rerun.
  • Adapter 140/140 and PlatformServices 1125/1125 unit tests passed. UTF-8 BOM and internal API baselines checked.
  • Six composed Stryker runs exited 0: enabled hosts recorded 1009 hits each, disabled hosts zero. All had identical 1005 test identities and per-mutant coverage/killer sets, with 6 Killed, 2 Ignored, 1 NoCoverage. Production assemblies were restored. Post-run physical hashes matched five packed package families, nine isolated-cache consumers and six real-project DLL/package matches.

Independent Claude Opus 5.5 review found no blocking discrepancy for this narrow experimental recommendation. That is not CI, merge or shipping approval.

Performance and trade-offs

108 fresh hosts and 3924 timed requests, with six balanced blocks, covered 100/1000/5000-test fixtures and 0/10/50% live-type mixes. For one selected test in a 90/10 mix, paired median RPC speedups were 2.64x [2.14, 2.99] at 1000 tests and 3.64x [3.33, 4.25] at 5000 (paired-block bootstrap 95% intervals). At 50% live types, the corresponding gains were 1.88x and 2.26x with outcome parity.

These are synthetic fast tests on one shared Windows machine, not broad application compatibility or universal small-suite benefit. The first eligible run pays catalog construction: observed paired cold overhead was about +4 to +22 ms at 1000 tests and +22 to +88 ms at 5000. Catalog eviction reclaimed approximately 0.53/2.78 MiB of managed heap for 900/4500 reusable tests. Turning opt-in off stops reuse but retains an existing catalog until invalidation/shutdown. Discovery-only requests do not warm it. Overlapping RPC telemetry isolation is not claimed.

No full-Stryker or end-to-end runtime improvement is claimed. Package documentation records eligibility, fallbacks and costs. Raw measurements, TRX, reports and payload provenance are preserved in session artifacts.

Release boundary

Target the upcoming MSTest 4.6/MTP 2.6 line only. No servicing backport or downstream default enablement. Supported-OS PR CI, full acceptance and UWP/.NET Framework fallback validation remain merge prerequisites; release-branch and cross-platform execution have not been verified locally. The implementation owner retains responsibility for evidence-backed promotion or removal of the experimental flag.

Related issue: N/A.

Keep repeated GUID selections opt-in and reuse only inert reflection metadata, rediscovering live types and creating fresh execution descriptors. Preserve baseline routes, lifecycle, cancellation and filtering with packed parity coverage.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: e085e21a-57c7-4c4e-a32e-03cce215a62c
Copilot AI balanced review requested due to automatic review settings October 9, 2026 07:33
@github-actions github-actions Bot added the needs/merge-conflict-resolution PR has merge conflicts that must be resolved. label Oct 9, 2026
Preserve both discovery-cache and FSharp-module internal API declarations. Repack and verify all three packed metadata modes plus adapter and PlatformServices unit suites.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: e085e21a-57c7-4c4e-a32e-03cce215a62c
@github-actions github-actions Bot added state/needs-review Awaiting review from the team. and removed needs/merge-conflict-resolution PR has merge conflicts that must be resolved. labels Oct 9, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The reflection-cache lifecycle spans discovery, execution, telemetry, concurrency, and multiple runtimes, while cross-platform and fallback CI validation remains pending.

0 open findings

What changed in this PR

Adds opt-in discovery metadata reuse for repeated GUID-selected MSTest JSON-RPC server requests.

Changes:

  • Introduces application-scoped metadata caching with conservative eligibility and invalidation.
  • Preserves live discovery, filtering, ordering, telemetry, cancellation, and fallback behavior.
  • Adds extensive unit, packed acceptance, API-baseline, and package-documentation coverage.
File Description
test/​UnitTests/​MSTestAdapter.UnitTests/​MSTestDiscoveryCacheTests.cs Tests cache correctness, invalidation, isolation, and concurrency.
test/​IntegrationTests/​MSTest.Acceptance.IntegrationTests/​MtpDiscoveryCacheTests.cs Validates packed server-mode parity and fallback routes.
src/​Adapter/​MSTestAdapter.PlatformServices/​Telemetry/​MSTestTelemetryDataCollector.cs Supports telemetry snapshot and replay.
src/​Adapter/​MSTestAdapter.PlatformServices/​InternalAPI/​InternalAPI.Unshipped.txt Tracks new PlatformServices internals.
src/​Adapter/​MSTestAdapter.PlatformServices/​Execution/​TestExecutionManager.cs Allows injecting the cached discoverer.
src/​Adapter/​MSTestAdapter.PlatformServices/​Discovery/​UnitTestDiscoverer.cs Separates returned candidates from full discovery counts.
src/​Adapter/​MSTestAdapter.PlatformServices/​Discovery/​AssemblyEnumeratorWrapper.cs Supports targeted type enumeration and observation.
src/​Adapter/​MSTestAdapter.PlatformServices/​Discovery/​AssemblyEnumerator.cs Adds per-type discovery observation.
src/​Adapter/​MSTest.TestAdapter/​TestingPlatformAdapter/​TestApplicationBuilderExtensions.cs Registers the application-scoped cache.
src/​Adapter/​MSTest.TestAdapter/​TestingPlatformAdapter/​MSTestTestFramework.cs Gates reuse to eligible JSON-RPC requests.
src/​Adapter/​MSTest.TestAdapter/​TestingPlatformAdapter/​MSTestDiscoveryCache.cs Implements catalog construction, reuse, and invalidation.
src/​Adapter/​MSTest.TestAdapter/​PACKAGE.md Documents experimental activation and limitations.
src/​Adapter/​MSTest.TestAdapter/​InternalAPI/​uwp/​InternalAPI.Unshipped.txt Updates the UWP internal API baseline.
src/​Adapter/​MSTest.TestAdapter/​InternalAPI/​InternalAPI.Unshipped.txt Updates the adapter internal API baseline.

🧠 Review effort: Balanced


💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Copilot AI balanced review requested due to automatic review settings October 9, 2026 07:46
@microsoft-github-policy-service microsoft-github-policy-service Bot added state/needs-review Awaiting review from the team. and removed state/needs-review Awaiting review from the team. labels Oct 9, 2026
@github-actions github-actions Bot added state/needs-review Awaiting review from the team. and removed state/needs-review Awaiting review from the team. labels Oct 9, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧪 Test quality review — PR #11853

🧵 Parallel safety

Status: CLEAN (Critical=0, High=0, Warning=0, Info=2)

Test assembly Scope Workers Notes
MSTestAdapter.UnitTests (MSTestDiscoveryCacheTests) off — runs under the internal TestContainer engine (TestFramework.ForTestingMSTest), which has no concurrent scheduler n/a Sequential by construction
MSTest.Acceptance.IntegrationTests (outer) MethodLevel CPU count Pre-existing acceptance assembly setting
DiscoveryCacheHost (generated child asset embedded in the new test) MethodLevel, Workers = 2 2 Single-use generated fixture, not shipped test code

i️ Info — MSTestDiscoveryCacheTests.cs:604-651,701-706: DiscoveryFixture mutates process-global PlatformServiceProvider.Instance, MSTestTelemetryDataCollector.Current, and LiveData statics, restoring them in Dispose(). This is readiness-only: the owning engine has no parallel scheduler today, and the pattern matches existing sibling files in the same project (MSTestDiscovererTests.cs, TestResultRecorderExtensionsTests.cs). No action needed now; if this engine ever gains concurrency, these globals would need explicit mutual exclusion.

i️ Info — MSTestDiscoveryCacheTests.cs:439-454: ConcurrentHitsReturnIndependentMetadataWithoutChangingTheCatalog runs 16 concurrent Task.Run discoveries against one shared MSTestDiscoveryCache, but this exercises production-code internal locking (lock (_gate)), not cross-test parallelism — the suite itself runs sequentially. Not a hazard.

The new integration test's shared probe directory/events file usage was also checked: every [DataRow]/route variant allocates its own sub-directory, and in-process Probe.Record writes are serialized with a lock. No races found.

Per-test grades

All 23 new unit tests in MSTestDiscoveryCacheTests.cs and the single new acceptance test method (RepeatedSelectedRequestsMatchUncachedExecution, exercised via 3 [DataRow] metadata modes) were graded. Every test earned A: each uses exact-value AwesomeAssertions (Should().Equal(...), Should().Be(...)) against concrete production state rather than bare non-null checks, follows clear Arrange-Act-Assert structure under ~25 lines, and a pseudo-mutation walk of MSTestDiscoveryCache.GetTests/IsTypeSafe/AreAttributesSafe/CloneMetadata found no meaningful mutation (cache-key invalidation fields, unsafe-type detection, GUID multimap ordering, cloned-vs-original metadata independence, cancellation gating, telemetry replay) that these tests would fail to kill. No inline findings were needed.

GradeTestMutationNotesHow to improve
A (90–100)new MtpDiscoveryCacheTests.
RepeatedSelectedRequestsMatchUncachedExecution
N/A (process-level parity test)Verifies byte-identical TRX/event parity across default/enabled/disabled/invalid modes and all host routes.—
A (90–100)new MSTestDiscoveryCacheTests.
AlreadyCancelledRequestDoesNotPreventLaterDiscovery
2/2 killedConfirms a pre-cancelled token still performs baseline discovery and later requests succeed.—
A (90–100)new MSTestDiscoveryCacheTests.
CacheHitReplaysFullSourceAttributeTelemetryIncludingUnselectedTests
3/3 killedExact telemetry-count equivalence between cold scan and cache hit, including unselected tests.—
A (90–100)new MSTestDiscoveryCacheTests.
CancellationDuringColdScanDoesNotPublishAPartialCatalog
3/3 killedVerifies a catalog is not published on cancellation and a later scan still succeeds.—
A (90–100)new MSTestDiscoveryCacheTests.
ChangedSettingsXmlInvalidatesTheCatalog
3/3 killedSettings-XML change forces rescan; identical settings still hit the cache.—
A (90–100)new MSTestDiscoveryCacheTests.
ColdResultsAndRepeatedHitsHaveIndependentMutableMetadata
4/4 killedMutating a returned element never leaks into subsequent cache hits across all mutable fields.—
A (90–100)new MSTestDiscoveryCacheTests.
ConcurrentHitsReturnIndependentMetadataWithoutChangingTheCatalog
2/2 killed16 concurrent hits each get independently mutable metadata without corrupting the shared catalog.—
A (90–100)new MSTestDiscoveryCacheTests.
CustomAttributeGetterRemainsLiveWithoutAnyDataSource
2/2 killedA live custom-category getter re-evaluates on every hit even with no data source.—
A (90–100)new MSTestDiscoveryCacheTests.
DeploymentClassMetadataIsRediscoveredEvenWhenUnselected
2/2 killedUnsafe deployment-item types are rediscovered live even when unselected.—
A (90–100)new MSTestDiscoveryCacheTests.
DisposedCacheFallsBackToCompleteBaselineDiscovery
2/2 killedDisposal forces a full baseline rescan rather than reusing a stale catalog.—
A (90–100)new MSTestDiscoveryCacheTests.
DiscoveryWarningsRejectTheEntireCatalog
2/2 killedA discovery warning on one type prevents the whole catalog from being published.—
A (90–100)new MSTestDiscoveryCacheTests.
DuplicateAndUnknownSelectionsPreserveBaselineTypeOrder
2/2 killedDuplicate/unknown UIDs in selection don't break baseline source-ordering.—
A (90–100)new MSTestDiscoveryCacheTests.
EmptyAndUnknownSelectionsStillInvokeLiveProviders
2/2 killedLive dynamic-data providers still run for empty/unknown selections, observing side effects.—
A (90–100)new MSTestDiscoveryCacheTests.
EmptySelectionReturnsNoReusableCandidatesButRetainsFullCount
1/1 killedEmpty selection yields zero candidates while preserving the full discovered count.—
A (90–100)new MSTestDiscoveryCacheTests.
FirstSelectionDoesNotPoisonCatalogForLaterSelection
3/3 killedA narrow first selection still allows a later, different selection to hit the same catalog.—
A (90–100)new MSTestDiscoveryCacheTests.
GuidMultimapRetainsAllCatalogEntriesWithTheSameUid
2/2 killedTwo catalog entries sharing a GUID are both returned as distinct instances, in order.—
A (90–100)new MSTestDiscoveryCacheTests.
InheritedCustomAttributeGetterRemainsLiveWhenUnselected
2/2 killedAn inherited live category getter re-evaluates on an unselected hit.—
A (90–100)new MSTestDiscoveryCacheTests.
LiveDiscoveryWarningsDoNotReplaceOrMutateTheCatalog
2/2 killedA warning on a live (unsafe) type doesn't corrupt or replace the existing safe-type catalog.—
A (90–100)new MSTestDiscoveryCacheTests.
MetadataInspectionFailureRetainsBaselineDiscoveryAndRecovery
2/2 killedMetadata-inspection failure disables caching and recovers once the failure clears.—
A (90–100)new MSTestDiscoveryCacheTests.
NeutralResourceAssemblyMetadataAllowsCatalogHits
2/2 killedAn inert BCL assembly attribute does not block catalog eligibility.—
A (90–100)new MSTestDiscoveryCacheTests.
NewCacheOwnerDoesNotReuseAnotherOwnersCatalog
2/2 killedCatalogs are isolated per cache-owner instance; a new owner always rescans.—
A (90–100)new MSTestDiscoveryCacheTests.
RemovingSourceEvictsItsCatalog
2/2 killedSetSources correctly evicts a source's catalog when it's no longer present.—
A (90–100)new MSTestDiscoveryCacheTests.
UnknownSelectionReturnsNoReusableCandidatesButRetainsFullCount
1/1 killedUnknown UID selection yields zero candidates while retaining the full count.—
A (90–100)new MSTestDiscoveryCacheTests.
UnselectedDynamicProviderProducesFreshRowsInBaselineTypeOrder
3/3 killedA dynamic-data type produces fresh rows with unique indices even when unselected, in order.—

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.

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • github.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "github.com"

See Network Configuration for more information.

🤖 Automated content by GitHub Copilot. Generated by the Test Quality Review on PR (on open / sync) workflow. · copilot · auto · 315.3 AIC · ⌖ 7.41 AIC · ⊞ 19.6K · ◷

@microsoft-github-policy-service microsoft-github-policy-service Bot added state/needs-review Awaiting review from the team. and removed state/needs-review Awaiting review from the team. labels Oct 9, 2026
@github-actions github-actions Bot added state/needs-review Awaiting review from the team. and removed state/needs-review Awaiting review from the team. labels Oct 9, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The package documentation incorrectly implies that later live-type warnings evict an existing catalog.

1 open finding

🧠 Review effort: Balanced

@microsoft-github-policy-service microsoft-github-policy-service Bot added state/needs-review Awaiting review from the team. and removed state/needs-review Awaiting review from the team. labels Oct 9, 2026
@github-actions github-actions Bot added state/needs-review Awaiting review from the team. and removed state/needs-review Awaiting review from the team. labels Oct 9, 2026
Distinguish initial warning rejection from live warnings on later cache hits.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: e085e21a-57c7-4c4e-a32e-03cce215a62c
Copilot AI balanced review requested due to automatic review settings October 9, 2026 08:10
@github-actions github-actions Bot added state/needs-review Awaiting review from the team. and removed state/needs-review Awaiting review from the team. labels Oct 9, 2026
@microsoft-github-policy-service microsoft-github-policy-service Bot removed the state/needs-review Awaiting review from the team. label Oct 9, 2026
@Evangelink
Amaury Levé (Evangelink) enabled auto-merge (squash) October 9, 2026 10:26
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: e085e21a-57c7-4c4e-a32e-03cce215a62c
Copilot AI balanced review requested due to automatic review settings October 9, 2026 10:32
@github-actions github-actions Bot added state/needs-review Awaiting review from the team. and removed state/needs-review Awaiting review from the team. labels Oct 9, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Reflection metadata reuse spans discovery semantics, application lifetime, cancellation, and invalidation, warranting final human review and cross-platform CI.

0 open findings

🧠 Review effort: Balanced

@microsoft-github-policy-service microsoft-github-policy-service Bot added state/needs-review Awaiting review from the team. and removed state/needs-review Awaiting review from the team. labels Oct 9, 2026
@github-actions github-actions Bot added state/approved Proposal approved; ready for implementation. and removed state/needs-review Awaiting review from the team. labels Oct 9, 2026
@github-actions

This comment has been minimized.

@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Final test-triage resolution — Azure Pipelines build 1629558

This supersedes any preliminary comment for this build.

Affected leg: Linux Release (Test task), job result failed.

Actionable failure — product/test defect in this PR's own new feature:

MSTest.Acceptance.IntegrationTests → MtpDiscoveryCacheTests.RepeatedSelectedRequestsMatchUncachedExecution failed deterministically for all three parameterized variants on net11.0 (SourceGeneration, Reflection, AotSourceGeneration):

  • Primary assertion: Assertion failed. Expected values to be equal. on CACHE: UID A 1d94541e-0c0c-8bc5-953f-2c28d8191261 (the discovery-cache UID stability check added by this PR).
  • Each failure is immediately followed by a native createdump crash (signal 6, SIGABRT) of the DiscoveryCacheH* host process, and then a secondary unhandled harness exception: System.InvalidOperationException: Process was not started by this object... at Program.RunSequence (Process.get_ExitCode). This secondary exception looks like a cascading effect of the host aborting mid-test rather than an independent bug.
  • Source: test/IntegrationTests/MSTest.Acceptance.IntegrationTests/MtpDiscoveryCacheTests.cs:421.

Platform-specific signal: the identically-named test (same 3 variants, multiple attempts) passed on Windows Release in this same build (confirmed via both CTRF and JUnit reports). This matches the PR description, which states validation was done only on Windows and explicitly flags "release-branch and cross-platform execution have not been verified locally." This strongly suggests the new discovery-cache UID/eligibility logic has a Linux-specific defect (or the native host crashes under Linux's process semantics), surfaced for the first time by this PR's own acceptance test.

Evidence completeness: metadata.json reports evidenceIncomplete: true with one artifact download failure; the structured results.json/history.json collector could not retrieve the TestResults_Linux_Release_Attempt1 artifact, so this finding is based on the Azure Pipelines timeline issue text, not a parsed CTRF/TRX record. history.json's tracked candidate families only cover windows_app_model_diagnostics probes, so there is no historical data for this test on Linux — no claim is made about prior occurrences.

Not actionable: the other 6 failures in results.json (WinUIMtpPackagedApp.UnitTest1.RetryFailsFirstAttempt, NativeTests.Outcome ×4, PackagedWinUI...RetryTestMethod_PassesOnSecondAppContainerHost) are intentionally-failing retry/host-failure probes used to validate the Windows retry/AppContainer infrastructure itself (their own messages state "This probe deliberately fails..." / "expected host failure"); these are consistent with the same pattern seen across prior main builds in history and are not real regressions.

Conclusion: no issue created. This failure is scoped entirely to this PR's own new, experimental, Windows-only-validated discovery-cache feature and has no history on unrelated commits or main/scheduled builds, so the durable-issue thresholds are not met — the fix belongs in this PR.

Next step: investigate why MtpDiscoveryCacheTests cache-UID stability fails on Linux and why the native host process aborts (signal 6) during the selected-request replay path, most likely in the discovery-cache eligibility/invalidation logic or the process lifetime assumptions in the Linux-hosted MTP native server. Re-running the Linux leg after a fix, plus obtaining the full crash dump (artifacts/TestResults/Release/MSTest.Acceptance.IntegrationTests_*_crash.dmp, only available in Azure DevOps) in a Linux diagnostic session, would confirm the root cause.

🤖 Automated content by GitHub Copilot. Generated by the Pipeline Test Triage workflow. · copilot · auto · 81.3 AIC · ⌖ 5.82 AIC · ⊞ 9.7K

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: e085e21a-57c7-4c4e-a32e-03cce215a62c
Copilot AI balanced review requested due to automatic review settings October 9, 2026 12:21
@github-actions github-actions Bot added state/approved Proposal approved; ready for implementation. and removed state/approved Proposal approved; ready for implementation. labels Oct 9, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Cross-request reflection caching affects discovery, execution, cancellation, telemetry, and multiple runtime modes, while supported-OS validation remains pending.

0 open findings

🧠 Review effort: Balanced

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧪 Test quality review — PR #11853

🧵 Parallel safety

STATUS: FINDINGS (Warning/Info only — no Critical or High risk, no fix required)

Test assembly Scope Workers Analyzer coverage
Microsoft.VisualStudio.TestPlatform.MSTestAdapter.UnitTests off (TestContainer engine has no parallel scheduler) n/a n/a
MSTest.Acceptance.IntegrationTests MethodLevel (pre-existing [assembly: Parallelize], unchanged by this PR) CPU count pending parallel-safety analyzers
  • [Warning · A · High confidence] test/UnitTests/MSTestAdapter.UnitTests/MSTestDiscoveryCacheTests.cs — DiscoveryFixture mutates process-global statics (PlatformServiceProvider.Instance, MSTestTelemetryDataCollector.Current, LiveData.*), also touched by sibling files in the same assembly. No live race today because MSTestAdapter.UnitTests runs on the sequential TestContainer engine. Readiness-only: if this project ever adopts [Parallelize], these classes would need [DoNotParallelize] or a shared [ResourceLock]. No action needed now.
  • [Info · D · High confidence] test/IntegrationTests/MSTest.Acceptance.IntegrationTests/MtpDiscoveryCacheTests.cs — the fixed AssetName = "DiscoveryCacheHost" cannot collide because TestAsset.GenerateAssetAsync allocates a fresh randomly-suffixed temp directory per call, and no other file reuses that id. Context only, not a defect.

No inline parallel-safety comment is warranted: both findings are readiness-only/context, with no concrete present-day race or fix.

Per-test grades

GradeTestMutationNotesHow to improve
A (90–100)new MtpDiscoveryCacheTests.
RepeatedSelectedRequestsMatchUncachedExecution
4/4 killedByte-for-byte parity across console/UID/dotnet-test/vstest routes, UID stability, and kill-switch override, across 3 metadata modes; this test already caught a real Linux-only host crash in CI.—
A (90–100)new MSTestDiscoveryCacheTests.
AlreadyCancelledRequestDoesNotPreventLaterDiscovery
1/1 killedVerifies a pre-cancelled token still falls back to full discovery, not a stuck/empty result.—
A (90–100)new MSTestDiscoveryCacheTests.
CacheHitReplaysFullSourceAttributeTelemetryIncludingUnselectedTests
1/1 killedAsserts cache hits replay identical discovery-attribute telemetry counts as a cold scan.—
A (90–100)new MSTestDiscoveryCacheTests.
CancellationDuringColdScanDoesNotPublishAPartialCatalog
1/1 killedConfirms a cancelled cold scan never publishes a half-built catalog for later hits.—
A (90–100)new MSTestDiscoveryCacheTests.
ChangedSettingsXmlInvalidatesTheCatalog
1/1 killedExact pre/post full-scan counts prove settings-XML changes invalidate the catalog.—
A (90–100)new MSTestDiscoveryCacheTests.
ColdResultsAndRepeatedHitsHaveIndependentMutableMetadata
1/1 killedMutates returned elements across three fetches and asserts no shared-reference leakage between hits.—
A (90–100)new MSTestDiscoveryCacheTests.
ConcurrentHitsReturnIndependentMetadataWithoutChangingTheCatalog
1/1 killed16 concurrent cache hits each get independently-mutable metadata without corrupting the shared catalog.—
A (90–100)new MSTestDiscoveryCacheTests.
CustomAttributeGetterRemainsLiveWithoutAnyDataSource
1/1 killedExact category-value change on a second request proves custom attributes stay live even when unselected.—
A (90–100)new MSTestDiscoveryCacheTests.
DeploymentClassMetadataIsRediscoveredEvenWhenUnselected
1/1 killedDeployment-item path change between runs is reflected in the second result, proving no stale-cache leak.—
A (90–100)new MSTestDiscoveryCacheTests.
DisposedCacheFallsBackToCompleteBaselineDiscovery
1/1 killedDisposing mid-flight still returns the full baseline set rather than a stale/partial cached result.—
A (90–100)new MSTestDiscoveryCacheTests.
DiscoveryWarningsRejectTheEntireCatalog
1/1 killedA discovery warning on first scan is shown to block catalog publication (second scan re-warns identically).—
A (90–100)new MSTestDiscoveryCacheTests.
DuplicateAndUnknownSelectionsPreserveBaselineTypeOrder
1/1 killedDuplicate + unknown UIDs in one request still yield baseline type ordering, not scrambled or duplicated output.—
A (90–100)new MSTestDiscoveryCacheTests.
EmptyAndUnknownSelectionsStillInvokeLiveProviders
1/1 killedLive data-provider values change between empty/unknown-selection requests, proving providers are never cached.—
A (90–100)new MSTestDiscoveryCacheTests.
EmptySelectionReturnsNoReusableCandidatesButRetainsFullCount
1/1 killedEmpty selection yields zero candidates while total discovered count is still correct.—
A (90–100)new MSTestDiscoveryCacheTests.
FirstSelectionDoesNotPoisonCatalogForLaterSelection
2/2 killedFirst narrow selection is shown not to corrupt the catalog for a later, different selection.—
A (90–100)new MSTestDiscoveryCacheTests.
GuidMultimapRetainsAllCatalogEntriesWithTheSameUid
1/1 killedTwo catalog entries sharing one UID are both returned and are distinct instances — the multimap isn't collapsed.—
A (90–100)new MSTestDiscoveryCacheTests.
InheritedCustomAttributeGetterRemainsLiveWhenUnselected
1/1 killedInherited custom-category attribute stays live (re-evaluated) across requests even when unselected.—
A (90–100)new MSTestDiscoveryCacheTests.
LiveDiscoveryWarningsDoNotReplaceOrMutateTheCatalog
1/1 killedA later live-type warning is surfaced but proven not to replace/corrupt the existing cached catalog.—
A (90–100)new MSTestDiscoveryCacheTests.
MetadataInspectionFailureRetainsBaselineDiscoveryAndRecovery
2/2 killedMetadata-inspection exceptions fall back to full discovery, and recovery once the exception clears is verified.—
A (90–100)new MSTestDiscoveryCacheTests.
NeutralResourceAssemblyMetadataAllowsCatalogHits
1/1 killedA real inert BCL assembly attribute is shown not to block cache eligibility.—
A (90–100)new MSTestDiscoveryCacheTests.
NewCacheOwnerDoesNotReuseAnotherOwnersCatalog
1/1 killedA second cache instance never reuses the first owner's catalog, even after the first is disposed.—
A (90–100)new MSTestDiscoveryCacheTests.
RemovingSourceEvictsItsCatalog
1/1 killedDropping a source from SetSources is shown to evict and force a fresh full scan.—
A (90–100)new MSTestDiscoveryCacheTests.
UnknownSelectionReturnsNoReusableCandidatesButRetainsFullCount
1/1 killedAn unknown UID yields zero candidates while total discovered count remains correct.—
A (90–100)new MSTestDiscoveryCacheTests.
UnselectedDynamicProviderProducesFreshRowsInBaselineTypeOrder
2/2 killedChanged dynamic-data row count/values between requests prove the data provider is re-invoked, not cached.—

Summary

  • 24 gradable test methods (23 unit tests in MSTestDiscoveryCacheTests + 1 parameterized acceptance test in MtpDiscoveryCacheTests), all A. Assertions are precise (exact equality/sequence/value checks, not just non-null), scope is narrow per test, and the suite systematically covers cache eligibility, invalidation, concurrency, telemetry replay, warnings, and cross-owner isolation.
  • Parallel safety: no live race. The only two findings are readiness-only (sequential TestContainer engine today) and contextual (unique per-call temp directories); no fix is required and no inline comment is warranted.
  • For context (not part of this review's scope): CI's automated pipeline-test-triage already flagged that RepeatedSelectedRequestsMatchUncachedExecution is currently failing deterministically on the Linux Release leg (native host SIGABRT), which the test itself caught as a genuine product defect in this PR's new feature — a strong signal of this test's effectiveness, but a merge blocker the author still needs to fix.
  • Existing automated review threads (github-code-quality suggestions around Where/Select refactors, and the PACKAGE.md warning-semantics clarification) are already resolved with author replies; no new duplicate findings raised here.
  • No inline comments were posted: no verified, actionable defect met the publication bar independent of the already-resolved threads and the pre-existing CI triage.

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 · 412.1 AIC · ⌖ 8.59 AIC · ⊞ 19.6K · ◷

@microsoft-github-policy-service microsoft-github-policy-service Bot added the state/needs-review Awaiting review from the team. label Oct 9, 2026
@github-actions github-actions Bot added state/approved Proposal approved; ready for implementation. and removed state/needs-review Awaiting review from the team. state/approved Proposal approved; ready for implementation. labels Oct 9, 2026
@Evangelink
Amaury Levé (Evangelink) merged commit 60d9736 into main Oct 9, 2026
27 checks passed
@Evangelink
Amaury Levé (Evangelink) deleted the dev/amauryleve/mstest-discovery-cache branch October 9, 2026 13:52
@github-actions github-actions Bot removed the state/approved Proposal approved; ready for implementation. label Oct 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants