Skip to content

feat(reporting): add a JUnit XML report format - #691

Merged
chrisknvidia merged 21 commits into
NVIDIA:mainfrom
mvanhorn:feat/junit-report
Nov 17, 2026
Merged

chrisknvidia merged 21 commits into
NVIDIA:mainfrom
mvanhorn:feat/junit-report

Conversation

@mvanhorn

@mvanhorn mvanhorn commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Summary

skillevaluator now writes JUnit XML with -r junit (file extension
.junit.xml) so CI systems that ingest test reports can show each check
group as a test suite. Failures include file:line when a finding records a
location. Checks that did not run and scanners that did not complete are
<skipped> rather than passing cases, so an incomplete scan cannot look like
an all-passed report. Non-failing findings stay in <system-out>. Gate
failures such as a quality score below the required minimum remain
<failure> even when finding severity is only a warning. File paths are
relative to the scanned root, using the same resolution rules as the SARIF
reporter. Characters XML 1.0 forbids are stripped.

GitLab can attach the file with artifacts:reports:junit. Other -r formats
and command exit codes are unchanged.

Verification

  • I am familiar with the Contributing Guidelines
  • Added or updated focused tests
  • Updated documentation for user-visible changes
  • Ran make lint
  • Ran make test
  • Ran make build
  • Did not add credentials, private datasets, or proprietary benchmark content

Commands run on Linux 6.12.113+ x86_64, Python 3.12.3, uv-managed venv:

  • uv run make lint — All checks passed.
  • uv run pytest on focused JUnit coverage (tests/reporting/test_junit_reporter.py, incomplete-scan JUnit case, non-UTF8 filename parametrize, catalog collision, publisher sparse-checkout) — 25 passed in 1.98s.
  • uv run make test — 54 failed, 35695 passed, 173 skipped, 19 deselected in 1677.36s. None of the failures are the new JUnit tests. The 21 non-Harbor failures in that set reproduce on untouched upstream/main (cc3563e5) in this environment (80-column wrapping). Harbor timeout and redaction tests hang or fail here; they were not used to judge this change.
  • uv run make build — built skillevaluator-0.9.0.tar.gz and skillevaluator-0.9.0-py3-none-any.whl.
  • ./fern/node_modules/.bin/fern check — 0 errors.

Not verified: GitLab/Jenkins/Azure/CircleCI/Buildkite ingesting the XML in a
live pipeline; Python 3.13 and 3.14; Windows.

Release Impact

  • No user-visible release note needed
  • Updated CHANGELOG.md

Demo

demo

Full recording (MP4): https://raw.githubusercontent.com/mvanhorn/pr-demo-assets/main/osc-bulk-1116/junit-report/out.mp4

Signed-off-by: Matt Van Horn <mvanhorn@users.noreply.github.com>

@chrisknvidia chrisknvidia left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewed this head with actual CLI-generated XML and independent source/output checks. One actionable catalog-report issue is inline. Focused JUnit/incomplete-scan tests pass; live CI report ingestion was not run.

GitLab merges JUnit reports by (classname, name), so a catalog run whose
per-skill reports all used e.g. "Schema & Repository Governance" /
"manifest_exists" lost every target after the first once collected.

Suite names and testcase classnames are now prefixed with the target's
repository-relative path, falling back to its path inside the catalog
folder and then to its own name, as in
"group-a/demo::Schema & Repository Governance". A catalog with
group-a/demo and group-b/demo now yields distinct identities.

Signed-off-by: Matt Van Horn <mvanhorn@users.noreply.github.com>

@chrisknvidia chrisknvidia left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for the PR, Matt. A JUnit format is a useful addition and the escaping is solid: I threw control characters, lone surrogates, U+FFFE/U+FFFF, CR/CRLF and markup at every field (suite, case and file names, messages, suggestions) and the output parsed with a strict XML parser and encoded cleanly as UTF-8 each time. The counts match the cases, quality-gate failures stay as failures, cleanly skipped checks are skipped, and the golden CLI file matches the real option surface.

