Hmbown/CodeWhale · error · PersistenceBacklogError

baseline receipt {field} does not match baseline provenance

Error message

baseline receipt {field} does not match baseline provenance

What it means

Raised by validate_baseline_receipt when any of the seven provenance fields (platform, source_sha, source_dirty, rustc_version, cargo_version, build_profile, sample_count) differs between the baseline receipt and the budget's baseline_observation.provenance. Provenance pins the exact machine state, commit, and toolchain that produced the baseline, so both records must agree on those fields. The usual cause is one file being regenerated or edited without the other.

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 8880682c63)

Solutions

  1. Copy the provenance block from scripts/persistence-backlog-baseline-receipt.json into the budget's baseline_observation.provenance verbatim
  2. If the baseline was re-measured, update both files (values and provenance) in one atomic commit
  3. Verify source_sha is the exact 40-hex commit the receipt was measured at and source_dirty is false

Example fix

// before — budget provenance.rustc_version: "rustc 1.79.0"; receipt: "rustc 1.80.1"
// after — paste all seven receipt provenance fields into baseline_observation.provenance unchanged
"provenance": { "platform": "macos", "source_sha": "<same 40-hex>", "source_dirty": false, "rustc_version": "rustc 1.80.1", "cargo_version": "cargo 1.80.1", "build_profile": "test", "sample_count": 1 }
Defensive patterns

Strategy: validation

Validate before calling

keys = ('platform', 'source_sha', 'source_dirty', 'rustc_version', 'cargo_version', 'build_profile', 'sample_count')
assert all(receipt[k] == budget['baseline_observation']['provenance'][k] for k in keys)

Try / catch

try:
    validate_baseline_receipt(budget, receipt)
except PersistenceBacklogError as e:
    sync_provenance_from_receipt(); raise

Prevention

When it happens

Trigger: Re-measuring the baseline at a new commit (source_sha differs) or after a rustc upgrade (rustc_version differs) and updating only one of the two files; hand-editing provenance in the budget; committing the receipt and budget in separate changes so CI sees a half-updated pair.

Common situations: Toolchain upgrades between baseline regenerations; rebases or merges that touch one file; a teammate regenerating the receipt locally under a different platform or toolchain.

Related errors


AI-assisted analysis of Hmbown/CodeWhale@8880682c63 (2026-08-16). Data as JSON: /api/errors/88b38a2020893edc. Report an issue: GitHub.