{"record":{"id":"af7fb1e00aef5e6f","repo":"Hmbown/CodeWhale","slug":"final-version-applied-must-be-true","errorCode":null,"errorMessage":"final_version_applied must be true","messagePattern":"final_version_applied must be true","errorType":"validation","errorClass":"PersistenceBacklogError","httpStatus":null,"severity":"error","filePath":"scripts/check-persistence-backlog-budget.py","lineNumber":211,"sourceCode":"        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:\n            non_negative_integer(receipt[field], field)\n        before = receipt[\"rss_before_bytes\"]","sourceCodeStart":193,"sourceCodeEnd":229,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/433685b2024e7bc4c99e1e2e326bcad39b4d9d65/scripts/check-persistence-backlog-budget.py#L193-L229","documentation":"final_version_applied must be exactly true: the receipt must assert that the final sent version was applied by the consumer. Combined with applied_version, this proves the paused channel delivered every request with no loss; a false or missing value means the measurement cannot certify end-to-end delivery.","triggerScenarios":"Raised by validate_receipt when receipt['final_version_applied'] is not True (False, None, 1, \"true\"), from validate_baseline_receipt or compare.","commonSituations":"A harness that stops before unpausing/draining the consumer; serializing the flag as the string \"true\" or integer 1 instead of a JSON boolean; a consumer crash leaving the drain incomplete.","solutions":["Ensure the measurement drains the paused consumer fully before writing the receipt, then re-run it.","Emit final_version_applied as a strict JSON boolean true, not a string or number.","If the consumer cannot apply the final version, fix the delivery bug before measuring the backlog."],"exampleFix":"// before\n{\"final_version_applied\": \"true\"}\n// after\n{\"final_version_applied\": true}","handlingStrategy":"validation","validationCode":"def final_version_flag_valid(receipt):\n    return receipt.get(\"final_version_applied\") is True","typeGuard":"def is_strict_true(v):\n    return v is True","tryCatchPattern":"try:\n    validate_receipt(receipt)\nexcept PersistenceBacklogError as e:\n    print(f\"receipt rejected: {e}\", file=sys.stderr)\n    sys.exit(2)","preventionTips":["Drain the paused consumer before snapshotting receipt state.","Serialize booleans as JSON booleans, never strings or ints.","Add a post-run assertion that final_version_applied is True in the harness."],"tags":["measurement","validation","delivery","python"],"backgroundTag":"schema-validation-failed","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"}