Hmbown/CodeWhale · error · PersistenceBacklogError

baseline_observation payload is smaller than frozen…

Error message

baseline_observation payload is smaller than frozen retained content

What it means

validate_budget checks that the baseline's estimated_retained_payload_bytes is at least retained_queued_requests * 64KiB (the frozen content_bytes_per_request). A smaller payload means the estimate understates the retained content, so the baseline cannot serve as a trustworthy floor for the memory budget.

Solutions

  1. Regenerate the baseline with the current payload_estimator (retained-saved-session-json-bytes-v1) and the frozen 64KiB per-request content.
  2. Keep content_bytes_per_request in FIXTURE in sync with what the measurement actually produced.
  3. Do not lower the fixture constant to satisfy the check; restore the frozen value instead.

Example fix

// before
"content_bytes_per_request": 1024 (baseline payload sized for 1024)
// after
regenerate baseline with 64 * 1024 bytes per retained request
Defensive patterns

Strategy: validation

Validate before calling

CONTENT_BYTES = 64 * 1024
if b.get("estimated_retained_payload_bytes", 0) < b.get("retained_queued_requests", 0) * CONTENT_BYTES:
    raise ValueError("baseline payload below frozen retained content floor")

Try / catch

try:
    compare(budget, baseline_receipt)
except PersistenceBacklogError as e:
    if "smaller than frozen retained content" in str(e): re-run measure script with current estimator

Prevention

When it happens

Trigger: `compare` where baseline_payload < baseline_retained * 65536, e.g. after changing content_bytes_per_request in FIXTURE without regenerating the baseline payload estimate.

Common situations: Fixture byte-size constants changed, a different payload estimator version used for the baseline, or manually reduced payload numbers.

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/587b1aa67475752c. Report an issue: GitHub.

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