diff --git a/CHANGELOG.md b/CHANGELOG.md index 98415cbf..e537dac1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -106,6 +106,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Use prompt-file delivery for resumed Claude Code and Qoder turns when the prompt exceeds the inline limit or the target is Windows, preserving prompt delivery metadata and failing before execution if the file cannot be uploaded. +- Include gate and turn failure details in JUnit output when grading data is + absent. Omit skipped assertions from the list of failed assertions. - Read workspace file expectations and rule-based checks through the runtime when it exposes `Exists` and `ReadFile` accessors. Docker and OpenSandbox cases now grade the actual sandbox workspace instead of host paths, while diff --git a/internal/report/junit.go b/internal/report/junit.go index 964cb680..0e5693f1 100644 --- a/internal/report/junit.go +++ b/internal/report/junit.go @@ -198,9 +198,6 @@ func buildJudgeSkillProperties(cr CaseResult) *junitProperties { // Turn-scoped assertions already include turn numbers in their text field, // making CI failure output directly actionable. func buildFailureBody(cr CaseResult) string { - if cr.Grading == nil && len(cr.JudgeResults) == 0 { - return "" - } var lines []string if cr.Gates != nil { for _, failure := range cr.Gates.Failures { @@ -212,7 +209,7 @@ func buildFailureBody(cr CaseResult) string { } if cr.Grading != nil { for _, ar := range cr.Grading.AssertionResults { - if !ar.Passed { + if !ar.Passed && !ar.Skipped { lines = append(lines, fmt.Sprintf("- %s: %s", ar.Text, ar.Evidence)) } } diff --git a/internal/report/reporter_test.go b/internal/report/reporter_test.go index 4fe9f02d..d37b5543 100644 --- a/internal/report/reporter_test.go +++ b/internal/report/reporter_test.go @@ -275,6 +275,26 @@ func TestJUnitReporter_Write(t *testing.T) { } } +func TestJUnitFailureEvidence(t *testing.T) { + cr := CaseResult{CaseID: "example", Status: judge.StatusFail, Gates: &judge.ExpectResult{ + Failures: []judge.ExpectFailure{{Rule: "exit_code", Detail: "expected 0"}}, + }} + cr.TurnResults = []CaseTurnResult{{TurnNumber: 2, Status: "failed", Reason: "post-condition failed"}} + reporter := JUnitReporter{} + body := reporter.buildTestSuite(Input{CaseResults: []CaseResult{cr}}).Suites[0].TestCases[0].Failure.Body + if !strings.Contains(body, "expected 0") || !strings.Contains(body, "post-condition failed") { + t.Errorf("missing gate or turn failure in %q", body) + } + cr.Grading = judge.NewResult([]judge.AssertionResult{ + {Text: "independent failure", Evidence: "missing output"}, + {Text: "not evaluated", Skipped: true}, + }, 1, 1) + body = reporter.buildTestSuite(Input{CaseResults: []CaseResult{cr}}).Suites[0].TestCases[0].Failure.Body + if !strings.Contains(body, "independent failure") || strings.Contains(body, "not evaluated") { + t.Errorf("unexpected failed assertions in %q", body) + } +} + func TestJUnitReporter_FailureDetails(t *testing.T) { dir := t.TempDir() path := filepath.Join(dir, "result.xml")