Hmbown/CodeWhale · error · PersistenceBacklogError

baseline receipt does not match baseline_observation

Error message

baseline receipt {field} does not match baseline_observation

What it means

validate_baseline_receipt cross-checks a freshly generated baseline receipt against the baseline_observation stored in the persistence backlog budget file. This error means one of the compared fields (accepted_requests, applied_version, or a ceiling field) differs between the receipt and the stored observation, so the budget file's baseline can no longer be trusted. The script aborts rather than validating budgets against a stale or tampered baseline.

Solutions

  1. Regenerate the baseline receipt and update baseline_observation in the budget file so both come from the same measurement run
  2. Restore the budget file from version control if it was hand-edited
  3. Verify you are running the check from the same source SHA / build profile the baseline was captured with

Example fix

// before (mismatched, hand-edited budget)
"baseline_observation": {"accepted_requests": 42, "applied_version": 7}
// after (regenerate so receipt and observation agree)
"baseline_observation": {"accepted_requests": 57, "applied_version": 8}
Defensive patterns

Strategy: validation

Validate before calling

mismatches = [f for f in ('accepted_requests','applied_version',*CEILING_FIELDS) if receipt[f] != budget['baseline_observation'][f]]
if mismatches: raise SystemExit(f"baseline drift in: {mismatches}")

Try / catch

try:
    validate_baseline_receipt(budget, receipt)
except PersistenceBacklogError as e:
    print(f"baseline out of sync: {e}; regenerate baseline", file=sys.stderr)
    sys.exit(1)

Prevention

When it happens

Trigger: Running scripts/check-persistence-backlog-budget.py when the baseline receipt's accepted_requests, applied_version, or any CEILING_FIELDS value does not equal the corresponding value in budget['baseline_observation']. Typically the budget JSON was edited, regenerated, or produced from a different source state than the receipt being checked.

Common situations: A developer hand-edited the budget file's baseline_observation; the baseline was regenerated after code changes but the checked-in budget file was not updated; measuring against a different git SHA or build profile than the one the baseline was captured from.

Understand the failure class

Background: Checksum mismatch errors: "checksum verification failed", "digest mismatch", "expected vs actual checksum" — what they mean and how to fix them — this error's family across 41 libraries.

Related errors


AI-assisted analysis of Hmbown/CodeWhale@433685b202 (2026-09-15). Data as JSON: /api/errors/51275028f33e4118. Report an issue: GitHub.

Appendix: source

Thrown at scripts/check-persistence-backlog-budget.py:326

        raise PersistenceBacklogError("baseline provenance must identify a clean source tree")
    for field, prefix in (("rustc_version", "rustc "), ("cargo_version", "cargo ")):
        if not isinstance(provenance.get(field), str) or not provenance[field].startswith(prefix):
            raise PersistenceBacklogError(f"baseline provenance needs {field}")
    if provenance.get("build_profile") != "test" or not (
        type(provenance.get("sample_count")) is int
        and provenance["sample_count"] == 1
    ):
        raise PersistenceBacklogError("baseline provenance build profile/sample count changed")


def validate_baseline_receipt(
    budget: dict[str, Any], baseline_receipt: dict[str, Any]
) -> None:
    validate_receipt(baseline_receipt, require_clean_source=True)
    baseline = budget["baseline_observation"]
    for field in ("accepted_requests", "applied_version", *CEILING_FIELDS):
        if baseline_receipt[field] != baseline[field]:
            raise PersistenceBacklogError(
                f"baseline receipt {field} does not match baseline_observation"
            )
    provenance = baseline["provenance"]
    for field in (
        "platform",
        "source_sha",
        "source_dirty",
        "rustc_version",
        "cargo_version",
        "build_profile",
        "sample_count",
    ):
        if baseline_receipt[field] != provenance[field]:
            raise PersistenceBacklogError(
                f"baseline receipt {field} does not match baseline provenance"
            )

View on GitHub (pinned to 433685b202)