{"record":{"id":"ed5a874b40512187","repo":"Hmbown/CodeWhale","slug":"receipt-metric-skill-discovery-prompts-byte-identical-must","errorCode":null,"errorMessage":"receipt metric `skill_discovery.prompts_byte_identical` must be true","messagePattern":"receipt metric `skill_discovery\\.prompts_byte_identical` must be true","errorType":"exception","errorClass":"RuntimeContractError","httpStatus":null,"severity":"error","filePath":"scripts/check-runtime-contract-budget.py","lineNumber":264,"sourceCode":"    for stage, _label in REPRESENTATIVE_STAGES:\n        path = (\"representative_context\", \"stages\", stage, \"identity_sha256\")\n        digest = required_value(document, path, kind)\n        if not isinstance(digest, str) or re.fullmatch(r\"[0-9a-f]{64}\", digest) is None:\n            raise RuntimeContractError(\n                f\"{kind} field `{'.'.join(path)}` must be a lowercase SHA-256 digest\"\n            )\n\n\ndef validate_receipt(receipt: dict[str, Any]) -> None:\n    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        )","sourceCodeStart":246,"sourceCodeEnd":282,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/433685b2024e7bc4c99e1e2e326bcad39b4d9d65/scripts/check-runtime-contract-budget.py#L246-L282","documentation":"A valid receipt must assert that the skill-discovery prompts were byte-identical across the measured runs; otherwise the budget measurement is not reproducible. validate_receipt requires this field to be literally True (not truthy).","triggerScenarios":"validate_receipt (via compare, budget_from_receipt, or run_measurement) sees skill_discovery.prompts_byte_identical set to false, missing, or a non-boolean truthy value.","commonSituations":"Prompt text changed between the compared runs (tool description edits, locale/env differences); a generator writing 1/0 instead of true; an older receipt predating this assertion.","solutions":["Fix the nondeterminism so both runs produce byte-identical prompts, then regenerate the receipt","Set the field to literal true only when the runs genuinely produced identical prompts","Regenerate the receipt with run_measurement instead of flipping the flag by hand"],"exampleFix":"// before\n\"skill_discovery\": {\"prompts_byte_identical\": false}\n// after\n\"skill_discovery\": {\"prompts_byte_identical\": true}","handlingStrategy":"validation","validationCode":"sd = doc.get(\"skill_discovery\", {})\nassert isinstance(sd, dict) and sd.get(\"prompts_byte_identical\") is True, \\\n    \"skill-discovery prompts were not byte-identical; re-measure\"","typeGuard":"def is_true(v) -> bool:\n    return v is True","tryCatchPattern":"try:\n    budget = budget_from_receipt(receipt)\nexcept RuntimeContractError as e:\n    if \"prompts_byte_identical\" in str(e):\n        raise SystemExit(\"nondeterministic prompts: fix prompt source before re-measuring\")\n    raise","preventionTips":["Check the flag before calling compare/budget_from_receipt, not after","Freeze prompt-affecting inputs (env, locale, tool descriptions) during measurement","Diff prompts across runs when the flag is false to find the source of drift"],"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"}