JuliusBrussee/caveman · error · Error

${where} diagnosis manifestation node disagrees with its cau

Error message

${where} diagnosis manifestation node disagrees with its causal slice

What it means

diagnosis.manifestation.node_id and causal_slice.manifestation_node_id must be the same string — including the empty-string sentinel (validate-continuous-improvement.mjs:179-181). The diagnosis's manifestation claim and the slice's manifestation node are two views of one fact; they live in different sections of the case object, so drift is easy.

Source

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

      if (!unitsByID.has(trace.analysis_unit_id)) throw new Error(`${where} representative trace ${trace.analysis_unit_id} is not an analysis unit of this report`);
      if (!familyUnits.has(trace.analysis_unit_id)) throw new Error(`${where} representative trace ${trace.analysis_unit_id} is not a member of the cohort's task family`);
      if (!variant.analysis_unit_ids.includes(trace.analysis_unit_id)) throw new Error(`${where} representative trace ${trace.analysis_unit_id} did not run that arm's workflow variant`);
      selectedPerArm.set(trace.arm, (selectedPerArm.get(trace.arm) ?? 0) + 1);
    }
    for (const [arm, count] of selectedPerArm) {
      if (count > 3) throw new Error(`${where} arm ${arm} carries ${count} representative traces, more than three`);
    }

    const slice = item.causal_slice;
    const sliceVariant = variantsByID.get(slice.variant_id);
    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}`);
    }

View on GitHub (pinned to 766dce6b13)

Solutions

  1. Make both fields identical — pick one node id (or "" on both sides) and write it in both places.
  2. In a generator, derive both fields from a single variable so they cannot diverge.
  3. Re-run the validator.

Example fix

// before — slice.manifestation_node_id: "node/exec"
"diagnosis": { "manifestation": { "node_id": "node/parse", ... } }
// after
"diagnosis": { "manifestation": { "node_id": "node/exec", ... } }
Defensive patterns

Strategy: validation

Validate before calling

const manifestationDisagreement = (report) =>
  report.cases.filter((c) => c.diagnosis.manifestation.node_id !== c.causal_slice.manifestation_node_id)
    .map((c) => c.id);

Try / catch

try {
  execFileSync(process.execPath, [VALIDATOR, reportPath, spansPath]);
} catch (err) {
  if (/manifestation node disagrees/.test(err.message)) {
    failCI(`diagnosis and slice name different manifestation nodes: ${err.message}`);
  } else throw err;
}

Prevention

When it happens

Trigger: The slice's manifestation node was updated without touching the diagnosis block (or vice versa); a case was merged from two drafts; one side uses the "" sentinel while the other names a node.

Common situations: Hand-editing one half of a case; generators that render the diagnosis text and the slice from separate templates; reviewers fixing a node id in only one place.

Related errors


AI-assisted analysis of JuliusBrussee/caveman@766dce6b13 (2026-08-18). Data as JSON: /api/errors/2a5bad772fdd8c3a. Report an issue: GitHub.