test(match): zsync sparse-match adversarial fixture#3657
Merged
Conversation
Add an integration test that drives DeltaSignatureIndex::build + DeltaGenerator::generate over basis/source pairs where almost no basis blocks recur in source. Pins today's pre-bithash baseline matching behaviour for the rolling-hash hot path so the planned prefilter work (#2059) can be benchmarked against a fixed accuracy reference. The matrix sweeps planted block counts K in {0, 1, 2}, basis sizes in {64 KB, 1 MB, 16 MB}, block sizes in {1024, 4096}, and strong checksum algorithms (MD5, XXH3-64). The 16 MB cases are gated behind #[ignore] so default cargo nextest runs only the smaller fixtures; stress-test CI matrices opt in via --run-ignored only.
ea7f97a to
8b94112
Compare
oferchen
added a commit
that referenced
this pull request
May 18, 2026
* test(match): zsync sparse-match adversarial fixture Add an integration test that drives DeltaSignatureIndex::build + DeltaGenerator::generate over basis/source pairs where almost no basis blocks recur in source. Pins today's pre-bithash baseline matching behaviour for the rolling-hash hot path so the planned prefilter work (#2059) can be benchmarked against a fixed accuracy reference. The matrix sweeps planted block counts K in {0, 1, 2}, basis sizes in {64 KB, 1 MB, 16 MB}, block sizes in {1024, 4096}, and strong checksum algorithms (MD5, XXH3-64). The 16 MB cases are gated behind #[ignore] so default cargo nextest runs only the smaller fixtures; stress-test CI matrices opt in via --run-ignored only. * style: cargo fmt * fix(test): inline format args in sparse-match assert
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
crates/match/tests/sparse_match_fixture.rs, an integration test that drives the productionDeltaSignatureIndex::from_signature+DeltaGenerator::generatepipeline over synthetic basis/source pairs where almost no basis blocks recur in source. Exercises the rolling-hash hot path under near-constant rejection, the worst case identified indocs/design/zsync-inspired-matching.mdthat the planned bithash prefilter (#2059) targets. Pins today's pre-bithash matching accuracy as a baseline so future prefilter work can be benchmarked without regression risk.Matrix coverage
Kin{0, 1, 2}(K=0 is the most important: full literal stream, exercises the no-match hot path).{64 KB, 1 MB, 16 MB}. The 16 MB cases are marked#[ignore]so defaultcargo nextestruns only the 64 KB and 1 MB fixtures; stress-test CI matrices opt in via--run-ignored only.{1024, 4096}.Wire-compat invariants confirmed
KCopytokens at basis indices0..K, in order.matched_bytes == K * block_size,literal_bytes == source.len() - K * block_size,total_bytes == source.len().[0, 0x7f]) and source non-planted bytes (in[0x80, 0xff]) makes the "no-match" property robust at every sliding-window alignment, not just block-aligned offsets. A construction sanity-check asserts this directly on the smallest fixture.rsum.c:362-366) and asserts only the byte-level invariants.Test plan
fmt+clippy,nextest (stable), Windows, macOS, Linux musl all green.cargo nextest run -p matchingskips the#[ignore]-marked 16 MB cases.cargo nextest run -p matching --run-ignored onlyruns the stress fixtures in the opt-in matrix.