Add artifact merge engines and Kind metadata flow (RFC 018 phase 1) - #9805

Merged
Amaury Levé (Evangelink) merged 32 commits into
mainfrom
dev/amauryleve/miniature-broccoli
Jul 16, 2026
Merged

Add artifact merge engines and Kind metadata flow (RFC 018 phase 1)#9805
Amaury Levé (Evangelink) merged 32 commits into
mainfrom
dev/amauryleve/miniature-broccoli

Conversation

@Evangelink

Copy link
Copy Markdown
Member

Summary

Implements the first testfx-side pieces of RFC 018 — Artifact post-processing for dotnet test (MTP). Two independent, self-contained foundations that every later phase (dispatcher tool, SDK election) reuses. No SDK dependency; the SDK orchestration lands separately once this merges.

1. Report merge engines (pure, invocation-agnostic — no I/O in the core)

Validated the RFC's "collect same-kind inputs → re-aggregate → emit one" shape across both data models:

EngineFormatMerge unitRe-aggregation
TrxReportEngine.Merge / MergeToFileAsyncXMLResults/TestDefinitions/TestEntriescounters summed, Times earliest/latest, TestLists deduped by id, outcome Failed if any input failed
JUnitReportMergerXML<testsuite>counters derived by summing per-suite (correct even when root aggregates are missing); supports bare <testsuite> roots
CtrfReportMergerJSON (JsonNode)results.tests[]summary derived from the merged tests[] so summary.tests always matches the array; start/stop min/max

HTML is intentionally not file-merged (it's a rendered template with an embedded JSON blob) — this validates the design's opt-in / return-null semantics rather than breaking it.

2. Kind metadata flow (producer → IPC wire)

So the dotnet test orchestrator can group artifacts by format without inspecting file contents:

  • SessionFileArtifact gains an optional kind (experimental-gated, [TPEXP]); the shipped 4-arg constructor is preserved for binary compatibility.
  • IPC: FileArtifactMessage.Kind + FileArtifactMessageFieldsId.Kind = 7 + serializer read/write/field-count (forward/backward compatible — old readers skip the unknown field).
  • DotnetTestDataConsumer propagates Kind onto the wire message.
  • Report producers tag their kind: TRX microsoft.testing.trx, JUnit microsoft.testing.junit, CTRF microsoft.testing.ctrf, HTML microsoft.testing.html.

Tests

  • Unit tests for all three merge engines (null/empty inputs, counter summing, outcome, dedup, timestamps, bare-root/missing-aggregate robustness, summary-missing).
  • IPC protocol round-trip tests assert Kind survives the pipe.
  • Full repo builds clean (only the unrelated WasiPlayground sample fails on a missing workload); Platform IPC/protocol, contract-package, and Extensions unit tests all green.

Not in this PR (future phases, per the RFC)

  • IArtifactPostProcessor typed contract wrapping the engines.
  • Handshake advertisement of post-processor kinds.
  • Dispatcher ITool + tool-host-over-pipe composition.
  • User tools (merge-trx, …) and the dotnet/sdk orchestration.

cc Amaury Levé (@Evangelink)

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

Implements the first testfx-side pieces of RFC 018 (artifact post-processing
for dotnet test / MTP):
- Report merge engines (pure, invocation-agnostic, no I/O in the core):
- TrxReportEngine.Merge / MergeToFileAsync (XML-level TRX merge).
- JUnitReportMerger (unions <testsuite>, counters derived per-suite).
- CtrfReportMerger (JSON merge; summary derived from merged tests[]).
- Kind metadata flow so the dotnet/sdk orchestrator can group artifacts by
format: SessionFileArtifact gains an optional kind (experimental), the
FileArtifactMessage IPC record + serializer carry Kind (field id 7), the
dotnet-test consumer propagates it, and report producers tag their kind
(trx/junit/ctrf/html).
Unit tests cover all three merge engines and the IPC round-trip.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
CopilotAI review requested due to automatic review settings July 9, 2026 22:09

CopilotAI 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

Adds report-merging foundations and propagates artifact format metadata through MTP’s artifact and IPC layers.

Changes:

  • Adds TRX, JUnit, and CTRF merge engines with unit tests.
  • Adds experimental SessionFileArtifact.Kind metadata and IPC serialization.
  • Tags TRX, JUnit, CTRF, and HTML report artifacts by format.
Show a summary per file
FileDescription
test/UnitTests/Microsoft.Testing.Platform.UnitTests/IPC/ProtocolTests.csCovers IPC kind serialization.
test/UnitTests/Microsoft.Testing.Platform.UnitTests/IPC/ProtocolEdgeCaseTests.csTests nullable kind round trips.
test/UnitTests/Microsoft.Testing.Platform.DotnetTestProtocolContract.UnitTests/DotnetTestProtocolSerializerTests.csVerifies protocol-contract serialization.
test/UnitTests/Microsoft.Testing.Extensions.UnitTests/TrxReportEngineMergeTests.csTests TRX merging.
test/UnitTests/Microsoft.Testing.Extensions.UnitTests/JUnitReportMergerTests.csTests JUnit merging.
test/UnitTests/Microsoft.Testing.Extensions.UnitTests/CtrfReportMergerTests.csTests CTRF merging.
src/Platform/SharedExtensionHelpers/ReportGeneratorBase.csPublishes report artifact kinds.
src/Platform/Microsoft.Testing.Platform/ServerMode/DotnetTest/IPC/Serializers/FileArtifactMessagesSerializer.csSerializes the new kind field.
src/Platform/Microsoft.Testing.Platform/ServerMode/DotnetTest/IPC/ObjectFieldIds.csAssigns IPC field ID 7.
src/Platform/Microsoft.Testing.Platform/ServerMode/DotnetTest/IPC/Models/FileArtifactMessages.csAdds kind to the wire model.
src/Platform/Microsoft.Testing.Platform/ServerMode/DotnetTest/IPC/DotnetTestDataConsumer.csPropagates session artifact kinds.
src/Platform/Microsoft.Testing.Platform/PublicAPI/PublicAPI.Unshipped.txtTracks the experimental public API.
src/Platform/Microsoft.Testing.Platform/Messages/FileArtifacts.csAdds the kind-aware constructor and property.
src/Platform/Microsoft.Testing.Platform/InternalAPI/InternalAPI.Unshipped.txtTracks IPC internal API changes.
src/Platform/Microsoft.Testing.Extensions.TrxReport/TrxReportEngine.Merge.csImplements TRX merging.
src/Platform/Microsoft.Testing.Extensions.TrxReport/TrxDataConsumer.csTags in-process TRX artifacts.
src/Platform/Microsoft.Testing.Extensions.TrxReport/InternalAPI/InternalAPI.Unshipped.txtTracks TRX internal APIs.
src/Platform/Microsoft.Testing.Extensions.Retry/InternalAPI/InternalAPI.Unshipped.txtTracks linked IPC field API.
src/Platform/Microsoft.Testing.Extensions.MSBuild/InternalAPI.Unshipped.txtTracks linked IPC field API.
src/Platform/Microsoft.Testing.Extensions.JUnitReport/JUnitReportMerger.csImplements JUnit merging.
src/Platform/Microsoft.Testing.Extensions.JUnitReport/JUnitReportGenerator.csTags JUnit artifacts.
src/Platform/Microsoft.Testing.Extensions.JUnitReport/InternalAPI/InternalAPI.Unshipped.txtTracks JUnit internal APIs.
src/Platform/Microsoft.Testing.Extensions.HtmlReport/InternalAPI/InternalAPI.Unshipped.txtTracks shared generator API.
src/Platform/Microsoft.Testing.Extensions.HtmlReport/HtmlReportGenerator.csTags HTML artifacts.
src/Platform/Microsoft.Testing.Extensions.HangDump/InternalAPI/InternalAPI.Unshipped.txtTracks linked IPC field API.
src/Platform/Microsoft.Testing.Extensions.CtrfReport/InternalAPI/InternalAPI.Unshipped.txtTracks CTRF internal APIs.
src/Platform/Microsoft.Testing.Extensions.CtrfReport/CtrfReportMerger.csImplements CTRF merging.
src/Platform/Microsoft.Testing.Extensions.CtrfReport/CtrfReportGenerator.csTags CTRF artifacts.

Review details

  • Files reviewed: 28/28 changed files
  • Comments generated: 4
  • Review effort level: Medium

Comment threadsrc/Platform/Microsoft.Testing.Extensions.TrxReport/TrxDataConsumer.cs Outdated
@Evangelink
Amaury Levé (Evangelink) marked this pull request as ready for review July 13, 2026 14:43
…ure-broccoli
# Conflicts:
#	src/Platform/Microsoft.Testing.Extensions.CtrfReport/InternalAPI/InternalAPI.Unshipped.txt
#	src/Platform/Microsoft.Testing.Extensions.HangDump/InternalAPI/InternalAPI.Unshipped.txt
#	src/Platform/Microsoft.Testing.Extensions.HtmlReport/InternalAPI/InternalAPI.Unshipped.txt
#	src/Platform/Microsoft.Testing.Extensions.JUnitReport/InternalAPI/InternalAPI.Unshipped.txt
#	src/Platform/Microsoft.Testing.Extensions.TrxReport/InternalAPI/InternalAPI.Unshipped.txt
#	src/Platform/Microsoft.Testing.Platform/InternalAPI/InternalAPI.Unshipped.txt
- Carry microsoft.testing.trx through the out-of-process TRX path by adding an
(experimental) Kind to FileArtifact and propagating it in DotnetTestDataConsumer
and TrxProcessLifetimeHandler; centralize the kind in TrxReportEngine.TrxArtifactKind.
- Deduplicate <UnitTest> definitions by id when merging TRX (ids are deterministic
from the test UID and the schema forbids duplicates).
- Preserve <RunInfos> (crash/exit diagnostics) and <CollectorDataEntries> from every
input's <ResultSummary> instead of discarding them; omit them when empty.
- Correct the inaccurate 'attachment paths are absolute' remark and relocate each
input's attachment deployment tree into the merged deployment root in
MergeToFileAsync (best-effort, never fails the merge).
- Add unit tests for dedup and diagnostics preservation.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
CopilotAI review requested due to automatic review settings July 13, 2026 15:04

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

Review details

  • Files reviewed: 30/30 changed files
  • Comments generated: 11
  • Review effort level: Medium

Comment threadsrc/Platform/Microsoft.Testing.Extensions.JUnitReport/JUnitReportMerger.cs Outdated
Comment threadsrc/Platform/Microsoft.Testing.Extensions.TrxReport/TrxDataConsumer.cs Outdated
@github-actions

This comment has been minimized.

@EvangelinkAmaury Levé (Evangelink) added the state/needs-review Awaiting review from the team. label Jul 13, 2026
…ure-broccoli
# Conflicts:
#	src/Platform/Microsoft.Testing.Extensions.CtrfReport/InternalAPI/InternalAPI.Unshipped.txt
#	src/Platform/Microsoft.Testing.Extensions.HangDump/InternalAPI/InternalAPI.Unshipped.txt
#	src/Platform/Microsoft.Testing.Extensions.HtmlReport/InternalAPI/InternalAPI.Unshipped.txt
#	src/Platform/Microsoft.Testing.Extensions.JUnitReport/InternalAPI/InternalAPI.Unshipped.txt
#	src/Platform/Microsoft.Testing.Extensions.MSBuild/InternalAPI.Unshipped.txt
#	src/Platform/Microsoft.Testing.Extensions.Retry/InternalAPI/InternalAPI.Unshipped.txt
#	src/Platform/Microsoft.Testing.Extensions.TrxReport/InternalAPI/InternalAPI.Unshipped.txt
#	src/Platform/Microsoft.Testing.Platform/InternalAPI/InternalAPI.Unshipped.txt
CopilotAI review requested due to automatic review settings July 13, 2026 19:50

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

Review details

  • Files reviewed: 30/30 changed files
  • Comments generated: 3
  • Review effort level: Medium

- Skip relocation when the merged 'In' root overlaps the source 'In' root (output
written beside the input with a matching runName), preventing the copy from
recursing into its own destination; the original hrefs already resolve there.
- Skip file reparse points (symlinks) before File.Copy so a link inside the confined
tree can't pull in content from outside it.
- Overwrite copied attachment files so a reused output directory can't leave stale
bytes behind while the merged XML references the fresh per-input destination.
- Add a unit test for the overlapping-root skip case.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
CopilotAI review requested due to automatic review settings July 13, 2026 20:06

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

Review details

  • Files reviewed: 30/30 changed files
  • Comments generated: 1
  • Review effort level: Medium

@github-actions

This comment has been minimized.

Regenerated via UpdateXlf. The last localized check-in added translations for
'GlobalTestFixtureShouldBeValidClassLayout' (fr) and 'SlowTestStillRunning' (ru)
that XliffTasks rejects (placeholder mismatch), breaking the build with
"xlf is out-of-date with resx". UpdateXlf resets those two units to state="new"
so the build passes; they will be re-translated on the next localization pass.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 4350f662-0e5d-4e05-b156-1ef619da3b9e
CopilotAI review requested due to automatic review settings July 14, 2026 08:01

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

Review details

  • Files reviewed: 32/32 changed files
  • Comments generated: 3
  • Review effort level: Low

Comment threadsrc/Analyzers/MSTest.Analyzers/xlf/Resources.fr.xlf Outdated

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

Review details

  • Files reviewed: 31/31 changed files
  • Comments generated: 5
  • Review effort level: Medium

Comment threadsrc/Platform/Microsoft.Testing.Extensions.JUnitReport/JUnitReportMerger.cs Outdated
Comment threadsrc/Platform/Microsoft.Testing.Extensions.CtrfReport/CtrfReportMerger.cs Outdated
…ias check (review)
- TRX Merge now carries run-level <ResultSummary>/<Output> across (StdOut/StdErr/
DebugTrace concatenated, TextMessages/Message unioned), emitted in schema order right
after <Counters>, so VSTest's run-level skipped/informational messages are no longer
silently dropped.
- MergeToFileAsync rejects an empty input list before any filesystem work (output
directory creation / attachment relocation), so an invalid call no longer mutates the
disk before Merge throws. Applied to TRX/JUnit/CTRF.
- Output-alias check is now filesystem-aware: it compares canonicalized paths with a
cached case-sensitivity probe (case-sensitive on case-sensitive volumes, insensitive
otherwise), so on Linux a legitimate separate output like 'A.trx' is no longer rejected
as aliasing input 'a.trx', while Windows/macOS case aliases are still caught. Applied
to TRX/JUnit/CTRF.
Tests: run-level Output merge + schema order; empty-input rejection without touching the
filesystem (all three mergers). 74 merge tests pass; full solution build clean.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
CopilotAI review requested due to automatic review settings July 16, 2026 07:49

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

Review details

  • Files reviewed: 31/31 changed files
  • Comments generated: 3
  • Review effort level: Medium

Comment threadsrc/Platform/Microsoft.Testing.Extensions.JUnitReport/JUnitReportMerger.cs Outdated
Comment threadsrc/Platform/Microsoft.Testing.Extensions.CtrfReport/CtrfReportMerger.cs Outdated
@github-actions

This comment has been minimized.

…view)
The alias-equality check derived its case sensitivity from a one-time probe in
Path.GetTempPath(), but case sensitivity can differ per volume and (on Windows) per
directory. Replace the cached temp probe with a per-call probe of the OUTPUT's own
location (nearest existing ancestor) in all three mergers. An alias can only occur when
input and output share a directory, so that shared location's sensitivity is the correct
one — a different-directory input never compares equal. Falls back to case-insensitive
(rejects more, never less) if the probe fails. This closes the gap where 'A.trx' could
alias input 'a.trx' on a case-insensitive output volume while the temp-based probe said
Ordinal, letting ReplaceFile delete the input.
Applied to TRX/JUnit/CTRF. 74 merge tests pass; full solution build clean.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
CopilotAI review requested due to automatic review settings July 16, 2026 08:10

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

Review details

  • Files reviewed: 31/31 changed files
  • Comments generated: 3
  • Review effort level: Medium

Comment threadsrc/Platform/Microsoft.Testing.Extensions.JUnitReport/JUnitReportMerger.cs Outdated
Comment threadsrc/Platform/Microsoft.Testing.Extensions.CtrfReport/CtrfReportMerger.cs Outdated
…er (review)
The read-only-input alias check (canonicalization, per-output-directory case-sensitivity
probe, netstandard reparse-ancestor fail-closed) and the atomic temporary-sibling write/
replace were duplicated in the TRX, JUnit and CTRF mergers. Because this is security- and
data-loss-sensitive, extract it into a single shared SharedExtensionHelpers/
MergeOutputFileHelper.cs (linked into all three, namespace Microsoft.Testing.Extensions),
exposing EnsureOutputDoesNotAliasInput and WriteViaTemporarySiblingAsync so the logic can
no longer diverge across formats. Each merger now delegates to it; the per-format writer
(XDocument stream vs string) is passed as a callback. Registered the shared internal type/
methods in each project's InternalAPI.Unshipped.txt.
No behavior change. 74 merge tests pass; full solution build clean (0 warnings).
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
CopilotAI review requested due to automatic review settings July 16, 2026 08:40
@github-actions

This comment has been minimized.

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

Review details

  • Files reviewed: 35/35 changed files
  • Comments generated: 4
  • Review effort level: Medium

Comment threadsrc/Platform/SharedExtensionHelpers/MergeOutputFileHelper.cs
Comment threadsrc/Platform/Microsoft.Testing.Extensions.CtrfReport/CtrfReportMerger.cs Outdated
…ments
CI (macOS): GetCanonicalPath now re-resolves ancestor symlinks after every
link hop, so a link target whose prefix is itself a symlink (macOS
/var -> /private/var) canonicalizes consistently and the read-only-input
alias check no longer misses a symlinked-parent output. Fixes the 3
WhenOutputAliasesInputViaSymlinkedParent merge tests that failed on macOS.
Review comments addressed:
- MergeOutputFileHelper.ReplaceFile: atomic File.Move(overwrite:true) on
netcore so an interruption can never leave the previous report missing;
delete-then-move retained only on .NET Framework (no overwrite overload).
- TRX relocation: deployment root is now unique per run (run id suffix), so
relocation always writes a fresh tree and can never corrupt a previously
committed report's attachments if a later merge fails.
- TRX Times: earliest creation/queuing/start tracked independently and
omitted when no input supplies them, instead of fabricating all three
from the earliest start.
- CTRF reportId: derived only from accepted CTRF payloads, so an ignored
non-CTRF input no longer changes the merged report identity.
Adds regression tests for each and updates deployment-root-coupled TRX tests
to read the emitted runDeploymentRoot instead of assuming a literal name.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 34f1a49b-b1e0-4f38-b8a1-3870dd0842d2
CopilotAI review requested due to automatic review settings July 16, 2026 12:00

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

Review details

  • Files reviewed: 35/35 changed files
  • Comments generated: 1
  • Review effort level: Medium

Comment threadsrc/Platform/SharedExtensionHelpers/MergeOutputFileHelper.cs
@github-actions

Copy link
Copy Markdown
Contributor

🧪 Test quality grade — PR #9805

GradeTestNotes
B (80–89)new CtrfReportMergerTests.
Merge_
ReportIdIsUnaffectedByIgnoredNonCtrfInput
Clear scenario and deterministic inputs; equality assertion on both IDs plus a non-null guard make this near-perfect — no issues found, A could be reached by noting the comment rationale inline.
B (80–89)mod TrxReportEngineMergeTests.
MergeToFileAsync_
WhenInputLivesUnderMergedRoot_
PreservesOriginalReportAndAttachment
Presence-only assertions (File.Exists) confirm files survive, but adding a content check (File.ReadAllText) would close the preservation guarantee fully.
B (80–89)mod TrxReportEngineMergeTests.
MergeToFileAsync_
WhenRunNameEscapesOutputDirectory_
UsesConfinedDeploymentRoot
Security assertions (StartsWith, no-separator, confinement scan) are well-chosen; ~38-line body with a directory scan could be split into a confinement test and a content-integrity test.
B (80–89)mod TrxReportEngineMergeTests.
MergeToFileAsync_
RepeatedIntoSameNestedLayout_
IsBoundedAndNonDestructive
Loop + copy-count + href-resolution are all meaningful; the for-loop is idiomatic here, but extracting the loop limit (4) into a named constant would clarify intent.
B (80–89)mod TrxReportEngineMergeTests.
MergeToFileAsync_
RelocatesPerTestResultFilesByPrefixingResultDirectory
Four meaningful assertions covering path rewriting and file content; ~50-line body with manual XML construction — consider extracting a BuildResultFilesReport helper to compress the arrange phase.
A (90–100)new CtrfReportMergerTests.
Merge_
ReportIdIsUnaffectedByIgnoredNonCtrfInput
Inline comment explains non-CTRF input semantics; equality on both IDs plus IsNotNull guard — no issues found.
A (90–100)new TrxReportEngineMergeTests.
Merge_
TimesOmitAttributesNoInputSupplies
Null-absence and equality assertions together cover both the omission and the surviving fields — no issues found.
A (90–100)new TrxReportEngineMergeTests.
Merge_
TimesTrackEarliestCreationQueuingStartIndependently
All four time attributes verified independently with inputs deliberately split across two reports — no issues found.
A (90–100)new TrxReportEngineMergeTests.
MergeToFileAsync_
SecondMergeIntoSameOutput_
DoesNotCorruptPriorReportsAttachments
Two-merge scenario with distinct-root assertion and byte-level content verification — no issues found.
A (90–100)mod TrxReportEngineMergeTests.
MergeToFileAsync_
IsolatesCollidingAttachmentsPerInputAndRewritesHrefs
Now reads mergedRoot from the document rather than assuming runName; content + href assertions are thorough — no issues found.
A (90–100)mod TrxReportEngineMergeTests.
MergeToFileAsync_
WhenRunNameMatchesInputDeploymentRoot_
UsesUniqueRootAndRelocates
AreNotEqual uniqueness check, original-preservation check, and content-verified href resolution — no issues found.
A (90–100)mod TrxReportEngineMergeTests.
MergeToFileAsync_
WhenSourceNestedUnderMergedRoot_
RelocatesAndKeepsHrefsValid
Reads mergedRoot dynamically and validates href resolution end-to-end with content check — no issues found.

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

Warning

Firewall blocked 1 domain

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

  • awmgmcpg

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

network:
allowed:
- defaults
- "awmgmcpg"

See Network Configuration for more information.

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

@Evangelink
Amaury Levé (Evangelink) merged commit 0a44195 into mainJul 16, 2026
68 checks passed
@Evangelink
Amaury Levé (Evangelink) deleted the dev/amauryleve/miniature-broccoli branch July 16, 2026 14:10
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

