Skip to content

test(checksums): pin signed-byte rolling Adler regression fixture - #3636

Merged
oferchen merged 1 commit into
masterfrom
test/rolling-signed-byte-regression-2076
May 5, 2026
Merged

oferchen merged 1 commit into
masterfrom
test/rolling-signed-byte-regression-2076

Conversation

@oferchen

@oferchen oferchen commented May 5, 2026

Copy link
Copy Markdown
Owner

Summary

Adds hand-computed (s1, s2) regression fixtures for the rolling Adler checksum at inputs dominated by bytes >= 0x80.

PR #3560 fixed a sign-extension bug where bytes >= 0x80 were treated as unsigned, diverging from upstream's schar *buf cast (checksum.c:285). The existing parity proptest in crates/checksums/tests/rolling_simd_parity.rs covers this via a self-contained reference, but a corrupted reference would silently mask a regression.

This file pins offline-computed expected values that fail loud if the impl reverts to unsigned interpretation, regardless of what the proptest reference does.

What's covered

  • [0x80, 0x81, 0x82, 0x83] — small scalar path
  • 16 bytes of 0x80 — SSE2/NEON block boundary
  • 32 bytes of 0xFF — AVX2 block boundary
  • 33 bytes of 0xC0 — AVX2 boundary +1 (tail handling)
  • single byte 0x80 — smallest signed/unsigned divergence
  • 5-byte rolling-window roll() with mid-byte signed digit changes
  • explicit negative control: assert the unsigned-interpretation digest is != the actual digest

All expected values derived from (byte as i8) as i32 summation with & 0xffff applied only at the end, matching upstream checksum.c:285 and match.c:hash_search().

Why now

This regression guard lands ahead of internal matching-pipeline work that touches the rolling-hash hot loop (bithash prefilter, sequential-match heuristic, matched-block pruning). It is purely additive — no production code changes.

Hand-computed (s1, s2) values for inputs dominated by bytes >= 0x80.
Guards against any future rolling-checksum change that reverts to
unsigned interpretation, even if the parity test reference drifts.

Sizes chosen on SSE2/NEON 16-byte and AVX2 32-byte block boundaries
plus +/- 1 neighbours. Includes a negative-control test asserting
that the unsigned-interpretation digest is visibly different.
@github-actions github-actions Bot added the test label May 5, 2026
@oferchen
oferchen merged commit f825280 into master May 5, 2026
40 checks passed
@oferchen
oferchen deleted the test/rolling-signed-byte-regression-2076 branch May 5, 2026 09:41
oferchen added a commit that referenced this pull request May 18, 2026
)

Hand-computed (s1, s2) values for inputs dominated by bytes >= 0x80.
Guards against any future rolling-checksum change that reverts to
unsigned interpretation, even if the parity test reference drifts.

Sizes chosen on SSE2/NEON 16-byte and AVX2 32-byte block boundaries
plus +/- 1 neighbours. Includes a negative-control test asserting
that the unsigned-interpretation digest is visibly different.
oferchen added a commit that referenced this pull request Aug 24, 2026
)

Hand-computed (s1, s2) values for inputs dominated by bytes >= 0x80.
Guards against any future rolling-checksum change that reverts to
unsigned interpretation, even if the parity test reference drifts.

Sizes chosen on SSE2/NEON 16-byte and AVX2 32-byte block boundaries
plus +/- 1 neighbours. Includes a negative-control test asserting
that the unsigned-interpretation digest is visibly different.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant