[release/9.0] Helix reporter: add portable JSON output (#16774) - #17382
Open
wfurt wants to merge 1 commit into
Open
[release/9.0] Helix reporter: add portable JSON output (#16774)#17382wfurt wants to merge 1 commit into
wfurt wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
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_compatshim types plus aJsonReporterto emit a schema-versioned JSON results file. - Update reporter entrypoint and format parsers to fall back to the shim when
helix-scriptsisn’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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.