Hmbown/CodeWhale · error · PersistenceBacklogError
persistence measurement source tree is dirty
Error message
persistence measurement source tree is dirty
What it means
Raised in validate_receipt (scripts/check-persistence-backlog-budget.py:177-178) when require_clean_source is true (main() and validate_baseline_receipt both set it) and receipt.source_dirty is true. Backlog numbers from a dirty tree are untrustworthy because uncommitted code could change the measurement, so the gate demands a clean checkout.
Source
Thrown at scripts/check-persistence-backlog-budget.py:178
if not isinstance(receipt[field], str) or not receipt[field].startswith(prefix):
raise PersistenceBacklogError(f"receipt {field} must be a version string")
validate_frozen_field("build_profile", receipt["build_profile"], "test")
validate_frozen_field("sample_count", receipt["sample_count"], 1)
if expected_source is not None:
for field in (
"source_sha",
"source_dirty",
"rustc_version",
"cargo_version",
"build_profile",
"sample_count",
):
if receipt[field] != expected_source[field]:
raise PersistenceBacklogError(
f"receipt {field} does not match the checked source"
)
if require_clean_source and receipt["source_dirty"]:
raise PersistenceBacklogError("persistence measurement source tree is dirty")
platform = receipt["platform"]
if not isinstance(platform, str) or platform not in SUPPORTED_PLATFORMS:
raise PersistenceBacklogError("receipt platform is unsupported")
attempted = non_negative_integer(receipt["requests_attempted"], "requests_attempted")
accepted = non_negative_integer(receipt["accepted_requests"], "accepted_requests")
if accepted != attempted:
raise PersistenceBacklogError(
"accepted_requests must equal requests_attempted; sender rejection is not backlog improvement"
)
retained = non_negative_integer(
receipt["retained_queued_requests"], "retained_queued_requests"
)
if retained > accepted:
raise PersistenceBacklogError("retained_queued_requests exceeds accepted_requests")
for field in ("estimated_retained_payload_bytes", "enqueue_elapsed_ns"):
non_negative_integer(receipt[field], field)
if retained == 0 or receipt["estimated_retained_payload_bytes"] == 0:View on GitHub (pinned to 8880682c63)
Solutions
- Commit or stash your work (git stash --include-untracked), then re-measure.
- Add generated artifacts to .gitignore or remove them so `git status --porcelain` is empty.
- If the committed baseline receipt is dirty, re-measure it from a clean checkout and commit the replacement.
Example fix
# before git status --porcelain # -> M src/lib.rs python scripts/check-persistence-backlog-budget.py # after git stash --include-untracked && python scripts/check-persistence-backlog-budget.py
Defensive patterns
Strategy: validation
Validate before calling
dirty = subprocess.run(["git", "status", "porcelain", "--untracked-files=normal"], cwd=ROOT, text=True, capture_output=True).stdout
if dirty:
sys.exit("tree is dirty; commit or `git stash --include-untracked` before measuring") Try / catch
try:
validate_receipt(receipt, require_clean_source=True)
except PersistenceBacklogError as e:
if "source tree is dirty" in str(e):
print("clean the worktree and re-run scripts/measure-persistence-backlog.py")
raise Prevention
- Run `git status --porcelain` and require empty output before every measurement.
- gitignore generated artifacts so builds never dirty the tree.
- Commit the baseline receipt only from a clean verified checkout.
When it happens
Trigger: Running the measurement or baseline validation with uncommitted modifications or untracked files (git status --porcelain non-empty); the receipt recording source_dirty=true at capture time; a build artifact tracked as untracked noise.
Common situations: Local dev runs with work-in-progress changes; CI checkouts polluted by generated files; baseline receipt committed from a dirty tree.
Related errors
- receipt {field} does not match the checked source
- {context}: expected 'Name <id+login@users.noreply.github.com
- {context}: right-hand email must be numeric GitHub noreply,
- {path}:{lineno}: expected 'alias = Name <email>'
- {path}:{lineno}: duplicate alias {alias!r}
AI-assisted analysis of Hmbown/CodeWhale@8880682c63 (2026-08-16).
Data as JSON: /api/errors/296882440a24ab0f.
Report an issue: GitHub.