{"record":{"id":"50ce881425833fdf","repo":"Hmbown/CodeWhale","slug":"limitations-must-be-a-non-empty-string-array","errorCode":null,"errorMessage":"limitations must be a non-empty string array","messagePattern":"limitations must be a non-empty string array","errorType":"exception","errorClass":"PersistenceBacklogError","httpStatus":null,"severity":"error","filePath":"scripts/check-persistence-backlog-budget.py","lineNumber":217,"sourceCode":"        )\n    minimum_payload_bytes = retained * FIXTURE[\"content_bytes_per_request\"]\n    if receipt[\"estimated_retained_payload_bytes\"] < minimum_payload_bytes:\n        raise PersistenceBacklogError(\n            \"estimated_retained_payload_bytes is smaller than the frozen retained content\"\n        )\n    applied = non_negative_integer(\n        receipt[\"applied_version\"], \"applied_version\"\n    )\n    if applied != FIXTURE[\"expected_applied_version\"]:\n        raise PersistenceBacklogError(\"applied_version is not the final sent version\")\n    if receipt[\"final_version_applied\"] is not True:\n        raise PersistenceBacklogError(\"final_version_applied must be true\")\n\n    limitations = receipt[\"limitations\"]\n    if not isinstance(limitations, list) or not limitations or not all(\n        isinstance(item, str) and item for item in limitations\n    ):\n        raise PersistenceBacklogError(\"limitations must be a non-empty string array\")\n\n    if not isinstance(receipt[\"rss_supported\"], bool):\n        raise PersistenceBacklogError(\"rss_supported must be boolean\")\n    if receipt[\"rss_supported\"] != (platform == \"macos\"):\n        raise PersistenceBacklogError(\n            \"rss_supported must be true exactly on the macOS measurement lane\"\n        )\n    rss_fields = RSS_SAMPLE_FIELDS + RSS_DELTA_FIELDS\n    if receipt[\"rss_supported\"]:\n        for field in rss_fields:\n            non_negative_integer(receipt[field], field)\n        before = receipt[\"rss_before_bytes\"]\n        if receipt[\"rss_during_delta_bytes\"] != max(\n            0, receipt[\"rss_during_bytes\"] - before\n        ):\n            raise PersistenceBacklogError(\"rss_during_delta_bytes is inconsistent\")\n        if receipt[\"rss_after_delta_bytes\"] != max(\n            0, receipt[\"rss_after_bytes\"] - before","sourceCodeStart":199,"sourceCodeEnd":235,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/8880682c63083a91624de936797efa3ce9e498fd/scripts/check-persistence-backlog-budget.py#L199-L235","documentation":"Raised in validate_receipt (scripts/check-persistence-backlog-budget.py:213-217) when limitations is not a list, is empty, or contains a non-string or empty string. Every measurement receipt must carry at least one honest caveat about the measurement, so unqualified numbers cannot be presented as absolute.","triggerScenarios":"The Rust emitter writing [] or omitting caveats; null entries; whitespace-only strings; a schema change that moved limitations elsewhere without updating the emitter.","commonSituations":"Emitter simplification that dropped the caveats block; receipts from an older schema where limitations was optional; hand-trimmed JSON.","solutions":["Restore the limitations list in the Rust measurement test with at least one meaningful string (e.g. single-sample variance, platform specificity).","Regenerate the receipt.","Keep the field non-optional in any schema refactor — the checker enforces non-emptiness."],"exampleFix":"// receipt (before)\n\"limitations\": []\n// receipt (after)\n\"limitations\": [\"single-sample measurement; variance not captured\"]","handlingStrategy":"type-guard","validationCode":"lim = receipt.get(\"limitations\")\nif not isinstance(lim, list) or not lim or not all(isinstance(s, str) and s for s in lim):\n    sys.exit(\"limitations must be a non-empty array of non-empty strings\")","typeGuard":"def is_valid_limitations(value) -> bool:\n    return isinstance(value, list) and len(value) > 0 and all(isinstance(s, str) and s for s in value)","tryCatchPattern":"try:\n    validate_receipt(receipt)\nexcept PersistenceBacklogError as e:\n    if \"limitations\" in str(e):\n        raise RuntimeError(\"receipt lacks measurement caveats; restore the emitter's limitations block\") from e\n    raise","preventionTips":["Always emit at least one caveat (e.g. single-sample variance) in the Rust writer.","Keep limitations mandatory in schema refactors.","Never trim limitations when hand-reviewing receipt JSON."],"tags":["validation","json","documentation"],"backgroundTag":null,"analyzedSha":"8880682c63083a91624de936797efa3ce9e498fd","analyzedAt":"2026-08-16T11:31:27.956Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}