{"record":{"id":"ca2aa695b6a706c5","repo":"JuliusBrussee/caveman","slug":"where-is-diagnosis-only-but-carries-a-change-se","errorCode":null,"errorMessage":"${where} is diagnosis-only but carries a change set, eval pack or replay","messagePattern":"(.+?) is diagnosis-only but carries a change set, eval pack or replay","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/shared/contracts/scripts/validate-continuous-improvement.mjs","lineNumber":217,"sourceCode":"    for (const edge of slice.unproven_adjacencies) {\n      // The whole point of the separate list: nothing in it may read as proven.\n      if (provenDependency(edge)) throw new Error(`${where} unproven adjacency ${edge.from}->${edge.to} is in fact a proven hard dependency`);\n      if (slice.hard_edges.some((hard) => hard.from === edge.from && hard.to === edge.to && hard.type === edge.type)) {\n        throw new Error(`${where} adjacency ${edge.from}->${edge.to} appears in both the hard chain and the unproven list`);\n      }\n    }\n    const upstream = new Set(item.diagnosis.root_cause_hypothesis.upstream_node_ids);\n    for (const nodeID of upstream) {\n      if (!slice.node_chain.includes(nodeID) || nodeID === slice.manifestation_node_id) {\n        throw new Error(`${where} diagnosis upstream node ${nodeID} is not an upstream node of its causal slice`);\n      }\n    }\n\n    // A case that proposes nothing must carry nothing: no operator, no eval\n    // pack, no replay. Anything else would present an abstention as a proposal.\n    if (item.status === \"diagnosis_only\") {\n      if (item.change_set.operator_id !== \"\" || item.eval_pack.id !== \"\" || item.replay.status !== \"not_run\") {\n        throw new Error(`${where} is diagnosis-only but carries a change set, eval pack or replay`);\n      }\n      continue;\n    }\n    if (item.change_set.case_id !== item.id || item.eval_pack.case_id !== item.id) {\n      throw new Error(`${where} change set or eval pack is bound to another case`);\n    }\n\n    // The case must investigate the pair its own opportunity named. A cohort\n    // built from a differently-derived pair would describe one comparison and\n    // measure another.\n    const source = report.opportunities.find((opportunity) => opportunity.id === item.opportunity_id);\n    if (!source) throw new Error(`${where} names an opportunity that is not in this report`);\n    if (armVariants.get(\"baseline\").id !== source.current_variant_id || armVariants.get(\"alternative\").id !== source.alternative_variant_id) {\n      throw new Error(`${where} cohort arms (${armVariants.get(\"baseline\").id}/${armVariants.get(\"alternative\").id}) are not the variants opportunity ${source.id} named`);\n    }\n\n    // Every required grader is one the recorded interpreter actually computes.\n    // `json_schema` is deliberately absent: over a typed interpreter result it","sourceCodeStart":199,"sourceCodeEnd":235,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/3ee70a102609e550bd2e68004bf5990a9341c851/packages/shared/contracts/scripts/validate-continuous-improvement.mjs#L199-L235","documentation":"A case with status \"diagnosis_only\" is an abstention: it records a diagnosis but proposes no action. Such a case must carry no change_set.operator_id, no eval_pack id, and its replay status must remain \"not_run\" — otherwise the abstention would effectively be a hidden proposal. The validator throws when any of these fields is populated.","triggerScenarios":"Running the validator on a report containing a case whose status is \"diagnosis_only\" while change_set.operator_id is non-empty, eval_pack.id is non-empty, or replay.status is anything other than \"not_run\".","commonSituations":"Changing a case's status to diagnosis_only without clearing the previously attached operator/eval pack; template copies that pre-fill operator IDs; tooling that always emits a replay record.","solutions":["Set change_set.operator_id to \"\" and eval_pack.id to \"\" and replay.status to \"not_run\" on the diagnosis_only case.","If the case really does propose a change, change its status away from \"diagnosis_only\" instead of stripping the proposal.","Add a form/tool check that zeroes out proposal fields whenever status is set to diagnosis_only."],"exampleFix":"// before\n{ \"status\": \"diagnosis_only\", \"change_set\": { \"operator_id\": \"op-42\" }, \"replay\": { \"status\": \"passed\" } }\n// after\n{ \"status\": \"diagnosis_only\", \"change_set\": { \"operator_id\": \"\" }, \"replay\": { \"status\": \"not_run\" } }","handlingStrategy":"validation","validationCode":"if (item.status === 'diagnosis_only') {\n  if (item.change_set.operator_id !== '' || item.eval_pack.id !== '' || item.replay.status !== 'not_run') {\n    throw new Error('diagnosis_only case must carry no proposal');\n  }\n}","typeGuard":null,"tryCatchPattern":"try { validateReport(report); } catch (err) { if (String(err.message).includes('diagnosis-only but carries')) { /* strip operator/eval/replay or change status */ } else throw err; }","preventionTips":["Centralize status changes in a helper that clears proposal fields when moving to diagnosis_only.","Never pre-fill operator_id in case templates.","Assert emptiness in the case-authoring UI before save."],"tags":["validation","status-mismatch","contract"],"backgroundTag":"invalid-state-transition","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"}