Hmbown/CodeWhale · error · PersistenceBacklogError

baseline_observation payload is smaller than frozen retained

Error message

baseline_observation payload is smaller than frozen retained content

What it means

Raised by validate_budget() when baseline_observation.estimated_retained_payload_bytes is smaller than retained_queued_requests x 65536 (FIXTURE content_bytes_per_request). Every retained 64 KiB request must contribute at least its content bytes to the estimated retained payload; a smaller number means the estimator under-counts retained content or its semantics drifted from the frozen payload_estimator.

Source

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

    baseline_applied = non_negative_integer(
        baseline.get("applied_version"), "baseline_observation.applied_version"
    )
    if baseline_applied != FIXTURE["expected_applied_version"]:
        raise PersistenceBacklogError(
            "baseline_observation.applied_version must be the final sent version"
        )
    baseline_retained = baseline["retained_queued_requests"]
    baseline_payload = baseline["estimated_retained_payload_bytes"]
    if baseline_retained == 0 or baseline_payload == 0:
        raise PersistenceBacklogError(
            "baseline_observation must retain the final request and payload"
        )
    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

View on GitHub (pinned to 8880682c63)

Solutions

  1. Recompute estimated_retained_payload_bytes with the frozen estimator (retained saved-session JSON bytes, payload_estimator 'retained-saved-session-json-bytes-v1')
  2. If the estimator legitimately changed, update payload_estimator in FIXTURE and re-baseline everything together
  3. Sanity-check before saving: payload must be at least retained x 65536

Example fix

// before (budget.json)
"baseline_observation": {
  "retained_queued_requests": 128,
  "estimated_retained_payload_bytes": 8000000, ... }

// after: >= 128 * 65536 = 8388608
"baseline_observation": {
  "retained_queued_requests": 128,
  "estimated_retained_payload_bytes": 8527994, ... }
Defensive patterns

Strategy: validation

Validate before calling

def baseline_payload_floor_ok(budget: dict, per_request: int = 65536) -> bool:
    b = budget.get("baseline_observation", {})
    return (b.get("estimated_retained_payload_bytes", 0)
            >= b.get("retained_queued_requests", 0) * per_request)

Prevention

When it happens

Trigger: A payload below retained x 65536, e.g. 8000000 bytes with retained=128 (minimum 8388608); an estimator that measures something other than retained saved-session JSON bytes.

Common situations: Changing payload_estimator semantics without updating the fixture; measuring post-compression serialized size; counting only the newest snapshot instead of all retained requests.

Related errors


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