{"record":{"id":"5aa7a16c4e2c9459","repo":"Hmbown/CodeWhale","slug":"receipt-metric-representative-context-prompts-byte-identical","errorCode":null,"errorMessage":"receipt metric `representative_context.prompts_byte_identical` must be true","messagePattern":"receipt metric `representative_context\\.prompts_byte_identical` must be true","errorType":"exception","errorClass":"RuntimeContractError","httpStatus":null,"severity":"error","filePath":"scripts/check-runtime-contract-budget.py","lineNumber":280,"sourceCode":"    )\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\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        )","sourceCodeStart":262,"sourceCodeEnd":298,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/433685b2024e7bc4c99e1e2e326bcad39b4d9d65/scripts/check-runtime-contract-budget.py#L262-L298","documentation":"Like the skill-discovery check (807), the representative-context prompts across the measured runs must be byte-identical for the budget to be trustworthy. validate_receipt requires representative_context.prompts_byte_identical to be literally True.","triggerScenarios":"validate_receipt finds representative_context.prompts_byte_identical absent, false, or a non-boolean truthy value while the fixture_id check (808) already passed.","commonSituations":"System prompt or context assembly changed between runs; unstable ordering in context fragments; a template receipt with the flag left false.","solutions":["Diff the prompts from the two runs, remove the nondeterminism, and re-measure","Regenerate the receipt via run_measurement once prompts are stable","Set the flag to true only for genuinely byte-identical runs; never hand-edit it"],"exampleFix":"// before\n\"representative_context\": {\"prompts_byte_identical\": false}\n// after\n\"representative_context\": {\"prompts_byte_identical\": true}","handlingStrategy":"validation","validationCode":"rep = doc.get(\"representative_context\", {})\nassert isinstance(rep, dict) and rep.get(\"prompts_byte_identical\") is True, \\\n    \"representative-context prompts not byte-identical; re-measure\"","typeGuard":"def is_true(v) -> bool:\n    return v is True","tryCatchPattern":"try:\n    compare(receipt, budget)\nexcept RuntimeContractError as e:\n    if \"representative_context.prompts_byte_identical\" in str(e):\n        raise SystemExit(\"context assembly is nondeterministic; stabilize and re-measure\")\n    raise","preventionTips":["Run the validator on any receipt before trusting its budget numbers","Keep context assembly deterministic (stable ordering, no timestamps in prompts)","Re-measure rather than hand-flipping the flag after prompt changes"],"tags":["python","reproducibility","contract-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"}