{"record":{"id":"51275028f33e4118","repo":"Hmbown/CodeWhale","slug":"baseline-receipt-field-does-not-match-baseline-observation","errorCode":null,"errorMessage":"baseline receipt {field} does not match baseline_observation","messagePattern":"baseline receipt (.+?) does not match baseline_observation","errorType":"console","errorClass":"PersistenceBacklogError","httpStatus":null,"severity":"error","filePath":"scripts/check-persistence-backlog-budget.py","lineNumber":326,"sourceCode":"        raise PersistenceBacklogError(\"baseline provenance must identify a clean source tree\")\n    for field, prefix in ((\"rustc_version\", \"rustc \"), (\"cargo_version\", \"cargo \")):\n        if not isinstance(provenance.get(field), str) or not provenance[field].startswith(prefix):\n            raise PersistenceBacklogError(f\"baseline provenance needs {field}\")\n    if provenance.get(\"build_profile\") != \"test\" or not (\n        type(provenance.get(\"sample_count\")) is int\n        and provenance[\"sample_count\"] == 1\n    ):\n        raise PersistenceBacklogError(\"baseline provenance build profile/sample count changed\")\n\n\ndef validate_baseline_receipt(\n    budget: dict[str, Any], baseline_receipt: dict[str, Any]\n) -> None:\n    validate_receipt(baseline_receipt, require_clean_source=True)\n    baseline = budget[\"baseline_observation\"]\n    for field in (\"accepted_requests\", \"applied_version\", *CEILING_FIELDS):\n        if baseline_receipt[field] != baseline[field]:\n            raise PersistenceBacklogError(\n                f\"baseline receipt {field} does not match baseline_observation\"\n            )\n    provenance = baseline[\"provenance\"]\n    for field in (\n        \"platform\",\n        \"source_sha\",\n        \"source_dirty\",\n        \"rustc_version\",\n        \"cargo_version\",\n        \"build_profile\",\n        \"sample_count\",\n    ):\n        if baseline_receipt[field] != provenance[field]:\n            raise PersistenceBacklogError(\n                f\"baseline receipt {field} does not match baseline provenance\"\n            )\n\n","sourceCodeStart":308,"sourceCodeEnd":344,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/433685b2024e7bc4c99e1e2e326bcad39b4d9d65/scripts/check-persistence-backlog-budget.py#L308-L344","documentation":"validate_baseline_receipt cross-checks a freshly generated baseline receipt against the baseline_observation stored in the persistence backlog budget file. This error means one of the compared fields (accepted_requests, applied_version, or a ceiling field) differs between the receipt and the stored observation, so the budget file's baseline can no longer be trusted. The script aborts rather than validating budgets against a stale or tampered baseline.","triggerScenarios":"Running scripts/check-persistence-backlog-budget.py when the baseline receipt's accepted_requests, applied_version, or any CEILING_FIELDS value does not equal the corresponding value in budget['baseline_observation']. Typically the budget JSON was edited, regenerated, or produced from a different source state than the receipt being checked.","commonSituations":"A developer hand-edited the budget file's baseline_observation; the baseline was regenerated after code changes but the checked-in budget file was not updated; measuring against a different git SHA or build profile than the one the baseline was captured from.","solutions":["Regenerate the baseline receipt and update baseline_observation in the budget file so both come from the same measurement run","Restore the budget file from version control if it was hand-edited","Verify you are running the check from the same source SHA / build profile the baseline was captured with"],"exampleFix":"// before (mismatched, hand-edited budget)\n\"baseline_observation\": {\"accepted_requests\": 42, \"applied_version\": 7}\n// after (regenerate so receipt and observation agree)\n\"baseline_observation\": {\"accepted_requests\": 57, \"applied_version\": 8}","handlingStrategy":"validation","validationCode":"mismatches = [f for f in ('accepted_requests','applied_version',*CEILING_FIELDS) if receipt[f] != budget['baseline_observation'][f]]\nif mismatches: raise SystemExit(f\"baseline drift in: {mismatches}\")","typeGuard":null,"tryCatchPattern":"try:\n    validate_baseline_receipt(budget, receipt)\nexcept PersistenceBacklogError as e:\n    print(f\"baseline out of sync: {e}; regenerate baseline\", file=sys.stderr)\n    sys.exit(1)","preventionTips":["Always regenerate baseline receipt and baseline_observation in the same run","Never hand-edit budget JSON baseline values","Commit receipt and budget updates together"],"tags":["python","ci-guard","baseline-mismatch","drift"],"backgroundTag":"checksum-mismatch","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"}