I re-checked at the latest commit (the target-qualified names): the 16 reporter tests pass, and that change addresses the duplicate-identity point I had on skills with the same name. It does not change the two things below.

Two things I would like changed before merge.

First, incomplete scans should not be <skipped>. Skipped is neither a failure nor an error, so a result that is marked incomplete can come out as failures=0, errors=0 (details inline). The rest of the project treats incomplete as non-green, and the CLI exit code still does, but anything that reads the XML to decide will not see it. An <error type="incomplete"> counted in errors fixes that, and the passing checks in the same suite can then keep their normal status. The tests that pin the skipped behaviour will need to flip with it.

Second, the CI docs snippet. It sits in the walkthrough for the reusable skill-evaluation job, which does not produce a JUnit file, and its glob misses the per-skill folders that validate writes for a multi-skill run. Please move it next to a job that runs skillevaluator ... -r junit -o reports, or reword it.

A few smaller points are inline and not blocking: <error> for tool crashes, the report root for the standalone commands, and a test for the plugin render branches.

Comment thread src/skillevaluator/cli.py Resolved
Comment thread docs/gitlab-ci.mdx Resolved
Comment thread tests/reporting/test_junit_reporter.py Resolved

@rng1995 rng1995 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewed at 9818e303. 8 inline comments: 4 P2 and 4 P3. Folder-mode suites and classnames now carry the skill path (skills/alpha::QUALITY), as checked on a two-skill run, which settles the skill-identity concern I had at 34e99a8c.

What checks out:

  • XML is well-formed on every run I generated, including NUL, control characters and ]]> in messages.
  • On <testsuites> and every <testsuite>, the tests, failures and skipped counts equal the cases they contain.
  • Gate failures stay <failure> alongside warning-only findings.
  • --skip and advisory Tier 3 skips render as <skipped>.
  • In a git checkout, validate writes git-root-relative file attributes that match the SARIF URIs.
  • All 18 commands that accept -r produce a .junit.xml.
  • The extension and catalog-collision maps include junit.
  • The CI wrappers hard-code their own formats, so the wider -r choice breaks none of them.

The focused tests pass (test_junit_reporter.py, test_incomplete_scans.py, and the junit cases in test_reporters.py and test_cli.py). The 4 commits on main since this PR's base don't touch reporting.

The main gap: a few verdicts in the JUnit file disagree with the run's own verdict, either the exit code or the JSON passed flag. Blocking Bandit MEDIUM findings show as passing. A run that fails only because a scanner is incomplete shows zero failures. A blocking Tier 3 FAIL shows as passing. Basing each case on the existing gate helpers (run_status._blocking_finding, passes_required_gate) would close most of these.

As on #690, the "Contributing Guidelines" and "Did not add credentials, private datasets, or proprietary benchmark content" boxes are unchecked; please confirm both.

Comment thread docs/gitlab-ci.mdx Resolved
Comment thread tests/reporting/test_junit_reporter.py Resolved
Comment thread docs/reports.mdx Resolved
Comment thread docs/cli-reference.mdx Resolved
Keeps both Unreleased "Added" entries in CHANGELOG.md: the JUnit report
format from this branch and the Tier 3 execution backend entries from main.

Signed-off-by: Matt Van Horn <mvanhorn@users.noreply.github.com>
@mvanhorn

Copy link
Copy Markdown
Contributor Author

@rng1995 confirmed on both, and I ticked the two boxes in the description. I'm familiar with the Contributing Guidelines, and this diff adds no credentials, private datasets, or proprietary benchmark content. The SECRET findings in the tests are synthetic fixtures with no secret values.

mvanhorn and others added 14 commits November 16, 2026 14:35
Stripping XML-illegal characters also removed the lone surrogate Python
uses for an undecodable file-name byte, so caf\udce9.md was reported as
caf.md. Percent-encode the file attribute as SARIF does (caf%E9.md) and
backslash-escape surrogates in message text (caf\xe9.md) before
stripping. The non-UTF-8 file name test now asserts both in the junit
case.