state/needs-reviewAwaiting review from the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@Evangelink@0101
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Add copy buttons to all
 blocks\n(function() {\n function addCopyButtons() {\n document.querySelectorAll('pre code').forEach(function(codeBlock) {\n if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;\n codeBlock.parentElement.setAttribute('data-copy-added', 'true');\n \n var btn = document.createElement('button');\n btn.textContent = 'Copy';\n btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';\n btn.onmouseover = function() { this.style.opacity = '1'; };\n btn.onmouseout = function() { this.style.opacity = '0.7'; };\n btn.onclick = function() {\n navigator.clipboard.writeText(codeBlock.textContent).then(function() {\n btn.textContent = 'Copied!';\n setTimeout(function() { btn.textContent = 'Copy'; }, 1500);\n });\n };\n codeBlock.parentElement.style.position = 'relative';\n codeBlock.parentElement.appendChild(btn);\n });\n }\n \n addCopyButtons();\n \n // Re-run on dynamic content\n var observer = new MutationObserver(addCopyButtons);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Add Copy Buttons to Code Blocks");
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
Skip to content

Add artifact merge engines and Kind metadata flow (RFC 018 phase 1) - #9805

Merged
Amaury Levé (Evangelink) merged 32 commits into
mainfrom
dev/amauryleve/miniature-broccoli
Jul 16, 2026
Merged

Add artifact merge engines and Kind metadata flow (RFC 018 phase 1)#9805
Amaury Levé (Evangelink) merged 32 commits into
mainfrom
dev/amauryleve/miniature-broccoli

Conversation

@Evangelink

Copy link
Copy Markdown
Member

Summary

Implements the first testfx-side pieces of RFC 018 — Artifact post-processing for dotnet test (MTP). Two independent, self-contained foundations that every later phase (dispatcher tool, SDK election) reuses. No SDK dependency; the SDK orchestration lands separately once this merges.

1. Report merge engines (pure, invocation-agnostic — no I/O in the core)

Validated the RFC's "collect same-kind inputs → re-aggregate → emit one" shape across both data models:

EngineFormatMerge unitRe-aggregation
TrxReportEngine.Merge / MergeToFileAsyncXMLResults/TestDefinitions/TestEntriescounters summed, Times earliest/latest, TestLists deduped by id, outcome Failed if any input failed
JUnitReportMergerXML<testsuite>counters derived by summing per-suite (correct even when root aggregates are missing); supports bare <testsuite> roots
CtrfReportMergerJSON (JsonNode)results.tests[]summary derived from the merged tests[] so summary.tests always matches the array; start/stop min/max

HTML is intentionally not file-merged (it's a rendered template with an embedded JSON blob) — this validates the design's opt-in / return-null semantics rather than breaking it.

2. Kind metadata flow (producer → IPC wire)

So the dotnet test orchestrator can group artifacts by format without inspecting file contents:

  • SessionFileArtifact gains an optional kind (experimental-gated, [TPEXP]); the shipped 4-arg constructor is preserved for binary compatibility.
  • IPC: FileArtifactMessage.Kind + FileArtifactMessageFieldsId.Kind = 7 + serializer read/write/field-count (forward/backward compatible — old readers skip the unknown field).
  • DotnetTestDataConsumer propagates Kind onto the wire message.
  • Report producers tag their kind: TRX microsoft.testing.trx, JUnit microsoft.testing.junit, CTRF microsoft.testing.ctrf, HTML microsoft.testing.html.

Tests

  • Unit tests for all three merge engines (null/empty inputs, counter summing, outcome, dedup, timestamps, bare-root/missing-aggregate robustness, summary-missing).
  • IPC protocol round-trip tests assert Kind survives the pipe.
  • Full repo builds clean (only the unrelated WasiPlayground sample fails on a missing workload); Platform IPC/protocol, contract-package, and Extensions unit tests all green.

Not in this PR (future phases, per the RFC)

  • IArtifactPostProcessor typed contract wrapping the engines.
  • Handshake advertisement of post-processor kinds.
  • Dispatcher ITool + tool-host-over-pipe composition.
  • User tools (merge-trx, …) and the dotnet/sdk orchestration.

cc Amaury Levé (@Evangelink)

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

Implements the first testfx-side pieces of RFC 018 (artifact post-processing
for dotnet test / MTP):
- Report merge engines (pure, invocation-agnostic, no I/O in the core):
- TrxReportEngine.Merge / MergeToFileAsync (XML-level TRX merge).
- JUnitReportMerger (unions <testsuite>, counters derived per-suite).
- CtrfReportMerger (JSON merge; summary derived from merged tests[]).
- Kind metadata flow so the dotnet/sdk orchestrator can group artifacts by
format: SessionFileArtifact gains an optional kind (experimental), the
FileArtifactMessage IPC record + serializer carry Kind (field id 7), the
dotnet-test consumer propagates it, and report producers tag their kind
(trx/junit/ctrf/html).
Unit tests cover all three merge engines and the IPC round-trip.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
CopilotAI review requested due to automatic review settings July 9, 2026 22:09

CopilotAI 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

Adds report-merging foundations and propagates artifact format metadata through MTP’s artifact and IPC layers.

Changes:

  • Adds TRX, JUnit, and CTRF merge engines with unit tests.
  • Adds experimental SessionFileArtifact.Kind metadata and IPC serialization.
  • Tags TRX, JUnit, CTRF, and HTML report artifacts by format.
Show a summary per file
FileDescription
test/UnitTests/Microsoft.Testing.Platform.UnitTests/IPC/ProtocolTests.csCovers IPC kind serialization.
test/UnitTests/Microsoft.Testing.Platform.UnitTests/IPC/ProtocolEdgeCaseTests.csTests nullable kind round trips.
test/UnitTests/Microsoft.Testing.Platform.DotnetTestProtocolContract.UnitTests/DotnetTestProtocolSerializerTests.csVerifies protocol-contract serialization.
test/UnitTests/Microsoft.Testing.Extensions.UnitTests/TrxReportEngineMergeTests.csTests TRX merging.
test/UnitTests/Microsoft.Testing.Extensions.UnitTests/JUnitReportMergerTests.csTests JUnit merging.
test/UnitTests/Microsoft.Testing.Extensions.UnitTests/CtrfReportMergerTests.csTests CTRF merging.
src/Platform/SharedExtensionHelpers/ReportGeneratorBase.csPublishes report artifact kinds.
src/Platform/Microsoft.Testing.Platform/ServerMode/DotnetTest/IPC/Serializers/FileArtifactMessagesSerializer.csSerializes the new kind field.
src/Platform/Microsoft.Testing.Platform/ServerMode/DotnetTest/IPC/ObjectFieldIds.csAssigns IPC field ID 7.
src/Platform/Microsoft.Testing.Platform/ServerMode/DotnetTest/IPC/Models/FileArtifactMessages.csAdds kind to the wire model.
src/Platform/Microsoft.Testing.Platform/ServerMode/DotnetTest/IPC/DotnetTestDataConsumer.csPropagates session artifact kinds.
src/Platform/Microsoft.Testing.Platform/PublicAPI/PublicAPI.Unshipped.txtTracks the experimental public API.
src/Platform/Microsoft.Testing.Platform/Messages/FileArtifacts.csAdds the kind-aware constructor and property.
src/Platform/Microsoft.Testing.Platform/InternalAPI/InternalAPI.Unshipped.txtTracks IPC internal API changes.
src/Platform/Microsoft.Testing.Extensions.TrxReport/TrxReportEngine.Merge.csImplements TRX merging.
src/Platform/Microsoft.Testing.Extensions.TrxReport/TrxDataConsumer.csTags in-process TRX artifacts.
src/Platform/Microsoft.Testing.Extensions.TrxReport/InternalAPI/InternalAPI.Unshipped.txtTracks TRX internal APIs.
src/Platform/Microsoft.Testing.Extensions.Retry/InternalAPI/InternalAPI.Unshipped.txtTracks linked IPC field API.
src/Platform/Microsoft.Testing.Extensions.MSBuild/InternalAPI.Unshipped.txtTracks linked IPC field API.
src/Platform/Microsoft.Testing.Extensions.JUnitReport/JUnitReportMerger.csImplements JUnit merging.
src/Platform/Microsoft.Testing.Extensions.JUnitReport/JUnitReportGenerator.csTags JUnit artifacts.
src/Platform/Microsoft.Testing.Extensions.JUnitReport/InternalAPI/InternalAPI.Unshipped.txtTracks JUnit internal APIs.
src/Platform/Microsoft.Testing.Extensions.HtmlReport/InternalAPI/InternalAPI.Unshipped.txtTracks shared generator API.
src/Platform/Microsoft.Testing.Extensions.HtmlReport/HtmlReportGenerator.csTags HTML artifacts.
src/Platform/Microsoft.Testing.Extensions.HangDump/InternalAPI/InternalAPI.Unshipped.txtTracks linked IPC field API.
src/Platform/Microsoft.Testing.Extensions.CtrfReport/InternalAPI/InternalAPI.Unshipped.txtTracks CTRF internal APIs.
src/Platform/Microsoft.Testing.Extensions.CtrfReport/CtrfReportMerger.csImplements CTRF merging.
src/Platform/Microsoft.Testing.Extensions.CtrfReport/CtrfReportGenerator.csTags CTRF artifacts.

Review details

  • Files reviewed: 28/28 changed files
  • Comments generated: 4
  • Review effort level: Medium

Comment threadsrc/Platform/Microsoft.Testing.Extensions.TrxReport/TrxDataConsumer.cs Outdated
@Evangelink
Amaury Levé (Evangelink) marked this pull request as ready for review July 13, 2026 14:43
…ure-broccoli
# Conflicts:
#	src/Platform/Microsoft.Testing.Extensions.CtrfReport/InternalAPI/InternalAPI.Unshipped.txt
#	src/Platform/Microsoft.Testing.Extensions.HangDump/InternalAPI/InternalAPI.Unshipped.txt
#	src/Platform/Microsoft.Testing.Extensions.HtmlReport/InternalAPI/InternalAPI.Unshipped.txt
#	src/Platform/Microsoft.Testing.Extensions.JUnitReport/InternalAPI/InternalAPI.Unshipped.txt
#	src/Platform/Microsoft.Testing.Extensions.TrxReport/InternalAPI/InternalAPI.Unshipped.txt
#	src/Platform/Microsoft.Testing.Platform/InternalAPI/InternalAPI.Unshipped.txt
- Carry microsoft.testing.trx through the out-of-process TRX path by adding an
(experimental) Kind to FileArtifact and propagating it in DotnetTestDataConsumer
and TrxProcessLifetimeHandler; centralize the kind in TrxReportEngine.TrxArtifactKind.
- Deduplicate <UnitTest> definitions by id when merging TRX (ids are deterministic
from the test UID and the schema forbids duplicates).
- Preserve <RunInfos> (crash/exit diagnostics) and <CollectorDataEntries> from every
input's <ResultSummary> instead of discarding them; omit them when empty.
- Correct the inaccurate 'attachment paths are absolute' remark and relocate each
input's attachment deployment tree into the merged deployment root in
MergeToFileAsync (best-effort, never fails the merge).
- Add unit tests for dedup and diagnostics preservation.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
CopilotAI review requested due to automatic review settings July 13, 2026 15:04

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

Review details

  • Files reviewed: 30/30 changed files
  • Comments generated: 11
  • Review effort level: Medium

Comment threadsrc/Platform/Microsoft.Testing.Extensions.JUnitReport/JUnitReportMerger.cs Outdated
Comment threadsrc/Platform/Microsoft.Testing.Extensions.TrxReport/TrxDataConsumer.cs Outdated
@github-actions

This comment has been minimized.

@EvangelinkAmaury Levé (Evangelink) added the state/needs-review Awaiting review from the team. label Jul 13, 2026
…ure-broccoli
# Conflicts:
#	src/Platform/Microsoft.Testing.Extensions.CtrfReport/InternalAPI/InternalAPI.Unshipped.txt
#	src/Platform/Microsoft.Testing.Extensions.HangDump/InternalAPI/InternalAPI.Unshipped.txt
#	src/Platform/Microsoft.Testing.Extensions.HtmlReport/InternalAPI/InternalAPI.Unshipped.txt
#	src/Platform/Microsoft.Testing.Extensions.JUnitReport/InternalAPI/InternalAPI.Unshipped.txt
#	src/Platform/Microsoft.Testing.Extensions.MSBuild/InternalAPI.Unshipped.txt
#	src/Platform/Microsoft.Testing.Extensions.Retry/InternalAPI/InternalAPI.Unshipped.txt
#	src/Platform/Microsoft.Testing.Extensions.TrxReport/InternalAPI/InternalAPI.Unshipped.txt
#	src/Platform/Microsoft.Testing.Platform/InternalAPI/InternalAPI.Unshipped.txt
CopilotAI review requested due to automatic review settings July 13, 2026 19:50

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

Review details

  • Files reviewed: 30/30 changed files
  • Comments generated: 3
  • Review effort level: Medium

- Skip relocation when the merged 'In' root overlaps the source 'In' root (output
written beside the input with a matching runName), preventing the copy from
recursing into its own destination; the original hrefs already resolve there.
- Skip file reparse points (symlinks) before File.Copy so a link inside the confined
tree can't pull in content from outside it.
- Overwrite copied attachment files so a reused output directory can't leave stale
bytes behind while the merged XML references the fresh per-input destination.
- Add a unit test for the overlapping-root skip case.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
CopilotAI review requested due to automatic review settings July 13, 2026 20:06

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

Review details

  • Files reviewed: 30/30 changed files
  • Comments generated: 1
  • Review effort level: Medium

@github-actions

This comment has been minimized.

Regenerated via UpdateXlf. The last localized check-in added translations for
'GlobalTestFixtureShouldBeValidClassLayout' (fr) and 'SlowTestStillRunning' (ru)
that XliffTasks rejects (placeholder mismatch), breaking the build with
"xlf is out-of-date with resx". UpdateXlf resets those two units to state="new"
so the build passes; they will be re-translated on the next localization pass.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 4350f662-0e5d-4e05-b156-1ef619da3b9e
CopilotAI review requested due to automatic review settings July 14, 2026 08:01

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

Review details

  • Files reviewed: 32/32 changed files
  • Comments generated: 3
  • Review effort level: Low

Comment threadsrc/Analyzers/MSTest.Analyzers/xlf/Resources.fr.xlf Outdated

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

Review details

  • Files reviewed: 31/31 changed files
  • Comments generated: 5
  • Review effort level: Medium

Comment threadsrc/Platform/Microsoft.Testing.Extensions.JUnitReport/JUnitReportMerger.cs Outdated
Comment threadsrc/Platform/Microsoft.Testing.Extensions.CtrfReport/CtrfReportMerger.cs Outdated
…ias check (review)
- TRX Merge now carries run-level <ResultSummary>/<Output> across (StdOut/StdErr/
DebugTrace concatenated, TextMessages/Message unioned), emitted in schema order right
after <Counters>, so VSTest's run-level skipped/informational messages are no longer
silently dropped.
- MergeToFileAsync rejects an empty input list before any filesystem work (output
directory creation / attachment relocation), so an invalid call no longer mutates the
disk before Merge throws. Applied to TRX/JUnit/CTRF.
- Output-alias check is now filesystem-aware: it compares canonicalized paths with a
cached case-sensitivity probe (case-sensitive on case-sensitive volumes, insensitive
otherwise), so on Linux a legitimate separate output like 'A.trx' is no longer rejected
as aliasing input 'a.trx', while Windows/macOS case aliases are still caught. Applied
to TRX/JUnit/CTRF.
Tests: run-level Output merge + schema order; empty-input rejection without touching the
filesystem (all three mergers). 74 merge tests pass; full solution build clean.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
CopilotAI review requested due to automatic review settings July 16, 2026 07:49

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

Review details

  • Files reviewed: 31/31 changed files
  • Comments generated: 3
  • Review effort level: Medium

Comment threadsrc/Platform/Microsoft.Testing.Extensions.JUnitReport/JUnitReportMerger.cs Outdated
Comment threadsrc/Platform/Microsoft.Testing.Extensions.CtrfReport/CtrfReportMerger.cs Outdated
@github-actions

This comment has been minimized.

…view)
The alias-equality check derived its case sensitivity from a one-time probe in
Path.GetTempPath(), but case sensitivity can differ per volume and (on Windows) per
directory. Replace the cached temp probe with a per-call probe of the OUTPUT's own
location (nearest existing ancestor) in all three mergers. An alias can only occur when
input and output share a directory, so that shared location's sensitivity is the correct
one — a different-directory input never compares equal. Falls back to case-insensitive
(rejects more, never less) if the probe fails. This closes the gap where 'A.trx' could
alias input 'a.trx' on a case-insensitive output volume while the temp-based probe said
Ordinal, letting ReplaceFile delete the input.
Applied to TRX/JUnit/CTRF. 74 merge tests pass; full solution build clean.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
CopilotAI review requested due to automatic review settings July 16, 2026 08:10

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

Review details

  • Files reviewed: 31/31 changed files
  • Comments generated: 3
  • Review effort level: Medium

Comment threadsrc/Platform/Microsoft.Testing.Extensions.JUnitReport/JUnitReportMerger.cs Outdated
Comment threadsrc/Platform/Microsoft.Testing.Extensions.CtrfReport/CtrfReportMerger.cs Outdated
…er (review)
The read-only-input alias check (canonicalization, per-output-directory case-sensitivity
probe, netstandard reparse-ancestor fail-closed) and the atomic temporary-sibling write/
replace were duplicated in the TRX, JUnit and CTRF mergers. Because this is security- and
data-loss-sensitive, extract it into a single shared SharedExtensionHelpers/
MergeOutputFileHelper.cs (linked into all three, namespace Microsoft.Testing.Extensions),
exposing EnsureOutputDoesNotAliasInput and WriteViaTemporarySiblingAsync so the logic can
no longer diverge across formats. Each merger now delegates to it; the per-format writer
(XDocument stream vs string) is passed as a callback. Registered the shared internal type/
methods in each project's InternalAPI.Unshipped.txt.
No behavior change. 74 merge tests pass; full solution build clean (0 warnings).
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
CopilotAI review requested due to automatic review settings July 16, 2026 08:40
@github-actions

This comment has been minimized.

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

Review details

  • Files reviewed: 35/35 changed files
  • Comments generated: 4
  • Review effort level: Medium

Comment threadsrc/Platform/SharedExtensionHelpers/MergeOutputFileHelper.cs
Comment threadsrc/Platform/Microsoft.Testing.Extensions.CtrfReport/CtrfReportMerger.cs Outdated
…ments
CI (macOS): GetCanonicalPath now re-resolves ancestor symlinks after every
link hop, so a link target whose prefix is itself a symlink (macOS
/var -> /private/var) canonicalizes consistently and the read-only-input
alias check no longer misses a symlinked-parent output. Fixes the 3
WhenOutputAliasesInputViaSymlinkedParent merge tests that failed on macOS.
Review comments addressed:
- MergeOutputFileHelper.ReplaceFile: atomic File.Move(overwrite:true) on
netcore so an interruption can never leave the previous report missing;
delete-then-move retained only on .NET Framework (no overwrite overload).
- TRX relocation: deployment root is now unique per run (run id suffix), so
relocation always writes a fresh tree and can never corrupt a previously
committed report's attachments if a later merge fails.
- TRX Times: earliest creation/queuing/start tracked independently and
omitted when no input supplies them, instead of fabricating all three
from the earliest start.
- CTRF reportId: derived only from accepted CTRF payloads, so an ignored
non-CTRF input no longer changes the merged report identity.
Adds regression tests for each and updates deployment-root-coupled TRX tests
to read the emitted runDeploymentRoot instead of assuming a literal name.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 34f1a49b-b1e0-4f38-b8a1-3870dd0842d2
CopilotAI review requested due to automatic review settings July 16, 2026 12:00

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

Review details

  • Files reviewed: 35/35 changed files
  • Comments generated: 1
  • Review effort level: Medium

Comment threadsrc/Platform/SharedExtensionHelpers/MergeOutputFileHelper.cs
@github-actions

Copy link
Copy Markdown
Contributor

🧪 Test quality grade — PR #9805

GradeTestNotes
B (80–89)new CtrfReportMergerTests.
Merge_
ReportIdIsUnaffectedByIgnoredNonCtrfInput
Clear scenario and deterministic inputs; equality assertion on both IDs plus a non-null guard make this near-perfect — no issues found, A could be reached by noting the comment rationale inline.
B (80–89)mod TrxReportEngineMergeTests.
MergeToFileAsync_
WhenInputLivesUnderMergedRoot_
PreservesOriginalReportAndAttachment
Presence-only assertions (File.Exists) confirm files survive, but adding a content check (File.ReadAllText) would close the preservation guarantee fully.
B (80–89)mod TrxReportEngineMergeTests.
MergeToFileAsync_
WhenRunNameEscapesOutputDirectory_
UsesConfinedDeploymentRoot
Security assertions (StartsWith, no-separator, confinement scan) are well-chosen; ~38-line body with a directory scan could be split into a confinement test and a content-integrity test.
B (80–89)mod TrxReportEngineMergeTests.
MergeToFileAsync_
RepeatedIntoSameNestedLayout_
IsBoundedAndNonDestructive
Loop + copy-count + href-resolution are all meaningful; the for-loop is idiomatic here, but extracting the loop limit (4) into a named constant would clarify intent.
B (80–89)mod TrxReportEngineMergeTests.
MergeToFileAsync_
RelocatesPerTestResultFilesByPrefixingResultDirectory
Four meaningful assertions covering path rewriting and file content; ~50-line body with manual XML construction — consider extracting a BuildResultFilesReport helper to compress the arrange phase.
A (90–100)new CtrfReportMergerTests.
Merge_
ReportIdIsUnaffectedByIgnoredNonCtrfInput
Inline comment explains non-CTRF input semantics; equality on both IDs plus IsNotNull guard — no issues found.
A (90–100)new TrxReportEngineMergeTests.
Merge_
TimesOmitAttributesNoInputSupplies
Null-absence and equality assertions together cover both the omission and the surviving fields — no issues found.
A (90–100)new TrxReportEngineMergeTests.
Merge_
TimesTrackEarliestCreationQueuingStartIndependently
All four time attributes verified independently with inputs deliberately split across two reports — no issues found.
A (90–100)new TrxReportEngineMergeTests.
MergeToFileAsync_
SecondMergeIntoSameOutput_
DoesNotCorruptPriorReportsAttachments
Two-merge scenario with distinct-root assertion and byte-level content verification — no issues found.
A (90–100)mod TrxReportEngineMergeTests.
MergeToFileAsync_
IsolatesCollidingAttachmentsPerInputAndRewritesHrefs
Now reads mergedRoot from the document rather than assuming runName; content + href assertions are thorough — no issues found.
A (90–100)mod TrxReportEngineMergeTests.
MergeToFileAsync_
WhenRunNameMatchesInputDeploymentRoot_
UsesUniqueRootAndRelocates
AreNotEqual uniqueness check, original-preservation check, and content-verified href resolution — no issues found.
A (90–100)mod TrxReportEngineMergeTests.
MergeToFileAsync_
WhenSourceNestedUnderMergedRoot_
RelocatesAndKeepsHrefsValid
Reads mergedRoot dynamically and validates href resolution end-to-end with content check — no issues found.

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

Warning

Firewall blocked 1 domain

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

  • awmgmcpg

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

network:
allowed:
- defaults
- "awmgmcpg"

See Network Configuration for more information.

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

@Evangelink
Amaury Levé (Evangelink) merged commit 0a44195 into mainJul 16, 2026
68 checks passed
@Evangelink
Amaury Levé (Evangelink) deleted the dev/amauryleve/miniature-broccoli branch July 16, 2026 14:10
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

state/needs-reviewAwaiting review from the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@Evangelink@0101
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Force GitHub README to respect dark mode\n(function() {\n var style = document.createElement('style');\n style.textContent = '\n .markdown-body {\n color-scheme: dark light;\n }\n .markdown-body pre { background: #161b22 !important; }\n .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; }\n .markdown-body table th, .markdown-body table td { border-color: #30363d !important; }\n .markdown-body img { background: #0d1117; }\n .markdown-body blockquote { border-left-color: #8b949e; }\n .markdown-body hr { border-color: #30363d; }\n ';\n document.head.appendChild(style);\n})();", "GitHub Dark Mode README Fix"); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Add artifact merge engines and Kind metadata flow (RFC 018 phase 1) - #9805

Merged
Amaury Levé (Evangelink) merged 32 commits into
mainfrom
dev/amauryleve/miniature-broccoli
Jul 16, 2026
Merged

Add artifact merge engines and Kind metadata flow (RFC 018 phase 1)#9805
Amaury Levé (Evangelink) merged 32 commits into
mainfrom
dev/amauryleve/miniature-broccoli

Conversation

@Evangelink

Copy link
Copy Markdown
Member

Summary

Implements the first testfx-side pieces of RFC 018 — Artifact post-processing for dotnet test (MTP). Two independent, self-contained foundations that every later phase (dispatcher tool, SDK election) reuses. No SDK dependency; the SDK orchestration lands separately once this merges.

1. Report merge engines (pure, invocation-agnostic — no I/O in the core)

Validated the RFC's "collect same-kind inputs → re-aggregate → emit one" shape across both data models:

EngineFormatMerge unitRe-aggregation
TrxReportEngine.Merge / MergeToFileAsyncXMLResults/TestDefinitions/TestEntriescounters summed, Times earliest/latest, TestLists deduped by id, outcome Failed if any input failed
JUnitReportMergerXML<testsuite>counters derived by summing per-suite (correct even when root aggregates are missing); supports bare <testsuite> roots
CtrfReportMergerJSON (JsonNode)results.tests[]summary derived from the merged tests[] so summary.tests always matches the array; start/stop min/max

HTML is intentionally not file-merged (it's a rendered template with an embedded JSON blob) — this validates the design's opt-in / return-null semantics rather than breaking it.

2. Kind metadata flow (producer → IPC wire)

So the dotnet test orchestrator can group artifacts by format without inspecting file contents:

  • SessionFileArtifact gains an optional kind (experimental-gated, [TPEXP]); the shipped 4-arg constructor is preserved for binary compatibility.
  • IPC: FileArtifactMessage.Kind + FileArtifactMessageFieldsId.Kind = 7 + serializer read/write/field-count (forward/backward compatible — old readers skip the unknown field).
  • DotnetTestDataConsumer propagates Kind onto the wire message.
  • Report producers tag their kind: TRX microsoft.testing.trx, JUnit microsoft.testing.junit, CTRF microsoft.testing.ctrf, HTML microsoft.testing.html.

Tests

  • Unit tests for all three merge engines (null/empty inputs, counter summing, outcome, dedup, timestamps, bare-root/missing-aggregate robustness, summary-missing).
  • IPC protocol round-trip tests assert Kind survives the pipe.
  • Full repo builds clean (only the unrelated WasiPlayground sample fails on a missing workload); Platform IPC/protocol, contract-package, and Extensions unit tests all green.

Not in this PR (future phases, per the RFC)

  • IArtifactPostProcessor typed contract wrapping the engines.
  • Handshake advertisement of post-processor kinds.
  • Dispatcher ITool + tool-host-over-pipe composition.
  • User tools (merge-trx, …) and the dotnet/sdk orchestration.

cc Amaury Levé (@Evangelink)

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

Implements the first testfx-side pieces of RFC 018 (artifact post-processing
for dotnet test / MTP):
- Report merge engines (pure, invocation-agnostic, no I/O in the core):
- TrxReportEngine.Merge / MergeToFileAsync (XML-level TRX merge).
- JUnitReportMerger (unions <testsuite>, counters derived per-suite).
- CtrfReportMerger (JSON merge; summary derived from merged tests[]).
- Kind metadata flow so the dotnet/sdk orchestrator can group artifacts by
format: SessionFileArtifact gains an optional kind (experimental), the
FileArtifactMessage IPC record + serializer carry Kind (field id 7), the
dotnet-test consumer propagates it, and report producers tag their kind
(trx/junit/ctrf/html).
Unit tests cover all three merge engines and the IPC round-trip.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
CopilotAI review requested due to automatic review settings July 9, 2026 22:09

CopilotAI 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

Adds report-merging foundations and propagates artifact format metadata through MTP’s artifact and IPC layers.

Changes:

  • Adds TRX, JUnit, and CTRF merge engines with unit tests.
  • Adds experimental SessionFileArtifact.Kind metadata and IPC serialization.
  • Tags TRX, JUnit, CTRF, and HTML report artifacts by format.
Show a summary per file
FileDescription
test/UnitTests/Microsoft.Testing.Platform.UnitTests/IPC/ProtocolTests.csCovers IPC kind serialization.
test/UnitTests/Microsoft.Testing.Platform.UnitTests/IPC/ProtocolEdgeCaseTests.csTests nullable kind round trips.
test/UnitTests/Microsoft.Testing.Platform.DotnetTestProtocolContract.UnitTests/DotnetTestProtocolSerializerTests.csVerifies protocol-contract serialization.
test/UnitTests/Microsoft.Testing.Extensions.UnitTests/TrxReportEngineMergeTests.csTests TRX merging.
test/UnitTests/Microsoft.Testing.Extensions.UnitTests/JUnitReportMergerTests.csTests JUnit merging.
test/UnitTests/Microsoft.Testing.Extensions.UnitTests/CtrfReportMergerTests.csTests CTRF merging.
src/Platform/SharedExtensionHelpers/ReportGeneratorBase.csPublishes report artifact kinds.
src/Platform/Microsoft.Testing.Platform/ServerMode/DotnetTest/IPC/Serializers/FileArtifactMessagesSerializer.csSerializes the new kind field.
src/Platform/Microsoft.Testing.Platform/ServerMode/DotnetTest/IPC/ObjectFieldIds.csAssigns IPC field ID 7.
src/Platform/Microsoft.Testing.Platform/ServerMode/DotnetTest/IPC/Models/FileArtifactMessages.csAdds kind to the wire model.
src/Platform/Microsoft.Testing.Platform/ServerMode/DotnetTest/IPC/DotnetTestDataConsumer.csPropagates session artifact kinds.
src/Platform/Microsoft.Testing.Platform/PublicAPI/PublicAPI.Unshipped.txtTracks the experimental public API.
src/Platform/Microsoft.Testing.Platform/Messages/FileArtifacts.csAdds the kind-aware constructor and property.
src/Platform/Microsoft.Testing.Platform/InternalAPI/InternalAPI.Unshipped.txtTracks IPC internal API changes.
src/Platform/Microsoft.Testing.Extensions.TrxReport/TrxReportEngine.Merge.csImplements TRX merging.
src/Platform/Microsoft.Testing.Extensions.TrxReport/TrxDataConsumer.csTags in-process TRX artifacts.
src/Platform/Microsoft.Testing.Extensions.TrxReport/InternalAPI/InternalAPI.Unshipped.txtTracks TRX internal APIs.
src/Platform/Microsoft.Testing.Extensions.Retry/InternalAPI/InternalAPI.Unshipped.txtTracks linked IPC field API.
src/Platform/Microsoft.Testing.Extensions.MSBuild/InternalAPI.Unshipped.txtTracks linked IPC field API.
src/Platform/Microsoft.Testing.Extensions.JUnitReport/JUnitReportMerger.csImplements JUnit merging.
src/Platform/Microsoft.Testing.Extensions.JUnitReport/JUnitReportGenerator.csTags JUnit artifacts.
src/Platform/Microsoft.Testing.Extensions.JUnitReport/InternalAPI/InternalAPI.Unshipped.txtTracks JUnit internal APIs.
src/Platform/Microsoft.Testing.Extensions.HtmlReport/InternalAPI/InternalAPI.Unshipped.txtTracks shared generator API.
src/Platform/Microsoft.Testing.Extensions.HtmlReport/HtmlReportGenerator.csTags HTML artifacts.
src/Platform/Microsoft.Testing.Extensions.HangDump/InternalAPI/InternalAPI.Unshipped.txtTracks linked IPC field API.
src/Platform/Microsoft.Testing.Extensions.CtrfReport/InternalAPI/InternalAPI.Unshipped.txtTracks CTRF internal APIs.
src/Platform/Microsoft.Testing.Extensions.CtrfReport/CtrfReportMerger.csImplements CTRF merging.
src/Platform/Microsoft.Testing.Extensions.CtrfReport/CtrfReportGenerator.csTags CTRF artifacts.

Review details

  • Files reviewed: 28/28 changed files
  • Comments generated: 4
  • Review effort level: Medium

Comment threadsrc/Platform/Microsoft.Testing.Extensions.TrxReport/TrxDataConsumer.cs Outdated
@Evangelink
Amaury Levé (Evangelink) marked this pull request as ready for review July 13, 2026 14:43
…ure-broccoli
# Conflicts:
#	src/Platform/Microsoft.Testing.Extensions.CtrfReport/InternalAPI/InternalAPI.Unshipped.txt
#	src/Platform/Microsoft.Testing.Extensions.HangDump/InternalAPI/InternalAPI.Unshipped.txt
#	src/Platform/Microsoft.Testing.Extensions.HtmlReport/InternalAPI/InternalAPI.Unshipped.txt
#	src/Platform/Microsoft.Testing.Extensions.JUnitReport/InternalAPI/InternalAPI.Unshipped.txt
#	src/Platform/Microsoft.Testing.Extensions.TrxReport/InternalAPI/InternalAPI.Unshipped.txt
#	src/Platform/Microsoft.Testing.Platform/InternalAPI/InternalAPI.Unshipped.txt
- Carry microsoft.testing.trx through the out-of-process TRX path by adding an
(experimental) Kind to FileArtifact and propagating it in DotnetTestDataConsumer
and TrxProcessLifetimeHandler; centralize the kind in TrxReportEngine.TrxArtifactKind.
- Deduplicate <UnitTest> definitions by id when merging TRX (ids are deterministic
from the test UID and the schema forbids duplicates).
- Preserve <RunInfos> (crash/exit diagnostics) and <CollectorDataEntries> from every
input's <ResultSummary> instead of discarding them; omit them when empty.
- Correct the inaccurate 'attachment paths are absolute' remark and relocate each
input's attachment deployment tree into the merged deployment root in
MergeToFileAsync (best-effort, never fails the merge).
- Add unit tests for dedup and diagnostics preservation.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
CopilotAI review requested due to automatic review settings July 13, 2026 15:04

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

Review details

  • Files reviewed: 30/30 changed files
  • Comments generated: 11
  • Review effort level: Medium

Comment threadsrc/Platform/Microsoft.Testing.Extensions.JUnitReport/JUnitReportMerger.cs Outdated
Comment threadsrc/Platform/Microsoft.Testing.Extensions.TrxReport/TrxDataConsumer.cs Outdated
@github-actions

This comment has been minimized.

@EvangelinkAmaury Levé (Evangelink) added the state/needs-review Awaiting review from the team. label Jul 13, 2026
…ure-broccoli
# Conflicts:
#	src/Platform/Microsoft.Testing.Extensions.CtrfReport/InternalAPI/InternalAPI.Unshipped.txt
#	src/Platform/Microsoft.Testing.Extensions.HangDump/InternalAPI/InternalAPI.Unshipped.txt
#	src/Platform/Microsoft.Testing.Extensions.HtmlReport/InternalAPI/InternalAPI.Unshipped.txt
#	src/Platform/Microsoft.Testing.Extensions.JUnitReport/InternalAPI/InternalAPI.Unshipped.txt
#	src/Platform/Microsoft.Testing.Extensions.MSBuild/InternalAPI.Unshipped.txt
#	src/Platform/Microsoft.Testing.Extensions.Retry/InternalAPI/InternalAPI.Unshipped.txt
#	src/Platform/Microsoft.Testing.Extensions.TrxReport/InternalAPI/InternalAPI.Unshipped.txt
#	src/Platform/Microsoft.Testing.Platform/InternalAPI/InternalAPI.Unshipped.txt
CopilotAI review requested due to automatic review settings July 13, 2026 19:50

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

Review details

  • Files reviewed: 30/30 changed files
  • Comments generated: 3
  • Review effort level: Medium

- Skip relocation when the merged 'In' root overlaps the source 'In' root (output
written beside the input with a matching runName), preventing the copy from
recursing into its own destination; the original hrefs already resolve there.
- Skip file reparse points (symlinks) before File.Copy so a link inside the confined
tree can't pull in content from outside it.
- Overwrite copied attachment files so a reused output directory can't leave stale
bytes behind while the merged XML references the fresh per-input destination.
- Add a unit test for the overlapping-root skip case.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
CopilotAI review requested due to automatic review settings July 13, 2026 20:06

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

Review details

  • Files reviewed: 30/30 changed files
  • Comments generated: 1
  • Review effort level: Medium

@github-actions

This comment has been minimized.

Regenerated via UpdateXlf. The last localized check-in added translations for
'GlobalTestFixtureShouldBeValidClassLayout' (fr) and 'SlowTestStillRunning' (ru)
that XliffTasks rejects (placeholder mismatch), breaking the build with
"xlf is out-of-date with resx". UpdateXlf resets those two units to state="new"
so the build passes; they will be re-translated on the next localization pass.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 4350f662-0e5d-4e05-b156-1ef619da3b9e
CopilotAI review requested due to automatic review settings July 14, 2026 08:01

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

Review details

  • Files reviewed: 32/32 changed files
  • Comments generated: 3
  • Review effort level: Low

Comment threadsrc/Analyzers/MSTest.Analyzers/xlf/Resources.fr.xlf Outdated

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

Review details

  • Files reviewed: 31/31 changed files
  • Comments generated: 5
  • Review effort level: Medium

Comment threadsrc/Platform/Microsoft.Testing.Extensions.JUnitReport/JUnitReportMerger.cs Outdated
Comment threadsrc/Platform/Microsoft.Testing.Extensions.CtrfReport/CtrfReportMerger.cs Outdated
…ias check (review)
- TRX Merge now carries run-level <ResultSummary>/<Output> across (StdOut/StdErr/
DebugTrace concatenated, TextMessages/Message unioned), emitted in schema order right
after <Counters>, so VSTest's run-level skipped/informational messages are no longer
silently dropped.
- MergeToFileAsync rejects an empty input list before any filesystem work (output
directory creation / attachment relocation), so an invalid call no longer mutates the
disk before Merge throws. Applied to TRX/JUnit/CTRF.
- Output-alias check is now filesystem-aware: it compares canonicalized paths with a
cached case-sensitivity probe (case-sensitive on case-sensitive volumes, insensitive
otherwise), so on Linux a legitimate separate output like 'A.trx' is no longer rejected
as aliasing input 'a.trx', while Windows/macOS case aliases are still caught. Applied
to TRX/JUnit/CTRF.
Tests: run-level Output merge + schema order; empty-input rejection without touching the
filesystem (all three mergers). 74 merge tests pass; full solution build clean.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
CopilotAI review requested due to automatic review settings July 16, 2026 07:49

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

Review details

  • Files reviewed: 31/31 changed files
  • Comments generated: 3
  • Review effort level: Medium

Comment threadsrc/Platform/Microsoft.Testing.Extensions.JUnitReport/JUnitReportMerger.cs Outdated
Comment threadsrc/Platform/Microsoft.Testing.Extensions.CtrfReport/CtrfReportMerger.cs Outdated
@github-actions

This comment has been minimized.

…view)
The alias-equality check derived its case sensitivity from a one-time probe in
Path.GetTempPath(), but case sensitivity can differ per volume and (on Windows) per
directory. Replace the cached temp probe with a per-call probe of the OUTPUT's own
location (nearest existing ancestor) in all three mergers. An alias can only occur when
input and output share a directory, so that shared location's sensitivity is the correct
one — a different-directory input never compares equal. Falls back to case-insensitive
(rejects more, never less) if the probe fails. This closes the gap where 'A.trx' could
alias input 'a.trx' on a case-insensitive output volume while the temp-based probe said
Ordinal, letting ReplaceFile delete the input.
Applied to TRX/JUnit/CTRF. 74 merge tests pass; full solution build clean.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
CopilotAI review requested due to automatic review settings July 16, 2026 08:10

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

Review details

  • Files reviewed: 31/31 changed files
  • Comments generated: 3
  • Review effort level: Medium

Comment threadsrc/Platform/Microsoft.Testing.Extensions.JUnitReport/JUnitReportMerger.cs Outdated
Comment threadsrc/Platform/Microsoft.Testing.Extensions.CtrfReport/CtrfReportMerger.cs Outdated
…er (review)
The read-only-input alias check (canonicalization, per-output-directory case-sensitivity
probe, netstandard reparse-ancestor fail-closed) and the atomic temporary-sibling write/
replace were duplicated in the TRX, JUnit and CTRF mergers. Because this is security- and
data-loss-sensitive, extract it into a single shared SharedExtensionHelpers/
MergeOutputFileHelper.cs (linked into all three, namespace Microsoft.Testing.Extensions),
exposing EnsureOutputDoesNotAliasInput and WriteViaTemporarySiblingAsync so the logic can
no longer diverge across formats. Each merger now delegates to it; the per-format writer
(XDocument stream vs string) is passed as a callback. Registered the shared internal type/
methods in each project's InternalAPI.Unshipped.txt.
No behavior change. 74 merge tests pass; full solution build clean (0 warnings).
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
CopilotAI review requested due to automatic review settings July 16, 2026 08:40
@github-actions

This comment has been minimized.

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

Review details

  • Files reviewed: 35/35 changed files
  • Comments generated: 4
  • Review effort level: Medium

Comment threadsrc/Platform/SharedExtensionHelpers/MergeOutputFileHelper.cs
Comment threadsrc/Platform/Microsoft.Testing.Extensions.CtrfReport/CtrfReportMerger.cs Outdated
…ments
CI (macOS): GetCanonicalPath now re-resolves ancestor symlinks after every
link hop, so a link target whose prefix is itself a symlink (macOS
/var -> /private/var) canonicalizes consistently and the read-only-input
alias check no longer misses a symlinked-parent output. Fixes the 3
WhenOutputAliasesInputViaSymlinkedParent merge tests that failed on macOS.
Review comments addressed:
- MergeOutputFileHelper.ReplaceFile: atomic File.Move(overwrite:true) on
netcore so an interruption can never leave the previous report missing;
delete-then-move retained only on .NET Framework (no overwrite overload).
- TRX relocation: deployment root is now unique per run (run id suffix), so
relocation always writes a fresh tree and can never corrupt a previously
committed report's attachments if a later merge fails.
- TRX Times: earliest creation/queuing/start tracked independently and
omitted when no input supplies them, instead of fabricating all three
from the earliest start.
- CTRF reportId: derived only from accepted CTRF payloads, so an ignored
non-CTRF input no longer changes the merged report identity.
Adds regression tests for each and updates deployment-root-coupled TRX tests
to read the emitted runDeploymentRoot instead of assuming a literal name.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 34f1a49b-b1e0-4f38-b8a1-3870dd0842d2
CopilotAI review requested due to automatic review settings July 16, 2026 12:00

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

Review details

  • Files reviewed: 35/35 changed files
  • Comments generated: 1
  • Review effort level: Medium

Comment threadsrc/Platform/SharedExtensionHelpers/MergeOutputFileHelper.cs
@github-actions

Copy link
Copy Markdown
Contributor

🧪 Test quality grade — PR #9805

GradeTestNotes
B (80–89)new CtrfReportMergerTests.
Merge_
ReportIdIsUnaffectedByIgnoredNonCtrfInput
Clear scenario and deterministic inputs; equality assertion on both IDs plus a non-null guard make this near-perfect — no issues found, A could be reached by noting the comment rationale inline.
B (80–89)mod TrxReportEngineMergeTests.
MergeToFileAsync_
WhenInputLivesUnderMergedRoot_
PreservesOriginalReportAndAttachment
Presence-only assertions (File.Exists) confirm files survive, but adding a content check (File.ReadAllText) would close the preservation guarantee fully.
B (80–89)mod TrxReportEngineMergeTests.
MergeToFileAsync_
WhenRunNameEscapesOutputDirectory_
UsesConfinedDeploymentRoot
Security assertions (StartsWith, no-separator, confinement scan) are well-chosen; ~38-line body with a directory scan could be split into a confinement test and a content-integrity test.
B (80–89)mod TrxReportEngineMergeTests.
MergeToFileAsync_
RepeatedIntoSameNestedLayout_
IsBoundedAndNonDestructive
Loop + copy-count + href-resolution are all meaningful; the for-loop is idiomatic here, but extracting the loop limit (4) into a named constant would clarify intent.
B (80–89)mod TrxReportEngineMergeTests.
MergeToFileAsync_
RelocatesPerTestResultFilesByPrefixingResultDirectory
Four meaningful assertions covering path rewriting and file content; ~50-line body with manual XML construction — consider extracting a BuildResultFilesReport helper to compress the arrange phase.
A (90–100)new CtrfReportMergerTests.
Merge_
ReportIdIsUnaffectedByIgnoredNonCtrfInput
Inline comment explains non-CTRF input semantics; equality on both IDs plus IsNotNull guard — no issues found.
A (90–100)new TrxReportEngineMergeTests.
Merge_
TimesOmitAttributesNoInputSupplies
Null-absence and equality assertions together cover both the omission and the surviving fields — no issues found.
A (90–100)new TrxReportEngineMergeTests.
Merge_
TimesTrackEarliestCreationQueuingStartIndependently
All four time attributes verified independently with inputs deliberately split across two reports — no issues found.
A (90–100)new TrxReportEngineMergeTests.
MergeToFileAsync_
SecondMergeIntoSameOutput_
DoesNotCorruptPriorReportsAttachments
Two-merge scenario with distinct-root assertion and byte-level content verification — no issues found.
A (90–100)mod TrxReportEngineMergeTests.
MergeToFileAsync_
IsolatesCollidingAttachmentsPerInputAndRewritesHrefs
Now reads mergedRoot from the document rather than assuming runName; content + href assertions are thorough — no issues found.
A (90–100)mod TrxReportEngineMergeTests.
MergeToFileAsync_
WhenRunNameMatchesInputDeploymentRoot_
UsesUniqueRootAndRelocates
AreNotEqual uniqueness check, original-preservation check, and content-verified href resolution — no issues found.
A (90–100)mod TrxReportEngineMergeTests.
MergeToFileAsync_
WhenSourceNestedUnderMergedRoot_
RelocatesAndKeepsHrefsValid
Reads mergedRoot dynamically and validates href resolution end-to-end with content check — no issues found.

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

Warning

Firewall blocked 1 domain

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

  • awmgmcpg

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

network:
allowed:
- defaults
- "awmgmcpg"

See Network Configuration for more information.

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

@Evangelink
Amaury Levé (Evangelink) merged commit 0a44195 into mainJul 16, 2026
68 checks passed
@Evangelink
Amaury Levé (Evangelink) deleted the dev/amauryleve/miniature-broccoli branch July 16, 2026 14:10
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

state/needs-reviewAwaiting review from the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@Evangelink@0101
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Highlight search terms from Google/DuckDuckGo/Bing referrer\n(function() {\n var ref = document.referrer;\n var terms = [];\n \n if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) {\n var url = new URL(ref);\n var q = url.searchParams.get('q') || url.searchParams.get('p');\n if (q) {\n terms = q.split(/\\s+/).filter(function(t) { return t.length > 2; });\n }\n }\n \n if (terms.length === 0) return;\n \n var style = document.createElement('style');\n style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }';\n document.head.appendChild(style);\n \n function highlight(node) {\n if (node.nodeType === 3) { // text node\n var text = node.textContent;\n var found = false;\n terms.forEach(function(term) {\n var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\') + ')', 'gi');\n if (regex.test(text)) {\n found = true;\n var frag = document.createDocumentFragment();\n var parts = text.split(regex);\n parts.forEach(function(part, i) {\n if (i % 2 === 0) {\n frag.appendChild(document.createTextNode(part));\n } else {\n var span = document.createElement('span');\n span.className = 'userscript-highlight';\n span.textContent = part;\n frag.appendChild(span);\n }\n });\n node.parentNode.replaceChild(frag, node);\n }\n });\n } else if (node.nodeType === 1 && node.childNodes) { // element\n var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT'];\n if (!skipTags.includes(node.tagName)) {\n Array.from(node.childNodes).forEach(highlight);\n }\n }\n }\n \n highlight(document.body);\n \n // Re-highlight on dynamic content\n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1 || node.nodeType === 3) highlight(node);\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Highlight Search Terms"); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Add artifact merge engines and Kind metadata flow (RFC 018 phase 1) - #9805

Merged
Amaury Levé (Evangelink) merged 32 commits into
mainfrom
dev/amauryleve/miniature-broccoli
Jul 16, 2026
Merged

Add artifact merge engines and Kind metadata flow (RFC 018 phase 1)#9805
Amaury Levé (Evangelink) merged 32 commits into
mainfrom
dev/amauryleve/miniature-broccoli

Conversation

@Evangelink

Copy link
Copy Markdown
Member

Summary

Implements the first testfx-side pieces of RFC 018 — Artifact post-processing for dotnet test (MTP). Two independent, self-contained foundations that every later phase (dispatcher tool, SDK election) reuses. No SDK dependency; the SDK orchestration lands separately once this merges.

1. Report merge engines (pure, invocation-agnostic — no I/O in the core)

Validated the RFC's "collect same-kind inputs → re-aggregate → emit one" shape across both data models:

EngineFormatMerge unitRe-aggregation
TrxReportEngine.Merge / MergeToFileAsyncXMLResults/TestDefinitions/TestEntriescounters summed, Times earliest/latest, TestLists deduped by id, outcome Failed if any input failed
JUnitReportMergerXML<testsuite>counters derived by summing per-suite (correct even when root aggregates are missing); supports bare <testsuite> roots
CtrfReportMergerJSON (JsonNode)results.tests[]summary derived from the merged tests[] so summary.tests always matches the array; start/stop min/max

HTML is intentionally not file-merged (it's a rendered template with an embedded JSON blob) — this validates the design's opt-in / return-null semantics rather than breaking it.

2. Kind metadata flow (producer → IPC wire)

So the dotnet test orchestrator can group artifacts by format without inspecting file contents:

  • SessionFileArtifact gains an optional kind (experimental-gated, [TPEXP]); the shipped 4-arg constructor is preserved for binary compatibility.
  • IPC: FileArtifactMessage.Kind + FileArtifactMessageFieldsId.Kind = 7 + serializer read/write/field-count (forward/backward compatible — old readers skip the unknown field).
  • DotnetTestDataConsumer propagates Kind onto the wire message.
  • Report producers tag their kind: TRX microsoft.testing.trx, JUnit microsoft.testing.junit, CTRF microsoft.testing.ctrf, HTML microsoft.testing.html.

Tests

  • Unit tests for all three merge engines (null/empty inputs, counter summing, outcome, dedup, timestamps, bare-root/missing-aggregate robustness, summary-missing).
  • IPC protocol round-trip tests assert Kind survives the pipe.
  • Full repo builds clean (only the unrelated WasiPlayground sample fails on a missing workload); Platform IPC/protocol, contract-package, and Extensions unit tests all green.

Not in this PR (future phases, per the RFC)

  • IArtifactPostProcessor typed contract wrapping the engines.
  • Handshake advertisement of post-processor kinds.
  • Dispatcher ITool + tool-host-over-pipe composition.
  • User tools (merge-trx, …) and the dotnet/sdk orchestration.

cc Amaury Levé (@Evangelink)

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

Implements the first testfx-side pieces of RFC 018 (artifact post-processing
for dotnet test / MTP):
- Report merge engines (pure, invocation-agnostic, no I/O in the core):
- TrxReportEngine.Merge / MergeToFileAsync (XML-level TRX merge).
- JUnitReportMerger (unions <testsuite>, counters derived per-suite).
- CtrfReportMerger (JSON merge; summary derived from merged tests[]).
- Kind metadata flow so the dotnet/sdk orchestrator can group artifacts by
format: SessionFileArtifact gains an optional kind (experimental), the
FileArtifactMessage IPC record + serializer carry Kind (field id 7), the
dotnet-test consumer propagates it, and report producers tag their kind
(trx/junit/ctrf/html).
Unit tests cover all three merge engines and the IPC round-trip.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
CopilotAI review requested due to automatic review settings July 9, 2026 22:09

CopilotAI 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

Adds report-merging foundations and propagates artifact format metadata through MTP’s artifact and IPC layers.

Changes:

  • Adds TRX, JUnit, and CTRF merge engines with unit tests.
  • Adds experimental SessionFileArtifact.Kind metadata and IPC serialization.
  • Tags TRX, JUnit, CTRF, and HTML report artifacts by format.
Show a summary per file
FileDescription
test/UnitTests/Microsoft.Testing.Platform.UnitTests/IPC/ProtocolTests.csCovers IPC kind serialization.
test/UnitTests/Microsoft.Testing.Platform.UnitTests/IPC/ProtocolEdgeCaseTests.csTests nullable kind round trips.
test/UnitTests/Microsoft.Testing.Platform.DotnetTestProtocolContract.UnitTests/DotnetTestProtocolSerializerTests.csVerifies protocol-contract serialization.
test/UnitTests/Microsoft.Testing.Extensions.UnitTests/TrxReportEngineMergeTests.csTests TRX merging.
test/UnitTests/Microsoft.Testing.Extensions.UnitTests/JUnitReportMergerTests.csTests JUnit merging.
test/UnitTests/Microsoft.Testing.Extensions.UnitTests/CtrfReportMergerTests.csTests CTRF merging.
src/Platform/SharedExtensionHelpers/ReportGeneratorBase.csPublishes report artifact kinds.
src/Platform/Microsoft.Testing.Platform/ServerMode/DotnetTest/IPC/Serializers/FileArtifactMessagesSerializer.csSerializes the new kind field.
src/Platform/Microsoft.Testing.Platform/ServerMode/DotnetTest/IPC/ObjectFieldIds.csAssigns IPC field ID 7.
src/Platform/Microsoft.Testing.Platform/ServerMode/DotnetTest/IPC/Models/FileArtifactMessages.csAdds kind to the wire model.
src/Platform/Microsoft.Testing.Platform/ServerMode/DotnetTest/IPC/DotnetTestDataConsumer.csPropagates session artifact kinds.
src/Platform/Microsoft.Testing.Platform/PublicAPI/PublicAPI.Unshipped.txtTracks the experimental public API.
src/Platform/Microsoft.Testing.Platform/Messages/FileArtifacts.csAdds the kind-aware constructor and property.
src/Platform/Microsoft.Testing.Platform/InternalAPI/InternalAPI.Unshipped.txtTracks IPC internal API changes.
src/Platform/Microsoft.Testing.Extensions.TrxReport/TrxReportEngine.Merge.csImplements TRX merging.
src/Platform/Microsoft.Testing.Extensions.TrxReport/TrxDataConsumer.csTags in-process TRX artifacts.
src/Platform/Microsoft.Testing.Extensions.TrxReport/InternalAPI/InternalAPI.Unshipped.txtTracks TRX internal APIs.
src/Platform/Microsoft.Testing.Extensions.Retry/InternalAPI/InternalAPI.Unshipped.txtTracks linked IPC field API.
src/Platform/Microsoft.Testing.Extensions.MSBuild/InternalAPI.Unshipped.txtTracks linked IPC field API.
src/Platform/Microsoft.Testing.Extensions.JUnitReport/JUnitReportMerger.csImplements JUnit merging.
src/Platform/Microsoft.Testing.Extensions.JUnitReport/JUnitReportGenerator.csTags JUnit artifacts.
src/Platform/Microsoft.Testing.Extensions.JUnitReport/InternalAPI/InternalAPI.Unshipped.txtTracks JUnit internal APIs.
src/Platform/Microsoft.Testing.Extensions.HtmlReport/InternalAPI/InternalAPI.Unshipped.txtTracks shared generator API.
src/Platform/Microsoft.Testing.Extensions.HtmlReport/HtmlReportGenerator.csTags HTML artifacts.
src/Platform/Microsoft.Testing.Extensions.HangDump/InternalAPI/InternalAPI.Unshipped.txtTracks linked IPC field API.
src/Platform/Microsoft.Testing.Extensions.CtrfReport/InternalAPI/InternalAPI.Unshipped.txtTracks CTRF internal APIs.
src/Platform/Microsoft.Testing.Extensions.CtrfReport/CtrfReportMerger.csImplements CTRF merging.
src/Platform/Microsoft.Testing.Extensions.CtrfReport/CtrfReportGenerator.csTags CTRF artifacts.

Review details

  • Files reviewed: 28/28 changed files
  • Comments generated: 4
  • Review effort level: Medium

Comment threadsrc/Platform/Microsoft.Testing.Extensions.TrxReport/TrxDataConsumer.cs Outdated
@Evangelink
Amaury Levé (Evangelink) marked this pull request as ready for review July 13, 2026 14:43
…ure-broccoli
# Conflicts:
#	src/Platform/Microsoft.Testing.Extensions.CtrfReport/InternalAPI/InternalAPI.Unshipped.txt
#	src/Platform/Microsoft.Testing.Extensions.HangDump/InternalAPI/InternalAPI.Unshipped.txt
#	src/Platform/Microsoft.Testing.Extensions.HtmlReport/InternalAPI/InternalAPI.Unshipped.txt
#	src/Platform/Microsoft.Testing.Extensions.JUnitReport/InternalAPI/InternalAPI.Unshipped.txt
#	src/Platform/Microsoft.Testing.Extensions.TrxReport/InternalAPI/InternalAPI.Unshipped.txt
#	src/Platform/Microsoft.Testing.Platform/InternalAPI/InternalAPI.Unshipped.txt
- Carry microsoft.testing.trx through the out-of-process TRX path by adding an
(experimental) Kind to FileArtifact and propagating it in DotnetTestDataConsumer
and TrxProcessLifetimeHandler; centralize the kind in TrxReportEngine.TrxArtifactKind.
- Deduplicate <UnitTest> definitions by id when merging TRX (ids are deterministic
from the test UID and the schema forbids duplicates).
- Preserve <RunInfos> (crash/exit diagnostics) and <CollectorDataEntries> from every
input's <ResultSummary> instead of discarding them; omit them when empty.
- Correct the inaccurate 'attachment paths are absolute' remark and relocate each
input's attachment deployment tree into the merged deployment root in
MergeToFileAsync (best-effort, never fails the merge).
- Add unit tests for dedup and diagnostics preservation.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
CopilotAI review requested due to automatic review settings July 13, 2026 15:04

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

Review details

  • Files reviewed: 30/30 changed files
  • Comments generated: 11
  • Review effort level: Medium

Comment threadsrc/Platform/Microsoft.Testing.Extensions.JUnitReport/JUnitReportMerger.cs Outdated
Comment threadsrc/Platform/Microsoft.Testing.Extensions.TrxReport/TrxDataConsumer.cs Outdated
@github-actions

This comment has been minimized.

@EvangelinkAmaury Levé (Evangelink) added the state/needs-review Awaiting review from the team. label Jul 13, 2026
…ure-broccoli
# Conflicts:
#	src/Platform/Microsoft.Testing.Extensions.CtrfReport/InternalAPI/InternalAPI.Unshipped.txt
#	src/Platform/Microsoft.Testing.Extensions.HangDump/InternalAPI/InternalAPI.Unshipped.txt
#	src/Platform/Microsoft.Testing.Extensions.HtmlReport/InternalAPI/InternalAPI.Unshipped.txt
#	src/Platform/Microsoft.Testing.Extensions.JUnitReport/InternalAPI/InternalAPI.Unshipped.txt
#	src/Platform/Microsoft.Testing.Extensions.MSBuild/InternalAPI.Unshipped.txt
#	src/Platform/Microsoft.Testing.Extensions.Retry/InternalAPI/InternalAPI.Unshipped.txt
#	src/Platform/Microsoft.Testing.Extensions.TrxReport/InternalAPI/InternalAPI.Unshipped.txt
#	src/Platform/Microsoft.Testing.Platform/InternalAPI/InternalAPI.Unshipped.txt
CopilotAI review requested due to automatic review settings July 13, 2026 19:50

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

Review details

  • Files reviewed: 30/30 changed files
  • Comments generated: 3
  • Review effort level: Medium

- Skip relocation when the merged 'In' root overlaps the source 'In' root (output
written beside the input with a matching runName), preventing the copy from
recursing into its own destination; the original hrefs already resolve there.
- Skip file reparse points (symlinks) before File.Copy so a link inside the confined
tree can't pull in content from outside it.
- Overwrite copied attachment files so a reused output directory can't leave stale
bytes behind while the merged XML references the fresh per-input destination.
- Add a unit test for the overlapping-root skip case.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
CopilotAI review requested due to automatic review settings July 13, 2026 20:06

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

Review details

  • Files reviewed: 30/30 changed files
  • Comments generated: 1
  • Review effort level: Medium

@github-actions

This comment has been minimized.

Regenerated via UpdateXlf. The last localized check-in added translations for
'GlobalTestFixtureShouldBeValidClassLayout' (fr) and 'SlowTestStillRunning' (ru)
that XliffTasks rejects (placeholder mismatch), breaking the build with
"xlf is out-of-date with resx". UpdateXlf resets those two units to state="new"
so the build passes; they will be re-translated on the next localization pass.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 4350f662-0e5d-4e05-b156-1ef619da3b9e
CopilotAI review requested due to automatic review settings July 14, 2026 08:01

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

Review details

  • Files reviewed: 32/32 changed files
  • Comments generated: 3
  • Review effort level: Low

Comment threadsrc/Analyzers/MSTest.Analyzers/xlf/Resources.fr.xlf Outdated

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

Review details

  • Files reviewed: 31/31 changed files
  • Comments generated: 5
  • Review effort level: Medium

Comment threadsrc/Platform/Microsoft.Testing.Extensions.JUnitReport/JUnitReportMerger.cs Outdated
Comment threadsrc/Platform/Microsoft.Testing.Extensions.CtrfReport/CtrfReportMerger.cs Outdated
…ias check (review)
- TRX Merge now carries run-level <ResultSummary>/<Output> across (StdOut/StdErr/
DebugTrace concatenated, TextMessages/Message unioned), emitted in schema order right
after <Counters>, so VSTest's run-level skipped/informational messages are no longer
silently dropped.
- MergeToFileAsync rejects an empty input list before any filesystem work (output
directory creation / attachment relocation), so an invalid call no longer mutates the
disk before Merge throws. Applied to TRX/JUnit/CTRF.
- Output-alias check is now filesystem-aware: it compares canonicalized paths with a
cached case-sensitivity probe (case-sensitive on case-sensitive volumes, insensitive
otherwise), so on Linux a legitimate separate output like 'A.trx' is no longer rejected
as aliasing input 'a.trx', while Windows/macOS case aliases are still caught. Applied
to TRX/JUnit/CTRF.
Tests: run-level Output merge + schema order; empty-input rejection without touching the
filesystem (all three mergers). 74 merge tests pass; full solution build clean.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
CopilotAI review requested due to automatic review settings July 16, 2026 07:49

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

Review details

  • Files reviewed: 31/31 changed files
  • Comments generated: 3
  • Review effort level: Medium

Comment threadsrc/Platform/Microsoft.Testing.Extensions.JUnitReport/JUnitReportMerger.cs Outdated
Comment threadsrc/Platform/Microsoft.Testing.Extensions.CtrfReport/CtrfReportMerger.cs Outdated
@github-actions

This comment has been minimized.

…view)
The alias-equality check derived its case sensitivity from a one-time probe in
Path.GetTempPath(), but case sensitivity can differ per volume and (on Windows) per
directory. Replace the cached temp probe with a per-call probe of the OUTPUT's own
location (nearest existing ancestor) in all three mergers. An alias can only occur when
input and output share a directory, so that shared location's sensitivity is the correct
one — a different-directory input never compares equal. Falls back to case-insensitive
(rejects more, never less) if the probe fails. This closes the gap where 'A.trx' could
alias input 'a.trx' on a case-insensitive output volume while the temp-based probe said
Ordinal, letting ReplaceFile delete the input.
Applied to TRX/JUnit/CTRF. 74 merge tests pass; full solution build clean.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
CopilotAI review requested due to automatic review settings July 16, 2026 08:10

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

Review details

  • Files reviewed: 31/31 changed files
  • Comments generated: 3
  • Review effort level: Medium

Comment threadsrc/Platform/Microsoft.Testing.Extensions.JUnitReport/JUnitReportMerger.cs Outdated
Comment threadsrc/Platform/Microsoft.Testing.Extensions.CtrfReport/CtrfReportMerger.cs Outdated
…er (review)
The read-only-input alias check (canonicalization, per-output-directory case-sensitivity
probe, netstandard reparse-ancestor fail-closed) and the atomic temporary-sibling write/
replace were duplicated in the TRX, JUnit and CTRF mergers. Because this is security- and
data-loss-sensitive, extract it into a single shared SharedExtensionHelpers/
MergeOutputFileHelper.cs (linked into all three, namespace Microsoft.Testing.Extensions),
exposing EnsureOutputDoesNotAliasInput and WriteViaTemporarySiblingAsync so the logic can
no longer diverge across formats. Each merger now delegates to it; the per-format writer
(XDocument stream vs string) is passed as a callback. Registered the shared internal type/
methods in each project's InternalAPI.Unshipped.txt.
No behavior change. 74 merge tests pass; full solution build clean (0 warnings).
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
CopilotAI review requested due to automatic review settings July 16, 2026 08:40
@github-actions

This comment has been minimized.

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

Review details

  • Files reviewed: 35/35 changed files
  • Comments generated: 4
  • Review effort level: Medium

Comment threadsrc/Platform/SharedExtensionHelpers/MergeOutputFileHelper.cs
Comment threadsrc/Platform/Microsoft.Testing.Extensions.CtrfReport/CtrfReportMerger.cs Outdated
…ments
CI (macOS): GetCanonicalPath now re-resolves ancestor symlinks after every
link hop, so a link target whose prefix is itself a symlink (macOS
/var -> /private/var) canonicalizes consistently and the read-only-input
alias check no longer misses a symlinked-parent output. Fixes the 3
WhenOutputAliasesInputViaSymlinkedParent merge tests that failed on macOS.
Review comments addressed:
- MergeOutputFileHelper.ReplaceFile: atomic File.Move(overwrite:true) on
netcore so an interruption can never leave the previous report missing;
delete-then-move retained only on .NET Framework (no overwrite overload).
- TRX relocation: deployment root is now unique per run (run id suffix), so
relocation always writes a fresh tree and can never corrupt a previously
committed report's attachments if a later merge fails.
- TRX Times: earliest creation/queuing/start tracked independently and
omitted when no input supplies them, instead of fabricating all three
from the earliest start.
- CTRF reportId: derived only from accepted CTRF payloads, so an ignored
non-CTRF input no longer changes the merged report identity.
Adds regression tests for each and updates deployment-root-coupled TRX tests
to read the emitted runDeploymentRoot instead of assuming a literal name.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 34f1a49b-b1e0-4f38-b8a1-3870dd0842d2
CopilotAI review requested due to automatic review settings July 16, 2026 12:00

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

Review details

  • Files reviewed: 35/35 changed files
  • Comments generated: 1
  • Review effort level: Medium

Comment threadsrc/Platform/SharedExtensionHelpers/MergeOutputFileHelper.cs
@github-actions

Copy link
Copy Markdown
Contributor

🧪 Test quality grade — PR #9805

GradeTestNotes
B (80–89)new CtrfReportMergerTests.
Merge_
ReportIdIsUnaffectedByIgnoredNonCtrfInput
Clear scenario and deterministic inputs; equality assertion on both IDs plus a non-null guard make this near-perfect — no issues found, A could be reached by noting the comment rationale inline.
B (80–89)mod TrxReportEngineMergeTests.
MergeToFileAsync_
WhenInputLivesUnderMergedRoot_
PreservesOriginalReportAndAttachment
Presence-only assertions (File.Exists) confirm files survive, but adding a content check (File.ReadAllText) would close the preservation guarantee fully.
B (80–89)mod TrxReportEngineMergeTests.
MergeToFileAsync_
WhenRunNameEscapesOutputDirectory_
UsesConfinedDeploymentRoot
Security assertions (StartsWith, no-separator, confinement scan) are well-chosen; ~38-line body with a directory scan could be split into a confinement test and a content-integrity test.
B (80–89)mod TrxReportEngineMergeTests.
MergeToFileAsync_
RepeatedIntoSameNestedLayout_
IsBoundedAndNonDestructive
Loop + copy-count + href-resolution are all meaningful; the for-loop is idiomatic here, but extracting the loop limit (4) into a named constant would clarify intent.
B (80–89)mod TrxReportEngineMergeTests.
MergeToFileAsync_
RelocatesPerTestResultFilesByPrefixingResultDirectory
Four meaningful assertions covering path rewriting and file content; ~50-line body with manual XML construction — consider extracting a BuildResultFilesReport helper to compress the arrange phase.
A (90–100)new CtrfReportMergerTests.
Merge_
ReportIdIsUnaffectedByIgnoredNonCtrfInput
Inline comment explains non-CTRF input semantics; equality on both IDs plus IsNotNull guard — no issues found.
A (90–100)new TrxReportEngineMergeTests.
Merge_
TimesOmitAttributesNoInputSupplies
Null-absence and equality assertions together cover both the omission and the surviving fields — no issues found.
A (90–100)new TrxReportEngineMergeTests.
Merge_
TimesTrackEarliestCreationQueuingStartIndependently
All four time attributes verified independently with inputs deliberately split across two reports — no issues found.
A (90–100)new TrxReportEngineMergeTests.
MergeToFileAsync_
SecondMergeIntoSameOutput_
DoesNotCorruptPriorReportsAttachments
Two-merge scenario with distinct-root assertion and byte-level content verification — no issues found.
A (90–100)mod TrxReportEngineMergeTests.
MergeToFileAsync_
IsolatesCollidingAttachmentsPerInputAndRewritesHrefs
Now reads mergedRoot from the document rather than assuming runName; content + href assertions are thorough — no issues found.
A (90–100)mod TrxReportEngineMergeTests.
MergeToFileAsync_
WhenRunNameMatchesInputDeploymentRoot_
UsesUniqueRootAndRelocates
AreNotEqual uniqueness check, original-preservation check, and content-verified href resolution — no issues found.
A (90–100)mod TrxReportEngineMergeTests.
MergeToFileAsync_
WhenSourceNestedUnderMergedRoot_
RelocatesAndKeepsHrefsValid
Reads mergedRoot dynamically and validates href resolution end-to-end with content check — no issues found.

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

Warning

Firewall blocked 1 domain

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

  • awmgmcpg

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

network:
allowed:
- defaults
- "awmgmcpg"

See Network Configuration for more information.

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

@Evangelink
Amaury Levé (Evangelink) merged commit 0a44195 into mainJul 16, 2026
68 checks passed
@Evangelink
Amaury Levé (Evangelink) deleted the dev/amauryleve/miniature-broccoli branch July 16, 2026 14:10
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

state/needs-reviewAwaiting review from the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@Evangelink@0101
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Strip utm_, fbclid, gclid, etc. from all links on page\n(function() {\n var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content',\n 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid',\n 'ref', 'ref_src', 'source', 'medium', 'campaign'];\n \n function cleanUrl(url) {\n try {\n var u = new URL(url, window.location.origin);\n var changed = false;\n trackingParams.forEach(function(p) {\n if (u.searchParams.has(p)) {\n u.searchParams.delete(p);\n changed = true;\n }\n });\n return changed ? u.toString() : url;\n } catch (e) {\n return url;\n }\n }\n \n function cleanLinks() {\n document.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n \n cleanLinks();\n \n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1) {\n if (node.tagName === 'A') cleanLinks();\n node.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Remove Tracking Parameters from Links"); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + '
Skip to content

Add artifact merge engines and Kind metadata flow (RFC 018 phase 1) - #9805

Merged
Amaury Levé (Evangelink) merged 32 commits into
mainfrom
dev/amauryleve/miniature-broccoli
Jul 16, 2026
Merged

Add artifact merge engines and Kind metadata flow (RFC 018 phase 1)#9805
Amaury Levé (Evangelink) merged 32 commits into
mainfrom
dev/amauryleve/miniature-broccoli

Conversation

@Evangelink

Copy link
Copy Markdown
Member

Summary

Implements the first testfx-side pieces of RFC 018 — Artifact post-processing for dotnet test (MTP). Two independent, self-contained foundations that every later phase (dispatcher tool, SDK election) reuses. No SDK dependency; the SDK orchestration lands separately once this merges.

1. Report merge engines (pure, invocation-agnostic — no I/O in the core)

Validated the RFC's "collect same-kind inputs → re-aggregate → emit one" shape across both data models:

EngineFormatMerge unitRe-aggregation
TrxReportEngine.Merge / MergeToFileAsyncXMLResults/TestDefinitions/TestEntriescounters summed, Times earliest/latest, TestLists deduped by id, outcome Failed if any input failed
JUnitReportMergerXML<testsuite>counters derived by summing per-suite (correct even when root aggregates are missing); supports bare <testsuite> roots
CtrfReportMergerJSON (JsonNode)results.tests[]summary derived from the merged tests[] so summary.tests always matches the array; start/stop min/max

HTML is intentionally not file-merged (it's a rendered template with an embedded JSON blob) — this validates the design's opt-in / return-null semantics rather than breaking it.

2. Kind metadata flow (producer → IPC wire)

So the dotnet test orchestrator can group artifacts by format without inspecting file contents:

  • SessionFileArtifact gains an optional kind (experimental-gated, [TPEXP]); the shipped 4-arg constructor is preserved for binary compatibility.
  • IPC: FileArtifactMessage.Kind + FileArtifactMessageFieldsId.Kind = 7 + serializer read/write/field-count (forward/backward compatible — old readers skip the unknown field).
  • DotnetTestDataConsumer propagates Kind onto the wire message.
  • Report producers tag their kind: TRX microsoft.testing.trx, JUnit microsoft.testing.junit, CTRF microsoft.testing.ctrf, HTML microsoft.testing.html.

Tests

  • Unit tests for all three merge engines (null/empty inputs, counter summing, outcome, dedup, timestamps, bare-root/missing-aggregate robustness, summary-missing).
  • IPC protocol round-trip tests assert Kind survives the pipe.
  • Full repo builds clean (only the unrelated WasiPlayground sample fails on a missing workload); Platform IPC/protocol, contract-package, and Extensions unit tests all green.

Not in this PR (future phases, per the RFC)

  • IArtifactPostProcessor typed contract wrapping the engines.
  • Handshake advertisement of post-processor kinds.
  • Dispatcher ITool + tool-host-over-pipe composition.
  • User tools (merge-trx, …) and the dotnet/sdk orchestration.

cc Amaury Levé (@Evangelink)

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

Implements the first testfx-side pieces of RFC 018 (artifact post-processing
for dotnet test / MTP):
- Report merge engines (pure, invocation-agnostic, no I/O in the core):
- TrxReportEngine.Merge / MergeToFileAsync (XML-level TRX merge).
- JUnitReportMerger (unions <testsuite>, counters derived per-suite).
- CtrfReportMerger (JSON merge; summary derived from merged tests[]).
- Kind metadata flow so the dotnet/sdk orchestrator can group artifacts by
format: SessionFileArtifact gains an optional kind (experimental), the
FileArtifactMessage IPC record + serializer carry Kind (field id 7), the
dotnet-test consumer propagates it, and report producers tag their kind
(trx/junit/ctrf/html).
Unit tests cover all three merge engines and the IPC round-trip.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
CopilotAI review requested due to automatic review settings July 9, 2026 22:09

CopilotAI 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

Adds report-merging foundations and propagates artifact format metadata through MTP’s artifact and IPC layers.

Changes:

  • Adds TRX, JUnit, and CTRF merge engines with unit tests.
  • Adds experimental SessionFileArtifact.Kind metadata and IPC serialization.
  • Tags TRX, JUnit, CTRF, and HTML report artifacts by format.
Show a summary per file
FileDescription
test/UnitTests/Microsoft.Testing.Platform.UnitTests/IPC/ProtocolTests.csCovers IPC kind serialization.
test/UnitTests/Microsoft.Testing.Platform.UnitTests/IPC/ProtocolEdgeCaseTests.csTests nullable kind round trips.
test/UnitTests/Microsoft.Testing.Platform.DotnetTestProtocolContract.UnitTests/DotnetTestProtocolSerializerTests.csVerifies protocol-contract serialization.
test/UnitTests/Microsoft.Testing.Extensions.UnitTests/TrxReportEngineMergeTests.csTests TRX merging.
test/UnitTests/Microsoft.Testing.Extensions.UnitTests/JUnitReportMergerTests.csTests JUnit merging.
test/UnitTests/Microsoft.Testing.Extensions.UnitTests/CtrfReportMergerTests.csTests CTRF merging.
src/Platform/SharedExtensionHelpers/ReportGeneratorBase.csPublishes report artifact kinds.
src/Platform/Microsoft.Testing.Platform/ServerMode/DotnetTest/IPC/Serializers/FileArtifactMessagesSerializer.csSerializes the new kind field.
src/Platform/Microsoft.Testing.Platform/ServerMode/DotnetTest/IPC/ObjectFieldIds.csAssigns IPC field ID 7.
src/Platform/Microsoft.Testing.Platform/ServerMode/DotnetTest/IPC/Models/FileArtifactMessages.csAdds kind to the wire model.
src/Platform/Microsoft.Testing.Platform/ServerMode/DotnetTest/IPC/DotnetTestDataConsumer.csPropagates session artifact kinds.
src/Platform/Microsoft.Testing.Platform/PublicAPI/PublicAPI.Unshipped.txtTracks the experimental public API.
src/Platform/Microsoft.Testing.Platform/Messages/FileArtifacts.csAdds the kind-aware constructor and property.
src/Platform/Microsoft.Testing.Platform/InternalAPI/InternalAPI.Unshipped.txtTracks IPC internal API changes.
src/Platform/Microsoft.Testing.Extensions.TrxReport/TrxReportEngine.Merge.csImplements TRX merging.
src/Platform/Microsoft.Testing.Extensions.TrxReport/TrxDataConsumer.csTags in-process TRX artifacts.
src/Platform/Microsoft.Testing.Extensions.TrxReport/InternalAPI/InternalAPI.Unshipped.txtTracks TRX internal APIs.
src/Platform/Microsoft.Testing.Extensions.Retry/InternalAPI/InternalAPI.Unshipped.txtTracks linked IPC field API.
src/Platform/Microsoft.Testing.Extensions.MSBuild/InternalAPI.Unshipped.txtTracks linked IPC field API.
src/Platform/Microsoft.Testing.Extensions.JUnitReport/JUnitReportMerger.csImplements JUnit merging.
src/Platform/Microsoft.Testing.Extensions.JUnitReport/JUnitReportGenerator.csTags JUnit artifacts.
src/Platform/Microsoft.Testing.Extensions.JUnitReport/InternalAPI/InternalAPI.Unshipped.txtTracks JUnit internal APIs.
src/Platform/Microsoft.Testing.Extensions.HtmlReport/InternalAPI/InternalAPI.Unshipped.txtTracks shared generator API.
src/Platform/Microsoft.Testing.Extensions.HtmlReport/HtmlReportGenerator.csTags HTML artifacts.
src/Platform/Microsoft.Testing.Extensions.HangDump/InternalAPI/InternalAPI.Unshipped.txtTracks linked IPC field API.
src/Platform/Microsoft.Testing.Extensions.CtrfReport/InternalAPI/InternalAPI.Unshipped.txtTracks CTRF internal APIs.
src/Platform/Microsoft.Testing.Extensions.CtrfReport/CtrfReportMerger.csImplements CTRF merging.
src/Platform/Microsoft.Testing.Extensions.CtrfReport/CtrfReportGenerator.csTags CTRF artifacts.

Review details

  • Files reviewed: 28/28 changed files
  • Comments generated: 4
  • Review effort level: Medium

Comment threadsrc/Platform/Microsoft.Testing.Extensions.TrxReport/TrxDataConsumer.cs Outdated
@Evangelink
Amaury Levé (Evangelink) marked this pull request as ready for review July 13, 2026 14:43
…ure-broccoli
# Conflicts:
#	src/Platform/Microsoft.Testing.Extensions.CtrfReport/InternalAPI/InternalAPI.Unshipped.txt
#	src/Platform/Microsoft.Testing.Extensions.HangDump/InternalAPI/InternalAPI.Unshipped.txt
#	src/Platform/Microsoft.Testing.Extensions.HtmlReport/InternalAPI/InternalAPI.Unshipped.txt
#	src/Platform/Microsoft.Testing.Extensions.JUnitReport/InternalAPI/InternalAPI.Unshipped.txt
#	src/Platform/Microsoft.Testing.Extensions.TrxReport/InternalAPI/InternalAPI.Unshipped.txt
#	src/Platform/Microsoft.Testing.Platform/InternalAPI/InternalAPI.Unshipped.txt
- Carry microsoft.testing.trx through the out-of-process TRX path by adding an
(experimental) Kind to FileArtifact and propagating it in DotnetTestDataConsumer
and TrxProcessLifetimeHandler; centralize the kind in TrxReportEngine.TrxArtifactKind.
- Deduplicate <UnitTest> definitions by id when merging TRX (ids are deterministic
from the test UID and the schema forbids duplicates).
- Preserve <RunInfos> (crash/exit diagnostics) and <CollectorDataEntries> from every
input's <ResultSummary> instead of discarding them; omit them when empty.
- Correct the inaccurate 'attachment paths are absolute' remark and relocate each
input's attachment deployment tree into the merged deployment root in
MergeToFileAsync (best-effort, never fails the merge).
- Add unit tests for dedup and diagnostics preservation.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
CopilotAI review requested due to automatic review settings July 13, 2026 15:04

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

Review details

  • Files reviewed: 30/30 changed files
  • Comments generated: 11
  • Review effort level: Medium

Comment threadsrc/Platform/Microsoft.Testing.Extensions.JUnitReport/JUnitReportMerger.cs Outdated
Comment threadsrc/Platform/Microsoft.Testing.Extensions.TrxReport/TrxDataConsumer.cs Outdated
@github-actions

This comment has been minimized.

@EvangelinkAmaury Levé (Evangelink) added the state/needs-review Awaiting review from the team. label Jul 13, 2026
…ure-broccoli
# Conflicts:
#	src/Platform/Microsoft.Testing.Extensions.CtrfReport/InternalAPI/InternalAPI.Unshipped.txt
#	src/Platform/Microsoft.Testing.Extensions.HangDump/InternalAPI/InternalAPI.Unshipped.txt
#	src/Platform/Microsoft.Testing.Extensions.HtmlReport/InternalAPI/InternalAPI.Unshipped.txt
#	src/Platform/Microsoft.Testing.Extensions.JUnitReport/InternalAPI/InternalAPI.Unshipped.txt
#	src/Platform/Microsoft.Testing.Extensions.MSBuild/InternalAPI.Unshipped.txt
#	src/Platform/Microsoft.Testing.Extensions.Retry/InternalAPI/InternalAPI.Unshipped.txt
#	src/Platform/Microsoft.Testing.Extensions.TrxReport/InternalAPI/InternalAPI.Unshipped.txt
#	src/Platform/Microsoft.Testing.Platform/InternalAPI/InternalAPI.Unshipped.txt
CopilotAI review requested due to automatic review settings July 13, 2026 19:50

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

Review details

  • Files reviewed: 30/30 changed files
  • Comments generated: 3
  • Review effort level: Medium

- Skip relocation when the merged 'In' root overlaps the source 'In' root (output
written beside the input with a matching runName), preventing the copy from
recursing into its own destination; the original hrefs already resolve there.
- Skip file reparse points (symlinks) before File.Copy so a link inside the confined
tree can't pull in content from outside it.
- Overwrite copied attachment files so a reused output directory can't leave stale
bytes behind while the merged XML references the fresh per-input destination.
- Add a unit test for the overlapping-root skip case.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
CopilotAI review requested due to automatic review settings July 13, 2026 20:06

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

Review details

  • Files reviewed: 30/30 changed files
  • Comments generated: 1
  • Review effort level: Medium

@github-actions

This comment has been minimized.

Regenerated via UpdateXlf. The last localized check-in added translations for
'GlobalTestFixtureShouldBeValidClassLayout' (fr) and 'SlowTestStillRunning' (ru)
that XliffTasks rejects (placeholder mismatch), breaking the build with
"xlf is out-of-date with resx". UpdateXlf resets those two units to state="new"
so the build passes; they will be re-translated on the next localization pass.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 4350f662-0e5d-4e05-b156-1ef619da3b9e
CopilotAI review requested due to automatic review settings July 14, 2026 08:01

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

Review details

  • Files reviewed: 32/32 changed files
  • Comments generated: 3
  • Review effort level: Low

Comment threadsrc/Analyzers/MSTest.Analyzers/xlf/Resources.fr.xlf Outdated

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

Review details

  • Files reviewed: 31/31 changed files
  • Comments generated: 5
  • Review effort level: Medium

Comment threadsrc/Platform/Microsoft.Testing.Extensions.JUnitReport/JUnitReportMerger.cs Outdated
Comment threadsrc/Platform/Microsoft.Testing.Extensions.CtrfReport/CtrfReportMerger.cs Outdated
…ias check (review)
- TRX Merge now carries run-level <ResultSummary>/<Output> across (StdOut/StdErr/
DebugTrace concatenated, TextMessages/Message unioned), emitted in schema order right
after <Counters>, so VSTest's run-level skipped/informational messages are no longer
silently dropped.
- MergeToFileAsync rejects an empty input list before any filesystem work (output
directory creation / attachment relocation), so an invalid call no longer mutates the
disk before Merge throws. Applied to TRX/JUnit/CTRF.
- Output-alias check is now filesystem-aware: it compares canonicalized paths with a
cached case-sensitivity probe (case-sensitive on case-sensitive volumes, insensitive
otherwise), so on Linux a legitimate separate output like 'A.trx' is no longer rejected
as aliasing input 'a.trx', while Windows/macOS case aliases are still caught. Applied
to TRX/JUnit/CTRF.
Tests: run-level Output merge + schema order; empty-input rejection without touching the
filesystem (all three mergers). 74 merge tests pass; full solution build clean.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
CopilotAI review requested due to automatic review settings July 16, 2026 07:49

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

Review details

  • Files reviewed: 31/31 changed files
  • Comments generated: 3
  • Review effort level: Medium

Comment threadsrc/Platform/Microsoft.Testing.Extensions.JUnitReport/JUnitReportMerger.cs Outdated
Comment threadsrc/Platform/Microsoft.Testing.Extensions.CtrfReport/CtrfReportMerger.cs Outdated
@github-actions

This comment has been minimized.

…view)
The alias-equality check derived its case sensitivity from a one-time probe in
Path.GetTempPath(), but case sensitivity can differ per volume and (on Windows) per
directory. Replace the cached temp probe with a per-call probe of the OUTPUT's own
location (nearest existing ancestor) in all three mergers. An alias can only occur when
input and output share a directory, so that shared location's sensitivity is the correct
one — a different-directory input never compares equal. Falls back to case-insensitive
(rejects more, never less) if the probe fails. This closes the gap where 'A.trx' could
alias input 'a.trx' on a case-insensitive output volume while the temp-based probe said
Ordinal, letting ReplaceFile delete the input.
Applied to TRX/JUnit/CTRF. 74 merge tests pass; full solution build clean.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
CopilotAI review requested due to automatic review settings July 16, 2026 08:10

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

Review details

  • Files reviewed: 31/31 changed files
  • Comments generated: 3
  • Review effort level: Medium

Comment threadsrc/Platform/Microsoft.Testing.Extensions.JUnitReport/JUnitReportMerger.cs Outdated
Comment threadsrc/Platform/Microsoft.Testing.Extensions.CtrfReport/CtrfReportMerger.cs Outdated
…er (review)
The read-only-input alias check (canonicalization, per-output-directory case-sensitivity
probe, netstandard reparse-ancestor fail-closed) and the atomic temporary-sibling write/
replace were duplicated in the TRX, JUnit and CTRF mergers. Because this is security- and
data-loss-sensitive, extract it into a single shared SharedExtensionHelpers/
MergeOutputFileHelper.cs (linked into all three, namespace Microsoft.Testing.Extensions),
exposing EnsureOutputDoesNotAliasInput and WriteViaTemporarySiblingAsync so the logic can
no longer diverge across formats. Each merger now delegates to it; the per-format writer
(XDocument stream vs string) is passed as a callback. Registered the shared internal type/
methods in each project's InternalAPI.Unshipped.txt.
No behavior change. 74 merge tests pass; full solution build clean (0 warnings).
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
CopilotAI review requested due to automatic review settings July 16, 2026 08:40
@github-actions

This comment has been minimized.

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

Review details

  • Files reviewed: 35/35 changed files
  • Comments generated: 4
  • Review effort level: Medium

Comment threadsrc/Platform/SharedExtensionHelpers/MergeOutputFileHelper.cs
Comment threadsrc/Platform/Microsoft.Testing.Extensions.CtrfReport/CtrfReportMerger.cs Outdated
…ments
CI (macOS): GetCanonicalPath now re-resolves ancestor symlinks after every
link hop, so a link target whose prefix is itself a symlink (macOS
/var -> /private/var) canonicalizes consistently and the read-only-input
alias check no longer misses a symlinked-parent output. Fixes the 3
WhenOutputAliasesInputViaSymlinkedParent merge tests that failed on macOS.
Review comments addressed:
- MergeOutputFileHelper.ReplaceFile: atomic File.Move(overwrite:true) on
netcore so an interruption can never leave the previous report missing;
delete-then-move retained only on .NET Framework (no overwrite overload).
- TRX relocation: deployment root is now unique per run (run id suffix), so
relocation always writes a fresh tree and can never corrupt a previously
committed report's attachments if a later merge fails.
- TRX Times: earliest creation/queuing/start tracked independently and
omitted when no input supplies them, instead of fabricating all three
from the earliest start.
- CTRF reportId: derived only from accepted CTRF payloads, so an ignored
non-CTRF input no longer changes the merged report identity.
Adds regression tests for each and updates deployment-root-coupled TRX tests
to read the emitted runDeploymentRoot instead of assuming a literal name.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 34f1a49b-b1e0-4f38-b8a1-3870dd0842d2
CopilotAI review requested due to automatic review settings July 16, 2026 12:00

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

Review details

  • Files reviewed: 35/35 changed files
  • Comments generated: 1
  • Review effort level: Medium

Comment threadsrc/Platform/SharedExtensionHelpers/MergeOutputFileHelper.cs
@github-actions

Copy link
Copy Markdown
Contributor

🧪 Test quality grade — PR #9805

GradeTestNotes
B (80–89)new CtrfReportMergerTests.
Merge_
ReportIdIsUnaffectedByIgnoredNonCtrfInput
Clear scenario and deterministic inputs; equality assertion on both IDs plus a non-null guard make this near-perfect — no issues found, A could be reached by noting the comment rationale inline.
B (80–89)mod TrxReportEngineMergeTests.
MergeToFileAsync_
WhenInputLivesUnderMergedRoot_
PreservesOriginalReportAndAttachment
Presence-only assertions (File.Exists) confirm files survive, but adding a content check (File.ReadAllText) would close the preservation guarantee fully.
B (80–89)mod TrxReportEngineMergeTests.
MergeToFileAsync_
WhenRunNameEscapesOutputDirectory_
UsesConfinedDeploymentRoot
Security assertions (StartsWith, no-separator, confinement scan) are well-chosen; ~38-line body with a directory scan could be split into a confinement test and a content-integrity test.
B (80–89)mod TrxReportEngineMergeTests.
MergeToFileAsync_
RepeatedIntoSameNestedLayout_
IsBoundedAndNonDestructive
Loop + copy-count + href-resolution are all meaningful; the for-loop is idiomatic here, but extracting the loop limit (4) into a named constant would clarify intent.
B (80–89)mod TrxReportEngineMergeTests.
MergeToFileAsync_
RelocatesPerTestResultFilesByPrefixingResultDirectory
Four meaningful assertions covering path rewriting and file content; ~50-line body with manual XML construction — consider extracting a BuildResultFilesReport helper to compress the arrange phase.
A (90–100)new CtrfReportMergerTests.
Merge_
ReportIdIsUnaffectedByIgnoredNonCtrfInput
Inline comment explains non-CTRF input semantics; equality on both IDs plus IsNotNull guard — no issues found.
A (90–100)new TrxReportEngineMergeTests.
Merge_
TimesOmitAttributesNoInputSupplies
Null-absence and equality assertions together cover both the omission and the surviving fields — no issues found.
A (90–100)new TrxReportEngineMergeTests.
Merge_
TimesTrackEarliestCreationQueuingStartIndependently
All four time attributes verified independently with inputs deliberately split across two reports — no issues found.
A (90–100)new TrxReportEngineMergeTests.
MergeToFileAsync_
SecondMergeIntoSameOutput_
DoesNotCorruptPriorReportsAttachments
Two-merge scenario with distinct-root assertion and byte-level content verification — no issues found.
A (90–100)mod TrxReportEngineMergeTests.
MergeToFileAsync_
IsolatesCollidingAttachmentsPerInputAndRewritesHrefs
Now reads mergedRoot from the document rather than assuming runName; content + href assertions are thorough — no issues found.
A (90–100)mod TrxReportEngineMergeTests.
MergeToFileAsync_
WhenRunNameMatchesInputDeploymentRoot_
UsesUniqueRootAndRelocates
AreNotEqual uniqueness check, original-preservation check, and content-verified href resolution — no issues found.
A (90–100)mod TrxReportEngineMergeTests.
MergeToFileAsync_
WhenSourceNestedUnderMergedRoot_
RelocatesAndKeepsHrefsValid
Reads mergedRoot dynamically and validates href resolution end-to-end with content check — no issues found.

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

Warning

Firewall blocked 1 domain

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

  • awmgmcpg

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

network:
allowed:
- defaults
- "awmgmcpg"

See Network Configuration for more information.

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

@Evangelink
Amaury Levé (Evangelink) merged commit 0a44195 into mainJul 16, 2026
68 checks passed
@Evangelink
Amaury Levé (Evangelink) deleted the dev/amauryleve/miniature-broccoli branch July 16, 2026 14:10
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

state/needs-reviewAwaiting review from the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@Evangelink@0101
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Auto-enable theater mode on YouTube\n(function() {\n function tryTheater() {\n var btn = document.querySelector('button[aria-label=\"Theater mode\"], ytd-player #player button[title=\"Theater mode\"]');\n if (btn && !btn.classList.contains('activated')) {\n btn.click();\n }\n }\n \n // Try immediately\n tryTheater();\n \n // Try after navigation (SPA)\n var lastUrl = location.href;\n setInterval(function() {\n if (location.href !== lastUrl) {\n lastUrl = location.href;\n setTimeout(tryTheater, 500);\n }\n }, 1000);\n \n // Also try on player load\n var observer = new MutationObserver(tryTheater);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "YouTube Theater Mode Default"); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Add artifact merge engines and Kind metadata flow (RFC 018 phase 1) - #9805

Merged
Amaury Levé (Evangelink) merged 32 commits into
mainfrom
dev/amauryleve/miniature-broccoli
Jul 16, 2026
Merged

Add artifact merge engines and Kind metadata flow (RFC 018 phase 1)#9805
Amaury Levé (Evangelink) merged 32 commits into
mainfrom
dev/amauryleve/miniature-broccoli

Conversation

@Evangelink

Copy link
Copy Markdown
Member

Summary

Implements the first testfx-side pieces of RFC 018 — Artifact post-processing for dotnet test (MTP). Two independent, self-contained foundations that every later phase (dispatcher tool, SDK election) reuses. No SDK dependency; the SDK orchestration lands separately once this merges.

1. Report merge engines (pure, invocation-agnostic — no I/O in the core)

Validated the RFC's "collect same-kind inputs → re-aggregate → emit one" shape across both data models:

EngineFormatMerge unitRe-aggregation
TrxReportEngine.Merge / MergeToFileAsyncXMLResults/TestDefinitions/TestEntriescounters summed, Times earliest/latest, TestLists deduped by id, outcome Failed if any input failed
JUnitReportMergerXML<testsuite>counters derived by summing per-suite (correct even when root aggregates are missing); supports bare <testsuite> roots
CtrfReportMergerJSON (JsonNode)results.tests[]summary derived from the merged tests[] so summary.tests always matches the array; start/stop min/max

HTML is intentionally not file-merged (it's a rendered template with an embedded JSON blob) — this validates the design's opt-in / return-null semantics rather than breaking it.

2. Kind metadata flow (producer → IPC wire)

So the dotnet test orchestrator can group artifacts by format without inspecting file contents:

  • SessionFileArtifact gains an optional kind (experimental-gated, [TPEXP]); the shipped 4-arg constructor is preserved for binary compatibility.
  • IPC: FileArtifactMessage.Kind + FileArtifactMessageFieldsId.Kind = 7 + serializer read/write/field-count (forward/backward compatible — old readers skip the unknown field).
  • DotnetTestDataConsumer propagates Kind onto the wire message.
  • Report producers tag their kind: TRX microsoft.testing.trx, JUnit microsoft.testing.junit, CTRF microsoft.testing.ctrf, HTML microsoft.testing.html.

Tests

  • Unit tests for all three merge engines (null/empty inputs, counter summing, outcome, dedup, timestamps, bare-root/missing-aggregate robustness, summary-missing).
  • IPC protocol round-trip tests assert Kind survives the pipe.
  • Full repo builds clean (only the unrelated WasiPlayground sample fails on a missing workload); Platform IPC/protocol, contract-package, and Extensions unit tests all green.

Not in this PR (future phases, per the RFC)

  • IArtifactPostProcessor typed contract wrapping the engines.
  • Handshake advertisement of post-processor kinds.
  • Dispatcher ITool + tool-host-over-pipe composition.
  • User tools (merge-trx, …) and the dotnet/sdk orchestration.

cc Amaury Levé (@Evangelink)

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

Implements the first testfx-side pieces of RFC 018 (artifact post-processing
for dotnet test / MTP):
- Report merge engines (pure, invocation-agnostic, no I/O in the core):
- TrxReportEngine.Merge / MergeToFileAsync (XML-level TRX merge).
- JUnitReportMerger (unions <testsuite>, counters derived per-suite).
- CtrfReportMerger (JSON merge; summary derived from merged tests[]).
- Kind metadata flow so the dotnet/sdk orchestrator can group artifacts by
format: SessionFileArtifact gains an optional kind (experimental), the
FileArtifactMessage IPC record + serializer carry Kind (field id 7), the
dotnet-test consumer propagates it, and report producers tag their kind
(trx/junit/ctrf/html).
Unit tests cover all three merge engines and the IPC round-trip.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
CopilotAI review requested due to automatic review settings July 9, 2026 22:09

CopilotAI 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

Adds report-merging foundations and propagates artifact format metadata through MTP’s artifact and IPC layers.

Changes:

  • Adds TRX, JUnit, and CTRF merge engines with unit tests.
  • Adds experimental SessionFileArtifact.Kind metadata and IPC serialization.
  • Tags TRX, JUnit, CTRF, and HTML report artifacts by format.
Show a summary per file
FileDescription
test/UnitTests/Microsoft.Testing.Platform.UnitTests/IPC/ProtocolTests.csCovers IPC kind serialization.
test/UnitTests/Microsoft.Testing.Platform.UnitTests/IPC/ProtocolEdgeCaseTests.csTests nullable kind round trips.
test/UnitTests/Microsoft.Testing.Platform.DotnetTestProtocolContract.UnitTests/DotnetTestProtocolSerializerTests.csVerifies protocol-contract serialization.
test/UnitTests/Microsoft.Testing.Extensions.UnitTests/TrxReportEngineMergeTests.csTests TRX merging.
test/UnitTests/Microsoft.Testing.Extensions.UnitTests/JUnitReportMergerTests.csTests JUnit merging.
test/UnitTests/Microsoft.Testing.Extensions.UnitTests/CtrfReportMergerTests.csTests CTRF merging.
src/Platform/SharedExtensionHelpers/ReportGeneratorBase.csPublishes report artifact kinds.
src/Platform/Microsoft.Testing.Platform/ServerMode/DotnetTest/IPC/Serializers/FileArtifactMessagesSerializer.csSerializes the new kind field.
src/Platform/Microsoft.Testing.Platform/ServerMode/DotnetTest/IPC/ObjectFieldIds.csAssigns IPC field ID 7.
src/Platform/Microsoft.Testing.Platform/ServerMode/DotnetTest/IPC/Models/FileArtifactMessages.csAdds kind to the wire model.
src/Platform/Microsoft.Testing.Platform/ServerMode/DotnetTest/IPC/DotnetTestDataConsumer.csPropagates session artifact kinds.
src/Platform/Microsoft.Testing.Platform/PublicAPI/PublicAPI.Unshipped.txtTracks the experimental public API.
src/Platform/Microsoft.Testing.Platform/Messages/FileArtifacts.csAdds the kind-aware constructor and property.
src/Platform/Microsoft.Testing.Platform/InternalAPI/InternalAPI.Unshipped.txtTracks IPC internal API changes.
src/Platform/Microsoft.Testing.Extensions.TrxReport/TrxReportEngine.Merge.csImplements TRX merging.
src/Platform/Microsoft.Testing.Extensions.TrxReport/TrxDataConsumer.csTags in-process TRX artifacts.
src/Platform/Microsoft.Testing.Extensions.TrxReport/InternalAPI/InternalAPI.Unshipped.txtTracks TRX internal APIs.
src/Platform/Microsoft.Testing.Extensions.Retry/InternalAPI/InternalAPI.Unshipped.txtTracks linked IPC field API.
src/Platform/Microsoft.Testing.Extensions.MSBuild/InternalAPI.Unshipped.txtTracks linked IPC field API.
src/Platform/Microsoft.Testing.Extensions.JUnitReport/JUnitReportMerger.csImplements JUnit merging.
src/Platform/Microsoft.Testing.Extensions.JUnitReport/JUnitReportGenerator.csTags JUnit artifacts.
src/Platform/Microsoft.Testing.Extensions.JUnitReport/InternalAPI/InternalAPI.Unshipped.txtTracks JUnit internal APIs.
src/Platform/Microsoft.Testing.Extensions.HtmlReport/InternalAPI/InternalAPI.Unshipped.txtTracks shared generator API.
src/Platform/Microsoft.Testing.Extensions.HtmlReport/HtmlReportGenerator.csTags HTML artifacts.
src/Platform/Microsoft.Testing.Extensions.HangDump/InternalAPI/InternalAPI.Unshipped.txtTracks linked IPC field API.
src/Platform/Microsoft.Testing.Extensions.CtrfReport/InternalAPI/InternalAPI.Unshipped.txtTracks CTRF internal APIs.
src/Platform/Microsoft.Testing.Extensions.CtrfReport/CtrfReportMerger.csImplements CTRF merging.
src/Platform/Microsoft.Testing.Extensions.CtrfReport/CtrfReportGenerator.csTags CTRF artifacts.

Review details

  • Files reviewed: 28/28 changed files
  • Comments generated: 4
  • Review effort level: Medium

Comment threadsrc/Platform/Microsoft.Testing.Extensions.TrxReport/TrxDataConsumer.cs Outdated
@Evangelink
Amaury Levé (Evangelink) marked this pull request as ready for review July 13, 2026 14:43
…ure-broccoli
# Conflicts:
#	src/Platform/Microsoft.Testing.Extensions.CtrfReport/InternalAPI/InternalAPI.Unshipped.txt
#	src/Platform/Microsoft.Testing.Extensions.HangDump/InternalAPI/InternalAPI.Unshipped.txt
#	src/Platform/Microsoft.Testing.Extensions.HtmlReport/InternalAPI/InternalAPI.Unshipped.txt
#	src/Platform/Microsoft.Testing.Extensions.JUnitReport/InternalAPI/InternalAPI.Unshipped.txt
#	src/Platform/Microsoft.Testing.Extensions.TrxReport/InternalAPI/InternalAPI.Unshipped.txt
#	src/Platform/Microsoft.Testing.Platform/InternalAPI/InternalAPI.Unshipped.txt
- Carry microsoft.testing.trx through the out-of-process TRX path by adding an
(experimental) Kind to FileArtifact and propagating it in DotnetTestDataConsumer
and TrxProcessLifetimeHandler; centralize the kind in TrxReportEngine.TrxArtifactKind.
- Deduplicate <UnitTest> definitions by id when merging TRX (ids are deterministic
from the test UID and the schema forbids duplicates).
- Preserve <RunInfos> (crash/exit diagnostics) and <CollectorDataEntries> from every
input's <ResultSummary> instead of discarding them; omit them when empty.
- Correct the inaccurate 'attachment paths are absolute' remark and relocate each
input's attachment deployment tree into the merged deployment root in
MergeToFileAsync (best-effort, never fails the merge).
- Add unit tests for dedup and diagnostics preservation.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
CopilotAI review requested due to automatic review settings July 13, 2026 15:04

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

Review details

  • Files reviewed: 30/30 changed files
  • Comments generated: 11
  • Review effort level: Medium

Comment threadsrc/Platform/Microsoft.Testing.Extensions.JUnitReport/JUnitReportMerger.cs Outdated
Comment threadsrc/Platform/Microsoft.Testing.Extensions.TrxReport/TrxDataConsumer.cs Outdated
@github-actions

This comment has been minimized.

@EvangelinkAmaury Levé (Evangelink) added the state/needs-review Awaiting review from the team. label Jul 13, 2026
…ure-broccoli
# Conflicts:
#	src/Platform/Microsoft.Testing.Extensions.CtrfReport/InternalAPI/InternalAPI.Unshipped.txt
#	src/Platform/Microsoft.Testing.Extensions.HangDump/InternalAPI/InternalAPI.Unshipped.txt
#	src/Platform/Microsoft.Testing.Extensions.HtmlReport/InternalAPI/InternalAPI.Unshipped.txt
#	src/Platform/Microsoft.Testing.Extensions.JUnitReport/InternalAPI/InternalAPI.Unshipped.txt
#	src/Platform/Microsoft.Testing.Extensions.MSBuild/InternalAPI.Unshipped.txt
#	src/Platform/Microsoft.Testing.Extensions.Retry/InternalAPI/InternalAPI.Unshipped.txt
#	src/Platform/Microsoft.Testing.Extensions.TrxReport/InternalAPI/InternalAPI.Unshipped.txt
#	src/Platform/Microsoft.Testing.Platform/InternalAPI/InternalAPI.Unshipped.txt
CopilotAI review requested due to automatic review settings July 13, 2026 19:50

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

Review details

  • Files reviewed: 30/30 changed files
  • Comments generated: 3
  • Review effort level: Medium

- Skip relocation when the merged 'In' root overlaps the source 'In' root (output
written beside the input with a matching runName), preventing the copy from
recursing into its own destination; the original hrefs already resolve there.
- Skip file reparse points (symlinks) before File.Copy so a link inside the confined
tree can't pull in content from outside it.
- Overwrite copied attachment files so a reused output directory can't leave stale
bytes behind while the merged XML references the fresh per-input destination.
- Add a unit test for the overlapping-root skip case.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
CopilotAI review requested due to automatic review settings July 13, 2026 20:06

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

Review details

  • Files reviewed: 30/30 changed files
  • Comments generated: 1
  • Review effort level: Medium

@github-actions

This comment has been minimized.

Regenerated via UpdateXlf. The last localized check-in added translations for
'GlobalTestFixtureShouldBeValidClassLayout' (fr) and 'SlowTestStillRunning' (ru)
that XliffTasks rejects (placeholder mismatch), breaking the build with
"xlf is out-of-date with resx". UpdateXlf resets those two units to state="new"
so the build passes; they will be re-translated on the next localization pass.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 4350f662-0e5d-4e05-b156-1ef619da3b9e
CopilotAI review requested due to automatic review settings July 14, 2026 08:01

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

Review details

  • Files reviewed: 32/32 changed files
  • Comments generated: 3
  • Review effort level: Low

Comment threadsrc/Analyzers/MSTest.Analyzers/xlf/Resources.fr.xlf Outdated

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

Review details

  • Files reviewed: 31/31 changed files
  • Comments generated: 5
  • Review effort level: Medium

Comment threadsrc/Platform/Microsoft.Testing.Extensions.JUnitReport/JUnitReportMerger.cs Outdated
Comment threadsrc/Platform/Microsoft.Testing.Extensions.CtrfReport/CtrfReportMerger.cs Outdated
…ias check (review)
- TRX Merge now carries run-level <ResultSummary>/<Output> across (StdOut/StdErr/
DebugTrace concatenated, TextMessages/Message unioned), emitted in schema order right
after <Counters>, so VSTest's run-level skipped/informational messages are no longer
silently dropped.
- MergeToFileAsync rejects an empty input list before any filesystem work (output
directory creation / attachment relocation), so an invalid call no longer mutates the
disk before Merge throws. Applied to TRX/JUnit/CTRF.
- Output-alias check is now filesystem-aware: it compares canonicalized paths with a
cached case-sensitivity probe (case-sensitive on case-sensitive volumes, insensitive
otherwise), so on Linux a legitimate separate output like 'A.trx' is no longer rejected
as aliasing input 'a.trx', while Windows/macOS case aliases are still caught. Applied
to TRX/JUnit/CTRF.
Tests: run-level Output merge + schema order; empty-input rejection without touching the
filesystem (all three mergers). 74 merge tests pass; full solution build clean.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
CopilotAI review requested due to automatic review settings July 16, 2026 07:49

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

Review details

  • Files reviewed: 31/31 changed files
  • Comments generated: 3
  • Review effort level: Medium

Comment threadsrc/Platform/Microsoft.Testing.Extensions.JUnitReport/JUnitReportMerger.cs Outdated
Comment threadsrc/Platform/Microsoft.Testing.Extensions.CtrfReport/CtrfReportMerger.cs Outdated
@github-actions

This comment has been minimized.

…view)
The alias-equality check derived its case sensitivity from a one-time probe in
Path.GetTempPath(), but case sensitivity can differ per volume and (on Windows) per
directory. Replace the cached temp probe with a per-call probe of the OUTPUT's own
location (nearest existing ancestor) in all three mergers. An alias can only occur when
input and output share a directory, so that shared location's sensitivity is the correct
one — a different-directory input never compares equal. Falls back to case-insensitive
(rejects more, never less) if the probe fails. This closes the gap where 'A.trx' could
alias input 'a.trx' on a case-insensitive output volume while the temp-based probe said
Ordinal, letting ReplaceFile delete the input.
Applied to TRX/JUnit/CTRF. 74 merge tests pass; full solution build clean.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
CopilotAI review requested due to automatic review settings July 16, 2026 08:10

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

Review details

  • Files reviewed: 31/31 changed files
  • Comments generated: 3
  • Review effort level: Medium

Comment threadsrc/Platform/Microsoft.Testing.Extensions.JUnitReport/JUnitReportMerger.cs Outdated
Comment threadsrc/Platform/Microsoft.Testing.Extensions.CtrfReport/CtrfReportMerger.cs Outdated
…er (review)
The read-only-input alias check (canonicalization, per-output-directory case-sensitivity
probe, netstandard reparse-ancestor fail-closed) and the atomic temporary-sibling write/
replace were duplicated in the TRX, JUnit and CTRF mergers. Because this is security- and
data-loss-sensitive, extract it into a single shared SharedExtensionHelpers/
MergeOutputFileHelper.cs (linked into all three, namespace Microsoft.Testing.Extensions),
exposing EnsureOutputDoesNotAliasInput and WriteViaTemporarySiblingAsync so the logic can
no longer diverge across formats. Each merger now delegates to it; the per-format writer
(XDocument stream vs string) is passed as a callback. Registered the shared internal type/
methods in each project's InternalAPI.Unshipped.txt.
No behavior change. 74 merge tests pass; full solution build clean (0 warnings).
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
CopilotAI review requested due to automatic review settings July 16, 2026 08:40
@github-actions

This comment has been minimized.

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

Review details

  • Files reviewed: 35/35 changed files
  • Comments generated: 4
  • Review effort level: Medium

Comment threadsrc/Platform/SharedExtensionHelpers/MergeOutputFileHelper.cs
Comment threadsrc/Platform/Microsoft.Testing.Extensions.CtrfReport/CtrfReportMerger.cs Outdated
…ments
CI (macOS): GetCanonicalPath now re-resolves ancestor symlinks after every
link hop, so a link target whose prefix is itself a symlink (macOS
/var -> /private/var) canonicalizes consistently and the read-only-input
alias check no longer misses a symlinked-parent output. Fixes the 3
WhenOutputAliasesInputViaSymlinkedParent merge tests that failed on macOS.
Review comments addressed:
- MergeOutputFileHelper.ReplaceFile: atomic File.Move(overwrite:true) on
netcore so an interruption can never leave the previous report missing;
delete-then-move retained only on .NET Framework (no overwrite overload).
- TRX relocation: deployment root is now unique per run (run id suffix), so
relocation always writes a fresh tree and can never corrupt a previously
committed report's attachments if a later merge fails.
- TRX Times: earliest creation/queuing/start tracked independently and
omitted when no input supplies them, instead of fabricating all three
from the earliest start.
- CTRF reportId: derived only from accepted CTRF payloads, so an ignored
non-CTRF input no longer changes the merged report identity.
Adds regression tests for each and updates deployment-root-coupled TRX tests
to read the emitted runDeploymentRoot instead of assuming a literal name.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 34f1a49b-b1e0-4f38-b8a1-3870dd0842d2
CopilotAI review requested due to automatic review settings July 16, 2026 12:00

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

Review details

  • Files reviewed: 35/35 changed files
  • Comments generated: 1
  • Review effort level: Medium

Comment threadsrc/Platform/SharedExtensionHelpers/MergeOutputFileHelper.cs
@github-actions

Copy link
Copy Markdown
Contributor

🧪 Test quality grade — PR #9805

GradeTestNotes
B (80–89)new CtrfReportMergerTests.
Merge_
ReportIdIsUnaffectedByIgnoredNonCtrfInput
Clear scenario and deterministic inputs; equality assertion on both IDs plus a non-null guard make this near-perfect — no issues found, A could be reached by noting the comment rationale inline.
B (80–89)mod TrxReportEngineMergeTests.
MergeToFileAsync_
WhenInputLivesUnderMergedRoot_
PreservesOriginalReportAndAttachment
Presence-only assertions (File.Exists) confirm files survive, but adding a content check (File.ReadAllText) would close the preservation guarantee fully.
B (80–89)mod TrxReportEngineMergeTests.
MergeToFileAsync_
WhenRunNameEscapesOutputDirectory_
UsesConfinedDeploymentRoot
Security assertions (StartsWith, no-separator, confinement scan) are well-chosen; ~38-line body with a directory scan could be split into a confinement test and a content-integrity test.
B (80–89)mod TrxReportEngineMergeTests.
MergeToFileAsync_
RepeatedIntoSameNestedLayout_
IsBoundedAndNonDestructive
Loop + copy-count + href-resolution are all meaningful; the for-loop is idiomatic here, but extracting the loop limit (4) into a named constant would clarify intent.
B (80–89)mod TrxReportEngineMergeTests.
MergeToFileAsync_
RelocatesPerTestResultFilesByPrefixingResultDirectory
Four meaningful assertions covering path rewriting and file content; ~50-line body with manual XML construction — consider extracting a BuildResultFilesReport helper to compress the arrange phase.
A (90–100)new CtrfReportMergerTests.
Merge_
ReportIdIsUnaffectedByIgnoredNonCtrfInput
Inline comment explains non-CTRF input semantics; equality on both IDs plus IsNotNull guard — no issues found.
A (90–100)new TrxReportEngineMergeTests.
Merge_
TimesOmitAttributesNoInputSupplies
Null-absence and equality assertions together cover both the omission and the surviving fields — no issues found.
A (90–100)new TrxReportEngineMergeTests.
Merge_
TimesTrackEarliestCreationQueuingStartIndependently
All four time attributes verified independently with inputs deliberately split across two reports — no issues found.
A (90–100)new TrxReportEngineMergeTests.
MergeToFileAsync_
SecondMergeIntoSameOutput_
DoesNotCorruptPriorReportsAttachments
Two-merge scenario with distinct-root assertion and byte-level content verification — no issues found.
A (90–100)mod TrxReportEngineMergeTests.
MergeToFileAsync_
IsolatesCollidingAttachmentsPerInputAndRewritesHrefs
Now reads mergedRoot from the document rather than assuming runName; content + href assertions are thorough — no issues found.
A (90–100)mod TrxReportEngineMergeTests.
MergeToFileAsync_
WhenRunNameMatchesInputDeploymentRoot_
UsesUniqueRootAndRelocates
AreNotEqual uniqueness check, original-preservation check, and content-verified href resolution — no issues found.
A (90–100)mod TrxReportEngineMergeTests.
MergeToFileAsync_
WhenSourceNestedUnderMergedRoot_
RelocatesAndKeepsHrefsValid
Reads mergedRoot dynamically and validates href resolution end-to-end with content check — no issues found.

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

Warning

Firewall blocked 1 domain

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

  • awmgmcpg

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

network:
allowed:
- defaults
- "awmgmcpg"

See Network Configuration for more information.

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

@Evangelink
Amaury Levé (Evangelink) merged commit 0a44195 into mainJul 16, 2026
68 checks passed
@Evangelink
Amaury Levé (Evangelink) deleted the dev/amauryleve/miniature-broccoli branch July 16, 2026 14:10
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

state/needs-reviewAwaiting review from the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@Evangelink@0101
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Remove or un-stick sticky/fixed headers that block content\n(function() {\n function unstick() {\n document.querySelectorAll('header, nav, [role=\"banner\"], .header, .navbar, .sticky, .fixed-top, [style*=\"position: fixed\"], [style*=\"position:sticky\"]').forEach(function(el) {\n if (el.style.position === 'fixed' || el.style.position === 'sticky' || \n getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') {\n el.style.position = 'static';\n el.style.top = 'auto';\n el.style.zIndex = 'auto';\n }\n });\n }\n \n unstick();\n \n var observer = new MutationObserver(unstick);\n observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] });\n})();", "Kill Sticky Headers"); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Add artifact merge engines and Kind metadata flow (RFC 018 phase 1) - #9805

Merged
Amaury Levé (Evangelink) merged 32 commits into
mainfrom
dev/amauryleve/miniature-broccoli
Jul 16, 2026
Merged

Add artifact merge engines and Kind metadata flow (RFC 018 phase 1)#9805
Amaury Levé (Evangelink) merged 32 commits into
mainfrom
dev/amauryleve/miniature-broccoli

Conversation

@Evangelink

Copy link
Copy Markdown
Member

Summary

Implements the first testfx-side pieces of RFC 018 — Artifact post-processing for dotnet test (MTP). Two independent, self-contained foundations that every later phase (dispatcher tool, SDK election) reuses. No SDK dependency; the SDK orchestration lands separately once this merges.

1. Report merge engines (pure, invocation-agnostic — no I/O in the core)

Validated the RFC's "collect same-kind inputs → re-aggregate → emit one" shape across both data models:

EngineFormatMerge unitRe-aggregation
TrxReportEngine.Merge / MergeToFileAsyncXMLResults/TestDefinitions/TestEntriescounters summed, Times earliest/latest, TestLists deduped by id, outcome Failed if any input failed
JUnitReportMergerXML<testsuite>counters derived by summing per-suite (correct even when root aggregates are missing); supports bare <testsuite> roots
CtrfReportMergerJSON (JsonNode)results.tests[]summary derived from the merged tests[] so summary.tests always matches the array; start/stop min/max

HTML is intentionally not file-merged (it's a rendered template with an embedded JSON blob) — this validates the design's opt-in / return-null semantics rather than breaking it.

2. Kind metadata flow (producer → IPC wire)

So the dotnet test orchestrator can group artifacts by format without inspecting file contents:

  • SessionFileArtifact gains an optional kind (experimental-gated, [TPEXP]); the shipped 4-arg constructor is preserved for binary compatibility.
  • IPC: FileArtifactMessage.Kind + FileArtifactMessageFieldsId.Kind = 7 + serializer read/write/field-count (forward/backward compatible — old readers skip the unknown field).
  • DotnetTestDataConsumer propagates Kind onto the wire message.
  • Report producers tag their kind: TRX microsoft.testing.trx, JUnit microsoft.testing.junit, CTRF microsoft.testing.ctrf, HTML microsoft.testing.html.

Tests

  • Unit tests for all three merge engines (null/empty inputs, counter summing, outcome, dedup, timestamps, bare-root/missing-aggregate robustness, summary-missing).
  • IPC protocol round-trip tests assert Kind survives the pipe.
  • Full repo builds clean (only the unrelated WasiPlayground sample fails on a missing workload); Platform IPC/protocol, contract-package, and Extensions unit tests all green.

Not in this PR (future phases, per the RFC)

  • IArtifactPostProcessor typed contract wrapping the engines.
  • Handshake advertisement of post-processor kinds.
  • Dispatcher ITool + tool-host-over-pipe composition.
  • User tools (merge-trx, …) and the dotnet/sdk orchestration.

cc Amaury Levé (@Evangelink)

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

Implements the first testfx-side pieces of RFC 018 (artifact post-processing
for dotnet test / MTP):
- Report merge engines (pure, invocation-agnostic, no I/O in the core):
- TrxReportEngine.Merge / MergeToFileAsync (XML-level TRX merge).
- JUnitReportMerger (unions <testsuite>, counters derived per-suite).
- CtrfReportMerger (JSON merge; summary derived from merged tests[]).
- Kind metadata flow so the dotnet/sdk orchestrator can group artifacts by
format: SessionFileArtifact gains an optional kind (experimental), the
FileArtifactMessage IPC record + serializer carry Kind (field id 7), the
dotnet-test consumer propagates it, and report producers tag their kind
(trx/junit/ctrf/html).
Unit tests cover all three merge engines and the IPC round-trip.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
CopilotAI review requested due to automatic review settings July 9, 2026 22:09

CopilotAI 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

Adds report-merging foundations and propagates artifact format metadata through MTP’s artifact and IPC layers.

Changes:

  • Adds TRX, JUnit, and CTRF merge engines with unit tests.
  • Adds experimental SessionFileArtifact.Kind metadata and IPC serialization.
  • Tags TRX, JUnit, CTRF, and HTML report artifacts by format.
Show a summary per file
FileDescription
test/UnitTests/Microsoft.Testing.Platform.UnitTests/IPC/ProtocolTests.csCovers IPC kind serialization.
test/UnitTests/Microsoft.Testing.Platform.UnitTests/IPC/ProtocolEdgeCaseTests.csTests nullable kind round trips.
test/UnitTests/Microsoft.Testing.Platform.DotnetTestProtocolContract.UnitTests/DotnetTestProtocolSerializerTests.csVerifies protocol-contract serialization.
test/UnitTests/Microsoft.Testing.Extensions.UnitTests/TrxReportEngineMergeTests.csTests TRX merging.
test/UnitTests/Microsoft.Testing.Extensions.UnitTests/JUnitReportMergerTests.csTests JUnit merging.
test/UnitTests/Microsoft.Testing.Extensions.UnitTests/CtrfReportMergerTests.csTests CTRF merging.
src/Platform/SharedExtensionHelpers/ReportGeneratorBase.csPublishes report artifact kinds.
src/Platform/Microsoft.Testing.Platform/ServerMode/DotnetTest/IPC/Serializers/FileArtifactMessagesSerializer.csSerializes the new kind field.
src/Platform/Microsoft.Testing.Platform/ServerMode/DotnetTest/IPC/ObjectFieldIds.csAssigns IPC field ID 7.
src/Platform/Microsoft.Testing.Platform/ServerMode/DotnetTest/IPC/Models/FileArtifactMessages.csAdds kind to the wire model.
src/Platform/Microsoft.Testing.Platform/ServerMode/DotnetTest/IPC/DotnetTestDataConsumer.csPropagates session artifact kinds.
src/Platform/Microsoft.Testing.Platform/PublicAPI/PublicAPI.Unshipped.txtTracks the experimental public API.
src/Platform/Microsoft.Testing.Platform/Messages/FileArtifacts.csAdds the kind-aware constructor and property.
src/Platform/Microsoft.Testing.Platform/InternalAPI/InternalAPI.Unshipped.txtTracks IPC internal API changes.
src/Platform/Microsoft.Testing.Extensions.TrxReport/TrxReportEngine.Merge.csImplements TRX merging.
src/Platform/Microsoft.Testing.Extensions.TrxReport/TrxDataConsumer.csTags in-process TRX artifacts.
src/Platform/Microsoft.Testing.Extensions.TrxReport/InternalAPI/InternalAPI.Unshipped.txtTracks TRX internal APIs.
src/Platform/Microsoft.Testing.Extensions.Retry/InternalAPI/InternalAPI.Unshipped.txtTracks linked IPC field API.
src/Platform/Microsoft.Testing.Extensions.MSBuild/InternalAPI.Unshipped.txtTracks linked IPC field API.
src/Platform/Microsoft.Testing.Extensions.JUnitReport/JUnitReportMerger.csImplements JUnit merging.
src/Platform/Microsoft.Testing.Extensions.JUnitReport/JUnitReportGenerator.csTags JUnit artifacts.
src/Platform/Microsoft.Testing.Extensions.JUnitReport/InternalAPI/InternalAPI.Unshipped.txtTracks JUnit internal APIs.
src/Platform/Microsoft.Testing.Extensions.HtmlReport/InternalAPI/InternalAPI.Unshipped.txtTracks shared generator API.
src/Platform/Microsoft.Testing.Extensions.HtmlReport/HtmlReportGenerator.csTags HTML artifacts.
src/Platform/Microsoft.Testing.Extensions.HangDump/InternalAPI/InternalAPI.Unshipped.txtTracks linked IPC field API.
src/Platform/Microsoft.Testing.Extensions.CtrfReport/InternalAPI/InternalAPI.Unshipped.txtTracks CTRF internal APIs.
src/Platform/Microsoft.Testing.Extensions.CtrfReport/CtrfReportMerger.csImplements CTRF merging.
src/Platform/Microsoft.Testing.Extensions.CtrfReport/CtrfReportGenerator.csTags CTRF artifacts.

Review details

  • Files reviewed: 28/28 changed files
  • Comments generated: 4
  • Review effort level: Medium

Comment threadsrc/Platform/Microsoft.Testing.Extensions.TrxReport/TrxDataConsumer.cs Outdated
@Evangelink
Amaury Levé (Evangelink) marked this pull request as ready for review July 13, 2026 14:43
…ure-broccoli
# Conflicts:
#	src/Platform/Microsoft.Testing.Extensions.CtrfReport/InternalAPI/InternalAPI.Unshipped.txt
#	src/Platform/Microsoft.Testing.Extensions.HangDump/InternalAPI/InternalAPI.Unshipped.txt
#	src/Platform/Microsoft.Testing.Extensions.HtmlReport/InternalAPI/InternalAPI.Unshipped.txt
#	src/Platform/Microsoft.Testing.Extensions.JUnitReport/InternalAPI/InternalAPI.Unshipped.txt
#	src/Platform/Microsoft.Testing.Extensions.TrxReport/InternalAPI/InternalAPI.Unshipped.txt
#	src/Platform/Microsoft.Testing.Platform/InternalAPI/InternalAPI.Unshipped.txt
- Carry microsoft.testing.trx through the out-of-process TRX path by adding an
(experimental) Kind to FileArtifact and propagating it in DotnetTestDataConsumer
and TrxProcessLifetimeHandler; centralize the kind in TrxReportEngine.TrxArtifactKind.
- Deduplicate <UnitTest> definitions by id when merging TRX (ids are deterministic
from the test UID and the schema forbids duplicates).
- Preserve <RunInfos> (crash/exit diagnostics) and <CollectorDataEntries> from every
input's <ResultSummary> instead of discarding them; omit them when empty.
- Correct the inaccurate 'attachment paths are absolute' remark and relocate each
input's attachment deployment tree into the merged deployment root in
MergeToFileAsync (best-effort, never fails the merge).
- Add unit tests for dedup and diagnostics preservation.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
CopilotAI review requested due to automatic review settings July 13, 2026 15:04

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

Review details

  • Files reviewed: 30/30 changed files
  • Comments generated: 11
  • Review effort level: Medium

Comment threadsrc/Platform/Microsoft.Testing.Extensions.JUnitReport/JUnitReportMerger.cs Outdated
Comment threadsrc/Platform/Microsoft.Testing.Extensions.TrxReport/TrxDataConsumer.cs Outdated
@github-actions

This comment has been minimized.

@EvangelinkAmaury Levé (Evangelink) added the state/needs-review Awaiting review from the team. label Jul 13, 2026
…ure-broccoli
# Conflicts:
#	src/Platform/Microsoft.Testing.Extensions.CtrfReport/InternalAPI/InternalAPI.Unshipped.txt
#	src/Platform/Microsoft.Testing.Extensions.HangDump/InternalAPI/InternalAPI.Unshipped.txt
#	src/Platform/Microsoft.Testing.Extensions.HtmlReport/InternalAPI/InternalAPI.Unshipped.txt
#	src/Platform/Microsoft.Testing.Extensions.JUnitReport/InternalAPI/InternalAPI.Unshipped.txt
#	src/Platform/Microsoft.Testing.Extensions.MSBuild/InternalAPI.Unshipped.txt
#	src/Platform/Microsoft.Testing.Extensions.Retry/InternalAPI/InternalAPI.Unshipped.txt
#	src/Platform/Microsoft.Testing.Extensions.TrxReport/InternalAPI/InternalAPI.Unshipped.txt
#	src/Platform/Microsoft.Testing.Platform/InternalAPI/InternalAPI.Unshipped.txt
CopilotAI review requested due to automatic review settings July 13, 2026 19:50

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

Review details

  • Files reviewed: 30/30 changed files
  • Comments generated: 3
  • Review effort level: Medium

- Skip relocation when the merged 'In' root overlaps the source 'In' root (output
written beside the input with a matching runName), preventing the copy from
recursing into its own destination; the original hrefs already resolve there.
- Skip file reparse points (symlinks) before File.Copy so a link inside the confined
tree can't pull in content from outside it.
- Overwrite copied attachment files so a reused output directory can't leave stale
bytes behind while the merged XML references the fresh per-input destination.
- Add a unit test for the overlapping-root skip case.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
CopilotAI review requested due to automatic review settings July 13, 2026 20:06

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

Review details

  • Files reviewed: 30/30 changed files
  • Comments generated: 1
  • Review effort level: Medium

@github-actions

This comment has been minimized.

Regenerated via UpdateXlf. The last localized check-in added translations for
'GlobalTestFixtureShouldBeValidClassLayout' (fr) and 'SlowTestStillRunning' (ru)
that XliffTasks rejects (placeholder mismatch), breaking the build with
"xlf is out-of-date with resx". UpdateXlf resets those two units to state="new"
so the build passes; they will be re-translated on the next localization pass.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 4350f662-0e5d-4e05-b156-1ef619da3b9e
CopilotAI review requested due to automatic review settings July 14, 2026 08:01

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

Review details

  • Files reviewed: 32/32 changed files
  • Comments generated: 3
  • Review effort level: Low

Comment threadsrc/Analyzers/MSTest.Analyzers/xlf/Resources.fr.xlf Outdated

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

Review details

  • Files reviewed: 31/31 changed files
  • Comments generated: 5
  • Review effort level: Medium

Comment threadsrc/Platform/Microsoft.Testing.Extensions.JUnitReport/JUnitReportMerger.cs Outdated
Comment threadsrc/Platform/Microsoft.Testing.Extensions.CtrfReport/CtrfReportMerger.cs Outdated
…ias check (review)
- TRX Merge now carries run-level <ResultSummary>/<Output> across (StdOut/StdErr/
DebugTrace concatenated, TextMessages/Message unioned), emitted in schema order right
after <Counters>, so VSTest's run-level skipped/informational messages are no longer
silently dropped.
- MergeToFileAsync rejects an empty input list before any filesystem work (output
directory creation / attachment relocation), so an invalid call no longer mutates the
disk before Merge throws. Applied to TRX/JUnit/CTRF.
- Output-alias check is now filesystem-aware: it compares canonicalized paths with a
cached case-sensitivity probe (case-sensitive on case-sensitive volumes, insensitive
otherwise), so on Linux a legitimate separate output like 'A.trx' is no longer rejected
as aliasing input 'a.trx', while Windows/macOS case aliases are still caught. Applied
to TRX/JUnit/CTRF.
Tests: run-level Output merge + schema order; empty-input rejection without touching the
filesystem (all three mergers). 74 merge tests pass; full solution build clean.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
CopilotAI review requested due to automatic review settings July 16, 2026 07:49

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

Review details

  • Files reviewed: 31/31 changed files
  • Comments generated: 3
  • Review effort level: Medium

Comment threadsrc/Platform/Microsoft.Testing.Extensions.JUnitReport/JUnitReportMerger.cs Outdated
Comment threadsrc/Platform/Microsoft.Testing.Extensions.CtrfReport/CtrfReportMerger.cs Outdated
@github-actions

This comment has been minimized.

…view)
The alias-equality check derived its case sensitivity from a one-time probe in
Path.GetTempPath(), but case sensitivity can differ per volume and (on Windows) per
directory. Replace the cached temp probe with a per-call probe of the OUTPUT's own
location (nearest existing ancestor) in all three mergers. An alias can only occur when
input and output share a directory, so that shared location's sensitivity is the correct
one — a different-directory input never compares equal. Falls back to case-insensitive
(rejects more, never less) if the probe fails. This closes the gap where 'A.trx' could
alias input 'a.trx' on a case-insensitive output volume while the temp-based probe said
Ordinal, letting ReplaceFile delete the input.
Applied to TRX/JUnit/CTRF. 74 merge tests pass; full solution build clean.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
CopilotAI review requested due to automatic review settings July 16, 2026 08:10

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

Review details

  • Files reviewed: 31/31 changed files
  • Comments generated: 3
  • Review effort level: Medium

Comment threadsrc/Platform/Microsoft.Testing.Extensions.JUnitReport/JUnitReportMerger.cs Outdated
Comment threadsrc/Platform/Microsoft.Testing.Extensions.CtrfReport/CtrfReportMerger.cs Outdated
…er (review)
The read-only-input alias check (canonicalization, per-output-directory case-sensitivity
probe, netstandard reparse-ancestor fail-closed) and the atomic temporary-sibling write/
replace were duplicated in the TRX, JUnit and CTRF mergers. Because this is security- and
data-loss-sensitive, extract it into a single shared SharedExtensionHelpers/
MergeOutputFileHelper.cs (linked into all three, namespace Microsoft.Testing.Extensions),
exposing EnsureOutputDoesNotAliasInput and WriteViaTemporarySiblingAsync so the logic can
no longer diverge across formats. Each merger now delegates to it; the per-format writer
(XDocument stream vs string) is passed as a callback. Registered the shared internal type/
methods in each project's InternalAPI.Unshipped.txt.
No behavior change. 74 merge tests pass; full solution build clean (0 warnings).
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
CopilotAI review requested due to automatic review settings July 16, 2026 08:40
@github-actions

This comment has been minimized.

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

Review details

  • Files reviewed: 35/35 changed files
  • Comments generated: 4
  • Review effort level: Medium

Comment threadsrc/Platform/SharedExtensionHelpers/MergeOutputFileHelper.cs
Comment threadsrc/Platform/Microsoft.Testing.Extensions.CtrfReport/CtrfReportMerger.cs Outdated
…ments
CI (macOS): GetCanonicalPath now re-resolves ancestor symlinks after every
link hop, so a link target whose prefix is itself a symlink (macOS
/var -> /private/var) canonicalizes consistently and the read-only-input
alias check no longer misses a symlinked-parent output. Fixes the 3
WhenOutputAliasesInputViaSymlinkedParent merge tests that failed on macOS.
Review comments addressed:
- MergeOutputFileHelper.ReplaceFile: atomic File.Move(overwrite:true) on
netcore so an interruption can never leave the previous report missing;
delete-then-move retained only on .NET Framework (no overwrite overload).
- TRX relocation: deployment root is now unique per run (run id suffix), so
relocation always writes a fresh tree and can never corrupt a previously
committed report's attachments if a later merge fails.
- TRX Times: earliest creation/queuing/start tracked independently and
omitted when no input supplies them, instead of fabricating all three
from the earliest start.
- CTRF reportId: derived only from accepted CTRF payloads, so an ignored
non-CTRF input no longer changes the merged report identity.
Adds regression tests for each and updates deployment-root-coupled TRX tests
to read the emitted runDeploymentRoot instead of assuming a literal name.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 34f1a49b-b1e0-4f38-b8a1-3870dd0842d2
CopilotAI review requested due to automatic review settings July 16, 2026 12:00

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

Review details

  • Files reviewed: 35/35 changed files
  • Comments generated: 1
  • Review effort level: Medium

Comment threadsrc/Platform/SharedExtensionHelpers/MergeOutputFileHelper.cs
@github-actions

Copy link
Copy Markdown
Contributor

🧪 Test quality grade — PR #9805

GradeTestNotes
B (80–89)new CtrfReportMergerTests.
Merge_
ReportIdIsUnaffectedByIgnoredNonCtrfInput
Clear scenario and deterministic inputs; equality assertion on both IDs plus a non-null guard make this near-perfect — no issues found, A could be reached by noting the comment rationale inline.
B (80–89)mod TrxReportEngineMergeTests.
MergeToFileAsync_
WhenInputLivesUnderMergedRoot_
PreservesOriginalReportAndAttachment
Presence-only assertions (File.Exists) confirm files survive, but adding a content check (File.ReadAllText) would close the preservation guarantee fully.
B (80–89)mod TrxReportEngineMergeTests.
MergeToFileAsync_
WhenRunNameEscapesOutputDirectory_
UsesConfinedDeploymentRoot
Security assertions (StartsWith, no-separator, confinement scan) are well-chosen; ~38-line body with a directory scan could be split into a confinement test and a content-integrity test.
B (80–89)mod TrxReportEngineMergeTests.
MergeToFileAsync_
RepeatedIntoSameNestedLayout_
IsBoundedAndNonDestructive
Loop + copy-count + href-resolution are all meaningful; the for-loop is idiomatic here, but extracting the loop limit (4) into a named constant would clarify intent.
B (80–89)mod TrxReportEngineMergeTests.
MergeToFileAsync_
RelocatesPerTestResultFilesByPrefixingResultDirectory
Four meaningful assertions covering path rewriting and file content; ~50-line body with manual XML construction — consider extracting a BuildResultFilesReport helper to compress the arrange phase.
A (90–100)new CtrfReportMergerTests.
Merge_
ReportIdIsUnaffectedByIgnoredNonCtrfInput
Inline comment explains non-CTRF input semantics; equality on both IDs plus IsNotNull guard — no issues found.
A (90–100)new TrxReportEngineMergeTests.
Merge_
TimesOmitAttributesNoInputSupplies
Null-absence and equality assertions together cover both the omission and the surviving fields — no issues found.
A (90–100)new TrxReportEngineMergeTests.
Merge_
TimesTrackEarliestCreationQueuingStartIndependently
All four time attributes verified independently with inputs deliberately split across two reports — no issues found.
A (90–100)new TrxReportEngineMergeTests.
MergeToFileAsync_
SecondMergeIntoSameOutput_
DoesNotCorruptPriorReportsAttachments
Two-merge scenario with distinct-root assertion and byte-level content verification — no issues found.
A (90–100)mod TrxReportEngineMergeTests.
MergeToFileAsync_
IsolatesCollidingAttachmentsPerInputAndRewritesHrefs
Now reads mergedRoot from the document rather than assuming runName; content + href assertions are thorough — no issues found.
A (90–100)mod TrxReportEngineMergeTests.
MergeToFileAsync_
WhenRunNameMatchesInputDeploymentRoot_
UsesUniqueRootAndRelocates
AreNotEqual uniqueness check, original-preservation check, and content-verified href resolution — no issues found.
A (90–100)mod TrxReportEngineMergeTests.
MergeToFileAsync_
WhenSourceNestedUnderMergedRoot_
RelocatesAndKeepsHrefsValid
Reads mergedRoot dynamically and validates href resolution end-to-end with content check — no issues found.

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

Warning

Firewall blocked 1 domain

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

  • awmgmcpg

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

network:
allowed:
- defaults
- "awmgmcpg"

See Network Configuration for more information.

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

@Evangelink
Amaury Levé (Evangelink) merged commit 0a44195 into mainJul 16, 2026
68 checks passed
@Evangelink
Amaury Levé (Evangelink) deleted the dev/amauryleve/miniature-broccoli branch July 16, 2026 14:10
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

state/needs-reviewAwaiting review from the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@Evangelink@0101
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Universal Dark Mode - works on any site\n(function() {\n var enabled = true;\n \n function applyDarkMode() {\n if (!enabled) return;\n \n // Create style element if it doesn't exist\n var style = document.getElementById('universal-dark-mode-style');\n if (!style) {\n style = document.createElement('style');\n style.id = 'universal-dark-mode-style';\n document.head.appendChild(style);\n }\n \n // Dark mode CSS - inverts colors but preserves images/video\n style.textContent = '\n /* Invert everything except media */\n html {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #1a1a2e !important;\n }\n \n /* Restore images, videos, iframes, canvas */\n img, video, iframe, canvas, svg, picture, [style*=\"background-image\"] {\n filter: invert(1) hue-rotate(180deg) !important;\n }\n \n /* Preserve specific elements that should not be inverted */\n .no-dark-mode, .no-dark-mode *,\n [data-theme=\"light\"], [data-theme=\"light\"],\n .ace_editor, .ace_editor *,\n .CodeMirror, .CodeMirror *,\n .monaco-editor, .monaco-editor *,\n .markdown-body pre, .markdown-body pre *,\n .highlight, .highlight *,\n pre code, pre code * {\n filter: none !important;\n }\n \n /* Fix common UI elements */\n .modal, .popup, .dropdown-menu, .tooltip, .popover {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #2d2d44 !important;\n border-color: #444 !important;\n }\n \n /* Scrollbars */\n ::-webkit-scrollbar { background: #1a1a2e !important; }\n ::-webkit-scrollbar-thumb { background: #444 !important; }\n ::-webkit-scrollbar-thumb:hover { background: #555 !important; }\n \n /* Selection */\n ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ';\n }\n \n function removeDarkMode() {\n var style = document.getElementById('universal-dark-mode-style');\n if (style) style.remove();\n }\n \n // Toggle with Alt+Shift+D\n document.addEventListener('keydown', function(e) {\n if (e.altKey && e.shiftKey && e.key === 'D') {\n e.preventDefault();\n enabled = !enabled;\n if (enabled) {\n applyDarkMode();\n console.log('[Universal Dark Mode] Enabled');\n } else {\n removeDarkMode();\n console.log('[Universal Dark Mode] Disabled');\n }\n }\n });\n \n // Apply on load\n applyDarkMode();\n \n // Re-apply on dynamic content\n var observer = new MutationObserver(function(mutations) {\n if (enabled && !document.getElementById('universal-dark-mode-style')) {\n applyDarkMode();\n }\n });\n observer.observe(document.head, { childList: true });\n \n console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle');\n})();", "Universal Dark Mode"); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })();
Skip to content

Add artifact merge engines and Kind metadata flow (RFC 018 phase 1) - #9805

Merged
Amaury Levé (Evangelink) merged 32 commits into
mainfrom
dev/amauryleve/miniature-broccoli
Jul 16, 2026
Merged

Add artifact merge engines and Kind metadata flow (RFC 018 phase 1)#9805
Amaury Levé (Evangelink) merged 32 commits into
mainfrom
dev/amauryleve/miniature-broccoli

Conversation

@Evangelink

Copy link
Copy Markdown
Member

Summary

Implements the first testfx-side pieces of RFC 018 — Artifact post-processing for dotnet test (MTP). Two independent, self-contained foundations that every later phase (dispatcher tool, SDK election) reuses. No SDK dependency; the SDK orchestration lands separately once this merges.

1. Report merge engines (pure, invocation-agnostic — no I/O in the core)

Validated the RFC's "collect same-kind inputs → re-aggregate → emit one" shape across both data models:

EngineFormatMerge unitRe-aggregation
TrxReportEngine.Merge / MergeToFileAsyncXMLResults/TestDefinitions/TestEntriescounters summed, Times earliest/latest, TestLists deduped by id, outcome Failed if any input failed
JUnitReportMergerXML<testsuite>counters derived by summing per-suite (correct even when root aggregates are missing); supports bare <testsuite> roots
CtrfReportMergerJSON (JsonNode)results.tests[]summary derived from the merged tests[] so summary.tests always matches the array; start/stop min/max

HTML is intentionally not file-merged (it's a rendered template with an embedded JSON blob) — this validates the design's opt-in / return-null semantics rather than breaking it.

2. Kind metadata flow (producer → IPC wire)

So the dotnet test orchestrator can group artifacts by format without inspecting file contents:

  • SessionFileArtifact gains an optional kind (experimental-gated, [TPEXP]); the shipped 4-arg constructor is preserved for binary compatibility.
  • IPC: FileArtifactMessage.Kind + FileArtifactMessageFieldsId.Kind = 7 + serializer read/write/field-count (forward/backward compatible — old readers skip the unknown field).
  • DotnetTestDataConsumer propagates Kind onto the wire message.
  • Report producers tag their kind: TRX microsoft.testing.trx, JUnit microsoft.testing.junit, CTRF microsoft.testing.ctrf, HTML microsoft.testing.html.

Tests

  • Unit tests for all three merge engines (null/empty inputs, counter summing, outcome, dedup, timestamps, bare-root/missing-aggregate robustness, summary-missing).
  • IPC protocol round-trip tests assert Kind survives the pipe.
  • Full repo builds clean (only the unrelated WasiPlayground sample fails on a missing workload); Platform IPC/protocol, contract-package, and Extensions unit tests all green.

Not in this PR (future phases, per the RFC)

  • IArtifactPostProcessor typed contract wrapping the engines.
  • Handshake advertisement of post-processor kinds.
  • Dispatcher ITool + tool-host-over-pipe composition.
  • User tools (merge-trx, …) and the dotnet/sdk orchestration.

cc Amaury Levé (@Evangelink)

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

Implements the first testfx-side pieces of RFC 018 (artifact post-processing
for dotnet test / MTP):
- Report merge engines (pure, invocation-agnostic, no I/O in the core):
- TrxReportEngine.Merge / MergeToFileAsync (XML-level TRX merge).
- JUnitReportMerger (unions <testsuite>, counters derived per-suite).
- CtrfReportMerger (JSON merge; summary derived from merged tests[]).
- Kind metadata flow so the dotnet/sdk orchestrator can group artifacts by
format: SessionFileArtifact gains an optional kind (experimental), the
FileArtifactMessage IPC record + serializer carry Kind (field id 7), the
dotnet-test consumer propagates it, and report producers tag their kind
(trx/junit/ctrf/html).
Unit tests cover all three merge engines and the IPC round-trip.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
CopilotAI review requested due to automatic review settings July 9, 2026 22:09

CopilotAI 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

Adds report-merging foundations and propagates artifact format metadata through MTP’s artifact and IPC layers.

Changes:

  • Adds TRX, JUnit, and CTRF merge engines with unit tests.
  • Adds experimental SessionFileArtifact.Kind metadata and IPC serialization.
  • Tags TRX, JUnit, CTRF, and HTML report artifacts by format.
Show a summary per file
FileDescription
test/UnitTests/Microsoft.Testing.Platform.UnitTests/IPC/ProtocolTests.csCovers IPC kind serialization.
test/UnitTests/Microsoft.Testing.Platform.UnitTests/IPC/ProtocolEdgeCaseTests.csTests nullable kind round trips.
test/UnitTests/Microsoft.Testing.Platform.DotnetTestProtocolContract.UnitTests/DotnetTestProtocolSerializerTests.csVerifies protocol-contract serialization.
test/UnitTests/Microsoft.Testing.Extensions.UnitTests/TrxReportEngineMergeTests.csTests TRX merging.
test/UnitTests/Microsoft.Testing.Extensions.UnitTests/JUnitReportMergerTests.csTests JUnit merging.
test/UnitTests/Microsoft.Testing.Extensions.UnitTests/CtrfReportMergerTests.csTests CTRF merging.
src/Platform/SharedExtensionHelpers/ReportGeneratorBase.csPublishes report artifact kinds.
src/Platform/Microsoft.Testing.Platform/ServerMode/DotnetTest/IPC/Serializers/FileArtifactMessagesSerializer.csSerializes the new kind field.
src/Platform/Microsoft.Testing.Platform/ServerMode/DotnetTest/IPC/ObjectFieldIds.csAssigns IPC field ID 7.
src/Platform/Microsoft.Testing.Platform/ServerMode/DotnetTest/IPC/Models/FileArtifactMessages.csAdds kind to the wire model.
src/Platform/Microsoft.Testing.Platform/ServerMode/DotnetTest/IPC/DotnetTestDataConsumer.csPropagates session artifact kinds.
src/Platform/Microsoft.Testing.Platform/PublicAPI/PublicAPI.Unshipped.txtTracks the experimental public API.
src/Platform/Microsoft.Testing.Platform/Messages/FileArtifacts.csAdds the kind-aware constructor and property.
src/Platform/Microsoft.Testing.Platform/InternalAPI/InternalAPI.Unshipped.txtTracks IPC internal API changes.
src/Platform/Microsoft.Testing.Extensions.TrxReport/TrxReportEngine.Merge.csImplements TRX merging.
src/Platform/Microsoft.Testing.Extensions.TrxReport/TrxDataConsumer.csTags in-process TRX artifacts.
src/Platform/Microsoft.Testing.Extensions.TrxReport/InternalAPI/InternalAPI.Unshipped.txtTracks TRX internal APIs.
src/Platform/Microsoft.Testing.Extensions.Retry/InternalAPI/InternalAPI.Unshipped.txtTracks linked IPC field API.
src/Platform/Microsoft.Testing.Extensions.MSBuild/InternalAPI.Unshipped.txtTracks linked IPC field API.
src/Platform/Microsoft.Testing.Extensions.JUnitReport/JUnitReportMerger.csImplements JUnit merging.
src/Platform/Microsoft.Testing.Extensions.JUnitReport/JUnitReportGenerator.csTags JUnit artifacts.
src/Platform/Microsoft.Testing.Extensions.JUnitReport/InternalAPI/InternalAPI.Unshipped.txtTracks JUnit internal APIs.
src/Platform/Microsoft.Testing.Extensions.HtmlReport/InternalAPI/InternalAPI.Unshipped.txtTracks shared generator API.
src/Platform/Microsoft.Testing.Extensions.HtmlReport/HtmlReportGenerator.csTags HTML artifacts.
src/Platform/Microsoft.Testing.Extensions.HangDump/InternalAPI/InternalAPI.Unshipped.txtTracks linked IPC field API.
src/Platform/Microsoft.Testing.Extensions.CtrfReport/InternalAPI/InternalAPI.Unshipped.txtTracks CTRF internal APIs.
src/Platform/Microsoft.Testing.Extensions.CtrfReport/CtrfReportMerger.csImplements CTRF merging.
src/Platform/Microsoft.Testing.Extensions.CtrfReport/CtrfReportGenerator.csTags CTRF artifacts.

Review details

  • Files reviewed: 28/28 changed files
  • Comments generated: 4
  • Review effort level: Medium

Comment threadsrc/Platform/Microsoft.Testing.Extensions.TrxReport/TrxDataConsumer.cs Outdated
@Evangelink
Amaury Levé (Evangelink) marked this pull request as ready for review July 13, 2026 14:43
…ure-broccoli
# Conflicts:
#	src/Platform/Microsoft.Testing.Extensions.CtrfReport/InternalAPI/InternalAPI.Unshipped.txt
#	src/Platform/Microsoft.Testing.Extensions.HangDump/InternalAPI/InternalAPI.Unshipped.txt
#	src/Platform/Microsoft.Testing.Extensions.HtmlReport/InternalAPI/InternalAPI.Unshipped.txt
#	src/Platform/Microsoft.Testing.Extensions.JUnitReport/InternalAPI/InternalAPI.Unshipped.txt
#	src/Platform/Microsoft.Testing.Extensions.TrxReport/InternalAPI/InternalAPI.Unshipped.txt
#	src/Platform/Microsoft.Testing.Platform/InternalAPI/InternalAPI.Unshipped.txt
- Carry microsoft.testing.trx through the out-of-process TRX path by adding an
(experimental) Kind to FileArtifact and propagating it in DotnetTestDataConsumer
and TrxProcessLifetimeHandler; centralize the kind in TrxReportEngine.TrxArtifactKind.
- Deduplicate <UnitTest> definitions by id when merging TRX (ids are deterministic
from the test UID and the schema forbids duplicates).
- Preserve <RunInfos> (crash/exit diagnostics) and <CollectorDataEntries> from every
input's <ResultSummary> instead of discarding them; omit them when empty.
- Correct the inaccurate 'attachment paths are absolute' remark and relocate each
input's attachment deployment tree into the merged deployment root in
MergeToFileAsync (best-effort, never fails the merge).
- Add unit tests for dedup and diagnostics preservation.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
CopilotAI review requested due to automatic review settings July 13, 2026 15:04

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

Review details

  • Files reviewed: 30/30 changed files
  • Comments generated: 11
  • Review effort level: Medium

Comment threadsrc/Platform/Microsoft.Testing.Extensions.JUnitReport/JUnitReportMerger.cs Outdated
Comment threadsrc/Platform/Microsoft.Testing.Extensions.TrxReport/TrxDataConsumer.cs Outdated
@github-actions

This comment has been minimized.

@EvangelinkAmaury Levé (Evangelink) added the state/needs-review Awaiting review from the team. label Jul 13, 2026
…ure-broccoli
# Conflicts:
#	src/Platform/Microsoft.Testing.Extensions.CtrfReport/InternalAPI/InternalAPI.Unshipped.txt
#	src/Platform/Microsoft.Testing.Extensions.HangDump/InternalAPI/InternalAPI.Unshipped.txt
#	src/Platform/Microsoft.Testing.Extensions.HtmlReport/InternalAPI/InternalAPI.Unshipped.txt
#	src/Platform/Microsoft.Testing.Extensions.JUnitReport/InternalAPI/InternalAPI.Unshipped.txt
#	src/Platform/Microsoft.Testing.Extensions.MSBuild/InternalAPI.Unshipped.txt
#	src/Platform/Microsoft.Testing.Extensions.Retry/InternalAPI/InternalAPI.Unshipped.txt
#	src/Platform/Microsoft.Testing.Extensions.TrxReport/InternalAPI/InternalAPI.Unshipped.txt
#	src/Platform/Microsoft.Testing.Platform/InternalAPI/InternalAPI.Unshipped.txt
CopilotAI review requested due to automatic review settings July 13, 2026 19:50

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

Review details

  • Files reviewed: 30/30 changed files
  • Comments generated: 3
  • Review effort level: Medium

- Skip relocation when the merged 'In' root overlaps the source 'In' root (output
written beside the input with a matching runName), preventing the copy from
recursing into its own destination; the original hrefs already resolve there.
- Skip file reparse points (symlinks) before File.Copy so a link inside the confined
tree can't pull in content from outside it.
- Overwrite copied attachment files so a reused output directory can't leave stale
bytes behind while the merged XML references the fresh per-input destination.
- Add a unit test for the overlapping-root skip case.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
CopilotAI review requested due to automatic review settings July 13, 2026 20:06

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

Review details

  • Files reviewed: 30/30 changed files
  • Comments generated: 1
  • Review effort level: Medium

@github-actions

This comment has been minimized.

Regenerated via UpdateXlf. The last localized check-in added translations for
'GlobalTestFixtureShouldBeValidClassLayout' (fr) and 'SlowTestStillRunning' (ru)
that XliffTasks rejects (placeholder mismatch), breaking the build with
"xlf is out-of-date with resx". UpdateXlf resets those two units to state="new"
so the build passes; they will be re-translated on the next localization pass.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 4350f662-0e5d-4e05-b156-1ef619da3b9e
CopilotAI review requested due to automatic review settings July 14, 2026 08:01

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

Review details

  • Files reviewed: 32/32 changed files
  • Comments generated: 3
  • Review effort level: Low

Comment threadsrc/Analyzers/MSTest.Analyzers/xlf/Resources.fr.xlf Outdated

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

Review details

  • Files reviewed: 31/31 changed files
  • Comments generated: 5
  • Review effort level: Medium

Comment threadsrc/Platform/Microsoft.Testing.Extensions.JUnitReport/JUnitReportMerger.cs Outdated
Comment threadsrc/Platform/Microsoft.Testing.Extensions.CtrfReport/CtrfReportMerger.cs Outdated
…ias check (review)
- TRX Merge now carries run-level <ResultSummary>/<Output> across (StdOut/StdErr/
DebugTrace concatenated, TextMessages/Message unioned), emitted in schema order right
after <Counters>, so VSTest's run-level skipped/informational messages are no longer
silently dropped.
- MergeToFileAsync rejects an empty input list before any filesystem work (output
directory creation / attachment relocation), so an invalid call no longer mutates the
disk before Merge throws. Applied to TRX/JUnit/CTRF.
- Output-alias check is now filesystem-aware: it compares canonicalized paths with a
cached case-sensitivity probe (case-sensitive on case-sensitive volumes, insensitive
otherwise), so on Linux a legitimate separate output like 'A.trx' is no longer rejected
as aliasing input 'a.trx', while Windows/macOS case aliases are still caught. Applied
to TRX/JUnit/CTRF.
Tests: run-level Output merge + schema order; empty-input rejection without touching the
filesystem (all three mergers). 74 merge tests pass; full solution build clean.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
CopilotAI review requested due to automatic review settings July 16, 2026 07:49

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

Review details

  • Files reviewed: 31/31 changed files
  • Comments generated: 3
  • Review effort level: Medium

Comment threadsrc/Platform/Microsoft.Testing.Extensions.JUnitReport/JUnitReportMerger.cs Outdated
Comment threadsrc/Platform/Microsoft.Testing.Extensions.CtrfReport/CtrfReportMerger.cs Outdated
@github-actions

This comment has been minimized.

…view)
The alias-equality check derived its case sensitivity from a one-time probe in
Path.GetTempPath(), but case sensitivity can differ per volume and (on Windows) per
directory. Replace the cached temp probe with a per-call probe of the OUTPUT's own
location (nearest existing ancestor) in all three mergers. An alias can only occur when
input and output share a directory, so that shared location's sensitivity is the correct
one — a different-directory input never compares equal. Falls back to case-insensitive
(rejects more, never less) if the probe fails. This closes the gap where 'A.trx' could
alias input 'a.trx' on a case-insensitive output volume while the temp-based probe said
Ordinal, letting ReplaceFile delete the input.
Applied to TRX/JUnit/CTRF. 74 merge tests pass; full solution build clean.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
CopilotAI review requested due to automatic review settings July 16, 2026 08:10

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

Review details

  • Files reviewed: 31/31 changed files
  • Comments generated: 3
  • Review effort level: Medium

Comment threadsrc/Platform/Microsoft.Testing.Extensions.JUnitReport/JUnitReportMerger.cs Outdated
Comment threadsrc/Platform/Microsoft.Testing.Extensions.CtrfReport/CtrfReportMerger.cs Outdated
…er (review)
The read-only-input alias check (canonicalization, per-output-directory case-sensitivity
probe, netstandard reparse-ancestor fail-closed) and the atomic temporary-sibling write/
replace were duplicated in the TRX, JUnit and CTRF mergers. Because this is security- and
data-loss-sensitive, extract it into a single shared SharedExtensionHelpers/
MergeOutputFileHelper.cs (linked into all three, namespace Microsoft.Testing.Extensions),
exposing EnsureOutputDoesNotAliasInput and WriteViaTemporarySiblingAsync so the logic can
no longer diverge across formats. Each merger now delegates to it; the per-format writer
(XDocument stream vs string) is passed as a callback. Registered the shared internal type/
methods in each project's InternalAPI.Unshipped.txt.
No behavior change. 74 merge tests pass; full solution build clean (0 warnings).
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
CopilotAI review requested due to automatic review settings July 16, 2026 08:40
@github-actions

This comment has been minimized.

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

Review details

  • Files reviewed: 35/35 changed files
  • Comments generated: 4
  • Review effort level: Medium

Comment threadsrc/Platform/SharedExtensionHelpers/MergeOutputFileHelper.cs
Comment threadsrc/Platform/Microsoft.Testing.Extensions.CtrfReport/CtrfReportMerger.cs Outdated
…ments
CI (macOS): GetCanonicalPath now re-resolves ancestor symlinks after every
link hop, so a link target whose prefix is itself a symlink (macOS
/var -> /private/var) canonicalizes consistently and the read-only-input
alias check no longer misses a symlinked-parent output. Fixes the 3
WhenOutputAliasesInputViaSymlinkedParent merge tests that failed on macOS.
Review comments addressed:
- MergeOutputFileHelper.ReplaceFile: atomic File.Move(overwrite:true) on
netcore so an interruption can never leave the previous report missing;
delete-then-move retained only on .NET Framework (no overwrite overload).
- TRX relocation: deployment root is now unique per run (run id suffix), so
relocation always writes a fresh tree and can never corrupt a previously
committed report's attachments if a later merge fails.
- TRX Times: earliest creation/queuing/start tracked independently and
omitted when no input supplies them, instead of fabricating all three
from the earliest start.
- CTRF reportId: derived only from accepted CTRF payloads, so an ignored
non-CTRF input no longer changes the merged report identity.
Adds regression tests for each and updates deployment-root-coupled TRX tests
to read the emitted runDeploymentRoot instead of assuming a literal name.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 34f1a49b-b1e0-4f38-b8a1-3870dd0842d2
CopilotAI review requested due to automatic review settings July 16, 2026 12:00

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

Review details

  • Files reviewed: 35/35 changed files
  • Comments generated: 1
  • Review effort level: Medium

Comment threadsrc/Platform/SharedExtensionHelpers/MergeOutputFileHelper.cs
@github-actions

Copy link
Copy Markdown
Contributor

🧪 Test quality grade — PR #9805

GradeTestNotes
B (80–89)new CtrfReportMergerTests.
Merge_
ReportIdIsUnaffectedByIgnoredNonCtrfInput
Clear scenario and deterministic inputs; equality assertion on both IDs plus a non-null guard make this near-perfect — no issues found, A could be reached by noting the comment rationale inline.
B (80–89)mod TrxReportEngineMergeTests.
MergeToFileAsync_
WhenInputLivesUnderMergedRoot_
PreservesOriginalReportAndAttachment
Presence-only assertions (File.Exists) confirm files survive, but adding a content check (File.ReadAllText) would close the preservation guarantee fully.
B (80–89)mod TrxReportEngineMergeTests.
MergeToFileAsync_
WhenRunNameEscapesOutputDirectory_
UsesConfinedDeploymentRoot
Security assertions (StartsWith, no-separator, confinement scan) are well-chosen; ~38-line body with a directory scan could be split into a confinement test and a content-integrity test.
B (80–89)mod TrxReportEngineMergeTests.
MergeToFileAsync_
RepeatedIntoSameNestedLayout_
IsBoundedAndNonDestructive
Loop + copy-count + href-resolution are all meaningful; the for-loop is idiomatic here, but extracting the loop limit (4) into a named constant would clarify intent.
B (80–89)mod TrxReportEngineMergeTests.
MergeToFileAsync_
RelocatesPerTestResultFilesByPrefixingResultDirectory
Four meaningful assertions covering path rewriting and file content; ~50-line body with manual XML construction — consider extracting a BuildResultFilesReport helper to compress the arrange phase.
A (90–100)new CtrfReportMergerTests.
Merge_
ReportIdIsUnaffectedByIgnoredNonCtrfInput
Inline comment explains non-CTRF input semantics; equality on both IDs plus IsNotNull guard — no issues found.
A (90–100)new TrxReportEngineMergeTests.
Merge_
TimesOmitAttributesNoInputSupplies
Null-absence and equality assertions together cover both the omission and the surviving fields — no issues found.
A (90–100)new TrxReportEngineMergeTests.
Merge_
TimesTrackEarliestCreationQueuingStartIndependently
All four time attributes verified independently with inputs deliberately split across two reports — no issues found.
A (90–100)new TrxReportEngineMergeTests.
MergeToFileAsync_
SecondMergeIntoSameOutput_
DoesNotCorruptPriorReportsAttachments
Two-merge scenario with distinct-root assertion and byte-level content verification — no issues found.
A (90–100)mod TrxReportEngineMergeTests.
MergeToFileAsync_
IsolatesCollidingAttachmentsPerInputAndRewritesHrefs
Now reads mergedRoot from the document rather than assuming runName; content + href assertions are thorough — no issues found.
A (90–100)mod TrxReportEngineMergeTests.
MergeToFileAsync_
WhenRunNameMatchesInputDeploymentRoot_
UsesUniqueRootAndRelocates
AreNotEqual uniqueness check, original-preservation check, and content-verified href resolution — no issues found.
A (90–100)mod TrxReportEngineMergeTests.
MergeToFileAsync_
WhenSourceNestedUnderMergedRoot_
RelocatesAndKeepsHrefsValid
Reads mergedRoot dynamically and validates href resolution end-to-end with content check — no issues found.

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

Warning

Firewall blocked 1 domain

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

  • awmgmcpg

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

network:
allowed:
- defaults
- "awmgmcpg"

See Network Configuration for more information.

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

@Evangelink
Amaury Levé (Evangelink) merged commit 0a44195 into mainJul 16, 2026
68 checks passed
@Evangelink
Amaury Levé (Evangelink) deleted the dev/amauryleve/miniature-broccoli branch July 16, 2026 14:10
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

state/needs-reviewAwaiting review from the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@Evangelink@0101