Skip to content

Bumping versions, applied logical fixes and using more std functions - #87

Merged
Power2All merged 2 commits into
masterfrom
v4.2.16
Jul 22, 2026
Merged

Bumping versions, applied logical fixes and using more std functions#87
Power2All merged 2 commits into
masterfrom
v4.2.16

Conversation

@Power2All

@Power2All Power2All commented Jul 22, 2026

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

  • New Features
    • Added clearer error reporting for invalid hex-based identifiers.
  • Bug Fixes
    • Tightened UUID and database identifier validation rules.
    • Improved BEP 15 UDP request/response encoding and decoding for consistent big-endian behavior.
  • Maintenance
    • Updated application/desktop/container version to 4.2.16 (including Docker image tags) and refreshed bundled dependency versions.
  • Tests
    • Updated UDP parsing tests to match the revised packet encoding.

@Power2All Power2All self-assigned this Jul 22, 2026
@Power2All Power2All added the enhancement New feature or request label Jul 22, 2026
@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Version 4.2.16 updates dependencies and release metadata, replaces regex and legacy utility usage, introduces shared hexadecimal parsing errors, removes obsolete public API modules, and rewrites UDP serialization and parsing around explicit big-endian conversions.

Changes

Release and runtime updates

Layer / File(s) Summary
Release metadata and dependencies
Cargo.toml, docker/*, torrust-actix.desktop, version.bat
Release versions and Docker image tags are updated to 4.2.16, with broad dependency additions, removals, and version updates; the version script no longer updates the desktop entry version.
Validation and hex parsing contracts
src/api/api_users.rs, src/config/impls/configuration.rs, src/common/common.rs, src/tracker/impls/*
UUID and configuration identifier checks use direct byte validation, while tracker identifiers use the shared HexParseError and hex_to_id paths.
Legacy runtime and exports cleanup
src/http/http.rs, src/common/structs.rs
HTTP error payloads use LazyLock, and obsolete torrent API modules are removed from public exports.
UDP byte handling foundation
src/udp/udp.rs, src/udp/impls/parse_pool.rs, src/udp/impls/rio_recv.rs, src/udp/structs/parse_pool.rs
UDP parsing uses fixed-size big-endian reads and direct byte conversions; queue imports use crossbeam_queue.
UDP request and response wire paths
src/udp/impls/request.rs, src/udp/impls/response.rs, tests/udp_tests.rs, benches/tracker_benchmarks.rs
BEP 15 request and response encoding and decoding replace byteorder helpers with explicit big-endian conversions, with corresponding test and benchmark updates.

Estimated code review effort: 3 (Moderate) | ~30 minutes

Sequence Diagram(s)

sequenceDiagram
  participant RequestResponse
  participant read_be
  participant UDPStream
  RequestResponse->>UDPStream: write BEP 15 fields
  RequestResponse->>read_be: decode fixed-size fields
  read_be->>UDPStream: read_exact bytes
  read_be-->>RequestResponse: return big-endian values
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title matches the main changes: version bump plus refactors to replace third-party helpers with standard-library-based logic.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch v4.2.16

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🧹 Nitpick comments (2)
docker/Dockerfile (1)

6-6: 🔒 Security & Privacy | 🔵 Trivial | ⚡ Quick win

Pin the Docker build to an immutable release commit.

tags/v4.2.16 is a mutable build input; Git supports replacing an existing tag with -f. A retagged release could therefore change the image without any Dockerfile change. (git-scm.com)

Proposed fix
-RUN cd /app/torrust-actix && git checkout tags/v4.2.16
+RUN cd /app/torrust-actix && git checkout --detach <verified-release-commit-sha>
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docker/Dockerfile` at line 6, Update the Dockerfile’s git checkout command to
pin the v4.2.16 release to its immutable commit SHA instead of the mutable
tags/v4.2.16 reference, preserving the existing application directory and
checkout behavior.
src/tracker/impls/info_hash.rs (1)

14-31: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Unify hex decoding across InfoHash, PeerId, and UserId using the hex crate.

All three FromStr implementations hand-roll the same 40-char-hex → 20-byte decode loop with a custom hex_to_nibble helper. The hex crate is already a dependency (used for encoding via hex::encode_to_slice in common.rs), and hex::decode_to_slice offers an equivalent no-allocation decode path, letting a single shared helper in common.rs map its FromHexError into HexParseError once instead of duplicating the loop three times. Double-check case-sensitivity parity with the existing hex_to_nibble before switching, since hex::decode_to_slice accepts mixed-case input.

  • src/tracker/impls/info_hash.rs#L14-L31: replace the manual chunks_exact/hex_to_nibble loop with a shared common::common::hex_to_id::<InfoHash> (or equivalent) helper backed by hex::decode_to_slice.
  • src/tracker/impls/peer_id.rs#L116-L134: same replacement for PeerId::from_str.
  • src/tracker/impls/user_id.rs#L13-L33: same replacement for UserId::from_str.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/tracker/impls/info_hash.rs` around lines 14 - 31, Unify the 40-character
hex decoding in InfoHash::from_str, PeerId::from_str, and UserId::from_str by
replacing each manual hex_to_nibble loop with a shared common::common::hex_to_id
helper backed by hex::decode_to_slice; update src/tracker/impls/info_hash.rs
lines 14-31, src/tracker/impls/peer_id.rs lines 116-134, and
src/tracker/impls/user_id.rs lines 13-33. Preserve InvalidLength and
InvalidCharacter mapping, and verify mixed-case acceptance matches the existing
decoder behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@torrust-actix.desktop`:
- Line 2: Update the desktop entry’s Version field from the application release
value to the desktop-entry specification version 1.5, or remove the field;
preserve the application release separately in X-AppVersion if that key is
present or required.

---

Nitpick comments:
In `@docker/Dockerfile`:
- Line 6: Update the Dockerfile’s git checkout command to pin the v4.2.16
release to its immutable commit SHA instead of the mutable tags/v4.2.16
reference, preserving the existing application directory and checkout behavior.

In `@src/tracker/impls/info_hash.rs`:
- Around line 14-31: Unify the 40-character hex decoding in InfoHash::from_str,
PeerId::from_str, and UserId::from_str by replacing each manual hex_to_nibble
loop with a shared common::common::hex_to_id helper backed by
hex::decode_to_slice; update src/tracker/impls/info_hash.rs lines 14-31,
src/tracker/impls/peer_id.rs lines 116-134, and src/tracker/impls/user_id.rs
lines 13-33. Preserve InvalidLength and InvalidCharacter mapping, and verify
mixed-case acceptance matches the existing decoder behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 244a80de-6875-4c0c-b228-2577b3edaf17

📥 Commits

Reviewing files that changed from the base of the PR and between cc1b55e and c3a12c5.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (22)
  • Cargo.toml
  • benches/tracker_benchmarks.rs
  • docker/Dockerfile
  • docker/build.bat
  • src/api/api_users.rs
  • src/common/common.rs
  • src/common/structs.rs
  • src/common/structs/get_torrent_api.rs
  • src/common/structs/get_torrents_api.rs
  • src/config/impls/configuration.rs
  • src/http/http.rs
  • src/tracker/impls/info_hash.rs
  • src/tracker/impls/peer_id.rs
  • src/tracker/impls/user_id.rs
  • src/udp/impls/parse_pool.rs
  • src/udp/impls/request.rs
  • src/udp/impls/response.rs
  • src/udp/impls/rio_recv.rs
  • src/udp/structs/parse_pool.rs
  • src/udp/udp.rs
  • tests/udp_tests.rs
  • torrust-actix.desktop
💤 Files with no reviewable changes (2)
  • src/common/structs/get_torrent_api.rs
  • src/common/structs/get_torrents_api.rs

Comment thread torrust-actix.desktop Outdated

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/tracker/impls/info_hash.rs`:
- Around line 14-17: Keep the public FromStr::Err contract unchanged for both
InfoHash in src/tracker/impls/info_hash.rs:14-17 and UserId in
src/tracker/impls/user_id.rs:14-17. Update each impl to expose its previous
error type while converting or mapping the HexParseError returned by hex_to_id
into that established type; preserve successful parsing behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 626985ba-ce8c-4ba9-8f62-04ec8bc42a2d

📥 Commits

Reviewing files that changed from the base of the PR and between c3a12c5 and d06ae33.

📒 Files selected for processing (6)
  • src/common/common.rs
  • src/tracker/impls/info_hash.rs
  • src/tracker/impls/peer_id.rs
  • src/tracker/impls/user_id.rs
  • torrust-actix.desktop
  • version.bat
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/tracker/impls/peer_id.rs

Comment thread src/tracker/impls/info_hash.rs
@Power2All
Power2All merged commit e83159a into master Jul 22, 2026
2 checks passed
@Power2All
Power2All deleted the v4.2.16 branch July 22, 2026 11:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant