-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Summary
Add checksum (e.g. CRC-32) for each record (payload or header+payload—document which). Validate checksum on every read/scan; return a rich error (offset, file position, reason) when corruption is detected.
Scope
- Compute checksum when encoding (using existing header format from Day 2); verify when decoding in read/scan paths.
- Define checksum scope in
docs/file-format.md(payload only vs header+payload). - Error type: include offset, file position, and message (e.g. "checksum mismatch at offset X, position Y").
- Tests: append valid records; corrupt one byte in a record (in payload or checksum field); next read/scan must fail with the corruption error and not panic. Optionally: corrupt padding/magic and assert appropriate errors.
Acceptance criteria
- Every record read or scanned is checksum-verified.
- Corruption produces a deterministic, informative error (no unwrap in hot path).
- Tests prove that corruption is detected and reported correctly.
Suggested commit
feat: add per-record checksum verification and corruption errors
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels