Hmbown/CodeWhale · error · PersistenceBacklogError

baseline provenance must identify a clean source tree

Error message

baseline provenance must identify a clean source tree

What it means

Raised by validate_budget() when provenance.source_dirty is not exactly boolean false - the check is `provenance.get('source_dirty') is not False`, so 0, 'false', null, or a missing key all fail. Baselines must come from a clean git tree: a dirty tree means the measured binary may not correspond to the recorded source_sha, voiding the ceiling provenance.

Source

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

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


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(

View on GitHub (pinned to 8880682c63)

Solutions

  1. Commit or stash everything (including untracked files), confirm git status --porcelain is empty, then re-measure
  2. Set source_dirty to literal JSON false only when the tree truly was clean
  3. Let the measurement scripts record source_dirty automatically instead of hand-writing it

Example fix

// before (budget.json)
"provenance": { "source_dirty": 0 }

// after
"provenance": { "source_dirty": false }
Defensive patterns

Strategy: validation

Validate before calling

def provenance_clean_ok(budget: dict) -> bool:
    provenance = budget.get("baseline_observation", {}).get("provenance", {})
    return provenance.get("source_dirty") is False

Prevention

When it happens

Trigger: Rebaselining with uncommitted changes present (git status --porcelain non-empty), or hand-writing source_dirty as 0/'false'/null instead of literal JSON false.

Common situations: Measuring with work-in-progress edits in the tree; untracked build artifacts counting as dirty; JSON hand-edits substituting a truthy-looking stand-in for false.

Related errors


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