Skip to content

refactor(udp-server): relocate test environment to src/testing/environment.rs - #4

Closed
josecelano wants to merge 879 commits into
developfrom
1906-relocate-udp-server-test-environment
Closed

josecelano wants to merge 879 commits into
developfrom
1906-relocate-udp-server-test-environment

Conversation

@josecelano

Copy link
Copy Markdown
Owner

Description

Relocates packages/udp-server/src/environment.rs into packages/udp-server/src/testing/environment.rs, matching the pattern established by SI-23 (axum-rest-api-server) and SI-24 (axum-http-server).

This test-only infrastructure was living in the production module tree but is only consumed by tests and examples, forcing unnecessary runtime dependencies.

Changes

  • Moved: packages/udp-server/src/environment.rs → packages/udp-server/src/testing/environment.rs
  • Created: packages/udp-server/src/testing/mod.rs to export the test-only module
  • Updated lib.rs: exported pub mod testing instead of pub mod environment
  • Updated consumers:
    • packages/udp-server/tests/server/contract.rs (6 imports)
    • packages/udp-server/examples/udp_only_public_tracker.rs (1 import)
    • packages/axum-health-check-api-server/tests/server/contract.rs (2 imports)

Verification

  • cargo test --workspace — 129+ tests pass
  • cargo machete — pass
  • linter all — pass
  • cargo clippy — no warnings
  • cargo fmt --check — clean

Closes torrust#1906

josecelano added 30 commits May 26, 2026 18:06
…SI-12 specs

9ee440b docs(issues): open SI-11 and SI-12 issue specs (Jose Celano)
661f4fd docs(issues): refine SI drafts and decision references (Jose Celano)
96147b1 docs(issues): renumber subissue drafts and refresh EPIC tracking (Jose Celano)
2a91ce9 docs(1669): add rename draft and refresh subissue tracking (Jose Celano)
8b3454d docs(1669): normalize incoming package paths in epic (Jose Celano)
2e8d41e docs(1669): align draft subissues with latest epic decisions (Jose Celano)
6b4c6d7 docs(1669): defer moving protocol and tracker core crates (Jose Celano)
ed122cf docs(1669): add nested torrust dependency lists (Jose Celano)
8159d9c docs(1669): rename draft subissue specs and align epic links (Jose Celano)
6535069 docs(1669): align epic package-state naming decisions (Jose Celano)
bac4e05 docs(1669): prefer torrust prefix for Torrust crates (Jose Celano)
ec812f0 docs(issues): reflect metrics rename in 1669 epic (Jose Celano)
60767bd docs(issues): clarify bencode migration target in 1669 epic (Jose Celano)
6f13b04 docs(1669): reorganize desired-package-state by destination group (Jose Celano)
d77f018 docs(epic-1669): document external repos in scope and extraction destinations (Jose Celano)
ca25c08 docs(issues): add design decisions log for EPIC torrust#1669 (Jose Celano)
b6d8817 docs(docs): add hypothetical workspace coupling report for protocol/core merge (Jose Celano)

