{"record":{"id":"cf70fc0e18ddcf02","repo":"Hmbown/CodeWhale","slug":"applied-version-is-not-the-final-sent-version","errorCode":null,"errorMessage":"applied_version is not the final sent version","messagePattern":"applied_version is not the final sent version","errorType":"validation","errorClass":"PersistenceBacklogError","httpStatus":null,"severity":"error","filePath":"scripts/check-persistence-backlog-budget.py","lineNumber":209,"sourceCode":"    )\n    if retained > accepted:\n        raise PersistenceBacklogError(\"retained_queued_requests exceeds accepted_requests\")\n    for field in (\"estimated_retained_payload_bytes\", \"enqueue_elapsed_ns\"):\n        non_negative_integer(receipt[field], field)\n    if retained == 0 or receipt[\"estimated_retained_payload_bytes\"] == 0:\n        raise PersistenceBacklogError(\n            \"the paused channel must retain the newest request and its payload\"\n        )\n    minimum_payload_bytes = retained * FIXTURE[\"content_bytes_per_request\"]\n    if receipt[\"estimated_retained_payload_bytes\"] < minimum_payload_bytes:\n        raise PersistenceBacklogError(\n            \"estimated_retained_payload_bytes is smaller than the frozen retained content\"\n        )\n    applied = non_negative_integer(\n        receipt[\"applied_version\"], \"applied_version\"\n    )\n    if applied != FIXTURE[\"expected_applied_version\"]:\n        raise PersistenceBacklogError(\"applied_version is not the final sent version\")\n    if receipt[\"final_version_applied\"] is not True:\n        raise PersistenceBacklogError(\"final_version_applied must be true\")\n\n    limitations = receipt[\"limitations\"]\n    if not isinstance(limitations, list) or not limitations or not all(\n        isinstance(item, str) and item for item in limitations\n    ):\n        raise PersistenceBacklogError(\"limitations must be a non-empty string array\")\n\n    if not isinstance(receipt[\"rss_supported\"], bool):\n        raise PersistenceBacklogError(\"rss_supported must be boolean\")\n    if receipt[\"rss_supported\"] != (platform == \"macos\"):\n        raise PersistenceBacklogError(\n            \"rss_supported must be true exactly on the macOS measurement lane\"\n        )\n    rss_fields = RSS_SAMPLE_FIELDS + RSS_DELTA_FIELDS\n    if receipt[\"rss_supported\"]:\n        for field in rss_fields:","sourceCodeStart":191,"sourceCodeEnd":227,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/433685b2024e7bc4c99e1e2e326bcad39b4d9d65/scripts/check-persistence-backlog-budget.py#L191-L227","documentation":"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.","triggerScenarios":"Raised by validate_receipt when receipt['applied_version'] != FIXTURE['expected_applied_version'] (127), from validate_baseline_receipt or compare.","commonSituations":"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.","solutions":["Regenerate the receipt with the current fixture so applied_version lands on the final sent version (127).","If you intentionally changed requests_attempted, update FIXTURE['expected_applied_version'] in the checker to match (attempted - 1).","Verify the paused consumer drains and applies every retained request after unpausing."],"exampleFix":"// before\n\"expected_applied_version\": 63  # fixture now sends 128 requests\n// after\n\"expected_applied_version\": 127  # attempted(128) - 1","handlingStrategy":"validation","validationCode":"def applied_version_matches_fixture(receipt, expected_applied=127):\n    return receipt.get(\"applied_version\") == expected_applied","typeGuard":"def is_non_negative_int(v):\n    return isinstance(v, int) and not isinstance(v, bool) and v >= 0","tryCatchPattern":"try:\n    validate_receipt(receipt)\nexcept PersistenceBacklogError as e:\n    print(f\"applied_version mismatch: {e}\", file=sys.stderr)\n    sys.exit(2)","preventionTips":["Derive expected_applied_version as requests_attempted - 1 whenever the fixture changes.","Assert the consumer drained fully before writing the receipt.","Never reuse receipts across fixture versions."],"tags":["measurement","validation","fixture","python"],"backgroundTag":"invalid-argument-value","analyzedSha":"433685b2024e7bc4c99e1e2e326bcad39b4d9d65","analyzedAt":"2026-09-15T12:24:24.634Z","contentChangedAt":"2026-09-15T12:24:24.634Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}