{"record":{"id":"6cb90ba3ac1aada2","repo":"JuliusBrussee/caveman","slug":"at-generator-entry-generator-disagrees-with","errorCode":null,"errorMessage":"${at} generator ${entry.generator} disagrees with perturbation ${entry.perturbation}","messagePattern":"(.+?) generator (.+?) disagrees with perturbation (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/shared/contracts/scripts/validate-continuous-improvement.mjs","lineNumber":264,"sourceCode":"    // invented evidence wearing an adversarial label.\n    const dataset = item.eval_pack.dataset;\n    const generatorPerturbation = new Map([\n      [\"recorded_case.v1\", \"none\"],\n      [\"boundary_guard_threshold.v1\", \"guard_threshold_boundary\"],\n      [\"adversarial_misleading_tool_output.v1\", \"misleading_tool_output\"],\n      [\"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","sourceCodeStart":246,"sourceCodeEnd":282,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/3ee70a102609e550bd2e68004bf5990a9341c851/packages/shared/contracts/scripts/validate-continuous-improvement.mjs#L246-L282","documentation":"The generatorPerturbation map records, per generator, which perturbation it is supposed to produce. This throw fires when a dataset case's entry.perturbation differs from the perturbation its entry.generator is registered to apply — a generator/perturbation mismatch that would mislabel how the case was derived.","triggerScenarios":"A manifest entry sets perturbation to e.g. \"stale_input\" while referencing a generator whose registered perturbation is \"guard_threshold_boundary\" (or \"none\"); usually from hand-editing one field without the other.","commonSituations":"Manual manifest editing; a script changed the perturbation field but reused an old generator string; generator naming changed between tool versions.","solutions":["Set entry.perturbation to the value registered for entry.generator in generatorPerturbation.","Or switch entry.generator to the generator registered for the desired perturbation.","Regenerate the case programmatically instead of editing fields independently.","Check generator naming against the current version's generator registry."],"exampleFix":"// before\n{ \"generator\": \"stale-input-generator\", \"perturbation\": \"guard_threshold_boundary\" }\n// after\n{ \"generator\": \"stale-input-generator\", \"perturbation\": \"stale_input\" }","handlingStrategy":"validation","validationCode":"const generatorPerturbation = new Map(Object.entries(GENERATORS));\nfor (const c of dataset.cases) {\n  if (generatorPerturbation.get(c.generator) !== c.perturbation) throw new Error(`case ${c.id}: generator/perturbation mismatch`);\n}","typeGuard":null,"tryCatchPattern":"try {\n  validateContinuousImprovement(report, dataset);\n} catch (e) {\n  if (String(e.message).includes(\"disagrees with perturbation\")) {\n    // align generator and perturbation fields from the generator registry\n  }\n}","preventionTips":["Derive both generator and perturbation from a single registry entry.","Never edit one field without the other in manifests."],"tags":["manifest-validation","generator-mismatch","consistency-check"],"backgroundTag":"invalid-argument-value","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"}