{"record":{"id":"ebd9debca56d1d54","repo":"Hmbown/CodeWhale","slug":"receipt-metric-representative-context-fixture-id","errorCode":null,"errorMessage":"receipt metric `representative_context.fixture_id` must be `{REPRESENTATIVE_FIXTURE_ID}`, got {fixture_id!r}","messagePattern":"receipt metric `representative_context\\.fixture_id` must be `(.+?)`, got (.+?)","errorType":"exception","errorClass":"RuntimeContractError","httpStatus":null,"severity":"error","filePath":"scripts/check-runtime-contract-budget.py","lineNumber":267,"sourceCode":"    validate_document(receipt, RECEIPT_KIND, \"receipt\")\n    skill_discovery = receipt.get(\"skill_discovery\")\n    identical = (\n        skill_discovery.get(\"prompts_byte_identical\")\n        if isinstance(skill_discovery, dict)\n        else None\n    )\n    if identical is not True:\n        raise RuntimeContractError(\n            \"receipt metric `skill_discovery.prompts_byte_identical` must be true\"\n        )\n    representative = receipt.get(\"representative_context\")\n    fixture_id = (\n        representative.get(\"fixture_id\")\n        if isinstance(representative, dict)\n        else None\n    )\n    if fixture_id != REPRESENTATIVE_FIXTURE_ID:\n        raise RuntimeContractError(\n            \"receipt metric `representative_context.fixture_id` must be \"\n            f\"`{REPRESENTATIVE_FIXTURE_ID}`, got {fixture_id!r}\"\n        )\n    representative_identical = representative.get(\"prompts_byte_identical\")\n    if representative_identical is not True:\n        raise RuntimeContractError(\n            \"receipt metric `representative_context.prompts_byte_identical` must be true\"\n        )\n    validate_identity_structure(receipt, \"receipt\")\n\n\ndef validate_budget(budget: dict[str, Any]) -> None:\n    validate_document(budget, BUDGET_KIND, \"budget\")\n    representative = budget.get(\"representative_context\")\n    fixture_id = (\n        representative.get(\"fixture_id\")\n        if isinstance(representative, dict)\n        else None","sourceCodeStart":249,"sourceCodeEnd":285,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/8880682c63083a91624de936797efa3ce9e498fd/scripts/check-runtime-contract-budget.py#L249-L285","documentation":"validate_receipt requires receipt representative_context.fixture_id to equal the constant REPRESENTATIVE_FIXTURE_ID = \"representative-v1\". The fixture id pins which synthetic session the byte/token stage measurements were taken against, so receipts measured against a different fixture are incomparable with the budget. The message includes the offending value.","triggerScenarios":"A receipt from a measure-runtime-contract.py version that bumped the fixture (for example a future representative-v2); a hand-crafted receipt reusing another fixture id; a receipt for a different representative harness entirely.","commonSituations":"Version skew after pulling new code but re-checking an old receipt file; branches that prototype a new representative fixture; copy-pasting a receipt template from docs with a stale id.","solutions":["Re-measure with the repo's current scripts/measure-runtime-contract.py so the receipt carries representative-v1","If the fixture version truly changed upstream, update both sides together: the constant in the checker and the budget's representative_context.fixture_id (error 207 keeps them in lockstep)","Discard stale receipt files after pulling - the default CLI path measures fresh anyway"],"exampleFix":"// before (receipt.json)\n\"representative_context\": { \"fixture_id\": \"representative-v0\" }\n\n// after\n\"representative_context\": { \"fixture_id\": \"representative-v1\" }","handlingStrategy":"validation","validationCode":"EXPECTED_FIXTURE_ID = \"representative-v1\"\n\n\ndef receipt_fixture_ok(receipt: dict) -> bool:\n    rc = receipt.get(\"representative_context\")\n    return isinstance(rc, dict) and rc.get(\"fixture_id\") == EXPECTED_FIXTURE_ID","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Regenerate receipts after pulling changes instead of reusing old files","If you bump the fixture version, update REPRESENTATIVE_FIXTURE_ID and every budget fixture_id in the same commit","Check fixture_id first when diagnosing receipt rejection - it is the cheapest invariant to eyeball"],"tags":["python","json","fixtures","validation","receipt"],"backgroundTag":null,"analyzedSha":"8880682c63083a91624de936797efa3ce9e498fd","analyzedAt":"2026-08-16T11:31:27.956Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}