{"record":{"id":"fedb6500994432cd","repo":"Hmbown/CodeWhale","slug":"receipt-platform-is-unsupported","errorCode":null,"errorMessage":"receipt platform is unsupported","messagePattern":"receipt platform is unsupported","errorType":"exception","errorClass":"PersistenceBacklogError","httpStatus":null,"severity":"error","filePath":"scripts/check-persistence-backlog-budget.py","lineNumber":181,"sourceCode":"    validate_frozen_field(\"sample_count\", receipt[\"sample_count\"], 1)\n    if expected_source is not None:\n        for field in (\n            \"source_sha\",\n            \"source_dirty\",\n            \"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        )","sourceCodeStart":163,"sourceCodeEnd":199,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/8880682c63083a91624de936797efa3ce9e498fd/scripts/check-persistence-backlog-budget.py#L163-L199","documentation":"Raised in validate_receipt (scripts/check-persistence-backlog-budget.py:179-181) when receipt.platform is not a string or not in SUPPORTED_PLATFORMS {linux, macos, windows}. Only these canonical lowercase names are accepted so ceiling data stays comparable across lanes.","triggerScenarios":"The Rust emitter reporting \"darwin\" instead of \"macos\" (std::env::consts::OS naming), \"win32\" or \"Windows\" variants, capitalized \"Linux\", null, or an empty string.","commonSituations":"Mapping from Rust OS constants to receipt names incorrectly; adding a new platform lane without extending SUPPORTED_PLATFORMS; hand-authored receipts.","solutions":["Normalize the OS name in the Rust measurement test to the canonical set (darwin -> macos).","When adding a genuinely new platform, extend SUPPORTED_PLATFORMS and define which ceiling fields apply to it.","Regenerate the receipt after the emitter fix."],"exampleFix":"// Rust emitter (before)\n\"platform\": std::env::consts::OS  // \"darwin\" on macOS\n// after\n\"platform\": match std::env::consts::OS { \"darwin\" => \"macos\", os => os }","handlingStrategy":"type-guard","validationCode":"supported = {\"linux\", \"macos\", \"windows\"}\nif receipt.get(\"platform\") not in supported:\n    sys.exit(f\"platform {receipt.get('platform')!r} unsupported; normalize OS names in the emitter\")","typeGuard":"def is_supported_platform(value) -> bool:\n    return isinstance(value, str) and value in {\"linux\", \"macos\", \"windows\"}","tryCatchPattern":"try:\n    validate_receipt(receipt)\nexcept PersistenceBacklogError as e:\n    if \"platform is unsupported\" in str(e):\n        raise RuntimeError(\"map std::env::consts::OS darwin->macos in the emitter\") from e\n    raise","preventionTips":["Map Rust OS constants to the canonical set once, in a single emitter helper.","Extend SUPPORTED_PLATFORMS deliberately when adding a lane, alongside its ceiling policy.","Add a unit test asserting the emitted platform is in the supported set."],"tags":["validation","platform","portability"],"backgroundTag":null,"analyzedSha":"8880682c63083a91624de936797efa3ce9e498fd","analyzedAt":"2026-08-16T11:31:27.956Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}