{"record":{"id":"408b844efa8b7c1b","repo":"Hmbown/CodeWhale","slug":"receipt-field-does-not-match-the-checked-source","errorCode":null,"errorMessage":"receipt {field} does not match the checked source","messagePattern":"receipt (.+?) does not match the checked source","errorType":"validation","errorClass":"PersistenceBacklogError","httpStatus":null,"severity":"error","filePath":"scripts/check-persistence-backlog-budget.py","lineNumber":174,"sourceCode":"        raise PersistenceBacklogError(\"receipt source_sha must be an exact lowercase Git SHA\")\n    if type(receipt[\"source_dirty\"]) is not bool:\n        raise PersistenceBacklogError(\"receipt source_dirty must be boolean\")\n    for field, prefix in ((\"rustc_version\", \"rustc \"), (\"cargo_version\", \"cargo \")):\n        if not isinstance(receipt[field], str) or not receipt[field].startswith(prefix):\n            raise PersistenceBacklogError(f\"receipt {field} must be a version string\")\n    validate_frozen_field(\"build_profile\", receipt[\"build_profile\"], \"test\")\n    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:","sourceCodeStart":156,"sourceCodeEnd":192,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/433685b2024e7bc4c99e1e2e326bcad39b4d9d65/scripts/check-persistence-backlog-budget.py#L156-L192","documentation":"When `validate_receipt` is called with `expected_source` (as `compare()` does via main), each provenance field of the receipt — source_sha, source_dirty, rustc_version, cargo_version, build_profile, sample_count — must exactly equal the value captured from the current machine by `current_source_identity()`. This error means the receipt was measured under different conditions (different commit, dirty state, or toolchain) than the tree being checked, so its numbers cannot be compared against the budget for this source.","triggerScenarios":"Running the checker with `--receipt` for a receipt generated on another commit, after making local edits (dirty flag flips), or after upgrading rustc/cargo; copying a receipt from a teammate or CI into a different checkout.","commonSituations":"Checking a stale committed receipt against a moved HEAD; a rustup toolchain update between measurement and check; uncommitted changes making source_dirty true while the receipt says false.","solutions":["Re-run the measurement (`python scripts/check-persistence-backlog-budget.py` without --receipt) on the current tree to produce a fresh receipt","Commit or stash local changes so the source state matches the receipt's source_dirty/source_sha","Regenerate the receipt after any rustc/cargo version change so toolchain fields match","Align the checkout to the commit recorded in the receipt with `git checkout <source_sha>` if re-measuring is not an option"],"exampleFix":"// before (receipt from old commit)\n$ python scripts/check-persistence-backlog-budget.py --receipt old-receipt.json\nERROR: receipt source_sha does not match the checked source\n// after (fresh measurement on current HEAD)\n$ python scripts/check-persistence-backlog-budget.py\nPASS: one-way ceilings respected","handlingStrategy":"validation","validationCode":"def matches_current_source(receipt, expected):\n    return all(receipt.get(f) == expected.get(f) for f in (\"source_sha\",\"source_dirty\",\"rustc_version\",\"cargo_version\",\"build_profile\",\"sample_count\"))","typeGuard":null,"tryCatchPattern":"try:\n    compare(receipt, budget, expected_source=expected)\nexcept PersistenceBacklogError as e:\n    if \"does not match the checked source\" in str(e):\n        receipt = re_measure_current_tree()","preventionTips":["Re-measure rather than reusing receipts after any commit, edit, or toolchain upgrade","Run the check immediately after measurement on the same machine","Never copy receipts between checkouts or machines","Watch for rustup auto-updates between measurement and check"],"tags":["provenance","validation","git","receipt"],"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"}