{"record":{"id":"9cfda0939923c57c","repo":"Hmbown/CodeWhale","slug":"baseline-observation-must-retain-the-final-request","errorCode":null,"errorMessage":"baseline_observation must retain the final request and payload","messagePattern":"baseline_observation must retain the final request and payload","errorType":"exception","errorClass":"PersistenceBacklogError","httpStatus":null,"severity":"error","filePath":"scripts/check-persistence-backlog-budget.py","lineNumber":287,"sourceCode":"            )\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):\n        raise PersistenceBacklogError(\"baseline_observation needs provenance\")\n    if provenance.get(\"platform\") != \"macos\":\n        raise PersistenceBacklogError(\"baseline provenance platform must be macos\")\n    if not isinstance(provenance.get(\"source_sha\"), str) or not SOURCE_SHA_PATTERN.fullmatch(\n        provenance[\"source_sha\"]\n    ):","sourceCodeStart":269,"sourceCodeEnd":305,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/8880682c63083a91624de936797efa3ce9e498fd/scripts/check-persistence-backlog-budget.py#L269-L305","documentation":"Raised by validate_budget() when baseline_observation.retained_queued_requests or estimated_retained_payload_bytes is 0. The fixture pauses the consumer after the sends, so the queue must still hold the newest request and its payload bytes at measurement time; a zero means the baseline was captured from a drained or unpaused channel and says nothing about backlog retention.","triggerScenarios":"Either field 0 in the baseline block - typically a baseline measured after the consumer resumed and emptied the queue, or zero-filled template values left in a hand-written budget.","commonSituations":"Baseline captured too late (after a flush); running with paused_consumer=false; copy-pasting a template whose placeholder zeros were never replaced.","solutions":["Capture the baseline while the consumer is paused, before any flush","Set retained_queued_requests and estimated_retained_payload_bytes to the observed non-zero values","Keep fixture.paused_consumer=true in the measurement configuration"],"exampleFix":"// before (budget.json)\n\"baseline_observation\": {\n  \"retained_queued_requests\": 0,\n  \"estimated_retained_payload_bytes\": 0, ... }\n\n// after: paused-consumer run retains the queue\n\"baseline_observation\": {\n  \"retained_queued_requests\": 128,\n  \"estimated_retained_payload_bytes\": 8527994, ... }","handlingStrategy":"validation","validationCode":"def baseline_retention_ok(budget: dict) -> bool:\n    b = budget.get(\"baseline_observation\", {})\n    return (b.get(\"retained_queued_requests\", 0) > 0\n            and b.get(\"estimated_retained_payload_bytes\", 0) > 0)","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","python","ci-gate","measurement-receipt"],"backgroundTag":null,"analyzedSha":"8880682c63083a91624de936797efa3ce9e498fd","analyzedAt":"2026-08-16T11:31:27.956Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}