Hmbown/CodeWhale · error · PersistenceBacklogError

budget fixture.{field} must remain {expected!r}

Error message

budget fixture.{field} must remain {expected!r}

What it means

Raised by validate_budget() for the first fixture field whose value or Python type differs from the frozen FIXTURE constant - the check is type(fixture[field]) is not type(expected) or value inequality, so true vs 1, 128 vs 128.0, and '128' vs 128 all fail. The frozen values pin the workload exactly (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); changing any of them invalidates every ceiling.

Source

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

        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(
                f"baseline_observation.{field} exceeds its ceiling"
            )
    baseline_accepted = non_negative_integer(

View on GitHub (pinned to 8880682c63)

Solutions

  1. Restore the exact frozen value and JSON type named in the error message (e.g. content_bytes_per_request must be the integer 65536)
  2. If the workload genuinely changed, update FIXTURE in check-persistence-backlog-budget.py and re-baseline the budget in the same change
  3. Never edit fixture values to quiet a ceiling failure - re-measure instead

Example fix

// before (budget.json)
"fixture": { "content_bytes_per_request": 65535.0, "paused_consumer": 1 }

// after: exact frozen values and types
"fixture": { "content_bytes_per_request": 65536, "paused_consumer": true }
Defensive patterns

Strategy: validation

Validate before calling

def fixture_values_ok(budget: dict, frozen: dict) -> bool:
    fixture = budget.get("fixture")
    if not isinstance(fixture, dict):
        return False
    return all(
        type(fixture.get(k)) is type(v) and fixture.get(k) == v
        for k, v in frozen.items()
    )

Prevention

When it happens

Trigger: Any per-field drift in budget['fixture']: 65535 instead of 65536, 127.0 as a float, 'true' as a string, a new fixture_id after reworking the workload, or a JSON round-trip that coerced types.

Common situations: Hand-tuning fixture values to make a failing measurement pass; tools that re-serialize numbers as floats or booleans as integers; a workload change in measure-persistence-backlog.py not mirrored into the budget fixture.

Related errors


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