Problem
Per-result items are mapped blindly (r.caseName, r.passed, r.flags ?? []); missing passed or string flags slip through to the DB insert and become 500s or miscounts.
Where
app/api/runs/route.ts (results mapping; only the empty-array case is rejected).
Acceptance
Add a failing test first (extend test/runs-route.test.mjs) POSTing {caseName: "x"} without passed and asserting 400 with a structured per-item error. Then fix.
Problem
Per-result items are mapped blindly (
r.caseName,r.passed,r.flags ?? []); missingpassedor stringflagsslip through to the DB insert and become 500s or miscounts.Where
app/api/runs/route.ts(results mapping; only the empty-array case is rejected).Acceptance
Add a failing test first (extend
test/runs-route.test.mjs) POSTing{caseName: "x"}withoutpassedand asserting 400 with a structured per-item error. Then fix.