Hmbown/CodeWhale · error · PersistenceBacklogError

baseline_observation needs provenance

Error message

baseline_observation needs provenance

What it means

Raised by validate_budget() when baseline_observation.provenance is missing or not a JSON object. Provenance pins the platform, source SHA, dirty flag, toolchain versions, build profile, and sample count of the machine that produced the baseline; without it the baseline numbers are unreproducible and the RSS ceilings unanchored.

Source

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

            "baseline_observation.applied_version must be the final sent version"
        )
    baseline_retained = baseline["retained_queued_requests"]
    baseline_payload = baseline["estimated_retained_payload_bytes"]
    if baseline_retained == 0 or baseline_payload == 0:
        raise PersistenceBacklogError(
            "baseline_observation must retain the final request and payload"
        )
    if baseline_retained > baseline_accepted:
        raise PersistenceBacklogError(
            "baseline_observation.retained_queued_requests exceeds accepted_requests"
        )
    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")

View on GitHub (pinned to 8880682c63)

Solutions

  1. Restore the provenance object with the seven keys: platform, source_sha, source_dirty, rustc_version, cargo_version, build_profile, sample_count
  2. Copy provenance verbatim from scripts/persistence-backlog-baseline-receipt.json that produced the numbers
  3. Regenerate the baseline so provenance is captured automatically

Example fix

// before (budget.json)
"baseline_observation": { ..., "provenance": null }

// after
"baseline_observation": { ..., "provenance": {
  "platform": "macos", "source_sha": "2d4a9cb58c5c22ac361ab221bda1243a0e4349fb",
  "source_dirty": false, "rustc_version": "rustc 1.97.0 (2d8144b78 2026-07-07)",
  "cargo_version": "cargo 1.97.0 (c980f4866 2026-06-30)",
  "build_profile": "test", "sample_count": 1 } }
Defensive patterns

Strategy: type-guard

Type guard

from typing import TypeGuard

def has_provenance(baseline: object) -> TypeGuard[dict]:
    return isinstance(baseline, dict) and isinstance(baseline.get("provenance"), dict)

Prevention

When it happens

Trigger: baseline_observation lacking the provenance key, or provenance set to null, an array, or a string.

Common situations: Hand-writing a baseline_observation block from memory; stripping provenance during JSON cleanup; a merge losing nested blocks.

Related errors


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