Hmbown/CodeWhale · error · PersistenceBacklogError
rss_during_delta_bytes is inconsistent
Error message
rss_during_delta_bytes is inconsistent
What it means
Raised by validate_receipt() in scripts/check-persistence-backlog-budget.py when a receipt with rss_supported=true records rss_during_delta_bytes that is not exactly max(0, rss_during_bytes - rss_before_bytes). The raw RSS samples are treated as ground truth and the delta column must be a deterministic, clamped-at-zero recompute of them, so any mismatch means the receipt was hand-edited or produced by a buggy sampler. This integrity check runs before the receipt is compared against the budget ceilings.
Source
Thrown at scripts/check-persistence-backlog-budget.py:233
isinstance(item, str) and item for item in limitations
):
raise PersistenceBacklogError("limitations must be a non-empty string array")
if not isinstance(receipt["rss_supported"], bool):
raise PersistenceBacklogError("rss_supported must be boolean")
if receipt["rss_supported"] != (platform == "macos"):
raise PersistenceBacklogError(
"rss_supported must be true exactly on the macOS measurement lane"
)
rss_fields = RSS_SAMPLE_FIELDS + RSS_DELTA_FIELDS
if receipt["rss_supported"]:
for field in rss_fields:
non_negative_integer(receipt[field], field)
before = receipt["rss_before_bytes"]
if receipt["rss_during_delta_bytes"] != max(
0, receipt["rss_during_bytes"] - before
):
raise PersistenceBacklogError("rss_during_delta_bytes is inconsistent")
if receipt["rss_after_delta_bytes"] != max(
0, receipt["rss_after_bytes"] - before
):
raise PersistenceBacklogError("rss_after_delta_bytes is inconsistent")
elif any(receipt[field] is not None for field in rss_fields):
raise PersistenceBacklogError("unsupported RSS fields must be null")
def validate_budget(budget: dict[str, Any]) -> None:
if budget.get("document_kind") != BUDGET_KIND:
raise PersistenceBacklogError(f"budget document_kind must be {BUDGET_KIND}")
if budget.get("schema_version") != SCHEMA_VERSION:
raise PersistenceBacklogError("budget schema_version changed")
fixture = budget.get("fixture")
if not isinstance(fixture, dict) or set(fixture) != set(FIXTURE):
raise PersistenceBacklogError("budget fixture no longer matches the frozen workload")
for field, expected in FIXTURE.items():
if type(fixture[field]) is not type(expected) or fixture[field] != expected:View on GitHub (pinned to 8880682c63)
Solutions
- Recompute and write rss_during_delta_bytes = max(0, rss_during_bytes - rss_before_bytes) in the receipt
- Prefer regenerating the receipt entirely: python scripts/measure-persistence-backlog.py > receipt.json
- If the sampler itself emits inconsistent deltas, fix its delta computation to use the identical clamp formula
- Re-run scripts/check-persistence-backlog-budget.py --receipt receipt.json to confirm
Example fix
// before (receipt.json) "rss_before_bytes": 18923520, "rss_during_bytes": 28377088, "rss_during_delta_bytes": 9453000 // after: 28377088 - 18923520 = 9453568 "rss_before_bytes": 18923520, "rss_during_bytes": 28377088, "rss_during_delta_bytes": 9453568
Defensive patterns
Strategy: validation
Validate before calling
def rss_during_delta_consistent(receipt: dict) -> bool:
if not receipt.get("rss_supported"):
return receipt.get("rss_during_delta_bytes") is None
return receipt["rss_during_delta_bytes"] == max(
0, receipt["rss_during_bytes"] - receipt["rss_before_bytes"]
)
# call before compare(receipt, budget) Type guard
from typing import TypeGuard
def has_consistent_rss_deltas(r: dict) -> TypeGuard[dict]:
before = r["rss_before_bytes"]
return (r["rss_during_delta_bytes"] == max(0, r["rss_during_bytes"] - before)
and r["rss_after_delta_bytes"] == max(0, r["rss_after_bytes"] - before)) Try / catch
try:
increases, decreases = compare(receipt, budget)
except PersistenceBacklogError as error:
print(f"[persistence-backlog-budget] ERROR: {error}", file=sys.stderr)
raise SystemExit(2) from error Prevention
- Never hand-edit receipt JSON; regenerate it with scripts/measure-persistence-backlog.py
- Keep the clamp formula max(0, sample - rss_before_bytes) in one shared helper used by both the sampler and the checker
- Run scripts/test_check_persistence_backlog_budget.py after touching any RSS handling
When it happens
Trigger: Calling compare()/validate_receipt() with rss_supported true and rss_during_delta_bytes differing from max(0, rss_during_bytes - rss_before_bytes) - e.g. an off-by-one edit, a delta computed from a stale rss_during_bytes sample, or an unclamped negative difference stored as anything other than 0. The repo's own tests trigger it by bumping rss_during_delta_bytes by 1 (test_rss_delta_must_match_samples).
Common situations: Hand-editing a receipt JSON to nudge a number; refactoring scripts/measure-persistence-backlog.py so it samples RSS in a different order or drops the max(0, ...) clamp; mixing in receipts from an older schema where deltas were computed differently; KB-vs-bytes unit confusion.
Related errors
- rss_after_delta_bytes is inconsistent
- unsupported RSS fields must be null
- baseline_observation must retain the final request and paylo
- budget document_kind must be {BUDGET_KIND}
- budget schema_version changed
AI-assisted analysis of Hmbown/CodeWhale@8880682c63 (2026-08-16).
Data as JSON: /api/errors/9fb568fa2d2df175.
Report an issue: GitHub.