Skip to content

Fix ignore-times handling for identical timestamps - #2070

Merged
oferchen merged 1 commit into
masterfrom
fix-test-failure-in-transfer-request-tests
Nov 8, 2025
Merged

oferchen merged 1 commit into
masterfrom
fix-test-failure-in-transfer-request-tests

Conversation

@oferchen

@oferchen oferchen commented Nov 8, 2025 •

Copy link
Copy Markdown
Owner

Summary

  • update the local copy comparator to skip content-based equality checks when mtimes already match so we mirror upstream ignore-times behaviour
  • add a core-level regression test for sequential runs and register it in the client test suite

Testing

  • cargo test -p oc-rsync-cli transfer_request_with_ignore_times_forces_copy_despite_matching_timestamps
  • cargo test -p oc-rsync-core sequential_runs_respect_ignore_times

[Codex Task](

@oferchen
oferchen merged commit bdc30be into master Nov 8, 2025
@oferchen
oferchen deleted the fix-test-failure-in-transfer-request-tests branch November 8, 2025 14:59

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines 115 to 118
return false;
}

if src == dst && source.is_file() && destination.is_file() {
return files_content_matches(source_path, destination_path).unwrap_or(false);
}

true

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Removing identical-mtime content check skips modified files

After the change, should_skip_copy immediately returns true whenever the file sizes match and the mtimes fall within the modify window, without verifying the file contents. This means a file whose contents change but whose mtime is deliberately preserved will now be skipped unless the caller explicitly enables --checksum. The existing unit tests in this module (should_skip_copy_detects_content_changes_with_identical_timestamps) rely on the previous behaviour and will now fail (cargo test -p oc-rsync-engine), and more importantly the transfer logic will silently ignore data updates that share an mtime with the destination. Consider retaining the files_content_matches guard or otherwise ensuring modified files are copied when timestamps collide.

Useful? React with 👍 / 👎.

