Hmbown/CodeWhale · error · PersistenceBacklogError

baseline provenance needs

Error message

baseline provenance needs {field}

What it means

Baseline provenance must include rustc_version starting with "rustc " and cargo_version starting with "cargo ", attesting the toolchain used. Missing, non-string, or wrongly-prefixed values raise this templated error naming the offending field.

Solutions

  1. Include full `rustc --version` and `cargo --version` output strings in provenance (e.g. "rustc 1.78.0", "cargo 1.78.0").
  2. Regenerate the baseline with the measure script so it records both toolchain strings.
  3. Keep both fields present even if the toolchain is unchanged from a previous baseline.

Example fix

// before
"rustc_version": "1.78.0", "cargo_version": "1.78.0"
// after
"rustc_version": "rustc 1.78.0", "cargo_version": "cargo 1.78.0"
Defensive patterns

Strategy: validation

Validate before calling

p = budget.get("baseline_observation", {}).get("provenance", {})
for field, prefix in (("rustc_version", "rustc "), ("cargo_version", "cargo ")):
    if not str(p.get(field, "")).startswith(prefix):
        raise ValueError(f"provenance.{field} must start with {prefix!r}")

Type guard

def has_toolchain_strings(p: dict) -> bool:
    return str(p.get("rustc_version", "")).startswith("rustc ") and str(p.get("cargo_version", "")).startswith("cargo ")

Try / catch

try:
    compare(budget, baseline_receipt)
except PersistenceBacklogError as e:
    if "provenance needs" in str(e): fill in `rustc --version` / `cargo --version` output

Prevention

When it happens

Trigger: `compare` with provenance missing rustc_version/cargo_version, or values like "1.78.0" lacking the "rustc "/"cargo " prefix the measure script normally emits.

Common situations: Hand-assembled provenance blocks, trimmed baseline JSON, or values copied from `rustc -vV` without the binary-name prefix.

Understand the failure class

Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.

Related errors


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

Appendix: source

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

        )
    if baseline_payload < baseline_retained * FIXTURE["content_bytes_per_request"]:
        raise PersistenceBacklogError(
            "baseline_observation payload is smaller than frozen retained content"
        )
    provenance = baseline.get("provenance")
    if not isinstance(provenance, dict):
        raise PersistenceBacklogError("baseline_observation needs provenance")
    if provenance.get("platform") != "macos":
        raise PersistenceBacklogError("baseline provenance platform must be macos")
    if not isinstance(provenance.get("source_sha"), str) or not SOURCE_SHA_PATTERN.fullmatch(
        provenance["source_sha"]
    ):
        raise PersistenceBacklogError("baseline provenance needs an exact source SHA")
    if provenance.get("source_dirty") is not False:
        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"]

View on GitHub (pinned to 433685b202)