{"record":{"id":"01835491d8dcae4f","repo":"JuliusBrussee/caveman","slug":"at-is-a-generated-case-whose-id-does-not-name-i","errorCode":null,"errorMessage":"${at} is a generated case whose id does not name its generator and source unit","messagePattern":"(.+?) is a generated case whose id does not name its generator and source unit","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/shared/contracts/scripts/validate-continuous-improvement.mjs","lineNumber":270,"sourceCode":"      [\"adversarial_stale_input.v1\", \"stale_input\"],\n    ]);\n    const roleCounts = { target_failure: 0, prior_success: 0, boundary: 0, adversarial: 0 };\n    const recordedSources = new Set();\n    const datasetCaseIDs = new Set();\n    for (const entry of dataset.cases) {\n      const at = `${where} dataset case ${entry.id}`;\n      if (datasetCaseIDs.has(entry.id)) throw new Error(`${at} appears twice in the dataset`);\n      datasetCaseIDs.add(entry.id);\n      if (!unitsByID.has(entry.source_unit_id)) throw new Error(`${at} names source unit ${entry.source_unit_id} that is not an analysis unit of this report`);\n      if (!familyUnits.has(entry.source_unit_id)) throw new Error(`${at} names source unit ${entry.source_unit_id} that is not a member of task family ${family.id}`);\n      if (generatorPerturbation.get(entry.generator) !== entry.perturbation) {\n        throw new Error(`${at} generator ${entry.generator} disagrees with perturbation ${entry.perturbation}`);\n      }\n      if (entry.perturbation === \"none\" && entry.id !== entry.source_unit_id) {\n        throw new Error(`${at} replays a recorded flow but is not identified by its source unit`);\n      }\n      if (entry.perturbation !== \"none\" && entry.id !== `${entry.generator}:${entry.source_unit_id}`) {\n        throw new Error(`${at} is a generated case whose id does not name its generator and source unit`);\n      }\n      roleCounts[entry.role] += 1;\n      if (entry.role === \"target_failure\" || entry.role === \"prior_success\") recordedSources.add(entry.source_unit_id);\n    }\n    for (const entry of dataset.cases) {\n      // Leakage: a generated case must not perturb a unit the manifest already\n      // replays unperturbed.\n      if (entry.perturbation !== \"none\" && recordedSources.has(entry.source_unit_id)) {\n        throw new Error(`${where} generated case ${entry.id} perturbs a unit the dataset already replays unperturbed`);\n      }\n    }\n\n    // Manifest composition arithmetic (spec 18.2): target-failure + prior-success\n    // + one boundary + up to two adversarial, each capped and each recomputable.\n    //\n    // The boundary and stale-input generators perturb the localization evidence\n    // a confidence guard reads. A ChangeSet whose applicability never reads that\n    // evidence has no threshold to sit beside, so those two cases must NOT be","sourceCodeStart":252,"sourceCodeEnd":288,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/3ee70a102609e550bd2e68004bf5990a9341c851/packages/shared/contracts/scripts/validate-continuous-improvement.mjs#L252-L288","documentation":"Generated (perturbed) cases must be identified as \"<generator>:<source_unit_id>\" so the id records both how and from what the case was derived. This throw fires when a case with perturbation other than \"none\" has an id that is not exactly that composite string.","triggerScenarios":"A case's perturbation is not \"none\" but its id is a bare source unit id, an arbitrary label, or uses a different separator/casing than `${entry.generator}:${entry.source_unit_id}`.","commonSituations":"Hand-editing perturbation from \"none\" to a generated value without updating the id; renaming generators so old composite ids no longer match; writing ids manually instead of via the generator tooling.","solutions":["Rewrite entry.id as `${entry.generator}:${entry.source_unit_id}`.","If the id was correct under an old generator name, update entry.generator to the current name so the composite matches.","Regenerate the case with the tooling rather than editing fields separately."],"exampleFix":"// before\n{ \"id\": \"case-42\", \"generator\": \"stale-input-gen\", \"source_unit_id\": \"unit_abc\", \"perturbation\": \"stale_input\" }\n// after\n{ \"id\": \"stale-input-gen:unit_abc\", \"generator\": \"stale-input-gen\", \"source_unit_id\": \"unit_abc\", \"perturbation\": \"stale_input\" }","handlingStrategy":"validation","validationCode":"for (const c of dataset.cases) {\n  if (c.perturbation !== \"none\" && c.id !== `${c.generator}:${c.source_unit_id}`) {\n    throw new Error(`generated case ${c.id} must be named generator:source_unit_id`);\n  }\n}","typeGuard":null,"tryCatchPattern":"try {\n  validateContinuousImprovement(report, dataset);\n} catch (e) {\n  if (String(e.message).includes(\"does not name its generator and source unit\")) {\n    // rewrite id as `${generator}:${source_unit_id}`\n  }\n}","preventionTips":["Always generate ids via tooling, never by hand.","If a generator is renamed, regenerate affected case ids in the same change."],"tags":["manifest-validation","id-naming-convention","consistency-check"],"backgroundTag":"invalid-identifier-format","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"}