{"record":{"id":"a1821b90847e3a6f","repo":"Hmbown/CodeWhale","slug":"baseline-observation-needs-provenance","errorCode":null,"errorMessage":"baseline_observation needs provenance","messagePattern":"baseline_observation needs provenance","errorType":"exception","errorClass":"PersistenceBacklogError","httpStatus":null,"severity":"error","filePath":"scripts/check-persistence-backlog-budget.py","lineNumber":300,"sourceCode":"            \"baseline_observation.applied_version must be the final sent version\"\n        )\n    baseline_retained = baseline[\"retained_queued_requests\"]\n    baseline_payload = baseline[\"estimated_retained_payload_bytes\"]\n    if baseline_retained == 0 or baseline_payload == 0:\n        raise PersistenceBacklogError(\n            \"baseline_observation must retain the final request and payload\"\n        )\n    if baseline_retained > baseline_accepted:\n        raise PersistenceBacklogError(\n            \"baseline_observation.retained_queued_requests exceeds accepted_requests\"\n        )\n    if baseline_payload < baseline_retained * FIXTURE[\"content_bytes_per_request\"]:\n        raise PersistenceBacklogError(\n            \"baseline_observation payload is smaller than frozen retained content\"\n        )\n    provenance = baseline.get(\"provenance\")\n    if not isinstance(provenance, dict):\n        raise PersistenceBacklogError(\"baseline_observation needs provenance\")\n    if provenance.get(\"platform\") != \"macos\":\n        raise PersistenceBacklogError(\"baseline provenance platform must be macos\")\n    if not isinstance(provenance.get(\"source_sha\"), str) or not SOURCE_SHA_PATTERN.fullmatch(\n        provenance[\"source_sha\"]\n    ):\n        raise PersistenceBacklogError(\"baseline provenance needs an exact source SHA\")\n    if provenance.get(\"source_dirty\") is not False:\n        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","sourceCodeStart":282,"sourceCodeEnd":318,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/8880682c63083a91624de936797efa3ce9e498fd/scripts/check-persistence-backlog-budget.py#L282-L318","documentation":"Raised by validate_budget() when baseline_observation.provenance is missing or not a JSON object. Provenance pins the platform, source SHA, dirty flag, toolchain versions, build profile, and sample count of the machine that produced the baseline; without it the baseline numbers are unreproducible and the RSS ceilings unanchored.","triggerScenarios":"baseline_observation lacking the provenance key, or provenance set to null, an array, or a string.","commonSituations":"Hand-writing a baseline_observation block from memory; stripping provenance during JSON cleanup; a merge losing nested blocks.","solutions":["Restore the provenance object with the seven keys: platform, source_sha, source_dirty, rustc_version, cargo_version, build_profile, sample_count","Copy provenance verbatim from scripts/persistence-backlog-baseline-receipt.json that produced the numbers","Regenerate the baseline so provenance is captured automatically"],"exampleFix":"// before (budget.json)\n\"baseline_observation\": { ..., \"provenance\": null }\n\n// after\n\"baseline_observation\": { ..., \"provenance\": {\n  \"platform\": \"macos\", \"source_sha\": \"2d4a9cb58c5c22ac361ab221bda1243a0e4349fb\",\n  \"source_dirty\": false, \"rustc_version\": \"rustc 1.97.0 (2d8144b78 2026-07-07)\",\n  \"cargo_version\": \"cargo 1.97.0 (c980f4866 2026-06-30)\",\n  \"build_profile\": \"test\", \"sample_count\": 1 } }","handlingStrategy":"type-guard","validationCode":null,"typeGuard":"from typing import TypeGuard\n\ndef has_provenance(baseline: object) -> TypeGuard[dict]:\n    return isinstance(baseline, dict) and isinstance(baseline.get(\"provenance\"), dict)","tryCatchPattern":null,"preventionTips":["Regenerate baselines via the measure script so provenance is captured verbatim from git/rustc/cargo","Re-baseline only on macOS with a clean tree (git status --porcelain empty)","Never hand-write provenance fields; copy them from scripts/persistence-backlog-baseline-receipt.json"],"tags":["json","provenance","python","ci-gate"],"backgroundTag":null,"analyzedSha":"8880682c63083a91624de936797efa3ce9e498fd","analyzedAt":"2026-08-16T11:31:27.956Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}