Skip to content

fix(config): reject report formats the runner would ignore - #410

Merged
zpzjzj merged 1 commit into
alibaba:mainfrom
Walternater:fix/report-format-validation
Nov 16, 2026
Merged

zpzjzj merged 1 commit into
alibaba:mainfrom
Walternater:fix/report-format-validation

Conversation

@Walternater

Copy link
Copy Markdown
Contributor

Summary

report.formats accepted any string. An unknown value passed validation and the runner then skipped it without a word, while still printing ✅ Reports saved to … — so a typo (formats: [htlm]) looked like a successful run that wrote a report, and wrote none. Validation now rejects values other than json, junit, html, and the runner returns an error if an unsupported format reaches it without going through validation.

Related issues

Same class as #365 / #409 (configuration validation accepting values the runtime cannot honour). No issue tracks this one; the check is independent.

Changes

  • internal/config/validator.go: new validateReportFormats, called from ValidateEvalConfig. Blank entries report report.formats[%d] must not be empty; unknown entries report report.formats[%d] must be one of json, junit, html (got %q).
  • internal/runner/runner.go: writeFormattedReports gains a default branch returning unsupported report format %q (supported: json, junit, html), so a library caller constructing formats in code cannot recreate the silent skip.
  • internal/config/validator_test.go: three table cases — supported values still accepted, [json, bogus] rejected with the exact message, [""] rejected.
  • internal/runner/runner_test.go: TestRunner_WriteResults_RejectsUnknownReportFormat runs WriteResults with []string{"bogus"} and asserts the error.
  • docs/guide/writing-evals.md, docs/zh/guide/writing-evals.md: the report block now says only json/junit/html are accepted and why.
  • CHANGELOG.md: entry under Unreleased/Fixed.

Test plan

On a fixture with report.formats: [bogus] (engine claude_code, environment.type: none):

  • before: validate printed ✓ eval.yaml is valid; run finished 1 passed and printed ✅ Reports saved, but only result.json/benchmark.json/benchmark.md existed — no report.json.
  • after: validate → Error: validation failed: validation errors:\n - report.formats[0] must be one of json, junit, html (got "bogus"); run fails with the same validation error before starting the agent.
  • formats: [json, html] still produces both report.json and report.html.
  • Negative controls: deleting the validateReportFormats call turns the two new validator subtests red; deleting the runner default turns the runner test red (WriteResults() accepted an unsupported report format).
  • make test green; make verify → 0 issues.

Notes

Adjacent finding, not changed here: report.artifacts is documented (internal/config/schema.go:294, examples use artifacts: [transcript]) but has no runtime consumer — transcripts are always captured. That one needs a decision (wire it up, validate it, or remove it) rather than a silent fix, so it stays out of this PR.

Disclosure

Investigated and implemented with DeepSeek Harness (deepseek-v4.1-flash). The fixture, before/after CLI output and negative controls above were run locally on macOS.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-14T18:38:25.546371Z 9184c74 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@zpzjzj zpzjzj 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.

LGTM

@zpzjzj
zpzjzj added this pull request to the merge queue Nov 16, 2026
Merged via the queue into alibaba:main with commit c1e0ade Nov 16, 2026
16 checks passed
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