{"record":{"id":"c1d8863bd41d6942","repo":"Hmbown/CodeWhale","slug":"baseline-provenance-must-identify-a-clean-source-tree","errorCode":null,"errorMessage":"baseline provenance must identify a clean source tree","messagePattern":"baseline provenance must identify a clean source tree","errorType":"console","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/433685b2024e7bc4c99e1e2e326bcad39b4d9d65/scripts/check-persistence-backlog-budget.py#L290-L326","documentation":"Provenance.source_dirty must be exactly false: the baseline must come from a clean source tree so it is reproducible from the recorded SHA. A dirty tree baseline is rejected because its measurements can't be attributed to any committed revision.","triggerScenarios":"`compare` with provenance.source_dirty == true (or any value other than literal false), i.e. the baseline was measured with uncommitted changes present.","commonSituations":"Generating the baseline while local edits/WIP files are present, forgetting to commit before running the measure script.","solutions":["Commit or stash all changes, verify `git status` is clean, then re-run the measurement to produce a new baseline.","Keep the baseline-generation workflow in a clean worktree.","Do not hand-flip source_dirty to false; the SHA must actually match the measured tree."],"exampleFix":"git status --porcelain  # ensure empty\npython scripts/measure-persistence-backlog.py  # regenerate baseline with source_dirty: false","handlingStrategy":"validation","validationCode":"import subprocess\nif subprocess.run([\"git\", \"status\", \"--porcelain\"], capture_output=True, text=True).stdout.strip():\n    raise ValueError(\"commit or stash changes before measuring the baseline\")","typeGuard":null,"tryCatchPattern":"try:\n    measure_and_write_baseline()\nexcept PersistenceBacklogError as e:\n    if \"clean source tree\" in str(e): commit/stash, then re-measure","preventionTips":["Run baseline generation from a clean worktree only.","Verify `git status --porcelain` is empty before measuring."],"tags":["python","validation","provenance","git"],"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"}