Skip to content

feat(tracker-client): add unified tracker_client binary#1777

Merged
josecelano merged 6 commits into
torrust:developfrom
josecelano:1771-merge-clients-into-unified-tracker-client-cli
May 13, 2026
Merged

feat(tracker-client): add unified tracker_client binary#1777
josecelano merged 6 commits into
torrust:developfrom
josecelano:1771-merge-clients-into-unified-tracker-client-cli

Conversation

@josecelano
Copy link
Copy Markdown
Member

Closes #1771

Summary

Merges the three separate tracker client binaries (http_tracker_client, udp_tracker_client,
tracker_checker) into a single tracker_client binary with explicit protocol subcommands.

Changes

New: tracker_client binary

A single entry point replacing the three legacy binaries:

tracker_client http announce <url> <infohash> [--format json|text]
tracker_client http scrape   <url> <infohash>... [--format json|text]
tracker_client udp  announce <url> <infohash> [--format json|text]
tracker_client udp  scrape   <url> <infohash>... [--format json|text]
tracker_client check -- [--config-path FILE | --format json|text]
tracker_client check monitor udp --url udp://...
  • --format=json (default) / --format=text (pretty-printed JSON) for all subcommands
  • HTTP and UDP handlers are independent copies — not wired to the old implementations
  • Checker subcommand re-uses the existing checker library (checker::checks, checker::monitor)

Deprecation warnings

Each legacy binary (http_tracker_client, udp_tracker_client, tracker_checker) now prints
a startup warning on stderr directing users to tracker_client. The old binaries are otherwise
frozen — no new features, no modifications.

Tests

  • Ported tracker_checker integration tests to invoke tracker_client check --
  • Added new tracker_client integration tests: help output, HTTP error path (exit 1), UDP error path (exit 2)
  • All 46 unit tests + 13 integration tests pass

Docs and skills

  • Updated public-trackers-for-testing and run-tracker-locally skills
  • Updated docs/features/json-request-input/README.md
  • Issue spec fully updated with design decisions and manual verification evidence

Design decisions

Manual verification

All 7 local-tracker scenarios (HTTP announce/scrape, UDP announce/scrape, checker, --format=text)
pass with exit 0. Evidence recorded in the issue spec.

Spec

docs/issues/open/1771-merge-clients-into-unified-tracker-client-cli.md

Merge http_tracker_client, udp_tracker_client, and tracker_checker into
a single tracker_client binary with explicit protocol subcommands:

  tracker_client http announce|scrape <url> <infohash>
  tracker_client udp  announce|scrape <url> <infohash>
  tracker_client check [-- <checker-args>]

Implementation approach: progressive copy-and-port. Command handlers are
independent copies in console/tracker-client/src/console/clients/unified/.
The old binaries are frozen and never called from the new code.

