{"record":{"id":"ad0eb33074f9158d","repo":"JuliusBrussee/caveman","slug":"where-replay-trial-proof-id-graded-graders","errorCode":null,"errorMessage":"${where} replay trial ${proof.id} graded ${graders.join(\",\")}, want exactly ${required.join(\",\")}","messagePattern":"(.+?) replay trial (.+?) graded (.+?), want exactly (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/shared/contracts/scripts/validate-continuous-improvement.mjs","lineNumber":328,"sourceCode":"    if (composed !== dataset.cases.length) throw new Error(`${where} dataset roles (${composed}) do not account for its ${dataset.cases.length} cases`);\n    if (dataset.replay_case_ids.length !== datasetCaseIDs.size) throw new Error(`${where} replay manifest carries ${dataset.replay_case_ids.length} ids for ${datasetCaseIDs.size} dataset cases`);\n    for (const datasetCaseID of dataset.replay_case_ids) {\n      if (!datasetCaseIDs.has(datasetCaseID)) throw new Error(`${where} replay manifest case ${datasetCaseID} is not a composed dataset case`);\n    }\n\n    // The guard grader exists exactly when there is a perturbed case to catch a\n    // candidate on; a required grader with no case behind it is decoration.\n    const perturbed = dataset.cases.some((entry) => entry.perturbation !== \"none\");\n    if (perturbed !== item.eval_pack.graders.includes(\"guard_respected\")) {\n      throw new Error(`${where} guard_respected grader ${perturbed ? \"missing for\" : \"declared without\"} perturbed dataset cases`);\n    }\n    for (const proof of item.replay.trial_proofs) {\n      if (!datasetCaseIDs.has(proof.dataset_case_id)) throw new Error(`${where} replay trial ${proof.id} replays a case outside the composed dataset`);\n      for (const arm of [proof.baseline, proof.candidate]) {\n        const graders = arm.grader_results.map((grader) => grader.grader).sort();\n        const required = [...item.eval_pack.graders].sort();\n        if (graders.join(\",\") !== required.join(\",\")) {\n          throw new Error(`${where} replay trial ${proof.id} graded ${graders.join(\",\")}, want exactly ${required.join(\",\")}`);\n        }\n      }\n    }\n  }\n}\nif (!Array.isArray(spans) || spans.length === 0) throw new Error(\"canonical span fixture is empty\");\nfor (const [index, span] of spans.entries()) {\n  if (!validateSpan(span)) throw new Error(`canonical span ${index}: ${ajv.errorsText(validateSpan.errors)}`);\n}\nif (relationshipCount === 0) throw new Error(\"no theme relationship reached the shared-analysis-unit threshold in any fixture\");\nif (motifCount === 0) throw new Error(\"no workflow motif recurred across two variants of one task family in any fixture\");\nconsole.log(`validated ${reports.length} generated improvement report(s), ${relationshipCount} theme relationship(s), ${motifCount} workflow motif(s) and ${spans.length} canonical spans`);\n","sourceCodeStart":310,"sourceCodeEnd":341,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/3ee70a102609e550bd2e68004bf5990a9341c851/packages/shared/contracts/scripts/validate-continuous-improvement.mjs#L310-L341","documentation":"Each arm (baseline and candidate) of every replay trial must have grader_results covering exactly the graders declared in item.eval_pack.graders — no missing graders, no extras. The validator compares the sorted grader-name lists and throws on any difference, ensuring replay evidence is complete and not padded with irrelevant graders.","triggerScenarios":"validate-continuous-improvement.mjs sorts arm.grader_results grader names and compares to sorted item.eval_pack.graders; any missing, extra, or duplicated grader entry triggers the throw.","commonSituations":"Adding a grader to the eval pack without re-running replays; a grader run failing silently so its result is absent; leaving an obsolete grader's results in old proof files after removing it from the pack.","solutions":["Re-run the replay trials so each arm records results for exactly the current eval_pack.graders.","Remove stale grader_results entries whose grader is no longer in the eval pack.","Add the missing grader run for arms that lack it (or drop the grader from eval_pack.graders if it is no longer wanted).","Check for duplicate grader entries in one arm's results."],"exampleFix":"// before: graders [\"exact_match\"] but eval pack requires [\"exact_match\",\"guard_respected\"]\n// after: re-run replay so the arm includes both grader results,\n// or align the pack:\nitem.eval_pack.graders = [\"exact_match\"];","handlingStrategy":"validation","validationCode":"const required = [...item.eval_pack.graders].sort().join(\",\");\nfor (const proof of item.replay.trial_proofs) {\n  for (const arm of [proof.baseline, proof.candidate]) {\n    const got = arm.grader_results.map((g) => g.grader).sort().join(\",\");\n    if (got !== required) throw new Error(`grader coverage mismatch: ${got} != ${required}`);\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Re-run replays after any change to eval_pack.graders.","Fail the replay run if any grader execution errors instead of omitting results.","Prune stale grader results when removing a grader from the pack."],"tags":["fixture-validation","graders","replay-trial"],"backgroundTag":"internal-invariant-violation","analyzedSha":"3ee70a102609e550bd2e68004bf5990a9341c851","analyzedAt":"2026-09-20T15:53:39.229Z","contentChangedAt":"2026-09-20T15:53:39.229Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}