Hmbown/CodeWhale · error · PersistenceBacklogError

baseline_observation.applied_version must be the final sent

Error message

baseline_observation.applied_version must be the final sent version

What it means

Raised by validate_budget() when baseline_observation.applied_version is not exactly 127 (FIXTURE expected_applied_version). With 128 requests sent (versions 0..127) and the consumer paused, the applied version must still be the final sent version - the persisted PendingState must not stop at an earlier version. The receipt validator enforces the identical invariant.

Source

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

        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(
            "baseline_observation.accepted_requests must equal requests_attempted"
        )
    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):

View on GitHub (pinned to 8880682c63)

Solutions

  1. Set baseline_observation.applied_version to 127
  2. Regenerate the baseline with the frozen 128-request workload so the final version is sampled, not remembered
  3. Keep requests_attempted=128 and expected_applied_version=127 paired whenever either changes

Example fix

// before (budget.json)
"baseline_observation": { "applied_version": 126, ... }

// after: final sent version of 128 requests (versions 0..127)
"baseline_observation": { "applied_version": 127, ... }
Defensive patterns

Strategy: validation

Validate before calling

def baseline_applied_ok(budget: dict, expected: int = 127) -> bool:
    return budget.get("baseline_observation", {}).get("applied_version") == expected

Prevention

When it happens

Trigger: baseline_observation.applied_version set to 126, 128, a float, or missing; or a baseline captured from a run where the channel applied fewer versions than sent.

Common situations: Off-by-one confusion between the request count (128) and the final version (127); editing version counts during a hand re-baseline; testing with a different number of sends.

Related errors


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