Legacy binaries now print a deprecation notice on startup directing users
to tracker_client. They will be removed no earlier than ~1 year after
tracker_client ships (tracked in torrust#1775).

Changes:
- Add tracker_client binary entrypoint (bin/tracker_client.rs)
- Add unified/{app,http,udp,check}.rs with copied command handlers
- Add --format=json (default) / --format=text flag across all subcommands
- Port tracker_checker integration tests to tracker_client check --
- Add tracker_client integration tests (help, HTTP error, UDP error)
- Add deprecation eprintln! to http_tracker_client, udp_tracker_client,
  tracker_checker
- Update skills and docs to reference tracker_client commands
- Update issue spec torrust#1771: all tasks and AC marked DONE with evidence

All automated gates pass: linter all, 46 unit tests, 13 integration tests.
Manual verification M1-M7 against local tracker all exit 0.

Closes torrust#1771
@josecelano josecelano requested a review from a team as a code owner May 13, 2026 13:56
@josecelano josecelano self-assigned this May 13, 2026
@josecelano josecelano requested a review from Copilot May 13, 2026 13:56
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 introduces a new unified tracker_client CLI binary for the console/tracker-client crate, consolidating HTTP, UDP, and checker workflows under explicit protocol subcommands while leaving the legacy binaries in place with deprecation warnings.

Changes:

  • Added a new tracker_client binary with http, udp, and check subcommands implemented under console::clients::unified.
  • Ported/added integration tests to exercise tracker_client (including check) and updated docs/skills to reference the unified CLI.
  • Added startup deprecation warnings to http_tracker_client, udp_tracker_client, and tracker_checker.

Reviewed changes

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

Show a summary per file
File Description
docs/issues/open/1771-merge-clients-into-unified-tracker-client-cli.md Marks the issue spec as done; adds implementation strategy and design notes.
console/tracker-client/tests/tracker_client.rs New integration tests for tracker_client help and basic error paths.
console/tracker-client/tests/tracker_checker.rs Ports checker integration tests to tracker_client check -- ….
console/tracker-client/tests/tracker_checker/configuration.rs Updates test harness to use tracker_client check.
console/tracker-client/tests/tracker_checker/monitor.rs Updates monitor test to invoke tracker_client check monitor ….
console/tracker-client/src/console/clients/unified/mod.rs Declares unified module and documents migration intent.
console/tracker-client/src/console/clients/unified/app.rs Defines unified top-level clap app and dispatch to http/udp/check handlers.
console/tracker-client/src/console/clients/unified/http.rs New HTTP announce/scrape handlers + small unit tests.
console/tracker-client/src/console/clients/unified/udp.rs New UDP announce/scrape handlers wired to existing UDP client helpers.
console/tracker-client/src/console/clients/unified/check.rs New check implementation that reuses checker library modules.
console/tracker-client/src/console/clients/mod.rs Exposes the unified module alongside legacy modules.
console/tracker-client/src/bin/tracker_client.rs New unified binary entrypoint and exit/error handling.
console/tracker-client/src/bin/http_tracker_client.rs Adds deprecation warning on startup.
console/tracker-client/src/bin/udp_tracker_client.rs Adds deprecation warning on startup.
console/tracker-client/src/bin/tracker_checker.rs Adds deprecation warning on startup.
console/tracker-client/docs/features/json-request-input/README.md Updates examples/references to the unified CLI naming.
.github/skills/dev/testing/public-trackers-for-testing/SKILL.md Updates examples to use tracker_client http/udp … and new format names.
.github/skills/dev/environment-setup/run-tracker-locally/SKILL.md Updates local testing commands to use tracker_client http/udp ….

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

Comment thread console/tracker-client/src/console/clients/unified/check.rs Outdated
Comment thread console/tracker-client/src/bin/tracker_client.rs Outdated
Comment thread console/tracker-client/tests/tracker_client.rs
@codecov
Copy link
Copy Markdown

codecov Bot commented May 13, 2026

Codecov Report

❌ Patch coverage is 42.95612% with 247 lines in your changes missing coverage. Please review.
✅ Project coverage is 78.23%. Comparing base (2452f12) to head (4027638).

Files with missing lines Patch % Lines
...tracker-client/src/console/clients/unified/http.rs 42.93% 102 Missing and 3 partials ⚠️
.../tracker-client/src/console/clients/unified/udp.rs 15.57% 100 Missing and 3 partials ⚠️
...racker-client/src/console/clients/unified/check.rs 65.51% 24 Missing and 6 partials ⚠️
.../tracker-client/src/console/clients/unified/app.rs 72.72% 5 Missing and 1 partial ⚠️
...sole/tracker-client/src/bin/http_tracker_client.rs 0.00% 1 Missing ⚠️
console/tracker-client/src/bin/tracker_checker.rs 0.00% 1 Missing ⚠️
...nsole/tracker-client/src/bin/udp_tracker_client.rs 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1777      +/-   ##
===========================================
- Coverage    79.01%   78.23%   -0.79%     
===========================================
  Files          371      376       +5     
  Lines        27928    28361     +433     
  Branches     27928    28361     +433     
===========================================
+ Hits         22068    22188     +120     
- Misses        5555     5859     +304     
- Partials       305      314       +9     

☔ 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 3e47c36

@josecelano josecelano merged commit 0303d17 into torrust:develop May 13, 2026
15 of 16 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.

Merge clients into a unified tracker_client CLI (mechanical port)

2 participants