{"record":{"id":"a1821b90847e3a6f","repo":"Hmbown/CodeWhale","slug":"baseline-observation-needs-provenance","errorCode":null,"errorMessage":"baseline_observation needs provenance","messagePattern":"baseline_observation needs provenance","errorType":"console","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/433685b2024e7bc4c99e1e2e326bcad39b4d9d65/scripts/check-persistence-backlog-budget.py#L282-L318","documentation":"Every baseline observation must carry a provenance object describing how it was produced. If baseline_observation.provenance is missing or not a dict, the checker cannot attest the baseline's origin and raises this error before any comparison runs.","triggerScenarios":"`compare` with a baseline_observation lacking the provenance key, or where provenance is null/list/string — typically a hand-built or trimmed budget JSON.","commonSituations":"Baselines copied from older schema versions (schema_version < 2) that had no provenance block, manual JSON pruning, or a merge that dropped the object.","solutions":["Add a complete provenance object (platform, source_sha, source_dirty, rustc_version, cargo_version, build_profile, sample_count) to the baseline.","Regenerate the baseline via the measure script, which emits provenance automatically.","Remove stale pre-schema-v2 baselines and record a fresh one."],"exampleFix":"// before\n\"baseline_observation\": { \"applied_version\": 127, ... }\n// after\n\"baseline_observation\": { \"applied_version\": 127, ..., \"provenance\": { \"platform\": \"macos\", \"source_sha\": \"...\", \"source_dirty\": false, \"rustc_version\": \"rustc 1.78.0\", \"cargo_version\": \"cargo 1.78.0\", \"build_profile\": \"test\", \"sample_count\": 1 } }","handlingStrategy":"type-guard","validationCode":"if not isinstance(budget.get(\"baseline_observation\", {}).get(\"provenance\"), dict):\n    raise ValueError(\"baseline missing provenance object\")","typeGuard":"def has_provenance(b: dict) -> bool:\n    return isinstance(b.get(\"provenance\"), dict)","tryCatchPattern":"try:\n    compare(budget, baseline_receipt)\nexcept PersistenceBacklogError as e:\n    if \"needs provenance\" in str(e): regenerate_baseline_with_provenance()","preventionTips":["Always generate baselines with the measure script, never by hand.","Keep baseline JSON schema_version at 2 or later."],"tags":["python","validation","provenance"],"backgroundTag":"missing-required-config-field","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"}