{"record":{"id":"7ec3cd1fdfc9ef4b","repo":"Hmbown/CodeWhale","slug":"baseline-observation-applied-version-must-be-the-f","errorCode":null,"errorMessage":"baseline_observation.applied_version must be the final sent version","messagePattern":"baseline_observation\\.applied_version must be the final sent version","errorType":"exception","errorClass":"PersistenceBacklogError","httpStatus":null,"severity":"error","filePath":"scripts/check-persistence-backlog-budget.py","lineNumber":281,"sourceCode":"        observed = non_negative_integer(\n            baseline.get(field), f\"baseline_observation.{field}\"\n        )\n        if observed > ceiling:\n            raise PersistenceBacklogError(\n                f\"baseline_observation.{field} exceeds its ceiling\"\n            )\n    baseline_accepted = non_negative_integer(\n        baseline.get(\"accepted_requests\"), \"baseline_observation.accepted_requests\"\n    )\n    if baseline_accepted != FIXTURE[\"requests_attempted\"]:\n        raise PersistenceBacklogError(\n            \"baseline_observation.accepted_requests must equal requests_attempted\"\n        )\n    baseline_applied = non_negative_integer(\n        baseline.get(\"applied_version\"), \"baseline_observation.applied_version\"\n    )\n    if baseline_applied != FIXTURE[\"expected_applied_version\"]:\n        raise PersistenceBacklogError(\n            \"baseline_observation.applied_version must be the final sent version\"\n        )\n    baseline_retained = baseline[\"retained_queued_requests\"]\n    baseline_payload = baseline[\"estimated_retained_payload_bytes\"]\n    if baseline_retained == 0 or baseline_payload == 0:\n        raise PersistenceBacklogError(\n            \"baseline_observation must retain the final request and payload\"\n        )\n    if baseline_retained > baseline_accepted:\n        raise PersistenceBacklogError(\n            \"baseline_observation.retained_queued_requests exceeds accepted_requests\"\n        )\n    if baseline_payload < baseline_retained * FIXTURE[\"content_bytes_per_request\"]:\n        raise PersistenceBacklogError(\n            \"baseline_observation payload is smaller than frozen retained content\"\n        )\n    provenance = baseline.get(\"provenance\")\n    if not isinstance(provenance, dict):","sourceCodeStart":263,"sourceCodeEnd":299,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/8880682c63083a91624de936797efa3ce9e498fd/scripts/check-persistence-backlog-budget.py#L263-L299","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Set baseline_observation.applied_version to 127","Regenerate the baseline with the frozen 128-request workload so the final version is sampled, not remembered","Keep requests_attempted=128 and expected_applied_version=127 paired whenever either changes"],"exampleFix":"// before (budget.json)\n\"baseline_observation\": { \"applied_version\": 126, ... }\n\n// after: final sent version of 128 requests (versions 0..127)\n\"baseline_observation\": { \"applied_version\": 127, ... }","handlingStrategy":"validation","validationCode":"def baseline_applied_ok(budget: dict, expected: int = 127) -> bool:\n    return budget.get(\"baseline_observation\", {}).get(\"applied_version\") == expected","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Load budgets from the repo checkout (scripts/persistence-backlog-budget.json) instead of hand-maintained copies","Validate budget JSON with python -m json.tool and a key-set check before running the checker","Change FIXTURE/SCHEMA_VERSION in the checker only together with regenerating budget and baseline receipt in one commit"],"tags":["json","frozen-workload","python","ci-gate","off-by-one"],"backgroundTag":null,"analyzedSha":"8880682c63083a91624de936797efa3ce9e498fd","analyzedAt":"2026-08-16T11:31:27.956Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}