{"record":{"id":"d2ae49f6f08d4cfa","repo":"Hmbown/CodeWhale","slug":"budget-metric-representative-context-fixture-id","errorCode":null,"errorMessage":"budget metric `representative_context.fixture_id` must be `{REPRESENTATIVE_FIXTURE_ID}`, got {fixture_id!r}","messagePattern":"budget metric `representative_context\\.fixture_id` must be `(.+?)`, got (.+?)","errorType":"exception","errorClass":"RuntimeContractError","httpStatus":null,"severity":"error","filePath":"scripts/check-runtime-contract-budget.py","lineNumber":288,"sourceCode":"        )\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\n    )\n    if fixture_id != REPRESENTATIVE_FIXTURE_ID:\n        raise RuntimeContractError(\n            \"budget metric `representative_context.fixture_id` must be \"\n            f\"`{REPRESENTATIVE_FIXTURE_ID}`, got {fixture_id!r}\"\n        )\n    validate_identity_structure(budget, \"budget\")\n\n\ndef metric_value(document: dict[str, Any], path: MetricPath, kind: str) -> int:\n    value = required_value(document, path, kind)\n    dotted = \".\".join(path)\n    if isinstance(value, bool) or not isinstance(value, int) or value < 0:\n        raise RuntimeContractError(\n            f\"{kind} metric `{dotted}` must be a non-negative integer\"\n        )\n    return value\n\n\ndef compare(\n    receipt: dict[str, Any], budget: dict[str, Any]","sourceCodeStart":270,"sourceCodeEnd":306,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/8880682c63083a91624de936797efa3ce9e498fd/scripts/check-runtime-contract-budget.py#L270-L306","documentation":"validate_budget requires scripts/runtime-contract-budget.json to carry representative_context.fixture_id == \"representative-v1\" (REPRESENTATIVE_FIXTURE_ID). The budget and the receipt must be measured against the same fixture for the ceilings and stage digests to mean anything, so the checker refuses budgets pinned to a different fixture. Mirrors error 205 on the budget side.","triggerScenarios":"Loading a --budget file whose fixture_id was bumped or hand-edited; reusing a budget from a branch that introduced a new representative fixture; merging a budget file that dropped representative_context entirely (then the value is None).","commonSituations":"Carrying an old budget forward after a fixture-version bump without re-measuring; passing a custom --budget path pointing at another project's file.","solutions":["Set representative_context.fixture_id to \"representative-v1\" in the budget file","If the fixture version legitimately changed, regenerate the whole budget from a fresh receipt (python3 scripts/check-runtime-contract-budget.py --update once compare passes) rather than editing the id alone","Verify you are pointing --budget at the repo's scripts/runtime-contract-budget.json"],"exampleFix":"// before (scripts/runtime-contract-budget.json)\n\"representative_context\": { \"fixture_id\": \"representative-v2\" }\n\n// after\n\"representative_context\": { \"fixture_id\": \"representative-v1\" }","handlingStrategy":"validation","validationCode":"EXPECTED_FIXTURE_ID = \"representative-v1\"\n\n\ndef budget_fixture_ok(budget: dict) -> bool:\n    rc = budget.get(\"representative_context\")\n    return isinstance(rc, dict) and rc.get(\"fixture_id\") == EXPECTED_FIXTURE_ID","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pin the budget and the checker to the same commit; both live in scripts/ of this repo","Pass --budget only for experiments, and diff experimental budgets against the canonical one before adopting them","When the fixture bumps, regenerate the whole budget via --update instead of editing fixture_id in place"],"tags":["python","json","fixtures","validation","budget"],"backgroundTag":null,"analyzedSha":"8880682c63083a91624de936797efa3ce9e498fd","analyzedAt":"2026-08-16T11:31:27.956Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}