Repository navigation
fix(config): strictly decode eval and selected case YAML - #375
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2553117edf
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
3891ccd to
c5927ce
Compare
|
Could we use yaml.v3’s I understand that enabling strict mode alone is insufficient: Could those responsibilities move into the Loader—reading the metadata needed for filtering first, then strictly decoding selected cases and recording judge-field presence separately? That could avoid storing diagnostics in Could you explain the tradeoff between that approach and the custom top-level validation proposed here? |
|
I'd prefer the Loader approach. I kept this patch at the top level to preserve the existing load/filter/validate flow. The cost is maintaining YAML behavior ourselves. A local probe with the current structs and yaml.v3 confirmed that strict decoding into a defined type without The tradeoffs I'd make explicit are these.
I'd rework this PR along those lines, remove |
A misspelled top-level block, for example `judgez:` instead of `judges:`, was dropped while decoding, so validate accepted the file and the case ran with no judge and passed with zero checks. EvalConfig and CaseConfig decode through a custom UnmarshalYAML, whose node.Decode does not inherit a caller's Decoder.KnownFields(true), so a strict decoder alone would not catch this. Check the top-level keys against the struct's yaml tags in both UnmarshalYAML methods and report the line and key. YAML merge keys are still accepted. Nested keys are not checked by this change. Refs alibaba#365
Rejecting unknown top-level keys while decoding aborted `run` for a case
the include and exclude filters leave out, although run validates only
the selected cases. It also skipped keys brought in by `<<` merges, so
`<<: {judgez: []}` still slipped through.
Record unknown top-level keys, including those from merge mappings,
aliases and merge lists, while decoding, and report them from
ValidateEvalConfig and ValidateCaseConfig. `validate` reports every
case; `run` reports only the selected ones.
c5927ce to
970cbf0
Compare
Summary
A misspelled block such as
judgez:was silently dropped, allowing a case to run with zero checks and report PASS. The Loader now uses yaml.v3'sDecoder.KnownFields(true)to reject unknown fields, including nested struct fields, with the library's field name and line diagnostics.Refs #365. Changing how genuinely zero-check cases are reported remains outside this PR.
Changes
UnknownKeysdiagnostics. Config structs decode directly through the strict decoder.run --autowith YAML strictly decode only selected cases.map[string]yaml.Nodeto preserve explicit judge-field presence, including nulls, aliases and merges.validateandlist-casesstrict across every referenced case. Free-form maps such as engine kwargs and context files still accept arbitrary keys.judge.rule_based.must_containshape to usejudge.success.output_contains.any.Behavior changes
judgeandjudgeskeys now participate in null and mutual-exclusion validation.Test plan
Verified on
ca63bf4, rebased ontoca276f5:make verifypasses with zero findings using Go 1.26.10 and the pinned lint tools.go test -race ./...passes (22 packages).go test -tags e2e ./e2epasses with agent CLIs absent from PATH.Skill regression scripts and model-backed skill evals were not run. No full example-suite validation was performed in this revision.