JuliusBrussee/caveman · error · Error

hard chain carries an unproven edge ->

Error message

${where} hard chain carries an unproven edge ${edge.from}->${edge.to}

What it means

An edge listed in `slice.hard_edges` must be a proven dependency: strength 'hard', type 'data' or 'control', and at least one evidence_ref (the `provenDependency` predicate). Anything failing that predicate is labeled an unproven edge and must not sit in the hard chain.

Solutions

  1. Move the unproven edge to slice.unproven_adjacencies
  2. Add valid evidence_refs and set strength 'hard' if the dependency is genuinely proven
  3. Fix the edge's type to 'data' or 'control' if it is misclassified

Example fix

// before
hard_edges: [{from:'a',to:'b',type:'data',strength:'soft',evidence_refs:[]}]
// after
unproven_adjacencies: [{from:'a',to:'b',type:'data',strength:'soft',evidence_refs:[]}]
Defensive patterns

Strategy: validation

Validate before calling

const proven = (e) => e.strength === 'hard' && (e.type === 'data' || e.type === 'control') && e.evidence_refs.length > 0;
const bad = slice.hard_edges.filter(e => !proven(e));
if (bad.length) throw new Error(`unproven hard edges: ${bad.map(e => e.from + '->' + e.to)}`);

Type guard

const isProvenEdge = (e) => e.strength === 'hard' && (e.type === 'data' || e.type === 'control') && Array.isArray(e.evidence_refs) && e.evidence_refs.length > 0;

Try / catch

try { validateCase(item); } catch (e) { if (String(e.message).includes('unproven edge')) demoteToUnprovenAdjacencies(item); else throw e; }

Prevention

When it happens

Trigger: `slice.hard_edges` contains an edge whose strength is not 'hard', whose type is not 'data'/'control', or whose evidence_refs array is empty.

Common situations: Promoting a 'soft' adjacency into the hard chain by hand; evidence_refs stripped during dedup; an observation-typed edge misclassified as data/control.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


AI-assisted analysis of JuliusBrussee/caveman@3ee70a1026 (2026-09-20). Data as JSON: /api/errors/73c29a671b61cea4. Report an issue: GitHub.

Appendix: source

Thrown at packages/shared/contracts/scripts/validate-continuous-improvement.mjs:191

    if (!sliceVariant) throw new Error(`${where} causal slice references a workflow variant that is not in this report`);
    if (sliceVariant.id !== armVariants.get("baseline").id) throw new Error(`${where} causal slice is not taken from the baseline arm's variant`);
    const sliceNodes = new Set(sliceVariant.nodes.map((node) => node.id));
    if (slice.manifestation_node_id !== "" && !sliceNodes.has(slice.manifestation_node_id)) {
      throw new Error(`${where} manifestation node ${slice.manifestation_node_id} is not a node of variant ${sliceVariant.id}`);
    }
    if (item.diagnosis.manifestation.node_id !== slice.manifestation_node_id) {
      throw new Error(`${where} diagnosis manifestation node disagrees with its causal slice`);
    }
    for (const nodeID of slice.node_chain) {
      if (!sliceNodes.has(nodeID)) throw new Error(`${where} causal slice node ${nodeID} is not a node of variant ${sliceVariant.id}`);
    }
    if (slice.manifestation_node_id !== "" && !slice.node_chain.includes(slice.manifestation_node_id)) {
      throw new Error(`${where} causal slice omits its own manifestation node`);
    }
    const provenDependency = (edge) => edge.strength === "hard" && (edge.type === "data" || edge.type === "control") && edge.evidence_refs.length > 0;
    const variantEdges = new Map(sliceVariant.edges.map((edge) => [`${edge.from}${edge.to}${edge.type}`, edge]));
    for (const edge of slice.hard_edges) {
      if (!provenDependency(edge)) throw new Error(`${where} hard chain carries an unproven edge ${edge.from}->${edge.to}`);
      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}`);
      if (!slice.node_chain.includes(edge.from) || !slice.node_chain.includes(edge.to)) {
        throw new Error(`${where} hard chain edge ${edge.from}->${edge.to} is outside the slice's node chain`);
      }
      const source = variantEdges.get(`${edge.from}${edge.to}${edge.type}`);
      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}`);
    }
    for (const edge of slice.unproven_adjacencies) {
      // The whole point of the separate list: nothing in it may read as proven.
      if (provenDependency(edge)) throw new Error(`${where} unproven adjacency ${edge.from}->${edge.to} is in fact a proven hard dependency`);
      if (slice.hard_edges.some((hard) => hard.from === edge.from && hard.to === edge.to && hard.type === edge.type)) {
        throw new Error(`${where} adjacency ${edge.from}->${edge.to} appears in both the hard chain and the unproven list`);
      }
    }
    const upstream = new Set(item.diagnosis.root_cause_hypothesis.upstream_node_ids);
    for (const nodeID of upstream) {
      if (!slice.node_chain.includes(nodeID) || nodeID === slice.manifestation_node_id) {
        throw new Error(`${where} diagnosis upstream node ${nodeID} is not an upstream node of its causal slice`);

View on GitHub (pinned to 3ee70a1026)