Skip to content

fix(batch): use protocol version for stream flags bitmap encoding - #2528

Merged
oferchen merged 1 commit into
masterfrom
fix/batch-header-protocol-version
Feb 27, 2026
Merged

oferchen merged 1 commit into
masterfrom
fix/batch-header-protocol-version

Conversation

@oferchen

Copy link
Copy Markdown
Owner

Summary

  • Fix BatchFlags::write_to which hardcoded to_bitmap(30), incorrectly including protocol-30-only flag bits in batch files written with lower protocol versions
  • Fix BatchFlags::read_from which hardcoded from_bitmap(bitmap, 30), ignoring the actual protocol version from the header
  • Replace with write_to_versioned(writer, protocol_version) and read_raw(reader) that properly respect protocol version boundaries

Test plan

  • New test: protocol 28 batch masks out bits 7-14 (xfer_dirs, preserve_acls)
  • New test: protocol 29 batch includes bits 7-8 but masks bits 9-14
  • New test: versioned write/read roundtrip across protocol versions
  • All 131 batch tests pass
  • Full workspace compiles clean

@github-actions github-actions Bot added the bug Something isn't working label Feb 27, 2026
BatchFlags::write_to previously hardcoded to_bitmap(30), which would
incorrectly include protocol-30-only flag bits (e.g., xfer_dirs,
preserve_acls) in batch files written with lower protocol versions.

Similarly, BatchFlags::read_from hardcoded from_bitmap(bitmap, 30),
ignoring the actual protocol version read from the header.

Fix by:
- Replace write_to with write_to_versioned(writer, protocol_version)
  that masks bits by the given protocol version
- Replace read_from with read_raw(reader) that returns the raw bitmap,
  letting BatchHeader::read_from reconstruct flags after reading the
  protocol version from the header
@oferchen
oferchen force-pushed the fix/batch-header-protocol-version branch from 5416017 to e426a0a Compare February 27, 2026 14:35
@oferchen
oferchen merged commit 8954650 into master Feb 27, 2026
7 checks passed
@oferchen
oferchen deleted the fix/batch-header-protocol-version branch February 27, 2026 14:36
oferchen added a commit that referenced this pull request May 1, 2026
)

BatchFlags::write_to previously hardcoded to_bitmap(30), which would
incorrectly include protocol-30-only flag bits (e.g., xfer_dirs,
preserve_acls) in batch files written with lower protocol versions.

Similarly, BatchFlags::read_from hardcoded from_bitmap(bitmap, 30),
ignoring the actual protocol version read from the header.

Fix by:
- Replace write_to with write_to_versioned(writer, protocol_version)
  that masks bits by the given protocol version
- Replace read_from with read_raw(reader) that returns the raw bitmap,
  letting BatchHeader::read_from reconstruct flags after reading the
  protocol version from the header
oferchen added a commit that referenced this pull request May 5, 2026
)

BatchFlags::write_to previously hardcoded to_bitmap(30), which would
incorrectly include protocol-30-only flag bits (e.g., xfer_dirs,
preserve_acls) in batch files written with lower protocol versions.

Similarly, BatchFlags::read_from hardcoded from_bitmap(bitmap, 30),
ignoring the actual protocol version read from the header.

Fix by:
- Replace write_to with write_to_versioned(writer, protocol_version)
  that masks bits by the given protocol version
- Replace read_from with read_raw(reader) that returns the raw bitmap,
  letting BatchHeader::read_from reconstruct flags after reading the
  protocol version from the header
oferchen added a commit that referenced this pull request Jun 3, 2026
SEC-1.j (#2528) is completed. Remove the 3 leftover TODO comments that
referenced deferred DirSandbox wiring in guard.rs and process.rs.
oferchen added a commit that referenced this pull request Aug 24, 2026
SEC-1.j (#2528) is completed. Remove the 3 leftover TODO comments that
referenced deferred DirSandbox wiring in guard.rs and process.rs.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant