{"record":{"id":"1ae72b2cf40de704","repo":"Hmbown/CodeWhale","slug":"accepted-requests-must-equal-requests-attempted-s","errorCode":null,"errorMessage":"accepted_requests must equal requests_attempted; sender rejection is not backlog improvement","messagePattern":"accepted_requests must equal requests_attempted; sender rejection is not backlog improvement","errorType":"exception","errorClass":"PersistenceBacklogError","httpStatus":null,"severity":"error","filePath":"scripts/check-persistence-backlog-budget.py","lineNumber":186,"sourceCode":"            \"rustc_version\",\n            \"cargo_version\",\n            \"build_profile\",\n            \"sample_count\",\n        ):\n            if receipt[field] != expected_source[field]:\n                raise PersistenceBacklogError(\n                    f\"receipt {field} does not match the checked source\"\n                )\n    if require_clean_source and receipt[\"source_dirty\"]:\n        raise PersistenceBacklogError(\"persistence measurement source tree is dirty\")\n    platform = receipt[\"platform\"]\n    if not isinstance(platform, str) or platform not in SUPPORTED_PLATFORMS:\n        raise PersistenceBacklogError(\"receipt platform is unsupported\")\n\n    attempted = non_negative_integer(receipt[\"requests_attempted\"], \"requests_attempted\")\n    accepted = non_negative_integer(receipt[\"accepted_requests\"], \"accepted_requests\")\n    if accepted != attempted:\n        raise PersistenceBacklogError(\n            \"accepted_requests must equal requests_attempted; sender rejection is not backlog improvement\"\n        )\n    retained = non_negative_integer(\n        receipt[\"retained_queued_requests\"], \"retained_queued_requests\"\n    )\n    if retained > accepted:\n        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        )","sourceCodeStart":168,"sourceCodeEnd":204,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/8880682c63083a91624de936797efa3ce9e498fd/scripts/check-persistence-backlog-budget.py#L168-L204","documentation":"Raised in validate_receipt (scripts/check-persistence-backlog-budget.py:183-188) when accepted_requests != requests_attempted (the frozen fixture pins requests_attempted to 128, so accepted must be exactly 128). The gate encodes a measurement invariant: the sender must accept every request, because shrinking the backlog by having the channel reject sends is not a real persistence improvement.","triggerScenarios":"A measurement run where the actor's persistence channel rejected or dropped some of the 128 fixture requests (channel capacity/buffer changes, backpressure behavior change, test restructure that drains differently).","commonSituations":"Refactoring the persistence actor's channel so it no longer unconditionally accepts before pausing; a regression where bounded-send starts failing under the fixture load.","solutions":["Fix the measurement test so all 128 requests are accepted before the consumer pauses, then re-measure.","If the channel semantics intentionally changed, re-baseline the fixture and budget through the documented migration rather than tolerating rejections.","Inspect the receipt's accepted_requests to confirm which side (emitter vs actor) diverged."],"exampleFix":"// receipt (before)\n\"requests_attempted\": 128, \"accepted_requests\": 120\n// receipt (after)\n\"requests_attempted\": 128, \"accepted_requests\": 128","handlingStrategy":"validation","validationCode":"if receipt[\"accepted_requests\"] != receipt[\"requests_attempted\"]:\n    sys.exit(\"actor rejected sends; fix the measurement harness before budgeting\")","typeGuard":null,"tryCatchPattern":"try:\n    validate_receipt(receipt)\nexcept PersistenceBacklogError as e:\n    if \"sender rejection\" in str(e):\n        raise RuntimeError(\"persistence channel rejected fixture requests; not a backlog result\") from e\n    raise","preventionTips":["Keep the harness contract explicit: the channel must accept all 128 fixture requests before pause.","Assert accepted == attempted inside the Rust test so failures surface at measurement time.","Never treat rejection-driven shrinkage as an improvement in code review."],"tags":["validation","measurement","regression","invariants"],"backgroundTag":null,"analyzedSha":"8880682c63083a91624de936797efa3ce9e498fd","analyzedAt":"2026-08-16T11:31:27.956Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}