Skip to content

Fix overflow in filter shortcut counting - #2061

Merged
oferchen merged 1 commit into
masterfrom
decompose-source-files-over-500-lines
Nov 8, 2025
Merged

oferchen merged 1 commit into
masterfrom
decompose-source-files-over-500-lines

Conversation

@oferchen

@oferchen oferchen commented Nov 8, 2025 •

Copy link
Copy Markdown
Owner

Summary

  • store the count of -F shortcuts as a usize throughout CLI parsing and fallback argument plumbing
  • avoid truncating large shortcut counts by removing the lossy cast in the filter argument collector

Testing

  • cargo test -p oc-rsync-cli parse_args_collects_filter_patterns -- --nocapture

[Codex Task](

@oferchen
oferchen merged commit 788f949 into master Nov 8, 2025
@oferchen
oferchen deleted the decompose-source-files-over-500-lines branch November 8, 2025 11:28
oferchen added a commit that referenced this pull request May 5, 2026
Translate zsync librcksum's bithash mechanism into oc-rsync without
touching the wire. Establish the bit-array shape and the
BITHASHBITS=3 sizing rationale, name the exact insertion points in
the existing index, fix the bit-mixing function on the 32-bit packed
rolling sum, restate the no-missed-match property invariant, and
list every layer the change must keep byte-identical to upstream
3.0.9 / 3.1.3 / 3.4.1.

Bench scaffolding is cfg-gated and never reaches a CLI flag.
Implementation is tracked in #2060/#2061; tests in #2062; bench in
#2063.
oferchen added a commit that referenced this pull request May 5, 2026
)

