Hmbown/CodeWhale · error · PersistenceBacklogError

budget fixture no longer matches the frozen workload

Error message

budget fixture no longer matches the frozen workload

What it means

Raised by validate_budget() when budget['fixture'] is not a dict whose key set exactly equals the frozen FIXTURE keys: fixture_id, request_variant, payload_estimator, paused_consumer, requests_attempted, content_bytes_per_request, single_session_id, expected_applied_version. The fixture is the frozen measurement workload; adding, removing, or renaming keys means the budget no longer describes the contract the checker enforces.

Source

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

            0, receipt["rss_during_bytes"] - before
        ):
            raise PersistenceBacklogError("rss_during_delta_bytes is inconsistent")
        if receipt["rss_after_delta_bytes"] != max(
            0, receipt["rss_after_bytes"] - before
        ):
            raise PersistenceBacklogError("rss_after_delta_bytes is inconsistent")
    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(

View on GitHub (pinned to 8880682c63)

Solutions

  1. Restore the fixture object to exactly the eight frozen keys
  2. Run scripts/test_check_persistence_backlog_budget.py to confirm the shape matches the checker
  3. If the workload intentionally changed, update FIXTURE in check-persistence-backlog-budget.py and regenerate budget plus baseline receipt in the same commit

Example fix

// before (budget.json)
"fixture": {
  "fixture_id": "paused-production-channel-session-snapshot-v1",
  "_comment": "128 sends of 64KiB",
  "requests_attempted": 128
}

// after: exactly the eight frozen keys, no extras
"fixture": {
  "fixture_id": "paused-production-channel-session-snapshot-v1",
  "request_variant": "session_snapshot",
  "payload_estimator": "retained-saved-session-json-bytes-v1",
  "paused_consumer": true,
  "requests_attempted": 128,
  "content_bytes_per_request": 65536,
  "single_session_id": true,
  "expected_applied_version": 127
}
Defensive patterns

Strategy: validation

Validate before calling

FIXTURE_KEYS = {
    "fixture_id", "request_variant", "payload_estimator", "paused_consumer",
    "requests_attempted", "content_bytes_per_request", "single_session_id",
    "expected_applied_version",
}

def fixture_shape_ok(budget: dict) -> bool:
    fixture = budget.get("fixture")
    return isinstance(fixture, dict) and set(fixture) == FIXTURE_KEYS

Prevention

When it happens

Trigger: A fixture object carrying an extra key (e.g. a stray _comment), a missing key, or renamed keys like 'requests' instead of 'requests_attempted' - set(fixture) != set(FIXTURE).

Common situations: Someone 'documenting' the fixture by adding a comment key inside it; merging budgets across branches that changed the fixture shape; renaming a fixture field in the measure script without updating the budget.

Related errors


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