Skip to content

[release/9.0] Helix reporter: add portable JSON output (#16774) - #17382

Open
wfurt wants to merge 1 commit into
release/9.0from
backport/16774-to-release/9.0
Open

[release/9.0] Helix reporter: add portable JSON output (#16774)#17382
wfurt wants to merge 1 commit into
release/9.0from
backport/16774-to-release/9.0

Conversation

@wfurt

@wfurt wfurt commented Aug 21, 2026

Copy link
Copy Markdown
Member

Backport of #16774 to release/9.0.

Description

The current format uses Python's Pickle that is not portable. The reporter also depends on helix scripts that may or may not be present anymore. This change preserves the existing Pickle serialization when possible but makes it optional. It adds portable JSON serialization that can be consumed by anyone in any language.

Copilot AI lite review requested due to automatic review settings August 21, 2026 19:45

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Backport that makes the Helix in-work-item reporter resilient to missing helix-scripts by introducing a bundled compatibility shim and adding a portable, language-neutral JSON results file (__test_report_v2.json) alongside the legacy pickle output.

Changes:

  • Add _helix_compat shim types plus a JsonReporter to emit a schema-versioned JSON results file.
  • Update reporter entrypoint and format parsers to fall back to the shim when helix-scripts isn’t installed, while preserving legacy pickle behavior when it is.
  • Document the new JSON wire format and schema in RESULTS_FORMAT.md.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/Microsoft.DotNet.Helix/Sdk/tools/azure-pipelines/reporter/test_results_reader/init.py Fallback import to shim types when helix-scripts isn’t available.
src/Microsoft.DotNet.Helix/Sdk/tools/azure-pipelines/reporter/run.py Conditional legacy pickle reporting + unconditional JSON writer.
src/Microsoft.DotNet.Helix/Sdk/tools/azure-pipelines/reporter/RESULTS_FORMAT.md New documentation for JSON results format/schema.
src/Microsoft.DotNet.Helix/Sdk/tools/azure-pipelines/reporter/formats/xunit.py Shim fallback for TestResult / TestResultAttachment.
src/Microsoft.DotNet.Helix/Sdk/tools/azure-pipelines/reporter/formats/junit.py Shim fallback for TestResult / TestResultAttachment.
src/Microsoft.DotNet.Helix/Sdk/tools/azure-pipelines/reporter/formats/trx.py Shim fallback for TestResult / TestResultAttachment.
src/Microsoft.DotNet.Helix/Sdk/tools/azure-pipelines/reporter/formats/result_format.py Shim fallback for TestResult.
src/Microsoft.DotNet.Helix/Sdk/tools/azure-pipelines/reporter/_helix_compat.py New shim module + JSON serialization implementation.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +34 to +37
Recommended use: write `__test_report_v2.json` to `$HELIX_WORKITEM_ROOT`
from your test runner's own reporting hook, then either omit
`EnableAzurePipelinesReporter` or let it run — the reporter is a no-op
on a missing/empty results XML when the JSON file already exists.
Comment on lines +195 to +199
def _attachment_to_dict(a):
"""Serialize either our TestResultAttachment or the helix-scripts one."""
if hasattr(a, "to_dict"):
return a.to_dict()
return {"name": getattr(a, "name", None), "text": getattr(a, "text", None)}
Comment on lines +257 to +258
with open(path, "w", encoding="utf-8") as f:
json.dump(payload, f, ensure_ascii=False)
@wfurt
wfurt requested a review from mmitche August 24, 2026 17:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants