Remove duplicate file-naming utilities from CtrfReportEngine in favor of SharedExtensionHelpers#9307
Open
Copilot wants to merge 2 commits into
Open
Remove duplicate file-naming utilities from CtrfReportEngine in favor of SharedExtensionHelpers#9307Copilot wants to merge 2 commits into
Copilot wants to merge 2 commits into
Conversation
…haredExtensionHelpers Co-authored-by: Evangelink <11340282+Evangelink@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Remove duplicate file-naming utilities from CtrfReportEngine
Remove duplicate file-naming utilities from CtrfReportEngine in favor of SharedExtensionHelpers
Jun 21, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR removes duplicated CTRF report file-naming/sanitization logic by delegating to the existing SharedExtensionHelpers utilities already used by the JUnit/HTML/TRX report engines, and extends the cross-engine parity unit tests to include CTRF.
Changes:
- Linked
ReportFileNameHelper,ReportFileNameSanitizer, andTargetFrameworkMonikerHelperinto the CTRF extension project. - Updated
CtrfReportEngine.FileNaming.csto delegate TFM resolution, template resolution + sanitization, and filename sanitization to the shared helpers. - Added a new unit test to ensure CTRF and TRX use identical filename sanitization rules.
Show a summary per file
| File | Description |
|---|---|
test/UnitTests/Microsoft.Testing.Extensions.UnitTests/ReportFileNameSanitizationConsistencyTests.cs |
Adds CTRF to the existing TRX-vs-other-engine sanitization parity checks via reflection. |
src/Platform/Microsoft.Testing.Extensions.CtrfReport/Microsoft.Testing.Extensions.CtrfReport.csproj |
Links shared file-naming/sanitization/TFM helper sources from SharedExtensionHelpers. |
src/Platform/Microsoft.Testing.Extensions.CtrfReport/CtrfReportEngine.FileNaming.cs |
Replaces local implementations with calls to shared helper utilities for consistency and maintenance. |
Copilot's findings
- Files reviewed: 3/3 changed files
- Comments generated: 0
Evangelink
approved these changes
Jun 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CtrfReportEngine.FileNaming.cscontained private reimplementations of three utilities already shared across JUnit/HTML/TRX report engines, including an acknowledgment comment that the duplication was a maintenance risk.Changes
.csproj: LinkReportFileNameSanitizer.cs,ReportFileNameHelper.cs, andTargetFrameworkMonikerHelper.csfromSharedExtensionHelpers(mirrors what JUnitReport and HtmlReport already do)CtrfReportEngine.FileNaming.cs:GetTargetFrameworkMoniker()→TargetFrameworkMonikerHelper.GetTargetFrameworkMoniker()ResolveJsonFileName()body →ReportFileNameHelper.ResolveAndSanitize()(eliminates manual template-resolve + sanitize reimplementation)ReplaceInvalidFileNameChars()+IsInvalidFileNameChar()+IsReservedFileName()(~50 lines) → single delegation toReportFileNameSanitizer.ReplaceInvalidFileNameChars()ReportFileNameSanitizationConsistencyTests.cs: AddedTrxAndCtrfReportEngines_UseSameFileNameSanitizationRulesto cover CTRF in the cross-engine sanitization parity checks