{"record":{"id":"9cfda0939923c57c","repo":"Hmbown/CodeWhale","slug":"baseline-observation-must-retain-the-final-request-and","errorCode":null,"errorMessage":"baseline_observation must retain the final request and payload","messagePattern":"baseline_observation must retain the final request and payload","errorType":"console","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/433685b2024e7bc4c99e1e2e326bcad39b4d9d65/scripts/check-persistence-backlog-budget.py#L269-L305","documentation":"After confirming the applied version, validate_budget requires the baseline observation to have retained at least one queued request and a non-zero estimated retained payload. A zero on either means the baseline did not actually retain the final request, contradicting the fixture's paused-consumer semantics, so the baseline is rejected as unusable for budget comparison.","triggerScenarios":"`compare` reads a baseline_observation where retained_queued_requests == 0 or estimated_retained_payload_bytes == 0 — e.g. a baseline captured with the consumer unpaused so all requests drained.","commonSituations":"Measurement run with the paused consumer flag flipped, baseline produced from the wrong scenario, or someone zeroing fields while editing the budget.","solutions":["Re-run the measurement with the consumer paused so the final request stays queued and is retained.","Verify measure-persistence-backlog.py wrote non-zero retained_queued_requests/estimated_retained_payload_bytes into the receipt before copying it into the baseline.","Do not hand-zero these fields; regenerate the baseline instead."],"exampleFix":"// before\n\"baseline_observation\": { ..., \"retained_queued_requests\": 0, \"estimated_retained_payload_bytes\": 0 }\n// after\n\"baseline_observation\": { ..., \"retained_queued_requests\": 1, \"estimated_retained_payload_bytes\": 65536 }","handlingStrategy":"validation","validationCode":"b = budget.get(\"baseline_observation\", {})\nif not b.get(\"retained_queued_requests\") or not b.get(\"estimated_retained_payload_bytes\"):\n    raise ValueError(\"baseline must retain the final request and payload\")","typeGuard":null,"tryCatchPattern":"try:\n    compare(budget, baseline_receipt)\nexcept PersistenceBacklogError as e:\n    if \"retain\" in str(e): regenerate_baseline()","preventionTips":["Run measurements only with the paused-consumer scenario enabled.","Inspect the raw receipt for zero retained fields before promoting it to baseline."],"tags":["python","validation","budget-check"],"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"}