Pin the parameters, invariants, and pass/fail thresholds for the
extreme sparse-match fixture: a 100 MiB basis where one block in
25600 matches the target. The fixture is the principal large-N
evidence gate for the bithash prefilter (#2061) before it lands in
release configuration.
oferchen added a commit that referenced this pull request May 5, 2026
#3723)

Add design note for the canonical zsync-style insertion adversary at
docs/design/zsync-shifted-insertion-test.md, pinning the public-API
guard for the four pipeline optimizations enumerated in
docs/design/zsync-inspired-matching.md (#2053). Documents the
fixture parameters, expected match output for aligned vs unaligned
regimes, the upstream rsync --stats comparison oracle, CI integration
gated by SIMD parity (#2077), and the failure modes (signed-byte
regression #2076 class, off-by-one in seek, bithash false negative
#2061-#2063 class, want_i hint off-by-one, rolling-window reset bugs,
strong-checksum truncation drift, ring-buffer wrap bugs).

Cites the existing fixture at crates/match/tests/shifted_insertion_fixture.rs,
the sibling rsum-collision fixture from #2078, and the rolling
sign-extension fix from PR #3560 (commit 723a0a0).
oferchen added a commit that referenced this pull request May 6, 2026
* feat(match): add zsync-inspired bithash prefilter to MatchIndex

Translate zsync's librcksum bithash gate into oc-rsync's existing
DeltaSignatureIndex. The bithash is an oversized one-sided bit array
sized to roughly 8x the rsum-bucket count and probed after the
1 KB tag_table check but before the FxHashMap walk. At the design
saturation density (1/8) it rejects ~7/8 of post-tag misses for
purely receiver-side CPU savings.

The prefilter is in-memory only: no signature payload, NDX framing,
capability negotiation, multiplex frame, golden-byte fixture, or
interop matrix is touched. Sizing follows docs/design/zsync-bithash.md
sections 1 and 2; insertion and probe sites match section 3 exactly.

Wires into populate_index alongside tag_table and lookup, and into
DeltaSignatureIndex::rebuild via clear() to recycle across the
INC_RECURSE per-segment rebuild path. The probe goes into both
find_match_bytes and find_match_slices; check_block_match_slices is
intentionally not gated since it bypasses the hash table.

Property tests pin the no-false-negative contract end-to-end (every
inserted basis block is still found) and at the BitHash level
(contains is true for every previously inserted rsum, including
across clear/reinsert cycles).

Closes #2060
Closes #2061
Closes #2062

* fix(deps): regenerate Cargo.lock for proptest dev-dep
oferchen added a commit that referenced this pull request May 18, 2026
Translate zsync librcksum's bithash mechanism into oc-rsync without
touching the wire. Establish the bit-array shape and the
BITHASHBITS=3 sizing rationale, name the exact insertion points in
the existing index, fix the bit-mixing function on the 32-bit packed
rolling sum, restate the no-missed-match property invariant, and
list every layer the change must keep byte-identical to upstream
3.0.9 / 3.1.3 / 3.4.1.

Bench scaffolding is cfg-gated and never reaches a CLI flag.
Implementation is tracked in #2060/#2061; tests in #2062; bench in
#2063.
oferchen added a commit that referenced this pull request May 18, 2026
)

Pin the parameters, invariants, and pass/fail thresholds for the
extreme sparse-match fixture: a 100 MiB basis where one block in
25600 matches the target. The fixture is the principal large-N
evidence gate for the bithash prefilter (#2061) before it lands in
release configuration.
oferchen added a commit that referenced this pull request May 18, 2026
#3723)

Add design note for the canonical zsync-style insertion adversary at
docs/design/zsync-shifted-insertion-test.md, pinning the public-API
guard for the four pipeline optimizations enumerated in
docs/design/zsync-inspired-matching.md (#2053). Documents the
fixture parameters, expected match output for aligned vs unaligned
regimes, the upstream rsync --stats comparison oracle, CI integration
gated by SIMD parity (#2077), and the failure modes (signed-byte
regression #2076 class, off-by-one in seek, bithash false negative
#2061-#2063 class, want_i hint off-by-one, rolling-window reset bugs,
strong-checksum truncation drift, ring-buffer wrap bugs).

Cites the existing fixture at crates/match/tests/shifted_insertion_fixture.rs,
the sibling rsum-collision fixture from #2078, and the rolling
sign-extension fix from PR #3560 (commit 723a0a0).
oferchen added a commit that referenced this pull request May 18, 2026
* feat(match): add zsync-inspired bithash prefilter to MatchIndex

Translate zsync's librcksum bithash gate into oc-rsync's existing
DeltaSignatureIndex. The bithash is an oversized one-sided bit array
sized to roughly 8x the rsum-bucket count and probed after the
1 KB tag_table check but before the FxHashMap walk. At the design
saturation density (1/8) it rejects ~7/8 of post-tag misses for
purely receiver-side CPU savings.

The prefilter is in-memory only: no signature payload, NDX framing,
capability negotiation, multiplex frame, golden-byte fixture, or
interop matrix is touched. Sizing follows docs/design/zsync-bithash.md
sections 1 and 2; insertion and probe sites match section 3 exactly.

Wires into populate_index alongside tag_table and lookup, and into
DeltaSignatureIndex::rebuild via clear() to recycle across the
INC_RECURSE per-segment rebuild path. The probe goes into both
find_match_bytes and find_match_slices; check_block_match_slices is
intentionally not gated since it bypasses the hash table.

Property tests pin the no-false-negative contract end-to-end (every
inserted basis block is still found) and at the BitHash level
(contains is true for every previously inserted rsum, including
across clear/reinsert cycles).

Closes #2060
Closes #2061
Closes #2062

* fix(deps): regenerate Cargo.lock for proptest dev-dep
oferchen added a commit that referenced this pull request Aug 24, 2026
Translate zsync librcksum's bithash mechanism into oc-rsync without
touching the wire. Establish the bit-array shape and the
BITHASHBITS=3 sizing rationale, name the exact insertion points in
the existing index, fix the bit-mixing function on the 32-bit packed
rolling sum, restate the no-missed-match property invariant, and
list every layer the change must keep byte-identical to upstream
3.0.9 / 3.1.3 / 3.4.1.

Bench scaffolding is cfg-gated and never reaches a CLI flag.
Implementation is tracked in #2060/#2061; tests in #2062; bench in
#2063.
oferchen added a commit that referenced this pull request Aug 24, 2026
)

Pin the parameters, invariants, and pass/fail thresholds for the
extreme sparse-match fixture: a 100 MiB basis where one block in
25600 matches the target. The fixture is the principal large-N
evidence gate for the bithash prefilter (#2061) before it lands in
release configuration.
oferchen added a commit that referenced this pull request Aug 24, 2026
#3723)

Add design note for the canonical zsync-style insertion adversary at
docs/design/zsync-shifted-insertion-test.md, pinning the public-API
guard for the four pipeline optimizations enumerated in
docs/design/zsync-inspired-matching.md (#2053). Documents the
fixture parameters, expected match output for aligned vs unaligned
regimes, the upstream rsync --stats comparison oracle, CI integration
gated by SIMD parity (#2077), and the failure modes (signed-byte
regression #2076 class, off-by-one in seek, bithash false negative
#2061-#2063 class, want_i hint off-by-one, rolling-window reset bugs,
strong-checksum truncation drift, ring-buffer wrap bugs).

Cites the existing fixture at crates/match/tests/shifted_insertion_fixture.rs,
the sibling rsum-collision fixture from #2078, and the rolling
sign-extension fix from PR #3560 (commit 723a0a0).
oferchen added a commit that referenced this pull request Aug 24, 2026
* feat(match): add zsync-inspired bithash prefilter to MatchIndex

Translate zsync's librcksum bithash gate into oc-rsync's existing
DeltaSignatureIndex. The bithash is an oversized one-sided bit array
sized to roughly 8x the rsum-bucket count and probed after the
1 KB tag_table check but before the FxHashMap walk. At the design
saturation density (1/8) it rejects ~7/8 of post-tag misses for
purely receiver-side CPU savings.

The prefilter is in-memory only: no signature payload, NDX framing,
capability negotiation, multiplex frame, golden-byte fixture, or
interop matrix is touched. Sizing follows docs/design/zsync-bithash.md
sections 1 and 2; insertion and probe sites match section 3 exactly.

Wires into populate_index alongside tag_table and lookup, and into
DeltaSignatureIndex::rebuild via clear() to recycle across the
INC_RECURSE per-segment rebuild path. The probe goes into both
find_match_bytes and find_match_slices; check_block_match_slices is
intentionally not gated since it bypasses the hash table.

Property tests pin the no-false-negative contract end-to-end (every
inserted basis block is still found) and at the BitHash level
(contains is true for every previously inserted rsum, including
across clear/reinsert cycles).

Closes #2060
Closes #2061
Closes #2062

* fix(deps): regenerate Cargo.lock for proptest dev-dep
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