Hmbown/CodeWhale · error · PersistenceBacklogError
rss_during_delta_bytes is inconsistent
Error message
rss_during_delta_bytes is inconsistent
What it means
On the RSS-supported (macOS) lane, rss_during_delta_bytes must equal max(0, rss_during_bytes - rss_before_bytes): the delta is a derived field clamped at zero, and it must be arithmetically consistent with the raw samples. A mismatch means the receipt's deltas were computed or edited independently of the samples, breaking the measurement's internal consistency.
Solutions
- Re-run the measurement so deltas are recomputed from the same samples as the raw byte counts.
- Fix the generator to derive deltas exactly as max(0, during - before) at receipt-write time.
- Never edit deltas independently; if a ceiling fails, tighten or justify the budget instead of altering the receipt.
Example fix
// before
{"rss_before_bytes": 100, "rss_during_bytes": 90, "rss_during_delta_bytes": -10}
// after
# delta = max(0, during - before)
{"rss_before_bytes": 100, "rss_during_bytes": 90, "rss_during_delta_bytes": 0} Defensive patterns
Strategy: validation
Validate before calling
def rss_deltas_consistent(receipt):
before = receipt.get("rss_before_bytes", 0)
return (
receipt.get("rss_during_delta_bytes") == max(0, receipt.get("rss_during_bytes", 0) - before)
and receipt.get("rss_after_delta_bytes") == max(0, receipt.get("rss_after_bytes", 0) - before)
) Type guard
def is_non_negative_int(v):
return isinstance(v, int) and not isinstance(v, bool) and v >= 0 Try / catch
try:
validate_receipt(receipt)
except PersistenceBacklogError as e:
print(f"rss delta mismatch: {e}", file=sys.stderr)
sys.exit(2) Prevention
- Compute deltas in the same write path as the raw samples, never by hand.
- Use max(0, after - before) as the single canonical delta formula.
- If a ceiling fails, adjust the budget file — never massage receipt deltas to fit.
When it happens
Trigger: Raised by validate_receipt (macOS lane only, after rss_supported passes) when receipt['rss_during_delta_bytes'] != max(0, receipt['rss_during_bytes'] - receipt['rss_before_bytes']), from validate_baseline_receipt or compare.
Common situations: Recomputing raw RSS samples after a re-run while leaving stale deltas; a generator that clamps deltas differently (e.g. without max(0, ...)); hand-editing a delta to fit under a ceiling in the budget file.
Understand the failure class
Background: Checksum mismatch errors: "checksum verification failed", "digest mismatch", "expected vs actual checksum" — what they mean and how to fix them — this error's family across 41 libraries.
Related errors
- accepted_requests must equal requests_attempted; sender…
- applied_version is not the final sent version
- estimated_retained_payload_bytes is smaller than the frozen…
- final_version_applied must be true
- limitations must be a non-empty string array
AI-assisted analysis of Hmbown/CodeWhale@433685b202 (2026-09-15).
Data as JSON: /api/errors/9fb568fa2d2df175.
Report an issue: GitHub.
Appendix: 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 433685b202)