Hmbown/CodeWhale · error · PersistenceBacklogError

applied_version is not the final sent version

Error message

applied_version is not the final sent version

What it means

applied_version in the receipt must equal the fixture's expected_applied_version (127): after sending 128 versioned requests to the paused channel, the final applied version must be the last sent version (0-indexed). Any other value means requests were dropped, applied out of order, or the receipt came from a different workload, breaking the measurement's no-data-loss contract.

Solutions

  1. Regenerate the receipt with the current fixture so applied_version lands on the final sent version (127).
  2. If you intentionally changed requests_attempted, update FIXTURE['expected_applied_version'] in the checker to match (attempted - 1).
  3. Verify the paused consumer drains and applies every retained request after unpausing.

Example fix

// before
"expected_applied_version": 63  # fixture now sends 128 requests
// after
"expected_applied_version": 127  # attempted(128) - 1
Defensive patterns

Strategy: validation

Validate before calling

def applied_version_matches_fixture(receipt, expected_applied=127):
    return receipt.get("applied_version") == expected_applied

Type guard

def is_non_negative_int(v):
    return isinstance(v, int) and not isinstance(v, bool) and v >= 0

Try / catch

try:
    validate_receipt(receipt)
except PersistenceBacklogError as e:
    print(f"applied_version mismatch: {e}", file=sys.stderr)
    sys.exit(2)

Prevention

When it happens

Trigger: Raised by validate_receipt when receipt['applied_version'] != FIXTURE['expected_applied_version'] (127), from validate_baseline_receipt or compare.

Common situations: Changing the fixture's requests_attempted without updating expected_applied_version; a consumer that applies only a prefix of queued requests; reusing a receipt generated by an older fixture version.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


AI-assisted analysis of Hmbown/CodeWhale@433685b202 (2026-09-15). Data as JSON: /api/errors/cf70fc0e18ddcf02. Report an issue: GitHub.

Appendix: source

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

    )
    if retained > accepted:
        raise PersistenceBacklogError("retained_queued_requests exceeds accepted_requests")
    for field in ("estimated_retained_payload_bytes", "enqueue_elapsed_ns"):
        non_negative_integer(receipt[field], field)
    if retained == 0 or receipt["estimated_retained_payload_bytes"] == 0:
        raise PersistenceBacklogError(
            "the paused channel must retain the newest request and its payload"
        )
    minimum_payload_bytes = retained * FIXTURE["content_bytes_per_request"]
    if receipt["estimated_retained_payload_bytes"] < minimum_payload_bytes:
        raise PersistenceBacklogError(
            "estimated_retained_payload_bytes is smaller than the frozen retained content"
        )
    applied = non_negative_integer(
        receipt["applied_version"], "applied_version"
    )
    if applied != FIXTURE["expected_applied_version"]:
        raise PersistenceBacklogError("applied_version is not the final sent version")
    if receipt["final_version_applied"] is not True:
        raise PersistenceBacklogError("final_version_applied must be true")

    limitations = receipt["limitations"]
    if not isinstance(limitations, list) or not limitations or not all(
        isinstance(item, str) and item for item in limitations
    ):
        raise PersistenceBacklogError("limitations must be a non-empty string array")

    if not isinstance(receipt["rss_supported"], bool):
        raise PersistenceBacklogError("rss_supported must be boolean")
    if receipt["rss_supported"] != (platform == "macos"):
        raise PersistenceBacklogError(
            "rss_supported must be true exactly on the macOS measurement lane"
        )
    rss_fields = RSS_SAMPLE_FIELDS + RSS_DELTA_FIELDS
    if receipt["rss_supported"]:
        for field in rss_fields:

View on GitHub (pinned to 433685b202)