{"record":{"id":"2c630e3723ef5290","repo":"Hmbown/CodeWhale","slug":"baseline-observation-retained-queued-requests-exceeds","errorCode":null,"errorMessage":"baseline_observation.retained_queued_requests exceeds accepted_requests","messagePattern":"baseline_observation\\.retained_queued_requests exceeds accepted_requests","errorType":"console","errorClass":"PersistenceBacklogError","httpStatus":null,"severity":"error","filePath":"scripts/check-persistence-backlog-budget.py","lineNumber":291,"sourceCode":"    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    ):\n        raise PersistenceBacklogError(\"baseline provenance needs an exact source SHA\")\n    if provenance.get(\"source_dirty\") is not False:\n        raise PersistenceBacklogError(\"baseline provenance must identify a clean source tree\")\n    for field, prefix in ((\"rustc_version\", \"rustc \"), (\"cargo_version\", \"cargo \")):","sourceCodeStart":273,"sourceCodeEnd":309,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/433685b2024e7bc4c99e1e2e326bcad39b4d9d65/scripts/check-persistence-backlog-budget.py#L273-L309","documentation":"The checker enforces that the baseline's retained_queued_requests never exceeds accepted_requests — you cannot retain more requests than were accepted. Exceeding it indicates an internally inconsistent baseline (acceptance counting bug or corrupted JSON), so the comparison is aborted.","triggerScenarios":"`compare` with a baseline_observation where retained_queued_requests > accepted_requests (fixture expected value: 127 retained vs 128 accepted).","commonSituations":"Hand-edited budget numbers, a measurement harness miscounting accepted requests, or merged/stale baseline data.","solutions":["Regenerate the baseline so accepted_requests >= retained_queued_requests (expected: accepted 128, retained 127).","Audit the measurement script's accept/retain accounting if a real run produces this inconsistency.","Correct accidental edits to the budget JSON."],"exampleFix":"// before\n\"accepted_requests\": 100, \"retained_queued_requests\": 127\n// after\n\"accepted_requests\": 128, \"retained_queued_requests\": 127","handlingStrategy":"validation","validationCode":"if b.get(\"retained_queued_requests\", 0) > b.get(\"accepted_requests\", 0):\n    raise ValueError(\"retained exceeds accepted; baseline inconsistent\")","typeGuard":null,"tryCatchPattern":"try:\n    compare(budget, baseline_receipt)\nexcept PersistenceBacklogError as e:\n    if \"exceeds accepted_requests\" in str(e): regenerate_baseline()","preventionTips":["Copy baseline numbers only from a complete measurement receipt.","Sanity-check accept/retain counts in CI before committing the 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"}