Hmbown/CodeWhale · error · PersistenceBacklogError

baseline receipt does not match baseline provenance

Error message

baseline receipt {field} does not match baseline provenance

What it means

After checking observation fields, validate_baseline_receipt compares the baseline receipt's provenance fields (platform, source_sha, rustc_version, cargo_version, build_profile, sample_count) against baseline_observation.provenance. This error means the receipt's provenance differs from the provenance recorded in the budget file, i.e. the baseline was measured in a different environment or source state. The guard refuses to validate against an environment-mismatched baseline.

Solutions

  1. Recapture the baseline receipt and baseline_observation on the current platform/toolchain and update the budget file
  2. Install the rustc/cargo versions recorded in the baseline provenance
  3. Re-run on the same platform and source SHA the baseline was captured from

Example fix

// before: budget provenance from an old toolchain
"provenance": {"rustc_version": "1.70.0", "platform": "linux-x86_64"}
// after: recapture with current toolchain
"provenance": {"rustc_version": "1.79.0", "platform": "linux-x86_64"}
Defensive patterns

Strategy: validation

Validate before calling

prov_bad = [f for f in ('platform','source_sha','rustc_version','cargo_version','build_profile','sample_count') if receipt[f] != budget['baseline_observation']['provenance'][f]]
if prov_bad: print(f"provenance drift: {prov_bad}")

Try / catch

try:
    validate_baseline_receipt(budget, receipt)
except PersistenceBacklogError as e:
    print(f"environment changed since baseline: {e}", file=sys.stderr)
    sys.exit(1)

Prevention

When it happens

Trigger: Running the budget check when baseline_receipt[field] != baseline['provenance'][field] for any provenance field — e.g. a different rustc/cargo version, OS platform, git source_sha, build profile, or sample count than recorded in the budget's baseline_observation.provenance.

Common situations: Toolchain upgraded since the baseline was captured; running the script on a different OS/CI runner; the baseline was regenerated on a branch with a different SHA; sample_count changed because the baseline was recaptured with different sampling settings.

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/88b38a2020893edc. Report an issue: GitHub.

Appendix: source

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

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


def compare(
    receipt: dict[str, Any],
    budget: dict[str, Any],
    *,
    expected_source: dict[str, Any] | None = None,
    require_clean_source: bool = False,
) -> tuple[list[tuple[str, int, int]], list[tuple[str, int, int]]]:
    validate_receipt(
        receipt,
        expected_source=expected_source,
        require_clean_source=require_clean_source,
    )
    validate_budget(budget)
    increases: list[tuple[str, int, int]] = []

View on GitHub (pinned to 433685b202)