Skip to content

feat(configuration): move v3 network settings per tracker instance (#1640)#2014

Merged
josecelano merged 7 commits into
torrust:developfrom
josecelano:1640-move-network-to-per-instance-config
Jul 21, 2026
Merged

feat(configuration): move v3 network settings per tracker instance (#1640)#2014
josecelano merged 7 commits into
torrust:developfrom
josecelano:1640-move-network-to-per-instance-config

Conversation

@josecelano

Copy link
Copy Markdown
Member

Summary

Implements the v3 schema slice of issue #1640 (subissue #3 of EPIC #1978).

Each HttpTracker and UdpTracker in v3 now carries its own network: Network block containing external_ip, on_reverse_proxy, and ipv6_v6only. The shared [core.net] section is removed from v3. Schema v2 is unchanged.

Changes

  • packages/configuration/src/v3_0_0/network.rsNetwork struct with per-instance fields; #[serde(deny_unknown_fields)] to reject old v2 field names at deserialization
  • packages/configuration/src/v3_0_0/http_tracker.rs — replaced flat ipv6_v6only: bool with network: Network
  • packages/configuration/src/v3_0_0/udp_tracker.rs — same as http_tracker
  • packages/configuration/src/v3_0_0/core.rs — removed net: Network field; #[serde(deny_unknown_fields)] blocks old [core.net] key
  • packages/configuration/src/v3_0_0/mod.rs — updated defaults, removed get_ext_ip(), added deserialization tests including rejection of removed v2 layouts
  • docs/adrs/20260721000000_make_network_configuration_per_tracker_instance.md — new ADR documenting the decision
  • docs/adrs/index.md — ADR index entry
  • docs/issues/open/1640-1978-per-http-tracker-on-reverse-proxy-setting.md — spec updated with schema boundary, deferred tasks, and progress log

Schema compatibility boundary

Testing

44 unit tests pass in torrust-tracker-configuration. New tests cover:

  • Deserializing [http_trackers.network] / [udp_trackers.network]
  • Safe defaults when the block is omitted
  • Rejection of the removed [core.net] layout
  • Rejection of the removed flat ipv6_v6only field on both tracker types

Closes #1640 (v3 schema slice — runtime migration deferred to #1980)

Copilot AI review requested due to automatic review settings July 21, 2026 11:05
@josecelano josecelano self-assigned this Jul 21, 2026
@josecelano
josecelano marked this pull request as ready for review July 21, 2026 11:06

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 updates the configuration crate’s v3.0.0 schema to make network-related settings per tracker instance (HTTP and UDP), removing the global core.net layout in v3 while keeping v2 unchanged. This supports mixed deployments (e.g., some HTTP trackers behind a reverse proxy, others direct) and enforces a strict schema boundary via serde unknown-field rejection.

Changes:

  • Introduces a v3 per-instance network: Network block (including external_ip, on_reverse_proxy, ipv6_v6only) on both HttpTracker and UdpTracker.
  • Removes v3 Core.net and v3-only helper Configuration::get_ext_ip(), and adds tests to ensure removed v2 layouts are rejected in v3.
  • Adds an ADR documenting the decision and updates EPIC/spec documentation and ADR index.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/configuration/src/v3_0_0/network.rs Adds ipv6_v6only to Network and enforces strict v3 deserialization with deny_unknown_fields.
packages/configuration/src/v3_0_0/http_tracker.rs Replaces flat networking fields with network: Network and rejects removed/unknown fields in v3.
packages/configuration/src/v3_0_0/udp_tracker.rs Same per-instance network: Network change for UDP tracker config.
packages/configuration/src/v3_0_0/core.rs Removes net: Network from v3 Core and rejects old [core.net] via deny_unknown_fields.
packages/configuration/src/v3_0_0/mod.rs Updates docs/tests/defaults for the new per-tracker network block and adds v3 schema boundary rejection tests.
docs/adrs/20260721000000_make_network_configuration_per_tracker_instance.md New ADR documenting the per-instance networking decision and explicit non-fallback v3 boundary.
docs/adrs/index.md Registers the new ADR in the ADR index.
docs/issues/open/1640-1978-per-http-tracker-on-reverse-proxy-setting.md Updates the spec to reflect the strict v3 boundary and deferred runtime migration to #1980.
docs/issues/open/1978-configuration-overhaul-epic.md Updates EPIC progress/log to reflect the start of #1640 work and schema boundary clarifications.

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

Comment thread packages/configuration/src/v3_0_0/mod.rs Outdated
Copilot AI review requested due to automatic review settings July 21, 2026 11:16

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 9 out of 9 changed files in this pull request and generated 3 comments.

Comment thread packages/configuration/src/v3_0_0/mod.rs Outdated
Comment thread packages/configuration/src/v3_0_0/mod.rs Outdated
Comment thread packages/configuration/src/v3_0_0/mod.rs Outdated
Copilot AI review requested due to automatic review settings July 21, 2026 11:33

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 9 out of 9 changed files in this pull request and generated 1 comment.

Comment thread packages/configuration/src/v3_0_0/mod.rs
Copilot AI review requested due to automatic review settings July 21, 2026 11:49
@josecelano

Copy link
Copy Markdown
Member Author

ACK f797ea7

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 9 out of 9 changed files in this pull request and generated no new comments.

@codecov

codecov Bot commented Jul 21, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.70992% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.20%. Comparing base (3f03996) to head (f797ea7).

Files with missing lines Patch % Lines
packages/configuration/src/v3_0_0/mod.rs 97.50% 3 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #2014      +/-   ##
===========================================
+ Coverage    80.97%   81.20%   +0.22%     
===========================================
  Files          340      340              
  Lines        23901    24000      +99     
  Branches     23901    24000      +99     
===========================================
+ Hits         19355    19490     +135     
+ Misses        4236     4200      -36     
  Partials       310      310              

☔ 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
josecelano merged commit 178b28d into torrust:develop Jul 21, 2026
18 checks passed
josecelano added a commit that referenced this pull request Jul 21, 2026
- Mark #1640 DONE in EPIC subissue table and progress log
  (PR #2014 merged v3 network schema slice; deferred runtime
  consumers tracked under #1980)
- Mark #1417 IN_PROGRESS in EPIC; start branch 1417-add-public-service-url
- Update #1640 spec: status done, add closed-out progress entry
- Update #1417 spec: scope decisions from maintainer review
  - public_url on HttpTracker, UdpTracker, HttpApi only (not HealthCheckApi)
  - url crate parse + scheme validation at deserialization
  - deny_unknown_fields added to HttpApi and HealthCheckApi for consistency
  - Revised implementation plan (T0-T6) and acceptance criteria (AC1-AC5)
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.

Support per-HTTP-tracker on_reverse_proxy setting

2 participants