JuliusBrussee/caveman · error · Error

a case a change set that confidence guard

Error message

${where} ${confidenceGuard ? "omits" : "generated"} a ${label} case ${confidenceGuard ? "for" : "against"} a change set that ${confidenceGuard ? "declares" : "declares no"} confidence guard

What it means

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).

Solutions

  1. Regenerate the dataset from the current change set so perturbation presence matches the confidenceGuard flag.
  2. If confidenceGuard is true, add the missing guard_threshold_boundary and stale_input cases.
  3. If confidenceGuard is false, delete the boundary/stale-input cases from the dataset.
  4. Correct the change set's confidence-guard declaration if it is wrong.

Example fix

// before (change set declares confidence guard, dataset has no boundary case)
cases: [...no guard_threshold_boundary...]
// after
cases: [..., {id:"boundary-gen:unit_9",perturbation:"guard_threshold_boundary",...}]
Defensive patterns

Strategy: validation

Validate before calling

const guard = changeSet.confidence_guard === true;
const perts = new Set(dataset.cases.map(c => c.perturbation));
for (const p of ["guard_threshold_boundary", "stale_input"]) {
  if (perts.has(p) !== guard) throw new Error(`perturbation ${p} presence disagrees with confidence guard`);
}

Try / catch

try {
  validateContinuousImprovement(report, dataset);
} catch (e) {
  if (String(e.message).includes("confidence guard")) {
    // regenerate dataset from the current change set
  }
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


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

Appendix: source

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

      }
    }

    // Manifest composition arithmetic (spec 18.2): target-failure + prior-success
    // + one boundary + up to two adversarial, each capped and each recomputable.
    //
    // The boundary and stale-input generators perturb the localization evidence
    // a confidence guard reads. A ChangeSet whose applicability never reads that
    // evidence has no threshold to sit beside, so those two cases must NOT be
    // generated for it — a "boundary" case against a guard that does not exist
    // tests nothing while counting as adversarial coverage.
    const confidenceGuard = item.change_set.applicability.all.some((condition) =>
      condition === "failure_location_confidence >= 0.90" ||
      condition === "symbol_resolution == unique" ||
      condition === "targeted_test_reproduces == true");
    const perturbations = new Set(dataset.cases.map((entry) => entry.perturbation));
    for (const [perturbation, label] of [["guard_threshold_boundary", "boundary"], ["stale_input", "stale-input"]]) {
      if (perturbations.has(perturbation) !== confidenceGuard) {
        throw new Error(`${where} ${confidenceGuard ? "omits" : "generated"} a ${label} case ${confidenceGuard ? "for" : "against"} a change set that ${confidenceGuard ? "declares" : "declares no"} confidence guard`);
      }
    }
    const expectedTargets = Math.min(4, dataset.target_failure_cases.length);
    const expectedPriors = Math.min(2, dataset.prior_success_cases.length);
    if (roleCounts.target_failure !== expectedTargets) throw new Error(`${where} dataset carries ${roleCounts.target_failure} target-failure cases, want ${expectedTargets}`);
    if (roleCounts.prior_success !== expectedPriors) throw new Error(`${where} dataset carries ${roleCounts.prior_success} prior-success cases, want ${expectedPriors}`);
    if (roleCounts.boundary > 1) throw new Error(`${where} dataset carries ${roleCounts.boundary} boundary cases, want at most one`);
    if (roleCounts.adversarial > (confidenceGuard ? 2 : 1)) throw new Error(`${where} dataset carries ${roleCounts.adversarial} adversarial cases`);
    if (roleCounts.boundary !== dataset.boundary_cases.length) throw new Error(`${where} boundary case list disagrees with the composed dataset`);
    if (roleCounts.adversarial !== dataset.generated_cases.length) throw new Error(`${where} generated case list disagrees with the composed dataset`);
    const composed = roleCounts.target_failure + roleCounts.prior_success + roleCounts.boundary + roleCounts.adversarial;
    if (composed !== dataset.cases.length) throw new Error(`${where} dataset roles (${composed}) do not account for its ${dataset.cases.length} cases`);
    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`);
    for (const datasetCaseID of dataset.replay_case_ids) {
      if (!datasetCaseIDs.has(datasetCaseID)) throw new Error(`${where} replay manifest case ${datasetCaseID} is not a composed dataset case`);
    }

    // The guard grader exists exactly when there is a perturbed case to catch a

View on GitHub (pinned to 3ee70a1026)