Hmbown/CodeWhale · error · PersistenceBacklogError

budget baseline_receipt path changed

Error message

budget baseline_receipt path changed

What it means

Raised by validate_budget() when budget['baseline_receipt'] is not exactly 'scripts/persistence-backlog-baseline-receipt.json' (BASELINE_RECEIPT_REFERENCE). The budget must point at the repo-canonical baseline receipt that main() also loads and cross-checks field-by-field in validate_baseline_receipt(), so a moved, renamed, or repointed file breaks the provenance chain.

Source

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

    elif any(receipt[field] is not None for field in rss_fields):
        raise PersistenceBacklogError("unsupported RSS fields must be null")


def validate_budget(budget: dict[str, Any]) -> None:
    if budget.get("document_kind") != BUDGET_KIND:
        raise PersistenceBacklogError(f"budget document_kind must be {BUDGET_KIND}")
    if budget.get("schema_version") != SCHEMA_VERSION:
        raise PersistenceBacklogError("budget schema_version changed")
    fixture = budget.get("fixture")
    if not isinstance(fixture, dict) or set(fixture) != set(FIXTURE):
        raise PersistenceBacklogError("budget fixture no longer matches the frozen workload")
    for field, expected in FIXTURE.items():
        if type(fixture[field]) is not type(expected) or fixture[field] != expected:
            raise PersistenceBacklogError(
                f"budget fixture.{field} must remain {expected!r}"
            )
    if budget.get("baseline_receipt") != BASELINE_RECEIPT_REFERENCE:
        raise PersistenceBacklogError("budget baseline_receipt path changed")
    ceilings = budget.get("ceilings")
    baseline = budget.get("baseline_observation")
    if not isinstance(ceilings, dict) or not isinstance(baseline, dict):
        raise PersistenceBacklogError("budget needs ceilings and baseline_observation objects")
    for field in CEILING_FIELDS:
        ceiling = non_negative_integer(ceilings.get(field), f"ceilings.{field}")
        observed = non_negative_integer(
            baseline.get(field), f"baseline_observation.{field}"
        )
        if observed > ceiling:
            raise PersistenceBacklogError(
                f"baseline_observation.{field} exceeds its ceiling"
            )
    baseline_accepted = non_negative_integer(
        baseline.get("accepted_requests"), "baseline_observation.accepted_requests"
    )
    if baseline_accepted != FIXTURE["requests_attempted"]:
        raise PersistenceBacklogError(

View on GitHub (pinned to 8880682c63)

Solutions

  1. Set baseline_receipt to the exact relative path 'scripts/persistence-backlog-baseline-receipt.json'
  2. Keep the baseline receipt at that path; move neither file without updating BASELINE_RECEIPT_REFERENCE in the checker
  3. Use forward slashes - the comparison is byte-exact

Example fix

// before (budget.json)
"baseline_receipt": "/abs/path/persistence-backlog-baseline-receipt.json"

// after
"baseline_receipt": "scripts/persistence-backlog-baseline-receipt.json"
Defensive patterns

Strategy: validation

Validate before calling

BASELINE_RECEIPT_REFERENCE = "scripts/persistence-backlog-baseline-receipt.json"

def baseline_ref_ok(budget: dict) -> bool:
    return budget.get("baseline_receipt") == BASELINE_RECEIPT_REFERENCE

Prevention

When it happens

Trigger: A budget whose baseline_receipt is an absolute path, '../scripts/...', a differently named file, contains a backslash separator, or is missing.

Common situations: Duplicating the budget for an experiment and repointing the baseline; moving receipt files during a directory reorg; Windows path separators sneaking into the JSON.

Related errors


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