Skip to content

refactor(http-protocol): decouple from tracker-core#1833

Merged
josecelano merged 2 commits into
torrust:developfrom
josecelano:1830-1669-12-decouple-http-protocol-from-tracker-core
May 27, 2026
Merged

refactor(http-protocol): decouple from tracker-core#1833
josecelano merged 2 commits into
torrust:developfrom
josecelano:1830-1669-12-decouple-http-protocol-from-tracker-core

Conversation

@josecelano
Copy link
Copy Markdown
Member

Summary

  • remove the forbidden protocol -> tracker-core edge by deleting the torrust-tracker-core dependency from packages/http-protocol/Cargo.toml
  • remove tracker-core error conversion impls from packages/http-protocol/src/v1/responses/error.rs
  • move HTTP failure-reason mapping to higher layers by adding From and From conversions in http-tracker-core services
  • update axum HTTP handlers and related tests to use boundary conversion into protocol error responses
  • update issue and EPIC tracking docs for SI-12 completion

Validation

  • TORRUST_GIT_HOOKS_LOG_DIR=.tmp ./contrib/dev-tools/git/hooks/pre-commit.sh --format=text --verbosity=concise
  • cargo build --workspace
  • cargo test -p torrust-tracker-http-tracker-protocol
  • cargo test -p torrust-tracker-http-tracker-core
  • cargo test -p torrust-tracker-axum-http-server
  • linter all
  • cargo tree -p torrust-tracker-http-tracker-protocol --depth 1
  • rg -n "torrust_tracker_core::|bittorrent_tracker_core::" packages/http-protocol

Notes

  • behavior is preserved at the protocol boundary with meaningful failure reasons for announce, scrape, whitelist, authentication, and peer IP resolution errors
  • authentication/whitelist message prefixes are now produced by boundary mapping in http-tracker-core instead of direct to_string usage in axum handlers

Closes #1830

Copilot AI review requested due to automatic review settings May 27, 2026 07:59
@josecelano josecelano self-assigned this May 27, 2026
Copy link
Copy Markdown

Copilot AI left a comment

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 removes the forbidden dependency edge from the HTTP protocol crate to torrust-tracker-core by moving tracker-core → HTTP failure-reason mapping into higher layers (http-tracker-core) and updating the axum handlers/tests to rely on boundary conversions.

Changes:

  • Removed torrust-tracker-core dependency and core-error From<...> conversions from packages/http-protocol.
  • Added From<HttpAnnounceError> / From<HttpScrapeError> → protocol responses::error::Error conversions in http-tracker-core.
  • Updated axum HTTP handlers + tests and refreshed the SI-12/EPIC tracking docs to reflect completion.

Reviewed changes

Copilot reviewed 9 out of 10 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
packages/http-tracker-core/src/services/announce.rs Adds boundary conversion from HttpAnnounceError into protocol error response.
packages/http-tracker-core/src/services/scrape.rs Adds boundary conversion from HttpScrapeError into protocol error response.
packages/http-protocol/src/v1/responses/error.rs Removes torrust_tracker_core error conversion impls from protocol layer.
packages/http-protocol/Cargo.toml Drops the torrust-tracker-core dependency.
packages/axum-http-server/src/v1/handlers/announce.rs Uses boundary conversion (Error::from(err)) instead of to_string() mapping.
packages/axum-http-server/src/v1/handlers/scrape.rs Uses boundary conversion (Error::from(err)) instead of to_string() mapping.
packages/axum-http-server/tests/server/asserts.rs Updates expected failure-reason fragments for authentication errors.
docs/issues/open/1830-1669-12-decouple-http-protocol-from-tracker-core.md Marks SI-12 tasks/acceptance criteria as DONE and updates verification notes.
docs/issues/open/1669-overhaul-packages/EPIC.md Updates EPIC dependency narrative and marks #1830 as complete.
Cargo.lock Removes the protocol crate’s lockfile reference to torrust-tracker-core.

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

Comment thread packages/axum-http-server/tests/server/asserts.rs
Comment thread packages/http-tracker-core/src/services/announce.rs Outdated
@codecov
Copy link
Copy Markdown

codecov Bot commented May 27, 2026

Codecov Report

❌ Patch coverage is 78.37838% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 77.80%. Comparing base (7242b48) to head (19b0ce1).

Files with missing lines Patch % Lines
...es/http-tracker-core/src/services/error_mapping.rs 60.00% 6 Missing ⚠️
...ackages/axum-http-server/src/v1/handlers/scrape.rs 66.66% 1 Missing ⚠️
packages/http-tracker-core/src/services/scrape.rs 80.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1833      +/-   ##
===========================================
+ Coverage    77.76%   77.80%   +0.04%     
===========================================
  Files          379      380       +1     
  Lines        28608    28592      -16     
  Branches     28608    28592      -16     
===========================================
  Hits         22246    22246              
+ Misses        6050     6033      -17     
- Partials       312      313       +1     

☔ View full report in Codecov by Sentry.
📢 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 19b0ce1

@josecelano josecelano merged commit 2809557 into torrust:develop May 27, 2026
18 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.

Decouple http-protocol from tracker-core

2 participants