Signed-off-by: Matt Van Horn <mvanhorn@users.noreply.github.com>
The JUnit reporter decided a finding's verdict from its severity and the
fail_on_medium/fail_on_low metadata only. A validator that marks a finding
blocking per call, such as Code Risk adding a Bandit MEDIUM finding with
is_error=True, put its line in result.errors and failed the result, yet
the finding was written as a passing testcase.

Decide per finding the way run_status does: the severity is an error or
the finding's legacy line (including folder-prefixed forms) is in
result.errors. run_status now exposes that check as finding_blocks.

Signed-off-by: Matt Van Horn <mvanhorn@users.noreply.github.com>
The JUnit artifact snippet sat under the reusable skill-evaluation job,
but that job runs tier1 with -r json,markdown,sarif and keeps only
skill-evaluator-report/, so reports/*.junit.xml never exists there.

Say plainly that the shared job does not produce JUnit yet, and move the
snippet into a run-it-yourself job with the full command. tier1 writes
reports/skillevaluator-tier1.junit.xml; validate on a folder writes
reports/<skill>/...junit.xml, so name the reports/*/*.junit.xml glob for
that layout.

Signed-off-by: Matt Van Horn <mvanhorn@users.noreply.github.com>
… scan

One incomplete scan used to mark every non-failing finding and every
passing check in that result as skipped, so a validator with three
passing checks and one crashed scanner reported 4 skipped and 0 passed.
The incomplete scan already has its own incomplete/<tool> case; the
other cases now keep their real passed or failed status.

Signed-off-by: Matt Van Horn <mvanhorn@users.noreply.github.com>
JUnit decided suite verdicts from result.passed, findings and errors,
never from passes_required_gate or the gating metadata validate stamps.
A scored Tier 3 result with verdict FAIL or NEUTRAL under
--block-on-agent-eval failed the gate and exited 1, yet JUnit showed
failures="0". A blocking Tier 3 that could not run got a bare
"failed" message and lost the reason.

When a blocking result fails the gate and none of its cases failed,
add a gate_failure case whose message is the cause: the first error,
the Tier 3 verdict, or the skip reason. Advisory results (Tier 3
without --block-on-agent-eval, Tier 2 with --no-block-on-dedup) no
longer emit failures; their findings and errors stay in system-out
with an "Advisory, does not gate:" prefix.

Signed-off-by: Matt Van Horn <mvanhorn@users.noreply.github.com>
The failure row named only failing findings and gate failures, but every
independent error on a group (schema errors, "No SKILL.md found", scanner
execution diagnostics) also becomes a failure case named error. The
skipped row now says only a group that did not run or an
incomplete/<tool> case is skipped; other cases in that group keep their
real status since 3c85a16.

Signed-off-by: Matt Van Horn <mvanhorn@users.noreply.github.com>
The installed skill still taught only cli, json, html, markdown and sarif
for -r, so an agent reading it would assume JUnit is unsupported. Add junit
to the Tier 1 report flag table, a JUnit note beside the SARIF CI gate, and
a row in the SKILL.md command table.

Signed-off-by: Matt Van Horn <mvanhorn@users.noreply.github.com>
…r reason

An incomplete scan fails the run, but the JUnit file reported each
incomplete/<tool> case as <skipped> with errors hard-coded to 0, so a
failed security-scan produced failures=0 errors=0, indistinguishable from
a deliberate --skip.

Each incomplete/<tool> case is now an <error type="incomplete"> counted
in errors on the suite and the document. Its message is the first warning
or error that names the tool (for example "skillspector not installed"),
else "<tool> scan did not complete". Advisory results keep those cases as
<skipped>, since they do not gate. Tests that pinned the skipped mapping
and errors == 0 now assert the error mapping.

Signed-off-by: Matt Van Horn <mvanhorn@users.noreply.github.com>
A group that was skipped but is still blocking (for example Tier 3 under
--block-on-agent-eval recorded as skipped) fails the run: result_status
returns failed and the exit code is non-zero. The JUnit reporter returned
early for any cleanly skipped group and wrote one <skipped> case, so the
file showed failures=0 for a failed run.

