Skip to content

fix(axum-http-server): return compact peer list by default per BEP 23 - #1990

Merged
josecelano merged 2 commits into
torrust:developfrom
josecelano:1986-align-http-tracker-compact-default-with-bep-23
Jul 16, 2026
Merged

fix(axum-http-server): return compact peer list by default per BEP 23#1990
josecelano merged 2 commits into
torrust:developfrom
josecelano:1986-align-http-tracker-compact-default-with-bep-23

Conversation

@josecelano

Copy link
Copy Markdown
Member

Description

Aligns the HTTP tracker with BEP 23, which SUGGESTS that trackers return compact peer lists by default when the client omits the compact GET parameter.

Changes

  1. packages/axum-http-server/src/v1/handlers/announce.rs — Inverted the compact logic in build_response. Now None (absent compact param) maps to compact response. Only compact=0 returns dictionary format.

  2. packages/axum-http-server/src/lib.rs — Removed the BEP 23 deviation NOTICE. Updated the query-parameter table Default column for compact from None to compact (BEP 23).

  3. packages/axum-http-server/tests/server/v1/contract/for_all_config_modes/receiving_an_announce_request.rs — Renamed test should_not_return_the_compact_response_by_defaultshould_return_the_compact_response_by_default. Flipped assertion. Removed code-review comment.

  4. packages/axum-http-server/tests/server/asserts.rs — Updated assert_is_announce_response helper to accept both compact and normal formats.

Verification

  • ✅ 74 tests pass for axum-http-server package
  • ✅ Full workspace tests pass (all targets, all features)
  • linter all exits with code 0
  • ✅ Manual verification confirmed:
    • No compact param → compact response
    • compact=1 → compact response
    • compact=0 → dictionary response

Closes #1986

Copilot AI review requested due to automatic review settings July 16, 2026 11:15
@josecelano josecelano self-assigned this Jul 16, 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 aligns the HTTP announce endpoint in axum-http-server with BEP 23’s suggestion to return compact peer lists by default when the compact query parameter is omitted, while still honoring compact=0 to request the dictionary (non-compact) format.

Changes:

  • Inverted announce response selection so compact absent → compact, and compact=0 → dictionary format.
  • Updated module documentation to remove the prior “deviation” notice and reflect the new default behavior.
  • Adjusted contract tests and test helpers to accept either announce response format.

Reviewed changes

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

Show a summary per file
File Description
packages/axum-http-server/src/v1/handlers/announce.rs Inverts the compact/default announce response selection logic.
packages/axum-http-server/src/lib.rs Updates HTTP tracker docs: removes prior deviation notice and documents compact-by-default behavior.
packages/axum-http-server/tests/server/v1/contract/for_all_config_modes/receiving_an_announce_request.rs Renames and flips the “default compact” contract test assertion.
packages/axum-http-server/tests/server/asserts.rs Updates assert_is_announce_response to accept both compact and normal response formats.
docs/issues/open/1986-align-http-tracker-compact-default-with-bep-23/ISSUE.md Marks the issue spec tasks/verification as completed with evidence.

💡 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/axum-http-server/src/lib.rs Outdated
…1990

- Use  instead of  in
   helper to handle arbitrary binary
  data in compact peer strings.
- Change  column for  in the query-parameter table
  from  to   (compact)  for clarity, per
  Copilot review feedback.
@josecelano

Copy link
Copy Markdown
Member Author

ACK 25162a0

@josecelano
josecelano merged commit bbc9686 into torrust:develop Jul 16, 2026
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.

Return compact peer list by default when compact param is absent (BEP 23)

2 participants