oferchen added a commit that referenced this pull request May 5, 2026
…tness (#3644)

Sub-design for the prune insertion point of
`docs/design/zsync-inspired-matching.md` (#2068, blocking impl #2069,
proptest #2070, benchmark #2071).

Covers what zsync does at write_blocks (rsum.c:109-119) and how
oc-rsync mirrors it inside crates/match/. Pins the insertion to the
inner-loop COPY emit at generator.rs:214. Specifies the MatchedBlocks
bitmap (1 bit per signature block, 128 B at 1k blocks, 12.5 MB at
100M), placement alongside DeltaSignatureIndex, and the extended probe
order (bithash -> tag_table -> bucket lookup -> bitmap filter ->
strong-checksum). Spells out duplicate-bucket correctness with a
worked example, the property-test contract, and the bench corpora
(VM disk images, log tarballs, synthetic). Restates the wire-compat
invariants and the no-CLI/no-protocol cleanup contract.
oferchen added a commit that referenced this pull request May 6, 2026
Introduce MatchedBlocks, a per-generator-session bitmap that records
which basis blocks have already been emitted as DeltaToken::Copy. The
delta generator threads the bitmap into find_match_slices_filtered so
that already-matched basis blocks are skipped before the strong-checksum
verify, mirroring zsync librcksum's matched-block hash removal in
hash.c:111-128 (remove_block_from_hash) triggered at write_blocks
(rsum.c:109-119).

Bits are keyed by basis block_idx, not by (rsum, strong) tuple. Two
blocks with identical content live at distinct block_idx slots, so
marking one leaves the other findable. Pruning only changes which
sibling block_idx is named in a Copy token when duplicate content
exists; the receiver applies the same bytes either way, so the wire
output stays equivalent (golden byte tests unchanged).

The want_i adjacent-match hint deliberately bypasses the bitmap: the
hint targets the just-matched index plus one, which the bitmap leaves
unset by construction.

Property tests pin two contracts from docs/design/zsync-prune.md:

  prune_does_not_reduce_matched_bytes:
    For sources built from a permutation of unique basis-block
    positions, total Copy-token bytes under prune-on are >= prune-off.
  prune_preserves_apply_round_trip:
    apply_delta(basis, generate(basis, source, prune)) == source for
    both prune-on and prune-off.

Hand-rolled regressions also cover three identical basis blocks and
the surplus-source-occurrences case where prune-on correctly falls
through to literal emission once every basis sibling is consumed.

Closes #2069
Closes #2070
oferchen added a commit that referenced this pull request May 6, 2026
* feat(match): add zsync-inspired matched-block pruning bitmap

Introduce MatchedBlocks, a per-generator-session bitmap that records
which basis blocks have already been emitted as DeltaToken::Copy. The
delta generator threads the bitmap into find_match_slices_filtered so
that already-matched basis blocks are skipped before the strong-checksum
verify, mirroring zsync librcksum's matched-block hash removal in
hash.c:111-128 (remove_block_from_hash) triggered at write_blocks
(rsum.c:109-119).

Bits are keyed by basis block_idx, not by (rsum, strong) tuple. Two
blocks with identical content live at distinct block_idx slots, so
marking one leaves the other findable. Pruning only changes which
sibling block_idx is named in a Copy token when duplicate content
exists; the receiver applies the same bytes either way, so the wire
output stays equivalent (golden byte tests unchanged).

The want_i adjacent-match hint deliberately bypasses the bitmap: the
hint targets the just-matched index plus one, which the bitmap leaves
unset by construction.

Property tests pin two contracts from docs/design/zsync-prune.md:

  prune_does_not_reduce_matched_bytes:
    For sources built from a permutation of unique basis-block
    positions, total Copy-token bytes under prune-on are >= prune-off.
  prune_preserves_apply_round_trip:
    apply_delta(basis, generate(basis, source, prune)) == source for
    both prune-on and prune-off.

Hand-rolled regressions also cover three identical basis blocks and
the surplus-source-occurrences case where prune-on correctly falls
through to literal emission once every basis sibling is consumed.

Closes #2069
Closes #2070

* fix(match): use slice::fill in matched_blocks property test
oferchen added a commit that referenced this pull request May 18, 2026
…tness (#3644)

Sub-design for the prune insertion point of
`docs/design/zsync-inspired-matching.md` (#2068, blocking impl #2069,
proptest #2070, benchmark #2071).

Covers what zsync does at write_blocks (rsum.c:109-119) and how
oc-rsync mirrors it inside crates/match/. Pins the insertion to the
inner-loop COPY emit at generator.rs:214. Specifies the MatchedBlocks
bitmap (1 bit per signature block, 128 B at 1k blocks, 12.5 MB at
100M), placement alongside DeltaSignatureIndex, and the extended probe
order (bithash -> tag_table -> bucket lookup -> bitmap filter ->
strong-checksum). Spells out duplicate-bucket correctness with a
worked example, the property-test contract, and the bench corpora
(VM disk images, log tarballs, synthetic). Restates the wire-compat
invariants and the no-CLI/no-protocol cleanup contract.
oferchen added a commit that referenced this pull request May 18, 2026
* feat(match): add zsync-inspired matched-block pruning bitmap

Introduce MatchedBlocks, a per-generator-session bitmap that records
which basis blocks have already been emitted as DeltaToken::Copy. The
delta generator threads the bitmap into find_match_slices_filtered so
that already-matched basis blocks are skipped before the strong-checksum
verify, mirroring zsync librcksum's matched-block hash removal in
hash.c:111-128 (remove_block_from_hash) triggered at write_blocks
(rsum.c:109-119).

Bits are keyed by basis block_idx, not by (rsum, strong) tuple. Two
blocks with identical content live at distinct block_idx slots, so
marking one leaves the other findable. Pruning only changes which
sibling block_idx is named in a Copy token when duplicate content
exists; the receiver applies the same bytes either way, so the wire
output stays equivalent (golden byte tests unchanged).

The want_i adjacent-match hint deliberately bypasses the bitmap: the
hint targets the just-matched index plus one, which the bitmap leaves
unset by construction.

Property tests pin two contracts from docs/design/zsync-prune.md:

  prune_does_not_reduce_matched_bytes:
    For sources built from a permutation of unique basis-block
    positions, total Copy-token bytes under prune-on are >= prune-off.
  prune_preserves_apply_round_trip:
    apply_delta(basis, generate(basis, source, prune)) == source for
    both prune-on and prune-off.

Hand-rolled regressions also cover three identical basis blocks and
the surplus-source-occurrences case where prune-on correctly falls
through to literal emission once every basis sibling is consumed.

Closes #2069
Closes #2070

* fix(match): use slice::fill in matched_blocks property test
oferchen added a commit that referenced this pull request Aug 24, 2026
…tness (#3644)

Sub-design for the prune insertion point of
`docs/design/zsync-inspired-matching.md` (#2068, blocking impl #2069,
proptest #2070, benchmark #2071).

Covers what zsync does at write_blocks (rsum.c:109-119) and how
oc-rsync mirrors it inside crates/match/. Pins the insertion to the
inner-loop COPY emit at generator.rs:214. Specifies the MatchedBlocks
bitmap (1 bit per signature block, 128 B at 1k blocks, 12.5 MB at
100M), placement alongside DeltaSignatureIndex, and the extended probe
order (bithash -> tag_table -> bucket lookup -> bitmap filter ->
strong-checksum). Spells out duplicate-bucket correctness with a
worked example, the property-test contract, and the bench corpora
(VM disk images, log tarballs, synthetic). Restates the wire-compat
invariants and the no-CLI/no-protocol cleanup contract.
oferchen added a commit that referenced this pull request Aug 24, 2026
* feat(match): add zsync-inspired matched-block pruning bitmap

Introduce MatchedBlocks, a per-generator-session bitmap that records
which basis blocks have already been emitted as DeltaToken::Copy. The
delta generator threads the bitmap into find_match_slices_filtered so
that already-matched basis blocks are skipped before the strong-checksum
verify, mirroring zsync librcksum's matched-block hash removal in
hash.c:111-128 (remove_block_from_hash) triggered at write_blocks
(rsum.c:109-119).

Bits are keyed by basis block_idx, not by (rsum, strong) tuple. Two
blocks with identical content live at distinct block_idx slots, so
marking one leaves the other findable. Pruning only changes which
sibling block_idx is named in a Copy token when duplicate content
exists; the receiver applies the same bytes either way, so the wire
output stays equivalent (golden byte tests unchanged).

The want_i adjacent-match hint deliberately bypasses the bitmap: the
hint targets the just-matched index plus one, which the bitmap leaves
unset by construction.

Property tests pin two contracts from docs/design/zsync-prune.md:

  prune_does_not_reduce_matched_bytes:
    For sources built from a permutation of unique basis-block
    positions, total Copy-token bytes under prune-on are >= prune-off.
  prune_preserves_apply_round_trip:
    apply_delta(basis, generate(basis, source, prune)) == source for
    both prune-on and prune-off.

Hand-rolled regressions also cover three identical basis blocks and
the surplus-source-occurrences case where prune-on correctly falls
through to literal emission once every basis sibling is consumed.

Closes #2069
Closes #2070

* fix(match): use slice::fill in matched_blocks property test
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