feat(udp): add IP-ban cleanup configuration and job - #2029
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a v3-only [udp_tracker_server] configuration section to validate an IP-ban reset interval, and consolidates IP-ban cleanup into a single cancellation-managed application job (instead of one task per UDP listener). This fits into the configuration-overhaul EPIC work by introducing a typed v3 schema boundary while improving runtime job ownership/lifecycle.
Changes:
- Introduces
v3_0_0::udp_tracker_server::UdpTrackerServerplus validated scalar newtypes (IpBansResetIntervalInSecs,AtLeastU64) with a 1-hour minimum and 24-hour default. - Moves UDP IP-ban cleanup spawning out of the per-listener UDP launcher into a single
JobManager-owned bootstrap job. - Adds ADR + documentation updates covering validation-layer boundaries and current application job ownership.
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
src/bootstrap/jobs/udp_tracker_server.rs |
Adds the new cancellation-managed UDP IP-ban cleanup job and unit tests. |
src/app.rs |
Registers the new udp_ban_cleanup job via JobManager during startup. |
packages/udp-server/src/server/launcher.rs |
Removes per-UDP-listener ban cleanup task spawning. |
packages/configuration/src/validator.rs |
Clarifies validator responsibility as cross-field consistency validation (not single-value invariants). |
packages/configuration/src/v3_0_0/udp_tracker_server.rs |
Adds v3 UDP-tracker-server-wide config struct + typed interval validation. |
packages/configuration/src/v3_0_0/types.rs |
Adds reusable validated scalar type(s) (AtLeastU64) for v3 schema invariants. |
packages/configuration/src/v3_0_0/mod.rs |
Wires [udp_tracker_server] into the v3 root config, docs, and tests. |
docs/issues/open/1980-1978-configuration-overhaul-final-cleanup.md |
Updates #1980 scope to include wiring the new v3 setting into runtime consumption later. |
docs/issues/open/1978-configuration-overhaul-epic.md |
Updates EPIC status/notes to reflect staged delivery and the new job behavior. |
docs/issues/open/1453-1978-ip-bans-reset-interval-configurable/ISSUE.md |
Adds the full issue spec in folder form, with staged-delivery boundary documented. |
docs/issues/open/1453-1978-ip-bans-reset-interval-configurable/evidence/2026-07-24-manual-runtime-verification.md |
Adds durable manual runtime verification evidence for “only one cleanup job starts”. |
docs/issues/open/1453-1978-ip-bans-reset-interval-configurable.md |
Removes the old single-file spec in favor of the folder-based spec. |
docs/issues/open/1136-1978-configurable-udp-connection-id-validation-policy.md |
Updates references to the new #1453 spec location. |
docs/index.md |
Adds docs/application-jobs.md to the documentation index. |
docs/application-jobs.md |
Documents current background-job ownership/lifecycle behavior and #1453 as an example. |
docs/adrs/index.md |
Registers the new ADR in the ADR index. |
docs/adrs/20260723184019_separate_configuration_value_invariants_from_consistency_validation.md |
Adds ADR defining the validation-layer boundary (value invariants vs consistency validation vs runtime checks). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #2029 +/- ##
===========================================
- Coverage 81.61% 81.48% -0.13%
===========================================
Files 342 342
Lines 24337 24448 +111
Branches 24337 24448 +111
===========================================
+ Hits 19862 19921 +59
- Misses 4177 4231 +54
+ Partials 298 296 -2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Previously the application checked `config.core.private` in multiple places when starting individual UDP-related jobs: - UDP listener launcher (start_the_udp_instances) - Ban cleanup job launcher (should_start_ban_cleanup_job) This was an indirect dependency. The real architectural policy is: start the entire UDP service group when the tracker allows UDP instances to run. Centralized `should_start_udp_tracker_services` in app.rs gates the complete group: - UDP listener instances - UDP stats event listener - UDP banning event listener - Ban cleanup job The policy function checks two conditions: 1. At least one UDP tracker is configured 2. The tracker is not in private mode Moved condition tests from udp_tracker_server to app.rs module, since the policy is now an application orchestration concern. Updated docs/application-jobs.md and issue spec to reflect service-group gating. This addresses the design concern raised in PR torrust#2029 review. Issue: torrust#1453 Co-developed-with: @josecelano PR: torrust#2029
Previously the application checked `config.core.private` in multiple places when starting individual UDP-related jobs: - UDP listener launcher (start_the_udp_instances) - Ban cleanup job launcher (should_start_ban_cleanup_job) This was an indirect dependency. The real architectural policy is: start the entire UDP service group when the tracker allows UDP instances to run. Centralized `should_start_udp_tracker_services` in app.rs gates the complete group: - UDP listener instances - UDP stats event listener - UDP banning event listener - Ban cleanup job The policy function checks two conditions: 1. At least one UDP tracker is configured 2. The tracker is not in private mode Moved condition tests from udp_tracker_server to app.rs module, since the policy is now an application orchestration concern. Updated docs/application-jobs.md and issue spec to reflect service-group gating. This addresses the design concern raised in PR torrust#2029 review. Issue: torrust#1453 Co-developed-with: @josecelano PR: torrust#2029
2806a5c to
03c53f2
Compare
|
ACK 03c53f2 |
Summary
Adds the v3-only UDP tracker server IP-ban reset interval schema and removes duplicate cleanup tasks by registering one cancellation-managed application job for the shared
BanService.UdpTrackerServer::ip_bans_reset_interval_in_secs, with a 3600-second minimum and 86400-second default.JobManager-owned bootstrap job. Runtime consumption of the v3 field remains intentionally deferred to Configuration overhaul final cleanup: remove global re-exports, migrate consumers to explicit versioned imports #1980.Verification
cargo machete --with-metadata,cargo deny check bans,linter all, andcargo test --doc --workspace.127.0.0.1:16868,127.0.0.1:16969) and observed exactly oneStarting UDP IP-ban cleanup joblog entry at the current 86400-second bootstrap default. Durable evidence:docs/issues/open/1453-1978-ip-bans-reset-interval-configurable/evidence/2026-07-24-manual-runtime-verification.md.Closes #1453.