Pull request description:

  ## Summary
  This PR consolidates EPIC torrust#1669 planning/spec review work and updates issue-spec tracking to reflect current decisions and progress.

  ### What changed
  - Refined `docs/issues/open/1669-overhaul-packages/EPIC.md`:
    - Reworked Active Subissues quick list into clearer status groups.
    - Updated SI numbering sequence and references.
    - Synced details table and draft/open spec links.
    - Marked implemented items (including torrust#1797) consistently.
  - Added and expanded design decision records in `docs/issues/open/1669-overhaul-packages/DECISIONS.md`.
  - Added/updated subissue specs for protocol decoupling and rename sequencing.
  - Renamed SI draft files to include SI numbers in filenames.
  - Opened and linked new GitHub issues for:
    - SI-11: torrust#1829
    - SI-12: torrust#1830
  - Moved SI-11 and SI-12 specs from `docs/issues/drafts/` to `docs/issues/open/` and updated metadata (`status`, `github-issue`, `spec-path`, headings, workflow checkpoints where present).
  - Updated stale SI cross-references in related closed specs to keep numbering coherent.

  ## Scope
  - Documentation/specification only.
  - No production code changes.

  ## Validation
  - Markdown diagnostics checked for modified specs/EPIC files (no errors).

  Related to torrust#1669
  Related to torrust#1829
  Related to torrust#1830

ACKs for top commit:
  josecelano:
    ACK 9ee440b

Tree-SHA512: f7ca16353b264c61537beb73585c301c62582f946b460d98dc2646fc0f68ae16eba57d92e50b8d21d6fadc34b429e7f50e172c5208012f307737d68d33c02924
…ckage folders

33cca9f refactor(workspace): rename tracker crates and package folders (Jose Celano)

Pull request description:

  ## Summary
  - implement SI-11 / torrust#1829 package rename migration from the EPIC matrix
  - rename crate package names from `bittorrent-*` to `torrust-tracker-*` for:
    - `http-tracker-core`
    - `tracker-core`
    - `tracker-client`
    - `udp-protocol`
    - `http-protocol`
    - `udp-tracker-core`
  - rename package folders while keeping crate names:
    - `axum-http-tracker-server` -> `axum-http-server`
    - `axum-rest-tracker-api-server` -> `axum-rest-api-server`
    - `rest-tracker-api-client` -> `rest-api-client`
    - `rest-tracker-api-core` -> `rest-api-core`
    - `udp-tracker-server` -> `udp-server`
  - update all workspace references (manifests/imports/docs/scripts)
  - sync package catalogs and issue specs:
    - `AGENTS.md`
    - `docs/packages.md`
    - `docs/issues/open/1829-1669-11-rename-crates-and-folders-to-match-desired-tracker-workspace.md`
    - `docs/issues/open/1669-overhaul-packages/EPIC.md`

  ## Notable Implementation Detail
  - renamed console package crate to `torrust-tracker-console-client` to avoid a workspace duplicate package-name collision with `packages/tracker-client` (`torrust-tracker-client`)

  ## Verification
  - ✅ `cargo build --workspace`
  - ✅ `linter all`
  - ✅ `cargo machete`
  - ⚠️ `cargo test --workspace` reaches a rustc compiler crash (`signal: 7`, SIGBUS) in this environment while compiling `e2e_tests_runner`

  ## Scope / Risk
  - no API/behavioral changes intended
  - changes are naming/path migration + reference updates

ACKs for top commit:
  josecelano:
    ACK 33cca9f

Tree-SHA512: 426828c1f24fdf357cc5600ef1cecaa265f0e2bba8623e459f7188ccc1d50875f3616006f373343e4c4591933d35c9a51b834f5d3596682d3d423da0923f77d8
19b0ce1 refactor(http-tracker-core): deduplicate protocol error mapping (Jose Celano)
54f8356 refactor(http-protocol): decouple from tracker-core (Jose Celano)

Pull request description:

  ## Summary
  - remove the forbidden protocol -> tracker-core edge by deleting the torrust-tracker-core dependency from packages/http-protocol/Cargo.toml
  - remove tracker-core error conversion impls from packages/http-protocol/src/v1/responses/error.rs
  - move HTTP failure-reason mapping to higher layers by adding From<HttpAnnounceError> and From<HttpScrapeError> conversions in http-tracker-core services
  - update axum HTTP handlers and related tests to use boundary conversion into protocol error responses
  - update issue and EPIC tracking docs for SI-12 completion

  ## Validation
  - TORRUST_GIT_HOOKS_LOG_DIR=.tmp ./contrib/dev-tools/git/hooks/pre-commit.sh --format=text --verbosity=concise
  - cargo build --workspace
  - cargo test -p torrust-tracker-http-tracker-protocol
  - cargo test -p torrust-tracker-http-tracker-core
  - cargo test -p torrust-tracker-axum-http-server
  - linter all
  - cargo tree -p torrust-tracker-http-tracker-protocol --depth 1
  - rg -n "torrust_tracker_core::|bittorrent_tracker_core::" packages/http-protocol

  ## Notes
  - behavior is preserved at the protocol boundary with meaningful failure reasons for announce, scrape, whitelist, authentication, and peer IP resolution errors
  - authentication/whitelist message prefixes are now produced by boundary mapping in http-tracker-core instead of direct to_string usage in axum handlers

  Closes torrust#1830

ACKs for top commit:
  josecelano:
    ACK 19b0ce1

Tree-SHA512: 1320a8d34f9abdc71ef9994add166693adfa0090dae1791861a86ff0d138b4e00a9f791fb35f73ae7b284a0de3cd654599628f9f22fd298774e1932b42dc4eac
… for EPIC torrust#1669

c3e2e72 docs(issues): fix spec wording and module path consistency (Jose Celano)
8c6d8f1 docs(issues): normalize markdown table alignment (Jose Celano)
c689d3a docs(issues): open SI-13 and SI-14 for EPIC torrust#1669 (Jose Celano)

Pull request description:

  ## Summary
  - create GitHub issue torrust#1834 for SI-13 and GitHub issue torrust#1835 for SI-14
  - move both specs from drafts to open with issue-numbered filenames
  - update SI-13 and SI-14 frontmatter metadata (`github-issue`, `spec-path`, `status: planned`)
  - normalize outdated references (crate names and `axum-http-server` paths)
  - update EPIC torrust#1669 tracking sections and links from TBD/drafts to the new open specs

  ## Related
  - torrust#1669
  - torrust#1834
  - torrust#1835

  ## Notes
  - SI-14 is documented to execute after SI-13 to reduce merge conflicts.

ACKs for top commit:
  josecelano:
    ACK c3e2e72

Tree-SHA512: c3372b5ce899039298caeb8da9d6f7e07c3240f0a6a9b02a6ca50cce4d48e56bd9928f74d863997d7410340c4439275becacb2d4ff43a03524be37853549cc61
…and torrust#1830

489fb3f chore(issues): archive closed specs torrust#1829 and torrust#1830 (Jose Celano)

Pull request description:

  ## Summary
  - archive closed issue specs torrust#1829 and torrust#1830 from docs/issues/open to docs/issues/closed
  - update archived spec metadata and relative links after move
  - update EPIC torrust#1669 table rows to point to closed specs
  - mark SI-11 row as DONE in EPIC details table

  ## Related
  - torrust#1669
  - torrust#1829
  - torrust#1830

ACKs for top commit:
  josecelano:
    ACK 489fb3f

Tree-SHA512: 66f5990983ae3615772d863ab840cc8d14925deaebbd71333b74799d18d885cf2f7b138ba584239f41578ead2574db4c066cb7a8c21d132daf8f4e4d8d16e667
…cture draft specs

d3535ae docs(issues): clarify REST API refactor path and PoC plan (Jose Celano)
07285ad docs(issues): add draft package versioning strategy spec (Jose Celano)

Pull request description:

  ## Summary

  Add two new EPIC torrust#1669 draft specs and align EPIC notes:

  1. `docs/issues/drafts/1669-define-package-versioning-strategy.md`
  2. `docs/issues/drafts/1669-define-rest-api-contract-first-package-architecture.md`

  ## What Changed

  - Added the package versioning strategy draft (linked vs independent SemVer policy).
  - Added the REST API contract-first architecture draft.
  - Updated the REST API draft to include:
    - desired package/type ownership map using final `torrust-tracker-*` naming
    - concrete single-endpoint layering example (`get_torrent_handler` flow)
    - PoC-first execution plan (single endpoint first)
    - explicit direction to open a dedicated API refactor EPIC after PoC
    - explicit guardrail: defer API package extraction/publication for now
  - Updated `docs/issues/open/1669-overhaul-packages/EPIC.md` draft checklist/details note to reflect the REST API draft status as a policy reminder with PoC-first + dedicated API EPIC follow-up.

  ## Scope Clarifications

  - API v2 rollout remains out of scope for EPIC torrust#1669.
  - This PR documents architecture direction; it does not perform package refactoring.

  ## Why

  Keep EPIC torrust#1669 focused on simpler package-overhaul subissues while documenting a clear and lower-risk path for the larger REST API restructuring effort.

ACKs for top commit:
  josecelano:
    ACK d3535ae

Tree-SHA512: 2b3b427172cca7213eaa6dccedeac25cebc757b2f1f9558a69a70d3aa5767304e0f8b05d1055c284e271729afc0ecc5d51f24c790659025304bb7faadd7517fc
1657e6e docs(epic): fix http protocol crate name (Jose Celano)
f899b63 refactor(http-protocol): decouple from udp-protocol (Jose Celano)

Pull request description:

  ## Summary
  - remove the `torrust-tracker-udp-tracker-protocol` dependency from `packages/http-protocol`
  - remove `From<torrust_tracker_udp_tracker_protocol::AnnounceEvent> for Event` from HTTP announce request parsing
  - keep HTTP announce event mappings via `torrust-tracker-primitives::AnnounceEvent`
  - update issue/EPIC tracking docs for SI-13 completion

  ## Verification
  - cargo tree -p torrust-tracker-http-tracker-protocol --depth 1
  - rg "torrust_tracker_udp_tracker_protocol::" packages/http-protocol
  - cargo test -p torrust-tracker-http-tracker-protocol
  - cargo test -p torrust-tracker-http-tracker-core
  - cargo test -p torrust-tracker-axum-http-server
  - cargo build --workspace
  - linter all

  ## Issue
  - Closes torrust#1834

ACKs for top commit:
  josecelano:
    ACK 1657e6e

Tree-SHA512: 622d18ec42f3fb3c6388f88af621942be7de0f03ca1147766098341c509cf90dfc8b82f03c9e4636588d7f4073e84969b88fae15c8770ad7d287fcb059f2ace4
…orrust#1841 specs

6e527df docs(skills): improve long-running push guidance (Jose Celano)
7309b5f docs(issues): add epic torrust#1840 and baseline torrust#1841 specs (Jose Celano)

Pull request description:

  ## Summary
  - add EPIC spec for torrust#1840 under `docs/issues/open/1840-improve-pr-workflow-performance-epic/EPIC.md`
  - add baseline subissue spec for torrust#1841 under `docs/issues/open/1841-1840-workflow-performance-baseline-analysis/`
  - add additional EPIC-related draft subissue specs under `docs/issues/drafts/1840-*`
  - rename/move specs to include EPIC/issue prefixes and align internal spec paths and related artifact references

  ## Validation
  - pre-commit checks passed during commit
  - pre-push checks passed during push
  - markdown and cspell checks passed

  ## Notes
  This is a spec-only PR.

  Related to torrust#1840
  Related to torrust#1841
  Related to torrust#1726

ACKs for top commit:
  josecelano:
    ACK 6e527df

Tree-SHA512: bfda560acb48fb195eae695a421924d6fb56a03c1980aee5d5efea1db2df11170915732b305b8b7fc7fc558a4127e5f196103f8754437db079e8fb4158b29e91
…ripts from Bash to Rust (torrust#1843)

dafdec8 docs(issues): add spec for migrating git hooks scripts from Bash to Rust (torrust#1843) (Jose Celano)

Pull request description:

  ## Summary

  Adds the implementation spec for issue torrust#1843 — migrating the three git hook Bash scripts to a single Rust binary.

  This PR contains **only the spec file** (`docs/issues/open/1843-migrate-git-hooks-scripts-from-bash-to-rust.md`). No implementation.

  ## Changes

  - `docs/issues/open/1843-migrate-git-hooks-scripts-from-bash-to-rust.md` — new spec (moved from `drafts/`, prefixed with issue number, frontmatter updated)
  - `project-words.txt` — two new British English words (`serialisation`, `summarising`) added to pass cspell

  ## Spec highlights

  The spec covers a two-phase plan:

  **Phase 1 — Core migration** (T1–T16): replace `pre-commit.sh`, `pre-push.sh`, and `install-git-hooks.sh` with a single `torrust-git-hooks` binary. Implements the same check steps with NDJSON output only (no `--format=text` switch). Switches over and removes the old scripts.

  **Phase 2 — Enhancements** (T17–T22): heartbeat events for long-running steps, smart step skipping for docs-only staged commits, and idempotency cache to skip hooks that already passed for the same changes.

  The binary must comply with the global CLI output contract ADR from day one (`no-stdout-result` class, NDJSON on stderr, exit codes 0/1/2).

  ## Related

  Related to torrust#1843 (this PR merges only the spec; the issue remains open until implementation is complete)

ACKs for top commit:
  josecelano:
    ACK dafdec8

Tree-SHA512: 180666899ec770480523833f8092c96d58d1cb8c002a839e74b1e9ab838b61def071b0751cba1fe84180e5451937ebdd6ad6d140c73e069480aca7848076e726
Updated run-pre-commit-checks, run-pre-push-checks, and commit-changes skills to instruct AI agents to set TORRUST_GIT_HOOKS_LOG_DIR=.tmp so per-step log files stay inside the workspace (git-ignored .tmp/) instead of /tmp.
Repo cache at 13.03 GB / 10 GB (over limit). sccache proved superior (93.38 % hit rate vs ~0 % for Swatinem). Removing Swatinem/rust-cache to free cache space and avoid eviction of sccache entries.

Removed from: testing.yaml (unit + docker-e2e), db-compatibility.yaml (mysql + postgres), coverage.yaml, db-benchmarking.yaml (sqlite3 + mysql + postgres)
- Fix project-words.txt alphabetical order (endgroup/endianness)
- Fix Q&A: clarify token scope ≠ cross-run block (Task 3a proved 93% hits work)
- Fix experiment-results-gha: 'incremental compilation' → 'dependency fingerprinting'
- Fix experiment-results-gha: remove TBD placeholder table at end
- Fix ISSUE.md: replace [- ] with [ ] ~strikethrough~ for GitHub task list compatibility
- Fix sccache-a-b-report: mark cargo install sccache section as skipped
- Fix testing.yaml ADR comment to mention Swatinem removal
…and tracker-client

- packages/udp-server/: box large HandlerError tuple to fix clippy::result_large_err
- packages/tracker-core/: suppress clippy::extra_unused_lifetimes on #[automock] traits
- console/tracker-client/: box large Error variant and fix dead match arm
- docs/issues/open/1726-1840-workflow-performance-sccache/: fix typo in checkbox

PR: torrust#1905
3538730 chore: fix multiple clippy warnings across udp-server, tracker-core, and tracker-client (Jose Celano)
97fb88d ci: retry with sccache-action wildcard allowed (Jose Celano)
909231a ci: trigger workflows after allowlist fix (Jose Celano)
44d8eb5 docs: address copilot review comments (Jose Celano)
60231d0 ci: remove Swatinem/rust-cache from sccache-enabled jobs (Jose Celano)
3871822 docs(build): record Q&A about cache limits and Swatinem removal (Jose Celano)
48d0e34 docs(project): fix spelling in skill-link-convention (Jose Celano)
691968b docs(skills): add TORRUST_GIT_HOOKS_LOG_DIR=.tmp for AI agents (Jose Celano)
b093328 docs(project): clarify why workflows cannot use frontmatter (Jose Celano)
599b3b6 docs(project): document ADR and workflow linking conventions (Jose Celano)
375c6de ci: adopt sccache for non-docker ci builds (Jose Celano)
031f32f chore: archive experiment workflow files to contrib/dev-tools (Jose Celano)
5ce4c24 docs(build): mark tasks 3b-3d complete, final decisions documented (Jose Celano)
69f7fb5 docs(build): record warm docker build results - sccache inside docker rejected (Jose Celano)
f39ff12 docs(build): record cold docker build results (task 3b) (Jose Celano)
455c931 fix(ci): map ACTIONS_RESULTS_URL to ACTIONS_CACHE_URL for sccache ghac (Jose Celano)
9f89e91 fix(ci): correct gha credential passing for sccache docker experiment (Jose Celano)
2fd2563 ci(experiment): add sccache docker build workflow (task 3b) (Jose Celano)
1d7e62b docs(build): update task 3b with docker docs review findings (Jose Celano)
a39f6d9 chore(build): add sccache-experiment containerfile (task 3b local prep) (Jose Celano)
c5fe8c3 docs(build): update task 3b strategy with local experiment findings (Jose Celano)
bd83503 chore(experiments): record local sccache docker integration tests (Jose Celano)
9602147 docs(build): record gha cross-run cache test results (task 3a complete) (Jose Celano)
2fd1edb docs(build): record gha experiment run 1 results (task 3a) (Jose Celano)
ab849b1 docs(build): link draft PR torrust#1905 in issue spec (Jose Celano)
b281768 ci(experiment): add sccache bare build workflow (task 3a) (Jose Celano)
0132701 docs(build): refine task 3 strategy with B1/B2 rationale (Jose Celano)
1eef743 docs(build): document local sccache decision (reject) (Jose Celano)
6a0e211 docs(build): record local sccache A/B benchmark results (Jose Celano)

Pull request description:

  Evidence-driven research for issue torrust#1726.

  ## Summary

  This PR investigates whether [sccache](https://github.com/mozilla/sccache) can reduce CI build times for the Torrust Tracker workspace. After controlled benchmarks in three contexts — local development, GHA bare builds, and GHA Docker builds — the final decision is documented in ADR `docs/adrs/20260612000000_adopt_sccache_for_ci_bare_builds.md`.

  **Final decisions:**

  | Context | Decision | Reasoning |
  |---|---|---|
  | Local development | ❌ **Reject** | Cold build 22 % slower; warm builds no better due to sccache overhead |
  | Docker CI builds | ❌ **Reject** | No measurable benefit on GHA runners (29 vs 30 min, within noise) |
  | Bare CI builds | ✅ **Adopt** | 93.38 % hit rate; cold build ~60 % faster (479 s → 192 s) |

  ## Changes

  ### Production CI (5 workflow files)
  - **`.github/workflows/testing.yaml`** — add sccache to `unit`, `test-doc`, `clippy`, `fmt` jobs
  - **`.github/workflows/os-compatibility.yaml`** — add sccache to `build` job
  - **`.github/workflows/db-compatibility.yaml`** — add sccache to `build` jobs
  - **`.github/workflows/coverage.yaml`** — add sccache, remove Swatinem/rust-cache
  - **`.github/workflows/db-benchmarking.yaml`** — add sccache, remove Swatinem/rust-cache

  ### Experiment artifacts (archived under `contrib/dev-tools/experiments/sccache-docker/`)
  - 3 local Docker build strategies (basic, multi-stage, GHA-backend) with full reports
  - 2 experiment workflows: `experiment-sccache-bare-build.yaml`, `experiment-sccache-docker.yaml`
  - `Containerfile.sccache-experiment` for sccache-in-Docker experiments
  - Raw results: GHA cold/warm timing, Docker cold/warm timing, A/B benchmark report, compile hotspot analysis, Q&A

  ### Documentation
  - **ADR**: `docs/adrs/20260612000000_adopt_sccache_for_ci_bare_builds.md`
  - **Issue spec**: `docs/issues/open/1726-1840-workflow-performance-sccache/ISSUE.md` — all tasks checked complete
  - **Reports**: sccache A/B report, GHA experiment results, Docker GHA experiment results, compile hotspot analysis, Q&A
  - **Skills**: `semantic-skill-link-convention.md`, git hook skills updated (`TORRUST_GIT_HOOKS_LOG_DIR=.tmp`)

  ### Drive-by fixes
  - Fix `clippy::result_large_err` by boxing large `HandlerError` tuple in `packages/udp-server/src/handlers/`
  - Suppress `clippy::extra_unused_lifetimes` on `#[automock]` traits in `packages/tracker-core/src/databases/traits/`
  - Fix clippy dead match arm and box large error variant in `console/tracker-client/src/console/clients/`

  ## Checklist
  - [x] Task 0: Local branch
  - [x] Task 1: Local A/B benchmarks — **sccache rejected for local development**
  - [x] Task 2: Local configuration decision — **do not enable**
  - [x] Task 3a: GHA bare build experiment — **93.38 % hit rate, ~60 % reduction** ✅
  - [x] Task 3b: Docker build experiment — **no measurable benefit, rejected** ❌
  - [x] Task 3c: Full E2E with sccache-warmed Docker — **merged into Task 3b**
  - [x] Task 3d: Final decision documented — **adopt sccache for bare CI, reject for Docker/local**

  See full spec: `docs/issues/open/1726-1840-workflow-performance-sccache/ISSUE.md`

ACKs for top commit:
  josecelano:
    ACK 3538730

Tree-SHA512: 9899b1fc67046a713158c3edd314ae1208383a9cba8754b83c6ff69357658dac7a6570c99a790a15766e34786919d7b116ffba27bc44404afc0b493f71127872
…Cargo.toml

Closes torrust#1786

Migrate the ad-hoc lint configuration from `.cargo/config.toml` RUSTFLAGS and
the root package `[lints.clippy]` section into a single authoritative
`[workspace.lints]` section in `Cargo.toml`, following the idiomatic Cargo
approach used in `torrust-index`.

Changes:
- Add `[workspace.lints.rust]` and `[workspace.lints.clippy]` sections
- Remove lint-related RUSTFLAGS from `.cargo/config.toml`
- Remove root `[lints.clippy]` package section (incl. needless_return temp workaround)
- Add `[lints] workspace = true` to all workspace member crates
- Fix new clippy errors across 60+ source files
- Revert accidental pub(crate)->pub visibility widening from auto-fix
…workspace.lints] in Cargo.toml

8024f49 chore(workspace): migrate lint configuration to [workspace.lints] in Cargo.toml (Jose Celano)

Pull request description:

  Closes torrust#1786

  ## Summary

  Migrate the ad-hoc lint configuration from `.cargo/config.toml` RUSTFLAGS and the root package `[lints.clippy]` section into a single authoritative `[workspace.lints]` section in `Cargo.toml`, following the idiomatic Cargo approach used in `torrust-index`.

  ## Changes

  **Configuration (`Cargo.toml`):**
  - Added `[lints] workspace = true` to the root package
  - Added `[workspace.lints.rust]` with all groups from former RUSTFLAGS plus `deprecated-safe` and `unsafe-code = "warn"`
  - Added `[workspace.lints.clippy]` with all clippy groups: `all = "deny"`, `nursery = "warn"`, plus individual groups and `exit`/`print_stderr`/`print_stdout`
  - Removed the old root `[lints.clippy]` package section (including `needless_return = "allow"` temp workaround)
  - Added `[lints] workspace = true` to all 5 workspace member crates

  **Cleanup (`.cargo/config.toml`):**
  - Removed entire `[build] rustflags` section (lint-related RUSTFLAGS)

  **Source fixes (67 files across workspace):**
  - Fixed new clippy errors surfaced by stricter workspace-wide lint enforcement
  - Auto-fixed unnecessary `.clone()` calls, `mut` qualifiers, `use_self` patterns

  ## Verification

  - `cargo clippy --workspace --all-targets --all-features` — clean
  - `cargo check --workspace --all-targets --all-features` — clean
  - `linter all` — all linters pass
  - `cargo test --doc --workspace` — clean
  - Pre-commit hook — all checks pass

  ## Remaining work (out of scope for this PR)

  - T6: Update `torrust-linting` to remove redundant `-D clippy::X` flags (separate PR to `torrust/torrust-linting`)
  - AC7/AC8: Full test suite and pre-push hook verification

ACKs for top commit:
  josecelano:
    ACK 8024f49

Tree-SHA512: ae54656ecddc6b1ed9a198b2e0a8e45f483c04b9ed9d0096f331babe5049aff3808781252c6495042990d1cad00b928d39e73ef3deeceb7aeb991ce184509fa9
…ing module

Move packages/axum-rest-api-server/src/environment.rs to
packages/axum-rest-api-server/src/testing/environment.rs, marking it
explicitly as test-only infrastructure. Update all internal test imports
and the external consumer in axum-health-check-api-server.

UDP deps (udp-server, udp-tracker-core) remain as runtime dependencies
for now; production handlers in src/v1/context/stats/handlers.rs still
reference BanService and UDP types directly. Full demotion to dev-deps
requires the rest-api-core decoupling subissue first.

Closes torrust#1903.
Remove the incorrect claim that the module is "not compiled into
production builds". Clarify that, like `tracker-core::test_helpers`,
it is exported unconditionally so external test packages can import
it, but is compiled in all build profiles.
- packages/persistence-benchmark/: fix broken Database trait path

- src/console/ci/qbittorrent_e2e/bencode.rs: replace private-item doc link with backtick

- src/console/ci/qbittorrent_e2e/filesystem_setup.rs: replace private-item doc link with backtick
…ironment to src/testing module

a78f293 docs: fix pre-existing doc link errors found by nightly doc build (Jose Celano)
7fa240f docs(axum-rest-api-server): correct module docstring for testing module (Jose Celano)
40360f6 docs(issues): update related-pr for SI-23 (Jose Celano)
60ccfde docs(issues): expand draft 1669 to cover axum-rest-api-server UDP decoupling (Jose Celano)
f9b0df2 refactor(axum-rest-api-server): relocate test environment to src/testing module (Jose Celano)

Pull request description:

  Closes torrust#1903.

  Moves `packages/axum-rest-api-server/src/environment.rs` to `packages/axum-rest-api-server/src/testing/environment.rs`, marking it explicitly as test-only infrastructure. Updates all internal test imports and the external consumer in `axum-health-check-api-server`.

  **What was done:**
  - Relocated `environment.rs` -> `src/testing/environment.rs` with `src/testing/mod.rs`
  - Updated `lib.rs`: `pub mod environment;` -> `pub mod testing;`
  - Updated 6 internal test import paths
  - Updated 1 external consumer (`axum-health-check-api-server`)
  - Expanded draft issue 1669 to also cover `axum-rest-api-server` UDP handler decoupling

  **Blocked item (documented in spec):** UDP deps cannot be fully demoted to dev-dependencies yet because production handlers in `src/v1/context/stats/handlers.rs` still reference `BanService` and UDP types directly. Requires the rest-api-core decoupling subissue first.

ACKs for top commit:
  josecelano:
    ACK a78f293

Tree-SHA512: 292a89cd88298add27034cacb75d532a56e1275216363a7ba1bd0c8b85efc76a76d0d706a7d31f53e53f5381c9b7cfced30c9667319026fbe9dc394e6d1809f1
…module

- Move packages/axum-http-server/src/environment.rs -> src/testing/environment.rs

- Create src/testing/mod.rs with module declaration and doc comment

- Update lib.rs: replace pub mod environment with pub mod testing

- Update all consumers to use testing::environment::Started:

  - packages/axum-http-server/tests/server/v1/contract.rs

  - packages/axum-http-server/examples/http_only_public_tracker.rs

  - packages/axum-health-check-api-server/tests/server/contract.rs

- Update issue spec 1904: set branch, date, check verification items

- Move closed issue 1903 spec from docs/issues/open/ to docs/issues/closed/
…ment to src/testing module

7299d07 docs(axum-http-server): correct module docstring for testing module (Jose Celano)
9a65cb9 docs(issues): update related-pr for SI-24 (Jose Celano)
c65846f refactor(axum-http-server): relocate test environment to src/testing module (Jose Celano)

Pull request description:

  ## Description

  Relocates `packages/axum-http-server/src/environment.rs` to `packages/axum-http-server/src/testing/environment.rs`, marking it explicitly as test-only infrastructure. Updates all internal test imports and the external consumer in `axum-health-check-api-server`.

  This follows the same pattern as the preceding SI-23 (PR torrust#1913) for `axum-rest-api-server`.

  ## Changes

  - **Relocated** `environment.rs` → `src/testing/` via `git mv` (history preserved)
  - **Created** `src/testing/mod.rs` with module docstring marking it as test-only
  - **Updated** `lib.rs`: `pub mod environment` → `pub mod testing`
  - **Updated** all consumers to import from `testing::environment::Started`:
    - `packages/axum-http-server/tests/server/v1/contract.rs` (10 occurrences)
    - `packages/axum-http-server/examples/http_only_public_tracker.rs`
    - `packages/axum-health-check-api-server/tests/server/contract.rs` (2 occurrences)

  ## Verification

  - [x] `cargo test --workspace --all-targets` — pass (1468+ tests)
  - [x] `cargo machete` — pass
  - [x] `linter all` — pass
  - [x] `cargo +nightly fmt --check` — pass

  Closes torrust#1904

ACKs for top commit:
  josecelano:
    ACK 7299d07

Tree-SHA512: daec7b532e48241b71e83af0d8bb6edcd063ea15ce78fffce1d87ac1caa2ec6f63549d1a4f50150e5937864aefd679eda71b45eba47ebfa005d545d6ff282824
…nment.rs

Move the test-only `environment.rs` infrastructure out of the production module tree
into `src/testing/`, where it belongs alongside similarly scoped test utilities.

- Moved `packages/udp-server/src/environment.rs` → `packages/udp-server/src/testing/environment.rs`
- Created `packages/udp-server/src/testing/mod.rs` to export the test-only module
- Updated `lib.rs` to export `pub mod testing` instead of `pub mod environment`
- Updated all consumers (`udp-server/tests/server/contract.rs`,
  `udp-server/examples/udp_only_public_tracker.rs`,
  `axum-health-check-api-server/tests/server/contract.rs`) to import
  `testing::environment::Started`
- Updated issue spec with branch name, date, and verification checkboxes
Copilot AI review requested due to automatic review settings June 17, 2026 08:32

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.

Copilot wasn't able to review this pull request because it exceeds the maximum number of files (300). Try reducing the number of changed files and requesting a review from Copilot again.

@josecelano josecelano closed this Jun 17, 2026
josecelano added a commit that referenced this pull request Jul 21, 2026
- Add IN_REVIEW to allowed status values in EPIC torrust#1978 table
- Bump EPIC last-updated-utc to 2026-07-21 17:00
- Update torrust#1417 spec: Subissue #4 of 9 -> #4 of 11
- Fix Goal section: remove HealthCheckApi from public_url scope
- Fix Scope section: remove HealthCheckApi and update type from
  Option<String> to typed Option<HttpUrl>/Option<UdpUrl> newtypes

Resolves Copilot review threads PRRT_kwDOGp2yqc6Sp69Y,
PRRT_kwDOGp2yqc6Sp69_, PRRT_kwDOGp2yqc6Sp6-e,
PRRT_kwDOGp2yqc6Sp6-t on PR torrust#2016.

This branch was previously deployed

1 inactive deployment
coverage — 37bda97f Deployed Jun 17, 2026 by josecelano via Generate Coverage Report #15
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.

2 participants