JuliusBrussee/caveman · error · Error
${where} dataset carries ${roleCounts.prior_success} prior-s
Error message
${where} dataset carries ${roleCounts.prior_success} prior-success cases, want ${expectedPriors} What it means
Thrown when the number of dataset cases with role "prior_success" does not equal min(2, dataset.prior_success_cases.length). Spec 18.2 caps prior-success replays at two and requires the role count in the composed dataset to recompute exactly from the manifest's own list.
Source
Thrown at packages/shared/contracts/scripts/validate-continuous-improvement.mjs:304
// 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
// candidate on; a required grader with no case behind it is decoration.
const perturbed = dataset.cases.some((entry) => entry.perturbation !== "none");
if (perturbed !== item.eval_pack.graders.includes("guard_respected")) {
throw new Error(`${where} guard_respected grader ${perturbed ? "missing for" : "declared without"} perturbed dataset cases`);
}
for (const proof of item.replay.trial_proofs) {View on GitHub (pinned to 27d5a3981a)
Solutions
- Synchronize: the number of dataset.cases entries with role exactly "prior_success" must equal min(2, dataset.prior_success_cases.length).
- Trim to at most 2 prior-success replays and keep the list in sync.
- Check role spellings on all entries while you are in there.
Example fix
// before prior_success_cases: [p1, p2] // expectedPriors = 2 dataset.cases roles: ["prior_success","prior_success","prior_success"] // after — drop the third dataset.cases roles: ["prior_success","prior_success"]
Defensive patterns
Strategy: validation
Validate before calling
const priorCount = dataset.cases.filter((c) => c.role === "prior_success").length; const ok = priorCount === Math.min(2, dataset.prior_success_cases.length);
Prevention
- Cap prior-success selection at 2 during composition and write the list from the selected cases.
- Spell roles exactly ("prior_success", underscore) and validate role strings as an enum in authoring code.
When it happens
Trigger: One prior-success case listed but two in dataset.cases (or vice versa); three prior-success cases replayed although the cap is 2; a role string typo such as "prior-success".
Common situations: Growing the prior-success pool beyond the cap without trimming the composed cases; editing one of the two parallel structures (cases vs prior_success_cases list) in isolation.
Related errors
- ${where} dataset carries ${roleCounts.target_failure} target
- ${where} dataset carries ${roleCounts.boundary} boundary cas
- ${where} dataset carries ${roleCounts.adversarial} adversari
- ${at} appears twice in the dataset
- ${at} names source unit ${entry.source_unit_id} that is not
AI-assisted analysis of JuliusBrussee/caveman@27d5a3981a (2026-08-15).
Data as JSON: /api/errors/cb218e9dea6b81dc.
Report an issue: GitHub.