{"record":{"id":"8c7f335495929419","repo":"Hmbown/CodeWhale","slug":"baseline-observation-field-exceeds-its-ceiling","errorCode":null,"errorMessage":"baseline_observation.{field} exceeds its ceiling","messagePattern":"baseline_observation\\.(.+?) exceeds its ceiling","errorType":"exception","errorClass":"PersistenceBacklogError","httpStatus":null,"severity":"error","filePath":"scripts/check-persistence-backlog-budget.py","lineNumber":267,"sourceCode":"        raise PersistenceBacklogError(\"budget fixture no longer matches the frozen workload\")\n    for field, expected in FIXTURE.items():\n        if type(fixture[field]) is not type(expected) or fixture[field] != expected:\n            raise PersistenceBacklogError(\n                f\"budget fixture.{field} must remain {expected!r}\"\n            )\n    if budget.get(\"baseline_receipt\") != BASELINE_RECEIPT_REFERENCE:\n        raise PersistenceBacklogError(\"budget baseline_receipt path changed\")\n    ceilings = budget.get(\"ceilings\")\n    baseline = budget.get(\"baseline_observation\")\n    if not isinstance(ceilings, dict) or not isinstance(baseline, dict):\n        raise PersistenceBacklogError(\"budget needs ceilings and baseline_observation objects\")\n    for field in CEILING_FIELDS:\n        ceiling = non_negative_integer(ceilings.get(field), f\"ceilings.{field}\")\n        observed = non_negative_integer(\n            baseline.get(field), f\"baseline_observation.{field}\"\n        )\n        if observed > ceiling:\n            raise PersistenceBacklogError(\n                f\"baseline_observation.{field} exceeds its ceiling\"\n            )\n    baseline_accepted = non_negative_integer(\n        baseline.get(\"accepted_requests\"), \"baseline_observation.accepted_requests\"\n    )\n    if baseline_accepted != FIXTURE[\"requests_attempted\"]:\n        raise PersistenceBacklogError(\n            \"baseline_observation.accepted_requests must equal requests_attempted\"\n        )\n    baseline_applied = non_negative_integer(\n        baseline.get(\"applied_version\"), \"baseline_observation.applied_version\"\n    )\n    if baseline_applied != FIXTURE[\"expected_applied_version\"]:\n        raise PersistenceBacklogError(\n            \"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\"]","sourceCodeStart":249,"sourceCodeEnd":285,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/8880682c63083a91624de936797efa3ce9e498fd/scripts/check-persistence-backlog-budget.py#L249-L285","documentation":"Raised by validate_budget() when a baseline_observation value for one of the five CEILING_FIELDS (retained_queued_requests, estimated_retained_payload_bytes, enqueue_elapsed_ns, rss_during_delta_bytes, rss_after_delta_bytes) exceeds the ceiling recorded for the same field in ceilings. The budget is self-consistent by construction - ceilings are one-way upper bounds set at or above the baseline - so this mismatch means the two blocks were edited independently.","triggerScenarios":"Tightening ceilings below the frozen baseline numbers (e.g. setting estimated_retained_payload_bytes ceiling under the 8527994 baseline), or raising a baseline value without raising its ceiling.","commonSituations":"Someone shrinks a ceiling to force future optimization work, forgetting the baseline itself must still fit; hand-rebaselining observation numbers while leaving old ceilings; unit drift (ms vs ns) making a baseline look larger.","solutions":["Make ceilings[field] >= baseline_observation[field] for all five fields","When tightening ceilings, lower them only down to the baseline, never below it","For a genuine new baseline, re-run the macOS measurement on a clean tree and regenerate budget and baseline receipt together"],"exampleFix":"// before (budget.json)\n\"baseline_observation\": { \"enqueue_elapsed_ns\": 456170, ... },\n\"ceilings\": { \"enqueue_elapsed_ns\": 400000, ... }\n\n// after: ceiling back at/above the frozen baseline\n\"baseline_observation\": { \"enqueue_elapsed_ns\": 456170, ... },\n\"ceilings\": { \"enqueue_elapsed_ns\": 25000000, ... }","handlingStrategy":"validation","validationCode":"CEILING_FIELDS = (\"retained_queued_requests\", \"estimated_retained_payload_bytes\",\n                  \"enqueue_elapsed_ns\", \"rss_during_delta_bytes\", \"rss_after_delta_bytes\")\n\ndef ceilings_cover_baseline(budget: dict) -> bool:\n    ceilings = budget.get(\"ceilings\", {})\n    baseline = budget.get(\"baseline_observation\", {})\n    return all(\n        baseline.get(f, float(\"inf\")) <= ceilings.get(f, -1)\n        for f in CEILING_FIELDS\n    )","typeGuard":null,"tryCatchPattern":"try:\n    increases, decreases = compare(receipt, budget)\nexcept PersistenceBacklogError as error:\n    print(f\"[persistence-backlog-budget] ERROR: {error}\", file=sys.stderr)\n    raise SystemExit(2) from error","preventionTips":["Load budgets from the repo checkout (scripts/persistence-backlog-budget.json) instead of hand-maintained copies","Validate budget JSON with python -m json.tool and a key-set check before running the checker","Change FIXTURE/SCHEMA_VERSION in the checker only together with regenerating budget and baseline receipt in one commit"],"tags":["json","ceilings","python","ci-gate","performance-budget"],"backgroundTag":null,"analyzedSha":"8880682c63083a91624de936797efa3ce9e498fd","analyzedAt":"2026-08-16T11:31:27.956Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}