feat(configuration): move v3 network settings per tracker instance (#1640)#2014
Conversation
There was a problem hiding this comment.
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: Networkblock (includingexternal_ip,on_reverse_proxy,ipv6_v6only) on bothHttpTrackerandUdpTracker. - Removes v3
Core.netand v3-only helperConfiguration::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.
|
ACK f797ea7 |
Codecov Report❌ Patch coverage is
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. 🚀 New features to boost your workflow:
|
- 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)
Summary
Implements the v3 schema slice of issue #1640 (subissue #3 of EPIC #1978).
Each
HttpTrackerandUdpTrackerin v3 now carries its ownnetwork: Networkblock containingexternal_ip,on_reverse_proxy, andipv6_v6only. The shared[core.net]section is removed from v3. Schema v2 is unchanged.Changes
packages/configuration/src/v3_0_0/network.rs—Networkstruct with per-instance fields;#[serde(deny_unknown_fields)]to reject old v2 field names at deserializationpackages/configuration/src/v3_0_0/http_tracker.rs— replaced flatipv6_v6only: boolwithnetwork: Networkpackages/configuration/src/v3_0_0/udp_tracker.rs— same as http_trackerpackages/configuration/src/v3_0_0/core.rs— removednet: Networkfield;#[serde(deny_unknown_fields)]blocks old[core.net]keypackages/configuration/src/v3_0_0/mod.rs— updated defaults, removedget_ext_ip(), added deserialization tests including rejection of removed v2 layoutsdocs/adrs/20260721000000_make_network_configuration_per_tracker_instance.md— new ADR documenting the decisiondocs/adrs/index.md— ADR index entrydocs/issues/open/1640-1978-per-http-tracker-on-reverse-proxy-setting.md— spec updated with schema boundary, deferred tasks, and progress logSchema compatibility boundary
#[serde(deny_unknown_fields)]— old v2 field names ([core.net], flatipv6_v6only) are rejected at parse timeTesting
44 unit tests pass in
torrust-tracker-configuration. New tests cover:[http_trackers.network]/[udp_trackers.network][core.net]layoutipv6_v6onlyfield on both tracker typesCloses #1640 (v3 schema slice — runtime migration deferred to #1980)