Skip to content

[test-improver] Add unit tests for ArtifactPostProcessingHelper.IsReparsePoint #10710

Description

@github-actions

Warning

Threat Detection Engine Failure — The analysis engine could not complete. This is a tooling failure, not a security finding.

What happened

The threat detection results could not be parsed.

Review the workflow run logs for details.

Goal and rationale

ArtifactPostProcessingHelper.IsReparsePoint (in src/Platform/SharedExtensionHelpers/) is a security-relevant helper used by TrxArtifactPostProcessor and HtmlArtifactPostProcessor to refuse writing artifacts through symlinks/reparse points. It had zero direct test coverage.

Approach

The type is compiled once per report-engine assembly (<Compile Include>-linked into TrxReport, HtmlReport, JUnitReport, CtrfReport), so it can't be referenced by name directly from the test project (ambiguous, CS0433). Following the existing ReportFileNameSanitizationConsistencyTests.cs pattern, the new tests resolve IsReparsePoint via reflection anchored on the Trx engine assembly and exercise it with real filesystem operations (no mocking needed):

  • Regular directory → false
  • Non-existent path → true (fails closed on the exception path)
  • Symbolic link to a directory → true (skips with Assert.Inconclusive if the sandbox doesn't permit symlink creation)
  • Plain file → false

Coverage impact

New file: test/UnitTests/Microsoft.Testing.Extensions.UnitTests/ArtifactPostProcessingHelperTests.cs (4 tests). ArtifactPostProcessingHelper line coverage for the Trx engine assembly goes from 0% to fully covered by these tests.

Trade-offs

Minimal maintenance burden: tests use only real filesystem operations and no mocks. The reflection indirection mirrors an existing repo pattern for this class of shared, multi-assembly-linked helper.

Reproducibility

./build.sh
dotnet run --project test/UnitTests/Microsoft.Testing.Extensions.UnitTests -f net9.0 --no-build -c Debug -- --filter "FullyQualifiedName~ArtifactPostProcessingHelperTests"

Test Status

  • Build: succeeded (Debug, net8.0/net9.0)
  • New tests: 4/4 passed
  • Full Microsoft.Testing.Extensions.UnitTests suite: 1129 passed, 0 failed, 34 skipped (no regressions)
  • dotnet format whitespace --verify-no-changes: clean

Warning

Firewall blocked 1 domain

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

  • southcentralus0.in.applicationinsights.azure.com

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

network:
  allowed:
    - defaults
    - "southcentralus0.in.applicationinsights.azure.com"

See Network Configuration for more information.

🤖 Automated content by GitHub Copilot. Generated by the Test Improver workflow. · auto · 222.6 AIC · ⌖ 8.45 AIC · ⊞ 19.4K · [◷]( · )
Comment /test-assist to run again

Add this agentic workflow to your repo

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/test-improver.md@main

Note

This was originally intended as a pull request, but GitHub Actions is not permitted to create or approve pull requests in this repository.
The changes have been pushed to branch test-assist/artifact-post-processing-helper-65fd3adb947a4f0d.

Click here to create the pull request

To fix the permissions issue, go to SettingsActionsGeneral and enable Allow GitHub Actions to create and approve pull requests. See also: gh-aw FAQ

Show patch preview (128 of 128 lines)
From c1c8df0575dc316510b0bc168214a4ed130a9c58 Mon Sep 17 00:00:00 2001
X-GH-AW-Base-Commit: a7f34662ebd9292b2f25750eb0ba8339dd107ad1
From: "github-actions[bot]" <github-actions[bot]@users.noreply.github.com>
Date: Mon, 24 Aug 2026 23:16:37 +0000
Subject: [PATCH] Add unit tests for
 ArtifactPostProcessingHelper.IsReparsePoint

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---
 .../ArtifactPostProcessingHelperTests.cs      | 105 ++++++++++++++++++
 1 file changed, 105 insertions(+)
 create mode 100644 test/UnitTests/Microsoft.Testing.Extensions.UnitTests/ArtifactPostProcessingHelperTests.cs

diff --git a/test/UnitTests/Microsoft.Testing.Extensions.UnitTests/ArtifactPostProcessingHelperTests.cs b/test/UnitTests/Microsoft.Testing.Extensions.UnitTests/ArtifactPostProcessingHelperTests.cs
new file mode 100644
index 0000000..1250d52
--- /dev/null
+++ b/test/UnitTests/Microsoft.Testing.Extensions.UnitTests/ArtifactPostProcessingHelperTests.cs
@@ -0,0 +1,105 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
+using System.Reflection;
+
+using Microsoft.Testing.Extensions.TrxReport.Abstractions;
+
+namespace Microsoft.Testing.Extensions.UnitTests;
+
+[TestClass]
+public class ArtifactPostProcessingHelperTests
+{
+    // ArtifactPostProcessingHelper is an internal type that is *linked* (compiled) into every
+    // artifact-post-processing engine assembly (Trx, Html, JUnit, Ctrf), so referencing it by name
+    // directly is ambiguous (CS0433). Resolve the method via reflection, anchoring on one public
+    // type from the Trx engine assembly, mirroring ReportFileNameSanitizationConsistencyTests.
+    private static readonly MethodInfo IsReparsePointMethod =
+        (typeof(TrxReportEngine).Assembly.GetType("Microsoft.Testing.Extensions.ArtifactPostProcessingHelper")
+            ?? throw new InvalidOperationException("Could not find
... (truncated)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions