Skip to content

refactor: migrate peer-id to published torrust-peer-id 0.1.0#1887

Merged
josecelano merged 7 commits into
torrust:developfrom
josecelano:1884-1669-move-bittorrent-peer-id-to-torrust-bittorrent
Jun 8, 2026
Merged

refactor: migrate peer-id to published torrust-peer-id 0.1.0#1887
josecelano merged 7 commits into
torrust:developfrom
josecelano:1884-1669-move-bittorrent-peer-id-to-torrust-bittorrent

Conversation

@josecelano

Copy link
Copy Markdown
Member

Migrate the bittorrent-peer-id path dependency to the published torrust-peer-id 0.1.0 crate.

Summary

Why

The torrust-peer-id crate was extracted to torrust/torrust-bittorrent, published under Apache-2.0 (matching the upstream aquatic_peer_id license). It has zero workspace dependencies and was the first in the bittorrent-* extraction sequence (EPIC #1669).

Verification

  • cargo check --workspace — pass
  • cargo test --tests --workspace --all-targets --all-features — pass
  • cargo test --doc --workspace — pass
  • linter all — pass
  • cargo machete --with-metadata — pass
  • Pre-push hook (format, check, doc, test) — pass

Closes #1884

Document the Apache-2.0 license change for torrust-peer-id when
migrating to torrust/torrust-bittorrent: drop the tracker-inherited
AGPL-3.0 LICENSE, keep LICENSE-APACHE for upstream attribution, and
inherit Apache-2.0 from the destination workspace.

Add task T2b and acceptance criterion for the license change.
Replace bittorrent-peer-id local path dep with published torrust-peer-id 0.1.0.

- Update Cargo.toml deps in http-protocol, primitives, and udp-protocol
  to depend on torrust-peer-id = "0.1.0" from crates.io (with zerocopy
  feature retained for udp-protocol).
- Rename all Rust use statements: bittorrent_peer_id -> torrust_peer_id.
- Remove packages/primitives/src/peer_id.rs thin re-export module;
  lib.rs now directly re-exports from torrust_peer_id.
- Delete the entire packages/peer-id/ directory.
- Remove peer-id row from AGENTS.md package catalog.

The crate was migrated to torrust/torrust-bittorrent as torrust-peer-id
0.1.0, published under Apache-2.0 (matching the upstream aquatic_peer_id
license).

Verification:
  cargo check --workspace            - pass
  cargo test --tests --workspace
    --all-targets --all-features      - pass
  cargo test --doc --workspace        - pass
  linter all                          - pass
  cargo machete --with-metadata       - pass
All 13 implementation tasks are DONE. Acceptance criteria, verification
scenarios, and progress log updated with completion evidence.

torrust-peer-id 0.1.0 is published on crates.io under Apache-2.0.
T14 (EPIC torrust#1669 table update) remains as the final task.
Mark SI-19 (torrust#1884) as complete across the EPIC:
- Remove bittorrent- prefix section from Package Inventory.
- Update Desired Package State note [4] to 'Completed June 2026'.
- Check SI-19 checkbox in Numbered Subissues.
- Mark Peer-ID move row DONE in the Active Subissues table.
- Mark T14 DONE and update last-updated-utc in the issue spec.
Copilot AI review requested due to automatic review settings June 8, 2026 11:43

Copilot AI 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.

Pull request overview

This PR migrates the workspace from the in-repo bittorrent-peer-id crate (path dependency) to the published torrust-peer-id crate v0.1.0 from crates.io, and removes the now-redundant in-workspace peer-id package.

Changes:

  • Replace bittorrent-peer-id path dependencies with torrust-peer-id = "0.1.0" (and zerocopy feature where needed) across protocol/domain crates.
  • Update Rust imports/re-exports from bittorrent_peer_id::* to torrust_peer_id::*, and simplify primitives re-exports.
  • Remove the packages/peer-id/ crate and update repository documentation (issue spec + EPIC + package catalog) accordingly.

Reviewed changes

Copilot reviewed 19 out of 20 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/udp-protocol/src/lib.rs Switch re-export to torrust_peer_id::{PeerClient, PeerId}.
packages/udp-protocol/Cargo.toml Replace peer-id path dep with crates.io torrust-peer-id (keeping zerocopy).
packages/primitives/src/peer_id.rs Delete thin compatibility re-export module.
packages/primitives/src/lib.rs Re-export PeerClient/PeerId from torrust_peer_id at crate root; remove peer_id module declaration.
packages/primitives/Cargo.toml Replace peer-id path dep with crates.io torrust-peer-id.
packages/peer-id/src/peer_id.rs Remove in-repo peer-id implementation (crate deleted).
packages/peer-id/src/peer_client.rs Remove in-repo client identification implementation (crate deleted).
packages/peer-id/src/lib.rs Remove in-repo peer-id crate root (crate deleted).
packages/peer-id/README.md Remove in-repo peer-id crate README (crate deleted).
packages/peer-id/LICENSE-APACHE Remove in-repo peer-id crate Apache license copy (crate deleted).
packages/peer-id/LICENSE Remove in-repo peer-id crate AGPL license file (crate deleted).
packages/peer-id/Cargo.toml Remove in-repo peer-id crate manifest (crate deleted).
packages/http-protocol/src/v1/responses/announce.rs Update PeerId import to torrust_peer_id::PeerId (including tests).
packages/http-protocol/src/v1/requests/announce.rs Update PeerId import and doc example to torrust_peer_id::PeerId (including tests).
packages/http-protocol/src/percent_encoding.rs Update PeerId import and doc example to torrust_peer_id::PeerId (including tests).
packages/http-protocol/Cargo.toml Replace peer-id path dep with crates.io torrust-peer-id.
docs/issues/open/1884-1669-19-move-bittorrent-peer-id-to-torrust-bittorrent.md Mark tasks/acceptance criteria done; update timestamps and verification notes.
docs/issues/open/1669-overhaul-packages/EPIC.md Mark SI-19 completed and note published crate + tracker migration.
Cargo.lock Remove bittorrent-peer-id entry; add torrust-peer-id 0.1.0 entry and update dependent packages.
AGENTS.md Remove peer-id package entry from workspace package catalog.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 7 to 14
pub mod announce;
pub mod mode;
pub mod number_of_bytes;
pub mod pagination;
pub mod peer;
pub mod peer_id;
pub mod policy;
pub mod scrape;
pub mod swarm_metadata;
@josecelano josecelano self-assigned this Jun 8, 2026
@codecov

codecov Bot commented Jun 8, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.32%. Comparing base (78e0c00) to head (f0f651f).

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1887      +/-   ##
===========================================
+ Coverage    81.17%   81.32%   +0.15%     
===========================================
  Files          353      351       -2     
  Lines        26669    26509     -160     
  Branches     26669    26509     -160     
===========================================
- Hits         21649    21559      -90     
+ Misses        4723     4659      -64     
+ Partials       297      291       -6     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Address Copilot suggestion to maintain backwards compatibility when migrating
to torrust-peer-id. Downstream code that imports
torrust_tracker_primitives::peer_id::{PeerId, PeerClient} will continue to
work with a deprecation warning, providing a smoother migration path until a
planned major release removes this compatibility layer.

Related-to: PR torrust#1887
The packages/peer-id/ directory was deleted as part of the migration to
the published torrust-peer-id crate, but the Containerfile still referenced
the old path in three places:
1. COPY packages/peer-id/Cargo.toml
2. packages/peer-id/src in source copy section
3. packages/peer-id/src/lib.rs in license check

Dropping these references fixes the Container (Docker) workflow failure.
Related-to: PR torrust#1887
@josecelano

Copy link
Copy Markdown
Member Author

ACK f0f651f

@josecelano josecelano merged commit 988678b into torrust:develop Jun 8, 2026
20 of 21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SI-19: Move bittorrent-peer-id to torrust/torrust-bittorrent as torrust-peer-id

2 participants