Skip to content

Stabilize extension UIDs and add naming governance (#9757)#9773

Merged
Evangelink merged 1 commit into
mainfrom
copilot/extension-uid-stability
Jul 9, 2026
Merged

Stabilize extension UIDs and add naming governance (#9757)#9773
Evangelink merged 1 commit into
mainfrom
copilot/extension-uid-stability

Conversation

@Evangelink

Copy link
Copy Markdown
Member

Fixes #9757.

Every MTP extension / command-line provider exposes IExtension.Uid, which is SHA-256-hashed for telemetry, printed verbatim in --info, embedded in artifact metadata, and used for feature detection. Many providers derived that value from nameof(ClassName), so an IDE "Rename Symbol" refactor would silently change the UID. This PR addresses all five tasks in the issue.

Changes

Task 1 — Document the stability requirement

  • IExtension.Uid XML doc now states the value must be a stable string constant that survives class renames and must not use nameof(ImplementingClass).

Task 2 — Fix MSBuildCommandLineProvider DisplayName

  • The provider passed nameof(MSBuildCommandLineProvider) as both uid and displayName, so --info leaked the internal class name. Added a localized MSBuildCommandLineProviderDisplayName = "MSBuild integration" resource (xlf regenerated) and use it as the display name. UID is unchanged.

Task 3 — Replace nameof() UIDs with stable literals

  • Converted the UID/providerName argument to an explicit string literal (same value) in the 12 remaining well-known command-line providers: PlatformCommandLineProvider, TerminalTestReporterCommandLineOptionsProvider, CrashDumpCommandLineProvider, HangDumpCommandLineProvider, RetryCommandLineOptionsProvider, the four report generators (Trx/JUnit/Html/Ctrf), AzureDevOpsCommandLineProvider, GitHubActionsCommandLineProvider, and VideoRecorderCommandLineProvider. Each carries a short "do not change" comment. No UID values change, so telemetry continuity is preserved.

Task 4 — Fix NopPlatformOutputDeviceTests

  • The identity test asserted nameof(NopPlatformOutputDevice) on both sides, so a rename would silently update rather than fail. It now asserts the string literal directly, turning a rename into a conspicuous failure.

Task 5 — UID snapshot coverage

  • The existing --info acceptance tests already assert provider UIDs as section headers. Added WellKnownExtensionUidTests as a fast, dependency-free unit-test tripwire pinning the platform-owned provider UIDs.

Validation

  • Built the platform, all touched extensions, and the unit-test project — 0 warnings / 0 errors.
  • WellKnownExtensionUidTests + NopPlatformOutputDeviceTests pass (5/5).
  • Updated the --info all-extensions acceptance expectation (HelpInfoAllExtensionsTests) so Name: MSBuild integration matches the new display name.

🤖 Generated with GitHub Copilot

Replace nameof(ClassName) UID/providerName arguments with explicit stable string literals across the well-known command-line providers so IDE renames no longer silently change telemetry hashes, --info output, and artifact metadata. Values are unchanged.

- Document the UID stability requirement on IExtension.Uid.
- Give MSBuildCommandLineProvider a user-facing DisplayName resource instead of leaking the internal class name in --info.
- Assert stable string literals (not nameof) in NopPlatformOutputDeviceTests.
- Add WellKnownExtensionUidTests as a fast UID snapshot tripwire.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 9, 2026 09:11

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.

Pull request overview

This PR hardens Microsoft.Testing.Platform (MTP) extension UID governance by documenting UID stability requirements and replacing nameof(...)-derived UIDs with stable literals in well-known command-line providers, preventing silent UID changes during refactors and improving --info output readability.

Changes:

  • Documented that IExtension.Uid must be a stable constant (not derived from nameof(ImplementingClass)).
  • Replaced nameof(...) UIDs with stable string literals across well-known command-line providers (preserving existing UID values).
  • Added/updated tests to pin UIDs and updated acceptance expectations for the MSBuild provider display name.
Show a summary per file
File Description
test/UnitTests/Microsoft.Testing.Platform.UnitTests/OutputDevice/NopPlatformOutputDeviceTests.cs Pins NopPlatformOutputDevice UID/DisplayName via string literals so renames become test-breaking.
test/UnitTests/Microsoft.Testing.Platform.UnitTests/CommandLine/WellKnownExtensionUidTests.cs Adds unit-test “tripwire” snapshot assertions for platform-owned provider UIDs.
test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/HelpInfoAllExtensionsTests.cs Updates --info expectation for the MSBuild provider display name.
src/Platform/Microsoft.Testing.Platform/OutputDevice/Terminal/TerminalTestReporterCommandLineOptionsProvider.cs Uses a stable literal UID (with “do not change” guidance).
src/Platform/Microsoft.Testing.Platform/Extensions/IExtension.cs Documents UID stability requirements and rationale in XML docs.
src/Platform/Microsoft.Testing.Platform/CommandLine/PlatformCommandLineProvider.cs Uses a stable literal UID (with “do not change” guidance).
src/Platform/Microsoft.Testing.Extensions.VideoRecorder/VideoRecorderCommandLineProvider.cs Uses a stable literal UID (with “do not change” guidance).
src/Platform/Microsoft.Testing.Extensions.TrxReport/TrxCommandLine.cs Uses a stable literal UID for the TRX report generator command line.
src/Platform/Microsoft.Testing.Extensions.Retry/RetryCommandLineOptionsProvider.cs Uses a stable literal UID (with “do not change” guidance).
src/Platform/Microsoft.Testing.Extensions.MSBuild/MSBuildCommandLineProvider.cs Switches to a stable literal UID and replaces display name with a localized resource.
src/Platform/Microsoft.Testing.Extensions.MSBuild/Resources/ExtensionResources.resx Adds localized display name resource for MSBuild command-line provider.
src/Platform/Microsoft.Testing.Extensions.MSBuild/Resources/xlf/ExtensionResources.cs.xlf Regenerated XLF entry for new MSBuild provider display name resource.
src/Platform/Microsoft.Testing.Extensions.MSBuild/Resources/xlf/ExtensionResources.de.xlf Regenerated XLF entry for new MSBuild provider display name resource.
src/Platform/Microsoft.Testing.Extensions.MSBuild/Resources/xlf/ExtensionResources.es.xlf Regenerated XLF entry for new MSBuild provider display name resource.
src/Platform/Microsoft.Testing.Extensions.MSBuild/Resources/xlf/ExtensionResources.fr.xlf Regenerated XLF entry for new MSBuild provider display name resource.
src/Platform/Microsoft.Testing.Extensions.MSBuild/Resources/xlf/ExtensionResources.it.xlf Regenerated XLF entry for new MSBuild provider display name resource.
src/Platform/Microsoft.Testing.Extensions.MSBuild/Resources/xlf/ExtensionResources.ja.xlf Regenerated XLF entry for new MSBuild provider display name resource.
src/Platform/Microsoft.Testing.Extensions.MSBuild/Resources/xlf/ExtensionResources.ko.xlf Regenerated XLF entry for new MSBuild provider display name resource.
src/Platform/Microsoft.Testing.Extensions.MSBuild/Resources/xlf/ExtensionResources.pl.xlf Regenerated XLF entry for new MSBuild provider display name resource.
src/Platform/Microsoft.Testing.Extensions.MSBuild/Resources/xlf/ExtensionResources.pt-BR.xlf Regenerated XLF entry for new MSBuild provider display name resource.
src/Platform/Microsoft.Testing.Extensions.MSBuild/Resources/xlf/ExtensionResources.ru.xlf Regenerated XLF entry for new MSBuild provider display name resource.
src/Platform/Microsoft.Testing.Extensions.MSBuild/Resources/xlf/ExtensionResources.tr.xlf Regenerated XLF entry for new MSBuild provider display name resource.
src/Platform/Microsoft.Testing.Extensions.MSBuild/Resources/xlf/ExtensionResources.zh-Hans.xlf Regenerated XLF entry for new MSBuild provider display name resource.
src/Platform/Microsoft.Testing.Extensions.MSBuild/Resources/xlf/ExtensionResources.zh-Hant.xlf Regenerated XLF entry for new MSBuild provider display name resource.
src/Platform/Microsoft.Testing.Extensions.JUnitReport/JUnitReportGeneratorCommandLine.cs Uses a stable literal UID for the JUnit report generator command line.
src/Platform/Microsoft.Testing.Extensions.HtmlReport/HtmlReportGeneratorCommandLine.cs Uses a stable literal UID for the HTML report generator command line.
src/Platform/Microsoft.Testing.Extensions.HangDump/HangDumpCommandLineProvider.cs Uses a stable literal UID (with “do not change” guidance).
src/Platform/Microsoft.Testing.Extensions.GitHubActionsReport/GitHubActionsCommandLineProvider.cs Uses a stable literal UID (with “do not change” guidance).
src/Platform/Microsoft.Testing.Extensions.CtrfReport/CtrfReportGeneratorCommandLine.cs Uses a stable literal UID for the CTRF report generator command line.
src/Platform/Microsoft.Testing.Extensions.CrashDump/CrashDumpCommandLineProvider.cs Uses a stable literal UID (with “do not change” guidance).
src/Platform/Microsoft.Testing.Extensions.AzureDevOpsReport/AzureDevOpsCommandLineProvider.cs Uses a stable literal UID (with “do not change” guidance).

Review details

  • Files reviewed: 31/31 changed files
  • Comments generated: 0
  • Review effort level: Low

@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.

Note

🤖 Automated review by GitHub Copilot. Generated by the Expert Code Review workflow. To request a follow-up action, reply by tagging @copilot directly.

✅ 22/22 dimensions clean — no findings.

Summary: Well-scoped, purely mechanical PR. All 12 nameof() → string literal conversions preserve the exact same runtime UID values, so telemetry continuity is unaffected. The MSBuild display name fix correctly moves from the leaked class name to a proper localized resource. The new WellKnownExtensionUidTests pinning test and the hardened NopPlatformOutputDeviceTests assertion will trip on any future accidental rename. Localization (.resx + regenerated .xlf) follows repo conventions, and the --info acceptance test expectation is updated to match the new display name.

@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

🧪 Test quality grade — PR #9773

GradeTestNotes
B (80–89) mod HelpInfoAllExtensionsTests.
Info_
WithAllExtensionsRegistered_
OutputFullInfoContent
Thorough --info output snapshot; ~490-line body exceeds the integration-test guideline (~120) — consider one test per provider group.
A (90–100) mod NopPlatformOutputDeviceTests.
Identity_
IsStableAndNonEmpty
String-literal assertions guard UID stability against renames; non-empty checks cover Version and Description.
A (90–100) new WellKnownExtensionUidTests.
PlatformCommandLineProvider_
HasStableUid
No issues found.
A (90–100) new WellKnownExtensionUidTests.
TerminalTestReporterCommandLineOptionsProvider_
HasStableUid
No issues found.

This advisory comment was generated automatically. Grades are heuristic
and informational — they do not block merging. Re-run with
/grade-tests.

🤖 Automated content by GitHub Copilot. Generated by the Grade Tests on PR (on open / sync) workflow. · 104.6 AIC · ⌖ 8.7 AIC · ⊞ 9.5K · [◷]( · )

@Evangelink
Evangelink enabled auto-merge (squash) July 9, 2026 11:11
@Evangelink Evangelink added the state/needs-review Awaiting review from the team. label Jul 9, 2026
@Evangelink
Evangelink merged commit a946ef7 into main Jul 9, 2026
35 checks passed
@Evangelink
Evangelink deleted the copilot/extension-uid-stability branch July 9, 2026 11:19
github-actions Bot added a commit that referenced this pull request Jul 9, 2026
…nternalAPI declarations

- Normalize array initialization in 3 DotnetTest IPC serializers to use
  empty array `= []` pattern instead of nullable `= null` with `?? []`
  fallback, matching the style used by DiscoveredTestMessagesSerializer
  and TestInProgressMessagesSerializer (introduced in PR #9774)

- Add missing InternalAPI.Unshipped.txt declarations for ReadFields and
  WriteListPayload methods added to BaseSerializer in PR #9774, across
  Microsoft.Testing.Platform and its 4 extension projects that link
  BaseSerializer.cs as a shared source file (HangDump, TrxReport, Retry,
  MSBuild)

- Add missing InternalAPI.Unshipped.txt declaration for
  PlatformServicesConfigurationAdapter class added in PR #9773 to
  MSTest.TestAdapter

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

state/needs-review Awaiting review from the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Repository Quality: Extension UID Stability and Naming Governance

3 participants