Skip to content

SI-16 #1881: Migrate contrib/bencode to torrust/torrust-bittorrent as torrust-bencode - #1883

Merged
josecelano merged 7 commits into
torrust:developfrom
josecelano:1881-1669-16-migrate-contrib-bencode-to-torrust-bittorrent
Jun 5, 2026
Merged

josecelano merged 7 commits into
torrust:developfrom
josecelano:1881-1669-16-migrate-contrib-bencode-to-torrust-bittorrent

Conversation

@josecelano

Copy link
Copy Markdown
Member

Summary

Closes #1881 (subissue of EPIC #1669 — Overhaul: Packages)

Migrates the contrib/bencode crate (torrust-tracker-contrib-bencode) out of this workspace into torrust/torrust-bittorrent as the published torrust-bencode 3.0.0 crate, and removes all traces of it from the tracker workspace.

Changes

torrust/torrust-bittorrent (already merged — separate repo)

  • Renamed crate to torrust-bencode, updated metadata and repository URL
  • Applied clippy fixes (ok_or_else, map_or) in access/convert.rs and reference/decode.rs
  • Published torrust-bencode 3.0.0 to crates.io

This PR (torrust/torrust-tracker)

  • packages/http-protocol: replace path dep torrust-tracker-contrib-bencode with published torrust-bencode = "3.0.0"; update imports in announce.rs and scrape.rs
  • Cargo.lock: remove torrust-tracker-contrib-bencode, add torrust-bencode 3.0.0
  • contrib/bencode/: delete directory (20 files)
  • AGENTS.md: remove bencode from contrib/ description and Community contributions table
  • docs/packages.md: update contrib/ tree noting migration
  • docs/release_process.md: remove old crate from publish checklist
  • src/console/ci/qbittorrent_e2e/bencode.rs: update crate name in doc comment
  • .github/skills/release-new-version/SKILL.md: remove contrib/bencode version bump step
  • docs/issues/open/1669-overhaul-packages/EPIC.md: mark SI-16 done, update tables
  • docs/issues/open/1881-.../ISSUE.md: mark all tasks done (T1–T11, T13)

Pending (not in this PR)

  • T12: Yank torrust-tracker-contrib-bencode on crates.io — deferred until no downstream consumers confirmed

Verification

  • cargo build -p torrust-tracker-http-tracker-protocol ✅
  • cargo build --workspace ✅ (verified locally)
  • CI will run full suite on this PR

…rrust-bittorrent

- Create GitHub issue torrust#1881 as sub-issue of EPIC torrust#1669
- Move spec from drafts/ to open/1881-1669-16-migrate-contrib-bencode-to-torrust-bittorrent/ISSUE.md
- Update frontmatter: status open, github-issue 1881, branch set
- Tick workflow checkpoints: draft, reviewed, issue created, moved to open
- Update EPIC torrust#1669: replace #TBD bencode row with torrust#1881; remove from draft list
…ode 3.0.0

- Replace torrust-tracker-contrib-bencode path dep with torrust-bencode = "3.0.0"
- Update imports in announce.rs and scrape.rs to torrust_bencode crate name

Closes part of torrust#1881 (T7)
- Remove torrust-tracker-contrib-bencode from lock file
- Add torrust-bencode 3.0.0 from crates.io

Part of torrust#1881 (T7)
- Delete contrib/bencode/ directory (crate migrated to torrust/torrust-bittorrent)
- AGENTS.md: remove bencode from contrib/ description and package table
- docs/packages.md: update contrib/ tree to note migration
- docs/release_process.md: remove torrust-tracker-contrib-bencode from publish checklist
- src/console/ci/qbittorrent_e2e/bencode.rs: update crate name reference in doc comment
- .github/skills/release-new-version/SKILL.md: remove contrib/bencode version bump step
  and torrust-tracker-contrib-bencode from deployment checklist

Part of torrust#1881 (T8, T9, T10)
…ompletion (T13)

- EPIC: remove torrust-tracker-contrib-bencode from Package Inventory table
- EPIC: mark bencode migration row as DONE, update extraction candidates
- EPIC: tick SI-16 in quick list
- ISSUE: mark T1-T11, T13 as DONE; T12 (yank old crate) remains TODO
- ISSUE: tick workflow checkpoints; add progress log entry

