{"record":{"id":"fe8d148593ebd819","repo":"Hmbown/CodeWhale","slug":"baseline-provenance-needs-field","errorCode":null,"errorMessage":"baseline provenance needs {field}","messagePattern":"baseline provenance needs (.+?)","errorType":"console","errorClass":"PersistenceBacklogError","httpStatus":null,"severity":"error","filePath":"scripts/check-persistence-backlog-budget.py","lineNumber":311,"sourceCode":"        )\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(\n                f\"baseline receipt {field} does not match baseline_observation\"\n            )\n    provenance = baseline[\"provenance\"]","sourceCodeStart":293,"sourceCodeEnd":329,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/433685b2024e7bc4c99e1e2e326bcad39b4d9d65/scripts/check-persistence-backlog-budget.py#L293-L329","documentation":"Baseline provenance must include rustc_version starting with \"rustc \" and cargo_version starting with \"cargo \", attesting the toolchain used. Missing, non-string, or wrongly-prefixed values raise this templated error naming the offending field.","triggerScenarios":"`compare` with provenance missing rustc_version/cargo_version, or values like \"1.78.0\" lacking the \"rustc \"/\"cargo \" prefix the measure script normally emits.","commonSituations":"Hand-assembled provenance blocks, trimmed baseline JSON, or values copied from `rustc -vV` without the binary-name prefix.","solutions":["Include full `rustc --version` and `cargo --version` output strings in provenance (e.g. \"rustc 1.78.0\", \"cargo 1.78.0\").","Regenerate the baseline with the measure script so it records both toolchain strings.","Keep both fields present even if the toolchain is unchanged from a previous baseline."],"exampleFix":"// before\n\"rustc_version\": \"1.78.0\", \"cargo_version\": \"1.78.0\"\n// after\n\"rustc_version\": \"rustc 1.78.0\", \"cargo_version\": \"cargo 1.78.0\"","handlingStrategy":"validation","validationCode":"p = budget.get(\"baseline_observation\", {}).get(\"provenance\", {})\nfor field, prefix in ((\"rustc_version\", \"rustc \"), (\"cargo_version\", \"cargo \")):\n    if not str(p.get(field, \"\")).startswith(prefix):\n        raise ValueError(f\"provenance.{field} must start with {prefix!r}\")","typeGuard":"def has_toolchain_strings(p: dict) -> bool:\n    return str(p.get(\"rustc_version\", \"\")).startswith(\"rustc \") and str(p.get(\"cargo_version\", \"\")).startswith(\"cargo \")","tryCatchPattern":"try:\n    compare(budget, baseline_receipt)\nexcept PersistenceBacklogError as e:\n    if \"provenance needs\" in str(e): fill in `rustc --version` / `cargo --version` output","preventionTips":["Copy toolchain strings directly from `rustc --version` / `cargo --version`.","Let the measure script populate provenance rather than typing it."],"tags":["python","validation","provenance","toolchain"],"backgroundTag":"invalid-argument-format","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"}