Hmbown/CodeWhale · error · PersistenceBacklogError

baseline provenance needs {field}

Error message

baseline provenance needs {field}

What it means

Raised by validate_budget() for rustc_version or cargo_version when provenance[field] is not a string starting with 'rustc ' or 'cargo ' respectively ({field} interpolates the offending field name). The full command output (e.g. 'rustc 1.97.0 (2d8144b78 2026-07-07)') is stored so the baseline toolchain is fully identifiable; a bare '1.97.0', a non-string, or swapped fields fails the prefix check.

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

Solutions

  1. Store the exact stdout of rustc --version and cargo --version
  2. Regenerate the baseline receipt so toolchain fields are captured verbatim
  3. Keep the 'rustc ' / 'cargo ' prefixes - the checker matches on them

Example fix

// before (budget.json)
"provenance": { "rustc_version": "1.97.0", "cargo_version": "1.97.0" }

// after: verbatim tool output
"provenance": {
  "rustc_version": "rustc 1.97.0 (2d8144b78 2026-07-07)",
  "cargo_version": "cargo 1.97.0 (c980f4866 2026-06-30)" }
Defensive patterns

Strategy: type-guard

Type guard

from typing import TypeGuard

def has_toolchain_versions(provenance: object) -> TypeGuard[dict]:
    if not isinstance(provenance, dict):
        return False
    rustc = provenance.get("rustc_version")
    cargo = provenance.get("cargo_version")
    return (isinstance(rustc, str) and rustc.startswith("rustc ")
            and isinstance(cargo, str) and cargo.startswith("cargo "))

Prevention

When it happens

Trigger: provenance.rustc_version = '1.97.0' (no 'rustc ' prefix), the two fields swapped, null/number values, or custom wrapper output without the expected prefix.

Common situations: Hand-writing provenance and trimming the version output; fields swapped during templating; toolchain wrappers printing custom version strings.

Related errors


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