fix(ledger): report malformed entries during verification - #39
Conversation
71285b2 to
8de4e67
Compare
Bughunt adversarial gate: REQUEST CHANGESThe second and final automated gate round reproduced three HIGH-severity corruption paths on commit
All three were independently reproduced against the PR head. The streaming/counting logic, entry-shape validation, existing chain semantics, and regression coverage otherwise passed review. Per the bughunt merge guardrail, this PR is intentionally left open and unmerged after two gate rounds. A human should review the findings before another implementation round. |
8de4e67 to
abc6bb5
Compare
Return an integrity failure at the first corrupt ledger record instead of letting decoding, parser-limit, or structural errors crash audit and report commands. Enforce UTF-8, validate entry shape and content, preserve record counts, and cover the library, CLI, and reporting paths with regression tests.
abc6bb5 to
1f79020
Compare
Third adversarial gate: PASSThe final review found one consistency gap: Final evidence on commit
All findings from the three adversarial rounds are resolved. |
Summary
This bughunt fix makes ledger verification report every malformed record as an integrity failure instead of crashing audit or report commands, and keeps every ledger reader on the same strict UTF-8 boundary.
Bug
flightdeck audit verifyand reporting leaked uncaught decoding, parser-limit, type, key, or Unicode errors when a ledger record was corrupt. Byte input could also be auto-detected as UTF-16 and incorrectly verify or render as valid. These paths violated the documented UTF-8 JSONL integrity-failure contract.Root cause
Ledger readers assumed records were UTF-8 JSON objects with safe scalar content and every required field before parsing or chain verification.
Fix
entries()so audit tail cannot accept transcoded records.Testing
.venv/bin/python -m pytest tests/test_ledger.py tests/test_cli_and_html.py— 47 passed..venv/bin/python -m pytest --cov=flightdeck --cov-fail-under=85— 245 passed, 94.26% coverage..venv/bin/ruff check src tests— passed.