JuliusBrussee/caveman · error · Error
generated case perturbs a unit the dataset already replays…
Error message
${where} generated case ${entry.id} perturbs a unit the dataset already replays unperturbed What it means
Leakage guard: if the dataset already replays a unit unperturbed (role target_failure or prior_success), a generated case must not perturb that same unit — doing so would let perturbed and unperturbed views of the same flow coexist and leak information across roles. The validator collects such recorded source ids in a first pass and rejects violations in a second pass.
Solutions
- Remove the generated case that targets an already-replayed unit.
- Point the generated case at a different source unit not replayed unperturbed.
- If the unperturbed replay is unnecessary, drop it so the perturbed case is allowed.
Example fix
// before
cases: [{id:"unit_1",perturbation:"none"},{id:"gen:unit_1",perturbation:"stale_input"}] // leak
// after
cases: [{id:"unit_1",perturbation:"none"},{id:"gen:unit_2",perturbation:"stale_input"}] Defensive patterns
Strategy: validation
Validate before calling
const replayed = new Set(dataset.cases.filter(c => c.perturbation === "none" && ["target_failure","prior_success"].includes(c.role)).map(c => c.source_unit_id));
for (const c of dataset.cases) {
if (c.perturbation !== "none" && replayed.has(c.source_unit_id)) throw new Error(`leak: ${c.id} perturbs a replayed unit`);
} Try / catch
try {
validateContinuousImprovement(report, dataset);
} catch (e) {
if (String(e.message).includes("already replays unperturbed")) {
// drop or retarget the leaking generated case
}
} Prevention
- Have generators exclude units already replayed unperturbed.
- Deduplicate source units across roles before composing perturbed cases.
When it happens
Trigger: A case with perturbation != "none" whose source_unit_id was added to recordedSources (i.e. some case with role target_failure or prior_success replays that unit with perturbation "none").
Common situations: Appending generated cases to a manifest without noticing a replay of the same unit already exists; generators reusing popular units; merging two datasets.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- names source unit that is not an analysis unit of this…
- names source unit that is not a member of task family
- replays a recorded flow but is not identified by its source…
- generator disagrees with perturbation
- is a generated case whose id does not name its generator…
AI-assisted analysis of JuliusBrussee/caveman@3ee70a1026 (2026-09-20).
Data as JSON: /api/errors/0b631d5011673519.
Report an issue: GitHub.
Appendix: source
Thrown at packages/shared/contracts/scripts/validate-continuous-improvement.mjs:279
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`);
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}`);
if (generatorPerturbation.get(entry.generator) !== entry.perturbation) {
throw new Error(`${at} generator ${entry.generator} disagrees with perturbation ${entry.perturbation}`);
}
if (entry.perturbation === "none" && entry.id !== entry.source_unit_id) {
throw new Error(`${at} replays a recorded flow but is not identified by its source unit`);
}
if (entry.perturbation !== "none" && entry.id !== `${entry.generator}:${entry.source_unit_id}`) {
throw new Error(`${at} is a generated case whose id does not name its generator and source unit`);
}
roleCounts[entry.role] += 1;
if (entry.role === "target_failure" || entry.role === "prior_success") recordedSources.add(entry.source_unit_id);
}
for (const entry of dataset.cases) {
// Leakage: a generated case must not perturb a unit the manifest already
// replays unperturbed.
if (entry.perturbation !== "none" && recordedSources.has(entry.source_unit_id)) {
throw new Error(`${where} generated case ${entry.id} perturbs a unit the dataset already replays unperturbed`);
}
}
// 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) {View on GitHub (pinned to 3ee70a1026)