{"record":{"id":"c1d8863bd41d6942","repo":"Hmbown/CodeWhale","slug":"baseline-provenance-must-identify-a-clean-source-t","errorCode":null,"errorMessage":"baseline provenance must identify a clean source tree","messagePattern":"baseline provenance must identify a clean source tree","errorType":"exception","errorClass":"PersistenceBacklogError","httpStatus":null,"severity":"error","filePath":"scripts/check-persistence-backlog-budget.py","lineNumber":308,"sourceCode":"    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\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(","sourceCodeStart":290,"sourceCodeEnd":326,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/8880682c63083a91624de936797efa3ce9e498fd/scripts/check-persistence-backlog-budget.py#L290-L326","documentation":"Raised by validate_budget() when provenance.source_dirty is not exactly boolean false - the check is `provenance.get('source_dirty') is not False`, so 0, 'false', null, or a missing key all fail. Baselines must come from a clean git tree: a dirty tree means the measured binary may not correspond to the recorded source_sha, voiding the ceiling provenance.","triggerScenarios":"Rebaselining with uncommitted changes present (git status --porcelain non-empty), or hand-writing source_dirty as 0/'false'/null instead of literal JSON false.","commonSituations":"Measuring with work-in-progress edits in the tree; untracked build artifacts counting as dirty; JSON hand-edits substituting a truthy-looking stand-in for false.","solutions":["Commit or stash everything (including untracked files), confirm git status --porcelain is empty, then re-measure","Set source_dirty to literal JSON false only when the tree truly was clean","Let the measurement scripts record source_dirty automatically instead of hand-writing it"],"exampleFix":"// before (budget.json)\n\"provenance\": { \"source_dirty\": 0 }\n\n// after\n\"provenance\": { \"source_dirty\": false }","handlingStrategy":"validation","validationCode":"def provenance_clean_ok(budget: dict) -> bool:\n    provenance = budget.get(\"baseline_observation\", {}).get(\"provenance\", {})\n    return provenance.get(\"source_dirty\") is False","typeGuard":null,"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","git","python","ci-gate"],"backgroundTag":null,"analyzedSha":"8880682c63083a91624de936797efa3ce9e498fd","analyzedAt":"2026-08-16T11:31:27.956Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}