Skip to content

Repository Quality: Extension UID Stability and Naming GovernanceΒ #9757

Description

@github-actions

🎯 Repository Quality Improvement Report β€” Extension UID Stability and Naming Governance

Analysis Date: 2026-07-08
Focus Area: Extension UID Stability and Naming Governance
Strategy Type: Custom

Executive Summary

Every MTP extension and internal platform service implements IExtension.Uid, which is SHA-256-hashed for AppInsights telemetry, displayed verbatim in --info output and error messages, embedded in artifact metadata, and used in feature-detection tests. Renaming the implementing class automatically and silently changes the Uid.

Analysis found 47 IExtension.Uid property definitions and 13 CommandLineOptionsProviderBase UID constructor arguments β€” ~60 total β€” that resolve their value via nameof(ClassName). The IExtension.Uid interface doc mentions uniqueness but not stability. Contrast this with the GUID-based auto-registration system, where the MSBuild .props files carry a block-caps warning: "DO NOT CHANGE THE GUID, IT'S A WELL KNOWN EXTENSION POINT." One concrete defect surfaces immediately: MSBuildCommandLineProvider passes nameof(MSBuildCommandLineProvider) as its displayName argument, so --info exposes the internal class name to end users.

Full Analysis

Metrics

Metric Value Status
IExtension.Uid properties using nameof() 47 ⚠️
CommandLineOptionsProviderBase UID args using nameof() 13 ⚠️
Providers with hardcoded stable string UID 1 ("System" in SystemExtension) ❌
Extension UIDs SHA-256-hashed for AppInsights All (via ExtensionInformationCollector) ⚠️
IExtension.Uid stability documented No ❌
Snapshot test capturing registered UIDs None ❌
MSBuildCommandLineProvider.DisplayName using internal class name Yes ❌

Distribution by Package

Package nameof() Uid count
Microsoft.Testing.Platform 19
Microsoft.Testing.Extensions.AzureDevOpsReport 6
Microsoft.Testing.Extensions.TrxReport 4
Microsoft.Testing.Extensions.Retry 3
Microsoft.Testing.Extensions.MSBuild 3
Microsoft.Testing.Extensions.GitHubActionsReport 3
Microsoft.Testing.Extensions.CrashDump 3
Others 6

Key Findings

  1. nameof(ClassName) as Uid anti-pattern β€” IDE "Rename Symbol" silently changes the Uid, breaking telemetry continuity, --info output, artifact URIs, and feature-detection tests.
  2. No stability documentation β€” src/Platform/Microsoft.Testing.Platform/Extensions/IExtension.cs docs say "unique identifier" but nothing about stability across renames.
  3. MSBuildCommandLineProvider DisplayName = internal class name β€” src/Platform/Microsoft.Testing.Extensions.MSBuild/MSBuildCommandLineProvider.cs passes nameof(MSBuildCommandLineProvider) as displayName in the constructor. --info prints provider.Uid verbatim; users see "MSBuildCommandLineProvider".
  4. Only one UID stability test β€” gives false confidence β€” NopPlatformOutputDeviceTests.cs:27 asserts Assert.AreEqual(nameof(NopPlatformOutputDevice), device.Uid). Both sides use nameof(), so a rename passes the test while changing the runtime value.
  5. Feature-detection tied to class name β€” DotnetTestPipeOrchestratorHandshakeTests.cs:24 has const string RetryOrchestratorFeature = "RetryOrchestrator", coupling a test constant to RetryOrchestrator's class name via its Uid.

πŸ€– Suggested Improvement Tasks

Task 1: Document UID stability requirement in IExtension

Priority: High | Effort: Small

Update IExtension.Uid XML doc in src/Platform/Microsoft.Testing.Platform/Extensions/IExtension.cs to state that the value must be a stable string constant that survives class renames, and must not use nameof(ImplementingClass).


Task 2: Fix MSBuildCommandLineProvider DisplayName

Priority: High | Effort: Small

src/Platform/Microsoft.Testing.Extensions.MSBuild/MSBuildCommandLineProvider.cs passes nameof(MSBuildCommandLineProvider) (line 20) as both the uid and displayName arguments. Replace the displayName argument with a user-readable string (e.g., move to Resources/ExtensionResources.resx as MSBuildCommandLineProviderDisplayName = "MSBuild Integration").


Task 3: Replace nameof() UIDs in command-line providers with stable string constants

Priority: Medium | Effort: Large

Introduce a stable const string UID per provider (or a shared WellKnownProviderUids file). Priority: the 13 providers whose UIDs appear in --info output and error messages, including PlatformCommandLineProvider, TerminalTestReporterCommandLineOptionsProvider, CrashDumpCommandLineProvider, HangDumpCommandLineProvider, RetryCommandLineOptionsProvider, all 4 report-format command lines, AzureDevOpsCommandLineProvider, GitHubActionsCommandLineProvider, VideoRecorderCommandLineProvider, MSBuildCommandLineProvider.


Task 4: Fix NopPlatformOutputDeviceTests UID assertion

Priority: Medium | Effort: Small

test/UnitTests/Microsoft.Testing.Platform.UnitTests/OutputDevice/NopPlatformOutputDeviceTests.cs:27: change Assert.AreEqual(nameof(NopPlatformOutputDevice), device.Uid) to assert the stable string literal directly (e.g., Assert.AreEqual("NopPlatformOutputDevice", device.Uid)) so a class rename causes the test to fail rather than silently update.


Task 5: Add a UID snapshot test to catch silent renames

Priority: Medium | Effort: Medium

Extend the --info acceptance tests in test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/HelpInfoTests.cs to also assert known provider UIDs alongside the existing display-name assertions. Any UID change β€” intentional or accidental β€” produces a conspicuous test failure rather than a silent telemetry break.


πŸ“Š Historical Context

Previous Focus Areas
Date Focus Area Type
2026-07-07 integration-test-asset-project-hygiene Custom
2026-07-06 global-test-fixture-implementation-gaps Custom
2026-07-03 test-context-api-surface-consistency Custom
2026-07-02 cross-component-diagnostic-metadata-consistency Custom
2026-07-01 preprocessor-symbol-hygiene Custom
2026-06-30 mstest-sdk-runner-target-correctness Custom

Next analysis: 2026-07-09 β€” Focus area selected based on diversity algorithm

πŸ€– Automated content by GitHub Copilot. Generated by the Repository Quality Improver workflow. Β· 186.5 AIC Β· βŒ– 10.2 AIC Β· ⊞ 10.2K Β· [β—·]( Β· β—·)

Add this agentic workflows to your repo

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repository-quality-improver.md@main
  • expires on Jul 10, 2026, 10:45 PM UTC

Metadata

Metadata

Assignees

No one assigned

    Labels

    type/automationCreated or maintained by an agentic workflow.type/tech-debtCode health, refactoring, simplification.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions