Skip to content

Commit 262d15f

Browse files
d-burgclaude
andcommitted
Regression - BUGFIX - Report a crashed golden-check run as a crash, not a tolerance failure
A case that crashed before producing results was counted in n_fail and exited as 'outside their golden tolerance'. The crash now travels in its own n_run_failed field and gets a crash-specific exit message. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent c925428 commit 262d15f

2 files changed

Lines changed: 14 additions & 6 deletions

File tree

regression-harness/regress.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,7 @@ function main(args=ARGS)
268268
n_failed = 0
269269
n_changed = 0
270270
n_golden_fail = 0
271+
n_golden_crashed = 0
271272
n_untracked = 0
272273
n_checked = 0
273274
n_no_golden = 0
@@ -293,6 +294,7 @@ function main(args=ARGS)
293294
elseif opts.check
294295
summary = report_golden_check(db, case_spec, resolved_refs[1].commit_hash)
295296
n_golden_fail += summary.n_fail
297+
n_golden_crashed += summary.n_run_failed
296298
n_untracked += summary.n_untracked
297299
has_golden(case_spec.name) ? (n_checked += 1) : (n_no_golden += 1)
298300
else
@@ -311,6 +313,10 @@ function main(args=ARGS)
311313
@error "$n_failed run(s) failed — see the reports above"
312314
exit(1)
313315
end
316+
if n_golden_crashed > 0
317+
@error "$n_golden_crashed case(s) crashed before producing results — see the reports above (a crash, not a tolerance failure)"
318+
exit(1)
319+
end
314320
if n_golden_fail > 0
315321
@error "$n_golden_fail quantity/quantities are outside their golden tolerance"
316322
exit(1)

regression-harness/src/golden.jl

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -311,9 +311,11 @@ end
311311
"""
312312
Compare a case's fresh run against its golden file and print the report.
313313
314-
Returns `(n_pass, n_fail, n_untracked, n_informational)`. Only gating classes can fail;
315-
`diagnostic` and `unconverged` quantities are shown with their deviation and marked as
316-
informational, so a reader sees them move without the run failing on them.
314+
Returns `(n_pass, n_fail, n_untracked, n_informational, n_run_failed)`. Only gating classes
315+
can fail; `diagnostic` and `unconverged` quantities are shown with their deviation and marked
316+
as informational, so a reader sees them move without the run failing on them. A run that
317+
crashed outright is counted in `n_run_failed`, never in `n_fail`, so the caller can exit with
318+
a crash message instead of a tolerance message.
317319
"""
318320
function report_golden_check(db::SQLite.DB, case_spec::CaseSpec, commit_hash::String)
319321
golden = load_golden(case_spec.name)
@@ -322,15 +324,15 @@ function report_golden_check(db::SQLite.DB, case_spec::CaseSpec, commit_hash::St
322324
if golden === nothing
323325
println(" No golden file at $(golden_path(case_spec.name)) — nothing to check against.")
324326
println(" Generate one with: regress --update-golden --cases $(case_spec.name) --reason \"...\"")
325-
return (n_pass=0, n_fail=0, n_untracked=0, n_informational=0)
327+
return (n_pass=0, n_fail=0, n_untracked=0, n_informational=0, n_run_failed=0)
326328
end
327329

328330
quantities = get_quantities(db, commit_hash, case_spec.name)
329331
info = get_run_info(db, commit_hash, case_spec.name)
330332
if info !== nothing && !info.success
331333
println(" RUN FAILED — nothing to compare (this is a crash, not a tolerance failure):")
332334
println(" $(_short_err(info.error_msg))")
333-
return (n_pass=0, n_fail=1, n_untracked=0, n_informational=0)
335+
return (n_pass=0, n_fail=0, n_untracked=0, n_informational=0, n_run_failed=1)
334336
end
335337

336338
rows = Vector{Vector{String}}()
@@ -419,7 +421,7 @@ function report_golden_check(db::SQLite.DB, case_spec::CaseSpec, commit_hash::St
419421
n_untracked > 0 && push!(parts, "$n_untracked untracked")
420422
println("Summary: ", join(parts, ", "))
421423
println()
422-
return (n_pass=n_pass, n_fail=n_fail, n_untracked=n_untracked, n_informational=n_informational)
424+
return (n_pass=n_pass, n_fail=n_fail, n_untracked=n_untracked, n_informational=n_informational, n_run_failed=0)
423425
end
424426

425427
"""

0 commit comments

Comments
 (0)