Skip to content

refactor(udp-core): [#2114] remove bloom ban pre-check - #2119

Merged
josecelano merged 5 commits into
torrust:developfrom
josecelano:2114-benchmark-udp-ban-service-counters
Aug 31, 2026
Merged

josecelano merged 5 commits into
torrust:developfrom
josecelano:2114-benchmark-udp-ban-service-counters

Conversation

@josecelano

@josecelano josecelano commented Aug 31, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Remove the bloom dependency and its transitive bit-vec dependency from udp-core.
  • Keep exact per-IP HashMap counters as the sole UDP ban decision state, preserving the strictly-greater-than threshold rule.
  • Add a Criterion benchmark, package-local benchmark record, and package-local ADR with the evaluated alternatives and their tradeoffs.
  • Keep Criterion as a development-only dependency and add the benchmark target stub required by the manifest-only Cargo Chef recipe stage.
  • Address and resolve all Copilot review threads; the review audit is recorded in docs/copilot-pr-reviews/pr-2119-copilot-suggestions.md.

Scope

  • packages/udp-core: BanService, Cargo dependencies, Criterion benchmark, package documentation, and package-local ADR collection.
  • Containerfile: Cargo Chef recipe-stage stub for the explicit UDP benchmark target.
  • docs/issues and docs/copilot-pr-reviews: Record Issue 2114 evidence, the decision, remaining follow-up work, and Copilot-review dispositions.

Validation

  • cargo test -p torrust-tracker-udp-core
  • cargo bench -p torrust-tracker-udp-core --bench ban_service_benchmark
  • docker build --target recipe --file Containerfile --tag torrust-tracker-chef-recipe-check:2119 .
  • docker build --target dependencies --file Containerfile --tag torrust-tracker-chef-dependencies-check:2119 .
  • linter all
  • TORRUST_GIT_HOOKS_LOG_DIR=.tmp ./contrib/dev-tools/git/hooks/pre-commit.sh

Deferred Work

The exact-counter map remains unbounded until reset. Bounded-state alternatives are documented in the ADR and require a separate threat-modelled design. The independent dependency-license review and manual tracker-level validation remain open in Issue 2114.

Related to #2114

Copilot AI lite review requested due to automatic review settings August 31, 2026 11:30
@josecelano josecelano self-assigned this Aug 31, 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 refactors the UDP banning service in udp-core to remove the counting Bloom filter pre-check (and its dependencies), keeping exact per-IP counters as the sole ban-decision state, and records the decision and evidence via package-local benchmarking docs and ADRs (Issue #2114).

Changes:

  • Removed the bloom/bit-vec dependency chain and simplified BanService to use only HashMap<IpAddr, u32> for ban decisions.
  • Added a focused Criterion benchmark for BanService, plus package-local benchmarking documentation.
  • Introduced a package-local ADR collection and recorded the Bloom-filter removal decision and tradeoffs.

Reviewed changes

Copilot reviewed 9 out of 10 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
packages/udp-core/src/services/banning.rs Removes Bloom pre-check, keeps exact counters, updates tests and docs.
packages/udp-core/README.md Adds links to package-local benchmarking and ADR docs.
packages/udp-core/docs/benchmarking/banning.md Documents benchmark purpose, workloads, and baseline results.
packages/udp-core/docs/adrs/README.md Introduces package-local ADR collection README.
packages/udp-core/docs/adrs/index.md Adds package-local ADR index entry for the banning decision.
packages/udp-core/docs/adrs/20260829204258_use_exact_ip_counters_for_udp_banning.md Records the removal decision, evidence, and alternatives.
packages/udp-core/Cargo.toml Removes bloom and registers the new benchmark target.
packages/udp-core/benches/ban_service_benchmark.rs Adds Criterion benchmark for increase_counter and is_banned.
docs/issues/open/2114-consider-removing-bloom-filter/ISSUE.md Updates issue spec progress, acceptance criteria, and references.
Cargo.lock Removes bloom and bit-vec from the lockfile dependency graph.
Suppressed comments (1)

packages/udp-core/src/services/banning.rs:61

  • After removing the Bloom filter, the reset log message still refers to the "connection id errors filter" being cleared. Updating the wording avoids misleading operational logs about a filter that no longer exists.
        self.last_connection_id_errors_reset = Instant::now();

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread packages/udp-core/Cargo.toml Resolved
@codecov

codecov Bot commented Aug 31, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.99%. Comparing base (23128fb) to head (557ed8e).

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #2119      +/-   ##
===========================================
- Coverage    84.03%   83.99%   -0.05%     
===========================================
  Files          349      349              
  Lines        26998    26996       -2     
  Branches     26998    26996       -2     
===========================================
- Hits         22688    22675      -13     
- Misses        3972     3982      +10     
- Partials       338      339       +1     

☔ 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

Copy link
Copy Markdown
Member Author

ACK 557ed8e

@josecelano josecelano linked an issue Aug 31, 2026 that may be closed by this pull request
@josecelano
josecelano merged commit 576f366 into torrust:develop Aug 31, 2026
20 checks passed
josecelano added a commit that referenced this pull request Sep 15, 2026
1edda0e docs(licenses): correct review inventory provenance (Jose Celano)
5a7cc85 docs(licenses): address dependency review feedback (Jose Celano)
7ad91f3 docs(licenses): record bloom removal (Jose Celano)
2d4baea docs(licenses): link bloom remediation issue (Jose Celano)
0dd5ae9 docs(licenses): add bloom legal review brief (Jose Celano)
8506e82 docs(licenses): clarify maintainer review actions (Jose Celano)
484efbd docs(licenses): record initial dependency license review (Jose Celano)

Pull request description:

  Records the first evidence-grounded technical dependency-license review for #269.

  The review retains compact inventories for the complete locked graph at its initial review snapshot (575 packages) and a runtime-oriented view (510 packages), with reproducible commands, checksums, and published-source records for non-routine declarations. It also adds the missing workspace license inheritance for `workspace-coupling`.

  The direct runtime `bloom` `GPL-2.0` finding is technically resolved: Issue #2114 and merged PR #2119 removed `bloom` and its transitive `bit-vec` dependency after a focused Criterion comparison found the exact-map path faster for the measured operations. The report retains the original `bloom` evidence for any review of releases that included it; it makes no conclusion about those releases.

  No license-enforcement policy is introduced. The five `LGPL-3.0` declarations and other non-routine expressions remain pending maintainer classification and qualified legal review where required.

  ## Pending Maintainer Actions

  1. For each remaining pending finding, record the package/version/license evidence, dependency kind and reachability, and which distributed artifacts include or depend on it.
  2. Read the linked license and notice files, recording plainly stated notice or text-retention requirements without inferring legal compatibility from SPDX metadata.
  3. Record one disposition per finding: escalate for qualified legal review, create remediation work, or propose an approval rationale after the required review is complete.
  4. Obtain an explicit approval or objection from every active maintainer. A missing response remains pending; approval records the project decision and is not an individual legal opinion.
  5. Create focused remediation issues for every finding that cannot be approved. Do not add automated license enforcement until an approved SPDX policy and exception process exist.

  Related to #269.

ACKs for top commit:
  da2ce7:
    ACK 1edda0e — r3-approved content rebased onto develop efebacf, range-diff identity and inventory checksums recomputed from the bytes at this head.
  josecelano:
    ACK 1edda0e

Tree-SHA512: ef70da50ba3e700fdb198994d0b79925e76d84b350dfce867d97187f2f1a8235956d99b1d192280e7da1b7c445e9ef5983abfd460ca897d692ed425759b8ef9f

This branch was previously deployed

1 inactive deployment
coverage — 557ed8e6 Deployed Aug 31, 2026 by josecelano via Generate Coverage Report #1863
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.

Evaluate removing the UDP Bloom filter

2 participants