Skip to content

Migrate from bittorrent-primitives to torrust-info-hash#1891

Merged
josecelano merged 2 commits into
torrust:developfrom
josecelano:1889-migrate-from-bittorrent-primitives-to-torrust-info-hash
Jun 9, 2026
Merged

Migrate from bittorrent-primitives to torrust-info-hash#1891
josecelano merged 2 commits into
torrust:developfrom
josecelano:1889-migrate-from-bittorrent-primitives-to-torrust-info-hash

Conversation

@josecelano

@josecelano josecelano commented Jun 9, 2026

Copy link
Copy Markdown
Member

Summary

Replaces the bittorrent-primitives crate dependency with the new torrust-info-hash crate (v0.2.0) across the entire workspace. The InfoHash type was migrated from torrust/bittorrent-primitives to torrust/torrust-bittorrent (see torrust/torrust-bittorrent#87 / torrust/torrust-bittorrent#88) and published as torrust-info-hash 0.2.0 on crates.io.

Changes

  • Replace bittorrent-primitives = "0.2.0" with torrust-info-hash = "=0.2.0" in all 14 Cargo.toml files
  • Update all Rust imports from use bittorrent_primitives::info_hash::InfoHash to use torrust_info_hash::InfoHash
  • Update fully-qualified paths and info_hash::ConversionError references
  • Update test fixture usage (gen_seeded_infohash) and doc comments
  • Update EPIC Overhaul: packages #1669 with SI-21 sub-issue entry
  • Add issue spec for SI-21: Migrate from bittorrent-primitives to torrust-info-hash #1889

Verification

  • cargo check --workspace: passes
  • cargo machete: passes (no unused deps)
  • linter all: passes
  • cargo test --workspace (nextest): 2520/2520 passed
  • ✅ All pre-push checks pass (format, doc, tests)
  • ✅ No remaining bittorrent-primitives / bittorrent_primitives references (except expected comment in udp-protocol/src/common.rs)

Closes #1889

Related to #1669

Copilot AI review requested due to automatic review settings June 9, 2026 12:47
@josecelano josecelano added rust Pull requests that update Rust code task labels Jun 9, 2026
@josecelano josecelano self-assigned this Jun 9, 2026

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 off the deprecated bittorrent-primitives crate and onto the standalone torrust-info-hash crate for the InfoHash type, updating all affected packages, tests, and documentation references accordingly.

Changes:

  • Replaced bittorrent-primitives dependencies with torrust-info-hash = "=0.2.0" across the workspace.
  • Updated Rust imports / fully-qualified paths (including ConversionError and fixtures) to use torrust_info_hash.
  • Updated workspace documentation (EPIC + new issue spec) and refreshed Cargo.lock.

Reviewed changes

Copilot reviewed 106 out of 107 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
tests/servers/api/contract/stats/mod.rs Switch test import to torrust_info_hash::InfoHash.
packages/udp-tracker-core/src/services/scrape.rs Switch InfoHash import to new crate.
packages/udp-tracker-core/src/services/announce.rs Switch InfoHash import to new crate.
packages/udp-tracker-core/src/lib.rs Switch test-only InfoHash import to new crate.
packages/udp-tracker-core/src/event.rs Switch InfoHash import to new crate.
packages/udp-tracker-core/Cargo.toml Replace dependency with torrust-info-hash.
packages/udp-server/tests/server/contract.rs Update fully-qualified InfoHash types to torrust_info_hash.
packages/udp-server/tests/common/fixtures.rs Switch fixture import to torrust_info_hash::InfoHash.
packages/udp-server/src/lib.rs Update rustdoc link target for InfoHash.
packages/udp-server/src/handlers/announce.rs Switch imports and test conversion to torrust_info_hash.
packages/udp-server/Cargo.toml Replace dependency with torrust-info-hash.
packages/tracker-core/tests/common/test_env.rs Switch test import to torrust_info_hash::InfoHash.
packages/tracker-core/tests/common/fixtures.rs Switch test import to torrust_info_hash::InfoHash.
packages/tracker-core/src/whitelist/repository/persisted.rs Switch InfoHash import to new crate.
packages/tracker-core/src/whitelist/repository/in_memory.rs Switch InfoHash import to new crate.
packages/tracker-core/src/whitelist/manager.rs Switch InfoHash import to new crate.
packages/tracker-core/src/whitelist/authorization.rs Switch InfoHash import to new crate.
packages/tracker-core/src/torrent/services.rs Switch imports in module + tests to new crate.
packages/tracker-core/src/torrent/repository/in_memory.rs Switch InfoHash import to new crate.
packages/tracker-core/src/torrent/manager.rs Switch test import to torrust_info_hash::InfoHash.
packages/tracker-core/src/test_helpers.rs Switch test helper import to torrust_info_hash::InfoHash.
packages/tracker-core/src/statistics/persisted/downloads.rs Switch InfoHash import to new crate.
packages/tracker-core/src/scrape_handler.rs Update rustdoc examples + imports/tests to new crate.
packages/tracker-core/src/lib.rs Switch test imports to torrust_info_hash::InfoHash.
packages/tracker-core/src/error.rs Switch InfoHash import to new crate.
packages/tracker-core/src/databases/traits/whitelist.rs Switch trait-level InfoHash import to new crate.
packages/tracker-core/src/databases/traits/torrent_metrics.rs Switch trait-level InfoHash import to new crate.
packages/tracker-core/src/databases/driver/sqlite/whitelist_store.rs Switch InfoHash import to new crate.
packages/tracker-core/src/databases/driver/sqlite/torrent_metrics_store.rs Switch InfoHash import to new crate.
packages/tracker-core/src/databases/driver/postgres/whitelist_store.rs Switch InfoHash import to new crate.
packages/tracker-core/src/databases/driver/postgres/torrent_metrics_store.rs Switch InfoHash import to new crate.
packages/tracker-core/src/databases/driver/mysql/whitelist_store.rs Switch InfoHash import to new crate.
packages/tracker-core/src/databases/driver/mysql/torrent_metrics_store.rs Switch InfoHash import to new crate.
packages/tracker-core/src/announce_handler.rs Update rustdoc example + import to torrust_info_hash.
packages/tracker-core/Cargo.toml Replace dependency with torrust-info-hash.
packages/tracker-client/src/http/client/requests/scrape.rs Switch InfoHash import to new crate.
packages/tracker-client/src/http/client/requests/announce.rs Switch InfoHash import to new crate.
packages/tracker-client/Cargo.toml Replace dependency with torrust-info-hash.
packages/torrent-repository-benchmarking/tests/repository/mod.rs Switch test import to torrust_info_hash::InfoHash.
packages/torrent-repository-benchmarking/tests/common/repo.rs Switch test import to torrust_info_hash::InfoHash.
packages/torrent-repository-benchmarking/src/repository/skip_map_mutex_std.rs Switch InfoHash import to new crate.
packages/torrent-repository-benchmarking/src/repository/rw_lock_tokio.rs Switch InfoHash import; update guard return type path.
packages/torrent-repository-benchmarking/src/repository/rw_lock_tokio_mutex_tokio.rs Switch InfoHash import to new crate.
packages/torrent-repository-benchmarking/src/repository/rw_lock_tokio_mutex_std.rs Switch InfoHash import to new crate.
packages/torrent-repository-benchmarking/src/repository/rw_lock_std.rs Switch InfoHash import; update guard return type path.
packages/torrent-repository-benchmarking/src/repository/rw_lock_std_mutex_tokio.rs Switch InfoHash import to new crate.
packages/torrent-repository-benchmarking/src/repository/rw_lock_std_mutex_std.rs Switch InfoHash import to new crate.
packages/torrent-repository-benchmarking/src/repository/mod.rs Switch InfoHash import to new crate.
packages/torrent-repository-benchmarking/src/repository/dash_map_mutex_std.rs Switch InfoHash import to new crate.
packages/torrent-repository-benchmarking/Cargo.toml Replace dependency with torrust-info-hash.
packages/torrent-repository-benchmarking/benches/helpers/utils.rs Switch bench helper import to new crate.
packages/torrent-repository-benchmarking/benches/helpers/sync.rs Switch bench helper import to new crate.
packages/torrent-repository-benchmarking/benches/helpers/asyn.rs Switch bench helper import to new crate.
packages/swarm-coordination-registry/src/swarm/registry.rs Switch imports + fixture path; adjust seeded fixture call.
packages/swarm-coordination-registry/src/swarm/coordinator.rs Switch InfoHash import to new crate.
packages/swarm-coordination-registry/src/lib.rs Switch test import to torrust_info_hash::InfoHash.
packages/swarm-coordination-registry/src/event.rs Switch InfoHash import to new crate.
packages/swarm-coordination-registry/Cargo.toml Replace dependency with torrust-info-hash.
packages/primitives/src/scrape.rs Switch imports/tests to torrust_info_hash::InfoHash.
packages/primitives/src/lib.rs Switch internal InfoHash import used in public type aliases.
packages/primitives/Cargo.toml Replace dependency with torrust-info-hash.
packages/persistence-benchmark/src/bin/persistence_benchmark/driver_bench/sampling.rs Switch InfoHash import to new crate.
packages/persistence-benchmark/Cargo.toml Replace dependency with torrust-info-hash.
packages/http-tracker-core/src/services/scrape.rs Switch test import to torrust_info_hash::InfoHash.
packages/http-tracker-core/src/services/announce.rs Switch InfoHash import to new crate.
packages/http-tracker-core/src/lib.rs Switch test import to torrust_info_hash::InfoHash.
packages/http-tracker-core/src/event.rs Switch InfoHash import to new crate.
packages/http-tracker-core/Cargo.toml Replace dependency with torrust-info-hash.
packages/http-tracker-core/benches/helpers/util.rs Switch bench helper import to new crate.
packages/http-protocol/src/v1/responses/scrape.rs Switch imports, examples, and tests to new crate.
packages/http-protocol/src/v1/requests/scrape.rs Switch InfoHash import and ConversionError path to new crate.
packages/http-protocol/src/v1/requests/announce.rs Switch InfoHash import and ConversionError path to new crate.
packages/http-protocol/src/percent_encoding.rs Switch InfoHash import and ConversionError type path to new crate.
packages/http-protocol/Cargo.toml Replace dependency with torrust-info-hash.
packages/axum-rest-api-server/tests/server/v1/contract/context/whitelist.rs Switch contract test import to new crate.
packages/axum-rest-api-server/tests/server/v1/contract/context/torrent.rs Switch contract test import to new crate.
packages/axum-rest-api-server/tests/server/v1/contract/context/stats.rs Switch contract test import to new crate.
packages/axum-rest-api-server/src/v1/context/whitelist/handlers.rs Switch handler import to new crate.
packages/axum-rest-api-server/src/v1/context/torrent/resources/torrent.rs Switch test import to new crate.
packages/axum-rest-api-server/src/v1/context/torrent/handlers.rs Switch handler import to new crate.
packages/axum-rest-api-server/src/environment.rs Switch InfoHash import to new crate.
packages/axum-rest-api-server/Cargo.toml Replace dependency with torrust-info-hash.
packages/axum-http-server/tests/server/v1/contract.rs Switch contract test imports to new crate.
packages/axum-http-server/tests/server/requests/scrape.rs Switch request test import to new crate.
packages/axum-http-server/tests/server/requests/announce.rs Switch request test import to new crate.
packages/axum-http-server/tests/common/fixtures.rs Switch test fixtures import to new crate.
packages/axum-http-server/src/v1/handlers/scrape.rs Switch test import to new crate.
packages/axum-http-server/src/v1/extractors/scrape_request.rs Switch test import to new crate.
packages/axum-http-server/src/v1/extractors/announce_request.rs Switch test import to new crate.
packages/axum-http-server/src/lib.rs Switch test helper import to new crate.
packages/axum-http-server/src/environment.rs Switch InfoHash import to new crate.
packages/axum-http-server/Cargo.toml Replace dependency with torrust-info-hash.
docs/issues/open/1889-1669-21-migrate-from-bittorrent-primitives-to-torrust-info-hash.md Add new issue spec documenting migration work.
docs/issues/open/1669-overhaul-packages/EPIC.md Link SI-21 sub-issue and update EPIC notes/table.
console/tracker-client/src/console/clients/unified/udp.rs Switch InfoHash import alias to new crate.
console/tracker-client/src/console/clients/unified/http.rs Switch InfoHash import to new crate.
console/tracker-client/src/console/clients/unified/check.rs Switch InfoHash import alias to new crate.
console/tracker-client/src/console/clients/udp/checker.rs Switch InfoHash import alias to new crate.
console/tracker-client/src/console/clients/udp/app.rs Switch InfoHash import alias to new crate.
console/tracker-client/src/console/clients/http/app.rs Switch InfoHash import to new crate.
console/tracker-client/src/console/clients/checker/monitor/udp.rs Switch InfoHash import alias to new crate.
console/tracker-client/src/console/clients/checker/checks/udp.rs Switch InfoHash import alias to new crate.
console/tracker-client/src/console/clients/checker/checks/http.rs Switch InfoHash import to new crate.
console/tracker-client/src/console/clients/checker/app.rs Switch InfoHash import alias to new crate.
console/tracker-client/Cargo.toml Replace dependency with torrust-info-hash.
Cargo.toml Replace dev-dependency with torrust-info-hash.
Cargo.lock Remove bittorrent-primitives; add/lock torrust-info-hash 0.2.0.

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

Comment thread docs/issues/open/1669-overhaul-packages/EPIC.md
Comment thread packages/torrent-repository-benchmarking/src/repository/rw_lock_std.rs Outdated
@codecov

codecov Bot commented Jun 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.35%. Comparing base (6c8e021) to head (b5a0d3f).

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1891      +/-   ##
===========================================
+ Coverage    81.29%   81.35%   +0.06%     
===========================================
  Files          351      351              
  Lines        26509    26505       -4     
  Branches     26509    26505       -4     
===========================================
+ Hits         21551    21564      +13     
+ Misses        4663     4645      -18     
- Partials       295      296       +1     

☔ 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.

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

Copilot reviewed 106 out of 107 changed files in this pull request and generated 4 comments.

Comment thread docs/issues/open/1669-overhaul-packages/EPIC.md Outdated
Comment thread docs/issues/open/1669-overhaul-packages/EPIC.md Outdated
@josecelano

Copy link
Copy Markdown
Member Author

ACK b5a0d3f

@josecelano josecelano merged commit 5baab2d into torrust:develop Jun 9, 2026
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

rust Pull requests that update Rust code task

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SI-21: Migrate from bittorrent-primitives to torrust-info-hash

2 participants