{"record":{"id":"862b5290e7712ea0","repo":"Hmbown/CodeWhale","slug":"baseline-provenance-build-profile-sample-count-changed","errorCode":null,"errorMessage":"baseline provenance build profile/sample count changed","messagePattern":"baseline provenance build profile/sample count changed","errorType":"console","errorClass":"PersistenceBacklogError","httpStatus":null,"severity":"error","filePath":"scripts/check-persistence-backlog-budget.py","lineNumber":316,"sourceCode":"    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(\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\",","sourceCodeStart":298,"sourceCodeEnd":334,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/433685b2024e7bc4c99e1e2e326bcad39b4d9d65/scripts/check-persistence-backlog-budget.py#L298-L334","documentation":"The checker freezes build_profile == \"test\" and sample_count == 1 in the baseline provenance; these are measurement-contract constants, not tunables. Any other profile or sample count means the baseline was gathered under a different methodology than the budget assumes, so the comparison is refused.","triggerScenarios":"`compare` with provenance.build_profile != \"test\" (e.g. \"release\") or sample_count not the integer 1 — typically a baseline measured with --release or with repeated sampling enabled.","commonSituations":"Generating the baseline with a different build profile for 'more realistic' numbers, or changing the measure script's sampling loop and reusing the old budget.","solutions":["Regenerate the baseline with build_profile \"test\" and exactly one sample, matching the frozen contract.","If the methodology intentionally changes, update FIXTURE/the checker expectations and regenerate the budget together.","Verify the measure script's defaults weren't overridden via CLI flags during baseline generation."],"exampleFix":"// before\n\"build_profile\": \"release\", \"sample_count\": 5\n// after\n\"build_profile\": \"test\", \"sample_count\": 1","handlingStrategy":"validation","validationCode":"p = budget.get(\"baseline_observation\", {}).get(\"provenance\", {})\nif p.get(\"build_profile\") != \"test\" or p.get(\"sample_count\") != 1:\n    raise ValueError(\"baseline must use build_profile 'test' and sample_count 1\")","typeGuard":null,"tryCatchPattern":"try:\n    compare(budget, baseline_receipt)\nexcept PersistenceBacklogError as e:\n    if \"build profile/sample count\" in str(e): re-measure with test profile and one sample","preventionTips":["Never override build profile or sample-count flags when generating baselines.","Treat build_profile/sample_count as frozen contract fields in reviews."],"tags":["python","validation","provenance","budget-check"],"backgroundTag":"invalid-config-value","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"}