Skip to content

Commit fe4ae50

Browse files
josecelanoCopilot
andcommitted
docs(issues): [#2505] correct the contract, origin, and AC4 statements
The inherent get_banned_ips_total had no doc comment, so the spec's contracts-violated bullet, scope, and AC3 now say the fix adds one and updates the reset_bans doc. Date the method from 1ce2e33 (#1145), not the package extraction, and note that the value was wrong since the metric was introduced. Make the AC4 evidence say that no code reference remains. Addresses late PR #2506 review findings F7 and F9 and PR #2524 review finding F4 by Cameron. Co-authored-by: Copilot <[email protected]>
1 parent 05d34e9 commit fe4ae50

1 file changed

Lines changed: 31 additions & 11 deletions

File tree

  • docs/issues/open/2505-udp-banned-ips-metric

‎docs/issues/open/2505-udp-banned-ips-metric/ISSUE.md‎

Lines changed: 31 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ github-issue: 2505
99
spec-path: docs/issues/open/2505-udp-banned-ips-metric/ISSUE.md
1010
branch: "2505-udp-banned-ips-metric"
1111
related-pr: null
12-
last-updated-utc: "2026-10-14 10:00"
12+
last-updated-utc: "2026-10-14 10:03"
1313
semantic-links:
1414
skill-links:
1515
- create-issue
@@ -83,8 +83,11 @@ stats, and the Prometheus metrics all show the wrong value.
8383

8484
**Contracts violated** (all say "banned"):
8585

86-
- `BanService::get_banned_ips_total` and `BanningStats::get_banned_ips_total` docs: "Returns the
87-
total number of banned IPs."
86+
- `BanningStats::get_banned_ips_total` doc: "Returns the total number of banned IPs." The inherent
87+
`BanService::get_banned_ips_total` had no doc comment, so its contract was only the trait's, and
88+
the `BanService::reset_bans` doc ("Resets the counters and updates the reset timestamp.") becomes
89+
false once the write-only timestamp field is removed. (Corrected after PR #2506 review finding F7;
90+
an earlier version said both methods carried the sentence.)
8891
- Metric description (`packages/udp-server/src/statistics/mod.rs`): "Total number of IPs banned from
8992
UDP requests" (Prometheus `udp_tracker_server_ips_banned_total`).
9093
- `udp-server` `Metrics::udp_banned_ips_total` doc: "Total number of banned IPs."
@@ -125,8 +128,12 @@ named `it_should_publish_the_distinct_client_ip_total_after_a_connection_cookie_
125128
### Origin
126129

127130
Found while planning `packages/udp-core/src/services/banning.rs` tests in Issue #1348 (EPIC #1347).
128-
`get_banned_ips_total` dates from the package extraction (`1886593b4`, 2025-02-18); the trait
129-
wrapper came with `637c17b18` (2026-06-23).
131+
`get_banned_ips_total` was added with its current body (`self.accurate_error_counter.len()`) by
132+
`1ce2e3327` (`feat: [#1145] add banned ips total for UDP to stats`, 2025-01-07), in
133+
`src/servers/udp/server/banning.rs`; the package extraction (`1886593b4`, 2025-02-18) only moved
134+
the file. So the value has been wrong since the metric was introduced. The trait wrapper came with
135+
`637c17b18` (2026-06-23). (Corrected after PR #2506 review finding F9; an earlier version dated the
136+
method from the extraction.)
130137

131138
## Decision: Meaning of "Banned" When Validation Is `disabled`
132139

@@ -149,7 +156,10 @@ field. The documentation listed under "Contracts violated" must state the `disab
149156
- Make `BanService::get_banned_ips_total()` return the number of IPs whose error count exceeds the
150157
limit, in both `strict` and `disabled` mode.
151158
- Update the gauge when bans are reset, so it never reports a stale total.
152-
- Fix the documentation listed under "Contracts violated" to match decision A.
159+
- Fix the documentation listed under "Contracts violated" to match decision A: add a doc comment
160+
to the inherent `BanService::get_banned_ips_total` (the threshold and the `disabled`-mode
161+
meaning), update the `BanService::reset_bans` doc, and correct the metric, `Metrics`, and REST
162+
field descriptions.
153163
- Remove the unused `BanningStats` trait and its implementation.
154164
- Remove the write-only `BanService::last_connection_id_errors_reset` field.
155165
- Adjust the `udp-server` unit tests that pin the old value, keeping their intent:
@@ -569,15 +579,23 @@ scope (`udp-core`, `udp-server`), signed with GPG.
569579
states the measure and the 5.1% figure, and says that attributing the P2 excesses to the counter
570580
or to noise rests on the same-machine comparison, not on the P1/P2 tables. AC5's conclusion is
571581
unchanged.
582+
- 2026-10-14 10:03 UTC - GitHub Copilot (implementation session) - Late PR #2506 review (Cameron, findings
583+
F7 and F9, handled on this branch with maintainer approval
584+
<https://github.com/torrust/torrust-tracker/pull/2506#issuecomment-6165699972>) and PR #2524
585+
finding F4 by Cameron: corrected the "Contracts violated" bullet (the inherent method had no doc
586+
comment), Scope, AC3, and its evidence row; dated `get_banned_ips_total` from `1ce2e3327` (#1145)
587+
and noted in "Risks and Trade-offs" that the value was wrong since the metric was introduced; and
588+
made the AC4 evidence say that no code reference remains, keeping the open EPIC's history row.
572589

573590
## Acceptance Criteria
574591

575592
- [x] AC1: The banned-IPs total counts only IPs whose error count exceeds the limit, in both `strict`
576593
and `disabled` mode (R1, R1p, R5, R6, M1-M3).
577594
- [x] AC2: After a ban reset, the banned total and the published gauge report the new value (R2, R3,
578595
R4, M4).
579-
- [x] AC3: The method, metric, `udp-server` helper, and REST field descriptions match the behavior,
580-
including the `disabled`-mode meaning.
596+
- [x] AC3: The inherent `BanService::get_banned_ips_total` has a doc comment, and it, the
597+
`BanService::reset_bans` doc, the metric, the `udp-server` helper, and the REST field descriptions
598+
match the behavior, including the `disabled`-mode meaning.
581599
- [x] AC4: The `BanningStats` trait and `BanService::last_connection_id_errors_reset` are removed.
582600
- [x] AC5: `performance-evidence.md` records the P1 baseline and the P2 after measurements
583601
(Criterion, including `udp_ban_service/record_error`, and `aquatic_udp_load_test`), and P2 meets
@@ -644,15 +662,17 @@ Status values: `TODO`, `IN_PROGRESS`, `DONE`, `FAILED`, `BLOCKED`. "Before" valu
644662
| ----- | ------ | ------------------ |
645663
| AC1 | DONE | R1, R1p, R5, R6 green and proven (manual-verification-evidence.md "Regression Tests"); M1-M3 after fix 0, 0, 1 |
646664
| AC2 | DONE | R2, R3, R4 green and proven; M4 after fix 0 right after the reset |
647-
| AC3 | DONE | `docs(udp-server): [#2505] describe the banned-IPs metric as IPs over the limit`; `BanService::get_banned_ips_total` doc in the `udp-core` fix |
648-
| AC4 | DONE | `fix(udp-core): [#2505] count only IPs over the limit as banned`; no reference remains outside archived docs |
665+
| AC3 | DONE | `docs(udp-server): [#2505] describe the banned-IPs metric as IPs over the limit`; the new `BanService::get_banned_ips_total` doc comment and the updated `reset_bans` doc in `fix(udp-core): [#2505] count only IPs over the limit as banned` |
666+
| AC4 | DONE | `fix(udp-core): [#2505] count only IPs over the limit as banned`; no code reference remains. The open EPIC (`docs/issues/open/1669-overhaul-packages/EPIC.md`, SI-30 row) still names `BanningStats` as an SI-30 deliverable, which records history and stays as is. |
649667
| AC5 | DONE (accepted deviation) | `performance-evidence.md` "Comparison": load test passes; 9 Criterion medians over the limit, accepted by the maintainer |
650668
| AC6 | DONE | manual-verification-evidence.md "Final Recheck on the Finished Code (T10)" (F-V1 to F-V4 on the final code) |
651669
| AC7 | DONE | `record_error` P2 medians flat across 10 to 10,000 tracked IPs; B1 check shows a scan would grow linearly |
652670

653671
## Risks and Trade-offs
654672

655-
- **Dashboards built on the inflated value will drop.** Mention it in the PR and release notes.
673+
- **Dashboards built on the inflated value will drop.** The value has been inflated since the metric
674+
was introduced (#1145), so every release that reports it is affected. Mention it in the PR and
675+
release notes.
656676
Operators who want "IPs that sent an invalid connection ID" lose that number; the existing
657677
counter `udp_tracker_server_connection_id_errors_total` still reports the error volume.
658678
- **Per-error cost.** See "Performance Alternatives"; the benchmark guards against regressions.

0 commit comments

Comments
 (0)