Hmbown/CodeWhale · error · PersistenceBacklogError

budget baseline_receipt path changed

Error message

budget baseline_receipt path changed

What it means

validate_budget requires budget.baseline_receipt to equal the exact relative path "scripts/persistence-backlog-baseline-receipt.json" (BASELINE_RECEIPT_REFERENCE). The budget must always cite the committed baseline receipt at its canonical location so the checker can load and cross-validate it. Any move, rename, or rewrite of the reference path is rejected.

Solutions

  1. Set "baseline_receipt": "scripts/persistence-backlog-baseline-receipt.json" in the budget
  2. Keep the baseline receipt at its canonical path and reference it relatively
  3. Restore the budget file from version control if the reference was lost

Example fix

// before
"baseline_receipt": "/home/me/repo/scripts/persistence-backlog-baseline-receipt.json"
// after
"baseline_receipt": "scripts/persistence-backlog-baseline-receipt.json"
Defensive patterns

Strategy: validation

Validate before calling

assert budget.get("baseline_receipt") == "scripts/persistence-backlog-baseline-receipt.json", "baseline_receipt must reference the canonical relative path"

Type guard

def references_canonical_baseline(doc):
    return isinstance(doc, dict) and doc.get("baseline_receipt") == "scripts/persistence-backlog-baseline-receipt.json"

Try / catch

try:
    validate_budget(budget)
except PersistenceBacklogError as e:
    if "baseline_receipt path changed" in str(e):
        budget["baseline_receipt"] = "scripts/persistence-backlog-baseline-receipt.json"
    raise

Prevention

When it happens

Trigger: compare calls validate_budget on a budget whose baseline_receipt field is missing, null, an absolute path, or a relocated relative path (e.g. after moving the file to another directory).

Common situations: Restructuring the scripts/ directory and updating the reference; replacing the field with the absolute path of a local checkout; deleting the field during a budget edit.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


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

Appendix: 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 433685b202)