Skip to content

docs(batch): drop restatement comments in tests and sources#4599

Merged
oferchen merged 1 commit into
masterfrom
docs/comment-cleanup-batch-v2
May 20, 2026
Merged

docs(batch): drop restatement comments in tests and sources#4599
oferchen merged 1 commit into
masterfrom
docs/comment-cleanup-batch-v2

Conversation

@oferchen
Copy link
Copy Markdown
Owner

Summary

Per-crate comment cleanup pass on the batch crate, following the precedent set by PRs #4587 (matching), #4591 (protocol), #4590 (transfer), #4589 (fast_io), #4584 (filters), #4582 (logging), #4583 (platform), #4575 (compress).

The crate already enforces #![deny(missing_docs)] at the root, so every public item already carries ///. This follow-up strips pure restatement and decorative section labels from the test bodies and a handful of source files, while preserving every upstream rsync citation, batch-shell-script generation WHY note, and load-bearing protocol invariant.

Scope

Walked crates/batch/src/ end to end. Files touched: 7.

  • src/tests.rs - integration tests: drop // Write a batch file, // Read the batch file back, // Verify file entries round-trip correctly, // EOF, // Should fail on corrupt data, // File 1 entry/// File 2 entry, per-section // Directory entry/// File entry/// End of flist labels, // File checksum (16 zero bytes) decorators, and // Replay the ... batch markers above the obvious replay call.
  • src/reader/tests.rs - drop // Try to read more data than available, // Write phase/// Read phase decorative dividers, // Don't read header, and a cluster of // Initial segment, // Read the sub-list segment, // Now we have all 3 entries, // NDX codec is available for ..., // Sub-list entries have parent directory prepended labels in the INC_RECURSE test builder.
  • src/format/tests.rs - drop value-restating comments above assert_eq!(&buf[N..M], ...) byte-layout checks; rewrite the multi-byte varint length breakdown as a single concise line.
  • src/replay/tests.rs - drop // Basis has "ABCDE" and // sqrt(1_000_000) = 1000 type restatements; convert the two CPRES_ZLIB / zstd cpres_zlib_* tests' explanatory bodies into /// rustdoc on the test functions themselves (where they actually belong).
  • src/reader/delta.rs - tighten the simple_recv_token match-arm comments (block_index formula stays, redundant "Literal data: n bytes follow" trailing the same-line literal_len reads).
  • src/script.rs - drop // Original filter args should be stripped, // The batch name should not appear as a passthrough argument, and the redundant // Read and verify script content -- upstream has no shebang (kept as the WHY note upstream batch shell scripts have no shebang).
  • src/writer.rs - drop // Verify file exists and has content and // write_data before write_header must fail decorators above the corresponding assert!.

What was kept

  • All // upstream: batch.c:NNN, io.c:NNN, compat.c:NNN, flist.c:NNN, token.c:NNN, uidlist.c:NNN, main.c:NNN, receiver.c:NNN, rsync.c:NNN citations.
  • All WHY notes: do_compression flag semantics, batch body being a raw protocol-stream tee, NDX codec state preservation across flist sub-lists, INC_RECURSE ndx_start segment layout, CPRES_ZLIB dictionary sync via see_token() after block matches, zstd codec auto-detection, MD4/MD5/XXH3 default 16-byte digest length rationale, iflags: ITEM_TRANSFER (0x8000) annotation above the raw u16 byte writes (the literal does not document itself).
  • All non-trivial test docstrings (/// Verifies that ...) including the upstream-bug reproductions for token.c:608 inflate -3.

Stats

  • 7 files changed, +47 / -234.
  • 175 pure-comment lines removed; the remaining diff covers reflowing a few multi-line comment paragraphs into concise one-liners and moving two test-body explanations into /// rustdoc on the test fn.
  • No semantic changes. No new #[allow(...)] attributes. No public-API rustdoc additions were needed (the crate enforces missing_docs).

Test plan

  • cargo fmt --all -- --check
  • cargo clippy --workspace --all-targets --all-features --no-deps -- -D warnings
  • CI matrix (fmt+clippy, nextest stable, Windows, macOS, Linux musl)

Strip pure restatement and decorative section labels from the `batch`
crate tests and a handful of source files (`reader/delta.rs`,
`script.rs`). All upstream rsync citations (`batch.c`, `io.c`,
`uidlist.c`, `flist.c`, `token.c`, `compat.c`, `main.c`,
`receiver.c`), batch shell-script generation WHYs, and load-bearing
notes (`do_compression` flag semantics, NDX state preservation,
CPRES_ZLIB dictionary sync invariants, INC_RECURSE segment layout)
are preserved verbatim. No semantic changes; no new allows.
@github-actions github-actions Bot added the documentation Improvements or additions to documentation label May 20, 2026
@oferchen oferchen merged commit 8242a20 into master May 20, 2026
54 of 55 checks passed
@oferchen oferchen deleted the docs/comment-cleanup-batch-v2 branch May 20, 2026 20:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant