{"record":{"id":"0daab5805573fac0","repo":"JuliusBrussee/caveman","slug":"where-confidenceguard-omits-generated","errorCode":null,"errorMessage":"${where} ${confidenceGuard ? \"omits\" : \"generated\"} a ${label} case ${confidenceGuard ? \"for\" : \"against\"} a change set that ${confidenceGuard ? \"declares\" : \"declares no\"} confidence guard","messagePattern":"(.+?) (.+?) a (.+?) case (.+?) a change set that (.+?) confidence guard","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/shared/contracts/scripts/validate-continuous-improvement.mjs","lineNumber":298,"sourceCode":"      }\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\n    // generated for it — a \"boundary\" case against a guard that does not exist\n    // tests nothing while counting as adversarial coverage.\n    const confidenceGuard = item.change_set.applicability.all.some((condition) =>\n      condition === \"failure_location_confidence >= 0.90\" ||\n      condition === \"symbol_resolution == unique\" ||\n      condition === \"targeted_test_reproduces == true\");\n    const perturbations = new Set(dataset.cases.map((entry) => entry.perturbation));\n    for (const [perturbation, label] of [[\"guard_threshold_boundary\", \"boundary\"], [\"stale_input\", \"stale-input\"]]) {\n      if (perturbations.has(perturbation) !== confidenceGuard) {\n        throw new Error(`${where} ${confidenceGuard ? \"omits\" : \"generated\"} a ${label} case ${confidenceGuard ? \"for\" : \"against\"} a change set that ${confidenceGuard ? \"declares\" : \"declares no\"} confidence guard`);\n      }\n    }\n    const expectedTargets = Math.min(4, dataset.target_failure_cases.length);\n    const expectedPriors = Math.min(2, dataset.prior_success_cases.length);\n    if (roleCounts.target_failure !== expectedTargets) throw new Error(`${where} dataset carries ${roleCounts.target_failure} target-failure cases, want ${expectedTargets}`);\n    if (roleCounts.prior_success !== expectedPriors) throw new Error(`${where} dataset carries ${roleCounts.prior_success} prior-success cases, want ${expectedPriors}`);\n    if (roleCounts.boundary > 1) throw new Error(`${where} dataset carries ${roleCounts.boundary} boundary cases, want at most one`);\n    if (roleCounts.adversarial > (confidenceGuard ? 2 : 1)) throw new Error(`${where} dataset carries ${roleCounts.adversarial} adversarial cases`);\n    if (roleCounts.boundary !== dataset.boundary_cases.length) throw new Error(`${where} boundary case list disagrees with the composed dataset`);\n    if (roleCounts.adversarial !== dataset.generated_cases.length) throw new Error(`${where} generated case list disagrees with the composed dataset`);\n    const composed = roleCounts.target_failure + roleCounts.prior_success + roleCounts.boundary + roleCounts.adversarial;\n    if (composed !== dataset.cases.length) throw new Error(`${where} dataset roles (${composed}) do not account for its ${dataset.cases.length} cases`);\n    if (dataset.replay_case_ids.length !== datasetCaseIDs.size) throw new Error(`${where} replay manifest carries ${dataset.replay_case_ids.length} ids for ${datasetCaseIDs.size} dataset cases`);\n    for (const datasetCaseID of dataset.replay_case_ids) {\n      if (!datasetCaseIDs.has(datasetCaseID)) throw new Error(`${where} replay manifest case ${datasetCaseID} is not a composed dataset case`);\n    }\n\n    // The guard grader exists exactly when there is a perturbed case to catch a","sourceCodeStart":280,"sourceCodeEnd":316,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/3ee70a102609e550bd2e68004bf5990a9341c851/packages/shared/contracts/scripts/validate-continuous-improvement.mjs#L280-L316","documentation":"Boundary and stale-input cases must correlate with the change set's declared confidence guard. If confidenceGuard is true, the dataset must include cases for both perturbations; if false, it must include neither. The message's wording flips based on which side of the mismatch occurred (omitted vs generated).","triggerScenarios":"The change set declares a confidence guard but the dataset lacks (or wrongly includes) a guard_threshold_boundary or stale_input case — checked via perturbations set membership versus the confidenceGuard boolean.","commonSituations":"Toggling the confidence guard flag on the change set without regenerating the dataset; dataset produced from a different change set; hand-removing boundary cases to satisfy an earlier error.","solutions":["Regenerate the dataset from the current change set so perturbation presence matches the confidenceGuard flag.","If confidenceGuard is true, add the missing guard_threshold_boundary and stale_input cases.","If confidenceGuard is false, delete the boundary/stale-input cases from the dataset.","Correct the change set's confidence-guard declaration if it is wrong."],"exampleFix":"// before (change set declares confidence guard, dataset has no boundary case)\ncases: [...no guard_threshold_boundary...]\n// after\ncases: [..., {id:\"boundary-gen:unit_9\",perturbation:\"guard_threshold_boundary\",...}]","handlingStrategy":"validation","validationCode":"const guard = changeSet.confidence_guard === true;\nconst perts = new Set(dataset.cases.map(c => c.perturbation));\nfor (const p of [\"guard_threshold_boundary\", \"stale_input\"]) {\n  if (perts.has(p) !== guard) throw new Error(`perturbation ${p} presence disagrees with confidence guard`);\n}","typeGuard":null,"tryCatchPattern":"try {\n  validateContinuousImprovement(report, dataset);\n} catch (e) {\n  if (String(e.message).includes(\"confidence guard\")) {\n    // regenerate dataset from the current change set\n  }\n}","preventionTips":["Regenerate the dataset whenever the change set's confidence-guard flag changes.","Generate dataset and change set in the same pipeline run."],"tags":["manifest-validation","confidence-guard","composition-rule"],"backgroundTag":"invalid-config-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"}