{"record":{"id":"c1a83a919bc777eb","repo":"JuliusBrussee/caveman","slug":"where-unproven-adjacency-edge-from-edge-t","errorCode":null,"errorMessage":"${where} unproven adjacency ${edge.from}->${edge.to} is in fact a proven hard dependency","messagePattern":"(.+?) unproven adjacency (.+?)->(.+?) is in fact a proven hard dependency","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/shared/contracts/scripts/validate-continuous-improvement.mjs","lineNumber":201,"sourceCode":"      if (!sliceNodes.has(nodeID)) throw new Error(`${where} causal slice node ${nodeID} is not a node of variant ${sliceVariant.id}`);\n    }\n    if (slice.manifestation_node_id !== \"\" && !slice.node_chain.includes(slice.manifestation_node_id)) {\n      throw new Error(`${where} causal slice omits its own manifestation node`);\n    }\n    const provenDependency = (edge) => edge.strength === \"hard\" && (edge.type === \"data\" || edge.type === \"control\") && edge.evidence_refs.length > 0;\n    const variantEdges = new Map(sliceVariant.edges.map((edge) => [`${edge.from}\u0000${edge.to}\u0000${edge.type}`, edge]));\n    for (const edge of slice.hard_edges) {\n      if (!provenDependency(edge)) throw new Error(`${where} hard chain carries an unproven edge ${edge.from}->${edge.to}`);\n      if (!sliceNodes.has(edge.from) || !sliceNodes.has(edge.to)) throw new Error(`${where} hard chain edge ${edge.from}->${edge.to} names a node outside variant ${sliceVariant.id}`);\n      if (!slice.node_chain.includes(edge.from) || !slice.node_chain.includes(edge.to)) {\n        throw new Error(`${where} hard chain edge ${edge.from}->${edge.to} is outside the slice's node chain`);\n      }\n      const source = variantEdges.get(`${edge.from}\u0000${edge.to}\u0000${edge.type}`);\n      if (!source || source.strength !== \"hard\") throw new Error(`${where} hard chain edge ${edge.from}->${edge.to} is not a hard edge of variant ${sliceVariant.id}`);\n    }\n    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;","sourceCodeStart":183,"sourceCodeEnd":219,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/3ee70a102609e550bd2e68004bf5990a9341c851/packages/shared/contracts/scripts/validate-continuous-improvement.mjs#L183-L219","documentation":"Entries in slice.unproven_adjacencies are supposed to capture dependencies that are suspected but NOT proven. If `provenDependency(edge)` returns true, the edge is actually an established hard dependency, so listing it as unproven contradicts the provenance data. The validator throws to force the author to either prove the edge (move it to the hard chain) or correct the provenance.","triggerScenarios":"Running the validator on a report where an unproven_adjacencies entry matches an edge that provenDependency() recognizes as proven — e.g. the same from/to pair is already a hard edge in the variant, or the edge is backed by recorded evidence.","commonSituations":"Copy-pasting an edge from the hard chain into the unproven list 'just in case'; provenance data was upgraded to prove an edge but the adjacency list was not pruned; bulk-imported slices from an older report format.","solutions":["Remove the edge from unproven_adjacencies and, if you want to assert it, add it to the hard chain.","If the dependency is genuinely unproven, fix the provenance/evidence so provenDependency no longer classifies it as proven.","Deduplicate the slice: check unproven_adjacencies against hard_edges before submitting the report."],"exampleFix":"// before\n\"unproven_adjacencies\": [{ \"from\": \"ingest\", \"to\": \"parse\", \"type\": \"causes\" }] // also a proven hard edge\n// after\n\"unproven_adjacencies\": []","handlingStrategy":"validation","validationCode":"const proven = new Set(variant.edges.filter(e => e.strength === 'hard').map(e => `${e.from}->${e.to}`));\nfor (const e of slice.unproven_adjacencies) {\n  if (proven.has(`${e.from}->${e.to}`)) throw new Error(`${e.from}->${e.to} is proven; remove from unproven list`);\n}","typeGuard":null,"tryCatchPattern":"try { validateReport(report); } catch (err) { if (String(err.message).includes('in fact a proven hard dependency')) { /* move edge to hard chain or fix provenance */ } else throw err; }","preventionTips":["Derive unproven_adjacencies by subtracting proven edges from all observed adjacencies.","Re-run the subtraction whenever provenance data is updated.","Review the unproven list in code review before publishing a report."],"tags":["validation","causal-slice","contradiction"],"backgroundTag":"schema-validation-failed","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"}