A skipped group is now a <skipped> case only when result_status reports it
as skipped. Otherwise it goes through the normal path and gets a
gate_failure case carrying the skip reason. Advisory skips are unchanged.

Signed-off-by: Matt Van Horn <mvanhorn@users.noreply.github.com>
Both the static and runtime plugin adapters return the JUnit document
unchanged. Cover that through augment_plugin_report and
render_plugin_report so a refactor cannot turn it into the
unsupported-format error.

Signed-off-by: Matt Van Horn <mvanhorn@users.noreply.github.com>
Finding case names were the check name plus an order-based suffix
(quality_correctness-2), so adding or reordering a finding renamed the
others and broke CI test history keyed on suite, class and name. Name
them check_name (path:line), or check_name (path) when no line was
recorded; the numeric suffix now only separates findings at the same
location.

Signed-off-by: Matt Van Horn <mvanhorn@users.noreply.github.com>
Independent errors were always <failure>, so a scanner crash or unusable
scanner output (for example "Bandit did not return valid JSON; scan did
not complete") read as "ran and found a problem" rather than "could not
run".

On a group that recorded an incomplete scan, each independent error that
is not a gate failure is now an <error type="execution"> case named
error, counted in errors on the suite and the document. Gate failures
such as a minimum score, blocking findings, and independent errors on
groups whose scans all completed stay <failure>. An advisory group keeps
execution errors in system-out with the "Advisory, does not gate:"
prefix, as it does for failures.

Signed-off-by: Matt Van Horn <mvanhorn@users.noreply.github.com>
… command

Single-check commands (tier1, tier2, quality-check, security-scan, and the
rest) passed the skill folder as the JUnit repository root and no roots at
all to SARIF, so one finding came out as file="SKILL.md" there and as a
repo-relative path from validate. A new _report_roots helper resolves the
Git root the way validate already did (falling back to the target folder)
and every emit_reports call passes it. emit_reports now takes one
scan_root/repository_root pair for both formats instead of the sarif_*
pair plus the plain pair.

Signed-off-by: Matt Van Horn <mvanhorn@users.noreply.github.com>

@chrisknvidia chrisknvidia left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Re-checked the latest commits: the points from my earlier review are addressed and the reporter tests pass for me. One small doc mismatch below.

Comment thread CHANGELOG.md Resolved

@chrisknvidia chrisknvidia left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Re-reviewed the shared report-root change. One current-head reporting regression is detailed inline.

Comment thread src/skillevaluator/cli.py Resolved
The entry still said incomplete checks come out as skipped. Since the later
commits an incomplete scanner is a JUnit error, failures follow the exit-code
gate, and only checks that did not run are skipped.

Signed-off-by: Christopher Kevin <christopherk@nvidia.com>
…are not doubled

From a repository root, tier1 skills/demo -r junit,sarif wrote
skills/demo/skills/demo/SKILL.md as the JUnit file and the SARIF uri. The
workflow handed the validators the relative path, so their finding paths were
relative to the working directory, and the report roots then prefixed the
skill folder a second time. The target is now resolved before the run, as
validate already does; the JSON target_path keeps the spelling the user typed.

A regression test runs tier1 with a relative path from a Git root and expects
skills/demo/SKILL.md once in both formats.

Signed-off-by: Christopher Kevin <christopherk@nvidia.com>
Keeps both new CHANGELOG entries and main's scanner setup inside
run_tier1_workflow alongside the resolved tier1 target.

Signed-off-by: Christopher Kevin <christopherk@nvidia.com>
@chrisknvidia
chrisknvidia merged commit de50c8a into NVIDIA:main Nov 17, 2026
25 of 26 checks passed
@mvanhorn

Copy link
Copy Markdown
Contributor Author

@chrisknvidia thanks for merging both of these. This one gives CI a JUnit XML report where checks that did not run show up as skipped instead of passing, and #690 adds the offline pre-commit hooks so skill repos can run the Tier 1 checks on every commit.

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.

3 participants