Skip to content

WI-151: emit IFSC slice checksums in the PAR2 test fixture - #143

Merged
thedancingdeveloper merged 2 commits into
mainfrom
feat/wi-151-par2-slice-fixtures
Sep 10, 2026
Merged

thedancingdeveloper merged 2 commits into
mainfrom
feat/wi-151-par2-slice-fixtures

Conversation

@thedancingdeveloper

Copy link
Copy Markdown
Collaborator

First piece of the WI-151 deterministic PAR2 damage fixtures (parity-in-flight initiative). Independent of the WI-143/#140 and WI-144/#141 branches.

What

The synthesised PAR2 index (crates/nzb-postproc/tests/support/par2_fixture.rs) only carried Main + FileDesc packets, so fixtures had no per-slice checksums and rust_par2 reported every file as damaged. This adds IFSC (Input File Slice Checksum) packets: per file, the File ID followed by (MD5[16] + CRC32[4]) per slice, with the final partial slice zero-padded to the slice size — exactly as PAR2 and rust_par2's verifier compute them. Adds a crc32fast dev-dependency.

This is what the in-flight slice verifier (WI-144, #141) will check decoded slices against.

Proof it's byte-exact (tests/par2_slice_fixture.rs)

  • Intact file verifies through the slice checksumsrust_par2::verify(...).all_correct().
  • A single corrupted slice is pinpointeddamaged_block_indices == [1] after flipping a byte in slice 1, which only holds if the per-slice MD5/CRC32 are correct.

Full nzb-postproc suite stays green (59 unit + existing fixture/deobfuscation tests unaffected); fmt + clippy -D warnings clean.

Out of scope (remaining WI-151, follow-ups)

  • RecoverySlice (RecvSlic) packets for repair fixtures (WI-146/148) — needs a PAR2 encoder.
  • mock-NNTP fault-injection timelines (430-then-200, 430 everywhere, busy-provider double-430, transport timeout, wrong body, damage>recovery, partial post).
  • Shared-harness home so nzb-decode and the ledger tests can reuse the generator (ties into WI-105).

🤖 Generated with Claude Code

https://claude.ai/code/session_01TpoFnScdkRq7qxQLQZe1we

…-151)

The synthesised PAR2 index only carried Main + FileDesc packets, so a
fixture set had no per-slice checksums and rust_par2 reported every file
as damaged. Emit IFSC (Input File Slice Checksum) packets too: per file,
the File ID followed by (MD5[16] + CRC32[4]) for each slice, with the
final partial slice zero-padded to the slice size exactly as PAR2 and
rust_par2's verifier compute them.

This is the first piece of the WI-151 deterministic PAR2 fixtures and is
what the in-flight slice verifier (WI-144) will check decoded slices
against. Two tests prove the checksums are byte-exact: an intact file
verifies through the slice checksums, and a single corrupted slice is
pinpointed by its block index (which only works if the per-slice MD5/CRC
are correct). Full nzb-postproc suite stays green.

RecoverySlice packets remain out of scope here (they need the encoder and
only matter for repair fixtures, WI-146/148).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TpoFnScdkRq7qxQLQZe1we
@thedancingdeveloper
thedancingdeveloper merged commit 7a5c083 into main Sep 10, 2026
9 of 11 checks passed
@thedancingdeveloper
thedancingdeveloper deleted the feat/wi-151-par2-slice-fixtures branch September 10, 2026 05:12
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.

1 participant