Exercise 09: Build history from two runs
What this exercise teaches
- History requires at least two runs with an explicit, stable baseline
run.id—--baseline-run-idonly works if you set it yourself. historyandcheck --baseline-run-idread the same.evals_outputdirectory but answer different questions: one records trend, the other gates on it.- A regression is not automatic — you must intentionally flip a row’s
passed/severity/reasonto see what a real new-failure gate failure looks like.
Question this answers
Given two runs in the same folder, how do I produce a persisted history file and a gate result that tells me whether the second run introduced a new failure versus the first?
Goal
- Create at least two run files.
- Generate report and history outputs.
How to read the check output
| Field | Meaning |
|---|---|
New failures 1 exceed allowed 0 (key=row, raw=1). |
A row that passed in the baseline run now fails; the count, not the row id, drives the gate. key=row is what the gate counted by, raw is the pre-dedup count |
Top failing categories |
Groups the new/current failures by category so you see the shape, not just a count |
Lint warning breakdown |
Taxonomy completeness warnings from the same run, shown for context, not blocking the gate |
exit=1 |
The process exit code the gate itself returns; anything non-zero fails CI |
Prerequisite
- Complete setup in
docs/teach-curriculum.mdsection “Exercise rules”. - Finish Exercise 08; this exercise renames that artifact into run-001/run-002.
Why this matters
- You cannot reason about regression from one run only.
Steps
- Rename the initial file to run-001 and create run-002 with a small change.
Why rename: this keeps a clean two-run history set for this exercise.
mv .evals_output/run-minimal.json .evals_output/run-001.json
python3 - <<'PY'
import json
from pathlib import Path
src = Path('.evals_output/run-001.json')
dst = Path('.evals_output/run-002.json')
# Make baseline id explicit so --baseline-run-id is deterministic
base = json.loads(src.read_text())
base['run']['id'] = 'local-minimal-001'
base['run']['generatedAt'] = '2026-09-13T00:00:00.000Z'
src.write_text(json.dumps(base, indent=2) + '\n')
doc = json.loads(src.read_text())
doc['run']['id'] = 'local-minimal-002'
doc['run']['generatedAt'] = '2026-09-13T00:10:00.000Z'
if doc['rows']:
doc['rows'][0]['passed'] = False
doc['rows'][0]['severity'] = 'high'
doc['rows'][0]['category'] = 'regression'
doc['rows'][0]['reason'] = 'Intentional regression example for history demo'
# Recompute suite totals after edits so counts match rows
from collections import defaultdict
stats = defaultdict(lambda: {'total': 0, 'passed': 0, 'failed': 0})
for r in doc.get('rows', []):
if isinstance(r, dict) and r.get('suite'):
stats[r['suite']]['total'] += 1
if r.get('passed') is True:
stats[r['suite']]['passed'] += 1
else:
stats[r['suite']]['failed'] += 1
for suite in doc.get('suites', []):
sid = suite.get('id')
if sid in stats:
suite['total'] = int(stats[sid]['total'])
suite['passed'] = int(stats[sid]['passed'])
suite['failed'] = int(stats[sid]['failed'])
dst.write_text(json.dumps(doc, indent=2) + '\n')
PY
- Generate outputs.
npx eval-dashboards report --input=.evals_output --reporter=html --reporter=json-summary --report-dir=eval-dashboard
npx eval-dashboards history --input=.evals_output --out=eval-dashboard/history.json
npx eval-dashboards check --input=.evals_output --baseline-run-id=local-minimal-001 --max-new-failures=0 --zero-critical
Example result (verified against a real run)
history.jsoncontains 2 run entries.- Baseline-aware check reports:
Eval gates failed:
New failures 1 exceed allowed 0 (key=row, raw=1).
Critical failures 1 exceed allowed 0.
Diagnostics:
Top failing categories: regression=2
Lint warning breakdown: missing-suite-manifest=3, missing-agent-versioning=1, low-category-coverage=1
- Exit code
1in this demo, becauserun-002.json’s only changed row (case-001) flips from pass to fail relative to baselinelocal-minimal-001. - Two gates trip here, not one.
New failuresis the gate this exercise is teaching.Critical failures 1iscase-002, the deliberately-critical row you added in Exercise 08 — it is still in the artifact and still red. That is the carry-forward Exercise 08’s last “common mistake” warned about, and this is where you feel it. regression=2for the same reason:case-001(new, this exercise) pluscase-002(inherited from Exercise 08). The baseline gate counts only the new one; the category diagnostic counts both.
Definition of done
run-001.jsonandrun-002.jsonboth exist.eval-dashboard/history.jsonhas multiple entries.- Baseline-aware new-failure check runs with an explicit baseline id.
- In this intentional-regression demo, this check can fail with exit code
1(expected).
Common mistakes
- Omitting
--baseline-run-idand expectingcheckto guess which run is the baseline — without it, there is no “new failure” comparison at all. - Forgetting to recompute suite
total/passed/failedafter flipping a row’spassedfield, so the suite summary silently disagrees with the rows underneath it. - Reading a nonzero exit code from
checkhere as a bug — it is the expected outcome of the intentional regression this exercise creates.