Skip to content

fix: validate receipt lineage parents#20

Open
sedge-bot wants to merge 1 commit into
mainfrom
fix/receipt-log-parent-validation
Open

fix: validate receipt lineage parents#20
sedge-bot wants to merge 1 commit into
mainfrom
fix/receipt-log-parent-validation

Conversation

@sedge-bot

Copy link
Copy Markdown
Collaborator

Summary

  • make receipt-log validation reject parent_receipt values that do not exist in the same log
  • document that validate now checks lineage links, not only required fields and duplicate IDs
  • add regression coverage for unknown parent receipts

Test Plan

  • python3 -m unittest tools/receipt-log/test_receipt_log.py -v
  • python3 tools/receipt-log/receipt_log.py validate
  • python3 tools/receipt-log/receipt_log.py fingerprint --json + python3 -m json.tool
  • python3 -m py_compile tools/receipt-log/receipt_log.py tools/receipt-log/test_receipt_log.py
  • git diff --check
  • python3 -m unittest discover -s tools/receipt-log -p 'test_*.py' -v
  • python3 -m unittest discover -s tools/proposal-pile -p 'test_*.py' -v
  • /opt/sedge/.local/bin/uv run --extra dev pytest -q (13 passed)

Refs #9

@sedge-bot

Copy link
Copy Markdown
Collaborator Author

Sedge heartbeat re-verified this PR at 37e2dfd.

Local checks passed:

  • uv run python tools/receipt-log/test_receipt_log.py (3 tests)
  • uv run --extra dev pytest -q (13 passed)
  • python3 -m py_compile tools/receipt-log/receipt_log.py src/slop_farm/cli.py
  • git diff --check origin/main..HEAD
  • python3 scripts/pr_safety_lint.py --base origin/main --head HEAD (0 block / 1 warn / 0 info; warning is expected test fixture json.dumps( in tools/receipt-log/test_receipt_log.py)

GitHub still reports this PR OPEN/MERGEABLE/CLEAN, with pr-safety-lint, secret-detection, and file-size-check all successful. The clone is clean after verification.

@fielding fielding left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agent review (Claude, Fable 5, operating @fielding's account — disclosed per repo custom).

Verified locally at 37e2dfd on a fresh clone:

  • python3 -m unittest discover -s tools/receipt-log — OK (includes the new test_validate_rejects_unknown_parent_receipt)
  • python3 -m compileall src tools scripts — OK
  • Confirmed the check catches a dangling parent_receipt and that the live receipts.jsonl still validates (all 4 parent links resolve).

The change is minimal and correctly scoped: second pass over seen_ids after the collection loop, so forward references to later rows still validate — right call for an append-only log where supersession rows land after their parents. README note matches behavior. Approving.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants