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

The persistence-backlog budget checker validates that the baseline observation's applied_version equals the fixture's expected final sent version (127 for the paused-production-channel fixture). It raises PersistenceBacklogError when a stale, hand-edited, or regenerated baseline records a different applied_version, meaning the baseline was not produced by the frozen measurement scenario.

Solutions

  1. Regenerate the baseline observation by running scripts/measure-persistence-backlog.py with the current fixture so applied_version equals 127.
  2. Check the fixture constants at the top of the script; if expected_applied_version intentionally changed, update the baseline accordingly.
  3. Ensure the paused consumer setup matches the fixture (paused_consumer=true, 128 attempted requests) so version 127 is the final applied version.

Example fix

// before (budget JSON)
"baseline_observation": { ..., "applied_version": 100 }
// after
"baseline_observation": { ..., "applied_version": 127 }
Defensive patterns

Strategy: validation

Validate before calling

baseline = budget.get("baseline_observation", {})
if baseline.get("applied_version") != 127:
    raise ValueError("baseline applied_version stale; regenerate baseline")

Type guard

def has_expected_applied_version(b: dict) -> bool:
    return b.get("applied_version") == 127

Try / catch

try:
    validate_budget(budget, baseline)
except PersistenceBacklogError as e:
    print(f"baseline out of date: {e}; re-run measure-persistence-backlog.py")

Prevention

When it happens

Trigger: Running `compare` on a persistence-backlog-budget.json whose baseline_observation.applied_version is not 127 (the FIXTURE expected_applied_version), e.g. after regenerating the baseline with changed fixture parameters or editing the budget by hand.

Common situations: Baseline JSON regenerated with a modified measure script, fixture constants updated without refreshing the baseline, manual edits to the budget file, or an old baseline from a previous schema version.

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

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