Part of torrust#1881 (T13)
Copilot AI review requested due to automatic review settings June 5, 2026 16:12
@josecelano
josecelano requested a review from a team as a code owner June 5, 2026 16:12
@josecelano josecelano self-assigned this Jun 5, 2026
- Remove COPY contrib/bencode/Cargo.toml line from recipe stage
- Remove contrib/bencode stubs from mkdir/touch in recipe stage
- Remove torrust-tracker-contrib-bencode from excluded-packages comment

Part of torrust#1881

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 completes the tracker-side portion of SI-16 (#1881) by removing the in-workspace contrib/bencode crate and switching the HTTP protocol crate to the published torrust-bencode 3.0.0 dependency, plus updating related documentation to reflect the migration.

Changes:

  • Replace torrust-tracker-contrib-bencode path dependency with the crates.io torrust-bencode = "3.0.0" dependency and update imports accordingly.
  • Remove the contrib/bencode/ crate sources from this workspace (deleted crate, tests, benches, and module files).
  • Update release/docs/issue-tracking documentation to reflect the migration status.

Reviewed changes

Copilot reviewed 30 out of 31 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/console/ci/qbittorrent_e2e/bencode.rs Update doc comment to reference torrust-bencode instead of the old contrib crate.
packages/http-protocol/src/v1/responses/scrape.rs Switch imports to torrust_bencode.
packages/http-protocol/src/v1/responses/announce.rs Switch imports to torrust_bencode.
packages/http-protocol/Cargo.toml Replace path dep on torrust-tracker-contrib-bencode with torrust-bencode = "3.0.0".
docs/release_process.md Remove torrust-tracker-contrib-bencode from the “crates published” checklist.
docs/packages.md Update the documented directory tree for contrib/.
docs/issues/open/1881-1669-16-migrate-contrib-bencode-to-torrust-bittorrent/ISSUE.md Mark tasks/checkpoints as completed and update metadata/progress log.
docs/issues/open/1669-overhaul-packages/EPIC.md Update EPIC tables to reflect SI-16 completion and remove bencode from inventory.
contrib/bencode/tests/mod.rs Deleted as part of removing the contrib bencode crate.
contrib/bencode/src/reference/mod.rs Deleted as part of removing the contrib bencode crate.
contrib/bencode/src/reference/decode.rs Deleted as part of removing the contrib bencode crate.
contrib/bencode/src/reference/decode_opt.rs Deleted as part of removing the contrib bencode crate.
contrib/bencode/src/reference/bencode_ref.rs Deleted as part of removing the contrib bencode crate.
contrib/bencode/src/mutable/mod.rs Deleted as part of removing the contrib bencode crate.
contrib/bencode/src/mutable/encode.rs Deleted as part of removing the contrib bencode crate.
contrib/bencode/src/mutable/bencode_mut.rs Deleted as part of removing the contrib bencode crate.
contrib/bencode/src/lib.rs Deleted as part of removing the contrib bencode crate.
contrib/bencode/src/error.rs Deleted as part of removing the contrib bencode crate.
contrib/bencode/src/cow.rs Deleted as part of removing the contrib bencode crate.
contrib/bencode/src/access/mod.rs Deleted as part of removing the contrib bencode crate.
contrib/bencode/src/access/list.rs Deleted as part of removing the contrib bencode crate.
contrib/bencode/src/access/dict.rs Deleted as part of removing the contrib bencode crate.
contrib/bencode/src/access/convert.rs Deleted as part of removing the contrib bencode crate.
contrib/bencode/src/access/bencode.rs Deleted as part of removing the contrib bencode crate.
contrib/bencode/README.md Deleted as part of removing the contrib bencode crate.
contrib/bencode/Cargo.toml Deleted as part of removing the contrib bencode crate.
contrib/bencode/benches/multi_kb.bencode Deleted as part of removing the contrib bencode crate.
contrib/bencode/benches/bencode_benchmark.rs Deleted as part of removing the contrib bencode crate.
Cargo.lock Add torrust-bencode 3.0.0 and remove torrust-tracker-contrib-bencode.
AGENTS.md Update contrib/ description and community contributions table after migration.
.github/skills/dev/git-workflow/release-new-version/SKILL.md Remove contrib bencode from version bump/publish checklists.
Comments suppressed due to low confidence (1)

docs/issues/open/1881-1669-16-migrate-contrib-bencode-to-torrust-bittorrent/ISSUE.md:118

  • This workflow checkpoint claims the old crates.io name was yanked, but the implementation plan still has T12 as TODO and the progress log says yanking is pending. This should not be marked complete until the yank/deprecation is actually performed.

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

Comment thread docs/packages.md Resolved
Comment thread docs/release_process.md Resolved
- docs/packages.md: restore accurate contrib/ tree (dev-tools still exists)
- .github/workflows/deployment.yaml: remove torrust-tracker-contrib-bencode publish step
- docs/issues/open/1669-overhaul-packages/EPIC.md: correct yank status to 'yank pending'

Part of torrust#1881
@codecov

codecov Bot commented Jun 5, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.18%. Comparing base (2c5d032) to head (a817386).

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1883      +/-   ##
===========================================
+ Coverage    80.72%   81.18%   +0.45%     
===========================================
  Files          363      353      -10     
  Lines        27429    26669     -760     
  Branches     27429    26669     -760     
===========================================
- Hits         22143    21650     -493     
+ Misses        4977     4723     -254     
+ Partials       309      296      -13     

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

@josecelano

Copy link
Copy Markdown
Member Author

ACK a817386

@josecelano
josecelano merged commit 9322406 into torrust:develop Jun 5, 2026
17 checks passed

@da2ce7 da2ce7 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a post-merge review of #1883 as it stands at e170b9620 on the default branch.

What still runs: torrust-tracker-http-protocol takes its bencode encoder from the published torrust-bencode = "3.0.0" (packages/http-protocol/Cargo.toml:32, locked with its registry checksum at Cargo.lock:4921), and the announce and scrape encoders import it at packages/http-protocol/src/v1/responses/announce/encoding.rs:9 and packages/http-protocol/src/v1/responses/scrape/encoding.rs:6. Later refactors moved those modules out of announce.rs and scrape.rs, but the import lines are unchanged since a0e0e8e. The doc comment at src/console/ci/qbittorrent_e2e/bencode.rs:3 names the new crate.

[Nit] cspell.json:24 still ignores contrib/bencode/benches/*.bencode. This change deleted the only file under that path (multi_kb.bencode), and contrib/ now holds only dev-tools. The entry does nothing today, but it would quietly exempt any future file at that path from spell checking, and it contradicts the description's claim that every trace of the crate was removed from the workspace. Fix: delete the line.

[Nit] docs/issues/closed/1881-1669-16-migrate-contrib-bencode-to-torrust-bittorrent/ISSUE.md:117 marks "torrust-bencode published from torrust/torrust-bittorrent; old name yanked" as done (checked in 7863546). The same file keeps the yank task T12 at TODO (line 102), records it as pending (line 125) and leaves the acceptance item for yanking or deprecating torrust-tracker-contrib-bencode unchecked (line 137), and the description of #1883 defers it as well. A reader who checks the closed spec to learn whether the old crate name was retired gets two answers. Fix: split line 117 into a checked publish item and an unchecked yank item. Because the issue is closed, the yank also needs to be recorded wherever open work is tracked.

The other leftovers at the merge, four --exclude torrust-tracker-contrib-bencode arguments and a comment in Containerfile plus the comment in .dockerignore, were removed by 0b17ac8 and are history.

Checked and found sound: the manifest swap and its lockfile entry (crates.io source, checksum, and an Apache-2.0 license matching the deleted crate and listed in the runtime license inventory). Both imports use only the encoding side of the crate (BencodeMut, BMutAccess, ben_map!, ben_list!, ben_bytes!, ben_int!); the decode-side changes the description lists for the published crate do not touch that path. The published crate's source was not compared byte for byte, so what pins its behaviour here is the exact-byte unit tests and doc test at the tip: normal and compact announce responses, and scrape responses including a u32::MAX download count, with dictionary key order covered. The unwrap() calls on list_mut() and dict_mut() act on values that ben_list!() and ben_map!() have just built, so request data cannot make them fail, and peer-supplied ids and addresses are length-prefixed, so they cannot change the structure of the response. The doc comment's claim that the crate cannot embed pre-encoded bytes matches the deleted type, which has only integer, bytes, list and dictionary variants. No live build, CI, release or dependency-policy file at the tip still names the removed crate.

This branch was previously deployed

1 inactive deployment
coverage — a8173863 Deployed Jun 5, 2026 by josecelano via Generate Coverage Report #1369
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-16: Migrate contrib/bencode to torrust/torrust-bittorrent as torrust-bencode

3 participants