Skip to content

feat(configuration): add configurable trace style and rename threshold to trace_filter - #5

Open
josecelano wants to merge 1312 commits into
developfrom
889-logging-style
Open

feat(configuration): add configurable trace style and rename threshold to trace_filter#5
josecelano wants to merge 1312 commits into
developfrom
889-logging-style

Conversation

@josecelano

Copy link
Copy Markdown
Owner

Summary

Make the tracing logging style configurable from the configuration file. Replace the hardcoded TraceStyle::Default with a user-selectable option, and rename threshold to trace_filter for clarity and consistency with tracing crate terminology.

Closes torrust#889

Changes

  • Redesigned TraceStyle enum: Renamed DefaultFull, simplified Pretty(bool)Pretty (dropped display_filename boolean parameter)
  • New config fields:
    • trace_filter (renamed from threshold) — filtering level for tracing output
    • trace_style — configurable output style: full (default), pretty, compact, json
  • Updated v3 configuration to use the new logging options
  • Documentation updates: issue spec progress, migration guide references, epic restructuring

Config example

[logging]
trace_filter = "info"
trace_style = "full"

Verification

Manual verification is deferred to torrust#1980.

…ment

Adds Environment<Running>::base_url() that returns a reqwest::Url from the
bind address, replacing ~40 duplicate Url::parse(&format!("http://{}/", ...))
call sites in the HTTP tracker contract tests.
… module

Split the large contract.rs (2018 lines) into smaller per-concern modules
to improve maintainability and make it easier for AI agents to work with.

- for_all_config_modes: further split into and_running_on_reverse_proxy,
  receiving_an_announce_request, receiving_an_scrape_request
- configured_as_whitelisted
- configured_as_private
- configured_as_private_and_whitelisted (with TODOs for missing tests)
- using_ipv6_v6only
All automated checks pass (linter, tests, pre-commit, pre-push).
Manual verification M1-M4 all PASS. Updated issue spec progress,
acceptance criteria, and manual verification evidence.
New skill in .github/skills/usage/use-tracker-client/ covering HTTP/UDP
announce and scrape commands, output formats, verification workflow,
and troubleshooting for the unified tracker_client binary.
…ypes into http-protocol

de92be2 docs(skill): T17 create use-tracker-client skill (torrust#1965) (Jose Celano)
ed9886d docs(issue): T16 run full verification after all changes (torrust#1965) (Jose Celano)
53186c0 refactor(axum-http-server): split test contract module into directory module (Jose Celano)
cffc619 refactor(axum-http-server): extract base_url() helper on test Environment (Jose Celano)
00efe0b refactor(axum-http-server): replace test client with canonical tracker-client (Jose Celano)
9e8f410 refactor(axum-http-server): wrap test client around canonical tracker-client (Jose Celano)
fe14598 refactor(http-protocol): restructure scrape responses into layered modules (Jose Celano)
548659b refactor(http-protocol): merge announce DTO layer into layered module (Jose Celano)
3dd9357 refactor(http-protocol): restructure announce responses into layered modules (Jose Celano)
a3172b1 refactor(http-protocol): merge announce_builder::Query into announce::Announce (Jose Celano)
b3cb02d docs(1965): add analysis docs and update issue spec for request/response type consolidation (Jose Celano)
9e79585 chore(http-protocol): add percent_encode_byte_array test and update module docs (Jose Celano)
2fe5b20 fix: remove dependency on torrust-tracker-primitives from http-protocol (Jose Celano)
1f5a344 feat(http-protocol): consolidate duplicate HTTP types into http-protocol (Jose Celano)

Pull request description:

  ## Description

  Eliminates duplicate HTTP request/response type definitions across the workspace by consolidating them into `packages/http-protocol`.

  ### Changes

  - **New modules in http-protocol**:
    - `announce_builder` / `scrape_builder` — Query builder types for constructing announce/scrape URLs
    - `announce_deserialization` / `scrape_deserialization` — Response deserialization types
    - `percent_encode_byte_array` — Moved to `percent_encoding` module

  - **Deleted duplicate types** from `packages/tracker-client/src/http/client/` (6 files) and `packages/axum-http-server/tests/server/` (5 files)

  - **Consumers updated** to import from `http-protocol` crate:
    - `tracker-client` (library)
    - `axum-http-server` (integration tests)
    - `console/tracker-client` (console tools)
    - Root crate integration tests

  - **Dependencies**: Added `http-protocol` to `tracker-client`, `console/tracker-client`, and root crate. Removed unused `percent-encoding` and `serde_repr` dev-dependencies from `axum-http-server`.

  ### Design Decisions

  - Builder types added alongside existing parsers (iteration 1; unification can be evaluated later)
  - Uses domain types (`InfoHash`/`PeerId`) instead of raw `ByteArray20`
  - Uses full `Event` enum (`Started`/`Stopped`/`Completed`/`Empty`) from http-protocol
  - `Error` response type consolidated into http-protocol

  ### Verification

  - `linter all` passes
  - `cargo test --workspace` passes
  - `cargo clippy -- -D warnings` passes
  - Pre-push checks pass (nightly fmt, nightly check, docs, stable tests)

  Part of torrust#1965

ACKs for top commit:
  josecelano:
    ACK de92be2

Tree-SHA512: bdc62bf4af8eaaca5bdfdddd04b8f590d0662d480fdae6fdf48d726f7b3e80a0b18e16679debd60b0837926c548962e7c3538c4c0063dcbb889ad756fad0da47
…sue specs (torrust#1978)

Add planning and spec work for the Configuration Overhaul EPIC targeting
config schema v3.0.0 and tracker app v4.0.0.

New EPIC and subissue specs:
- 1978-configuration-overhaul-epic.md: EPIC spec for all config changes
- 1979-1978-copy-configuration-schema-v2-to-v3-baseline.md: copy v2→v3 baseline
- 1980-1978-configuration-overhaul-final-cleanup.md: final cleanup subissue
- 1981-1978-fix-tsl-config-tls-config-typo.md: fix tsl→tls typo subissue

Pre-existing open issues reviewed, refined, and linked to EPIC:
- 889-1978-new-config-option-for-logging-style.md (renamed with EPIC prefix)
- 1415-1978-use-service-binding-instead-of-socket-addr.md (new, from closed draft)
- 1417-1978-add-public-service-url-to-configuration.md (moved from drafts/, renamed)
- 1453-1978-ip-bans-reset-interval-configurable.md (new, linked to EPIC)
- 1490-1978-decompose-database-config-and-overhaul-secrets.md (new, linked to EPIC)
- 1640-1978-per-http-tracker-on-reverse-proxy-setting.md (renamed with EPIC prefix)

Also add docs/issues/open/AGENTS.md with file naming conventions for the
open/ folder, and extend project-words.txt with colour, colours,
reorganisation, and zeroize.
- Fix stale spec filenames in progress log entries for issues torrust#1979,
  torrust#1980, and torrust#1981 (old intermediate names → correct final names)
- Replace .expose() with .expose_secret() in 4 places in spec torrust#1490
  (the correct secrecy crate API is ExposeSecret::expose_secret())
- Replace scheme() + bind_to() with protocol() + bind_address() in 2
  places in spec torrust#1415 (actual ServiceBinding API from torrust-net-primitives)
- Fix malformed markdown table in spec torrust#1980 where unescaped | in an
  rg command broke the table columns

Addresses review comments on PR torrust#1982.
…PIC spec and 9 subissue specs (torrust#1978)

dfe7b71 docs(configuration): address Copilot PR review comments (Jose Celano)
1770bce docs(configuration): add Configuration Overhaul EPIC spec and 9 subissue specs (torrust#1978) (Jose Celano)

Pull request description:

  ## Summary

  Planning and spec work for the **Configuration Overhaul EPIC** ([torrust#1978](torrust#1978)) — all configuration changes needed to release config schema v3.0.0 alongside tracker app v4.0.0.

  This PR adds no code changes. It only adds/updates documentation spec files under `docs/issues/`.

  ## What's included

  ### New EPIC and subissue specs

  | Issue | Spec file | Description |
  |-------|-----------|-------------|
  | [torrust#1978](torrust#1978) | `1978-configuration-overhaul-epic.md` | EPIC: Configuration Overhaul (schema v3.0.0) |
  | [torrust#1979](torrust#1979) | `1979-1978-copy-configuration-schema-v2-to-v3-baseline.md` | Copy v2_0_0 → v3_0_0 as baseline (foundation) |
  | [torrust#1980](torrust#1980) | `1980-1978-configuration-overhaul-final-cleanup.md` | Final cleanup: remove global re-exports |
  | [torrust#1981](torrust#1981) | `1981-1978-fix-tsl-config-tls-config-typo.md` | Fix `tsl_config` → `tls_config` typo (~21 files) |

  ### Updated pre-existing subissue specs (renamed to follow EPIC convention)

  | Issue | Spec file | Key changes |
  |-------|-----------|-------------|
  | [torrust#889](torrust#889) | `889-1978-new-config-option-for-logging-style.md` | `TraceStyle` redesigned: `Default`→`Full`, `Pretty(bool)`→`Pretty` |
  | [torrust#1415](torrust#1415) | `1415-1978-use-service-binding-instead-of-socket-addr.md` | Scope narrowed: use existing `ServiceBinding` as-is |
  | [torrust#1417](torrust#1417) | `1417-1978-add-public-service-url-to-configuration.md` | Flat field (not inside `Network`); protocol validation |
  | [torrust#1453](torrust#1453) | `1453-1978-ip-bans-reset-interval-configurable.md` | New `[udp_tracker_server]` config section |
  | [torrust#1490](torrust#1490) | `1490-1978-decompose-database-config-and-overhaul-secrets.md` | `Database` decomposed into enum; `secrecy` crate |
  | [torrust#1640](torrust#1640) | `1640-1978-per-http-tracker-on-reverse-proxy-setting.md` | Full `Network` block per instance; `public_url` stays flat |

  ### Other

  - `docs/issues/open/AGENTS.md` — new file documenting filename conventions for the `open/` folder
  - `project-words.txt` — added `colour`, `reorganisation`, `zeroize`

  ## Implementation order

  ```text
  1 → 2 → 3 → 4 → 9   (critical path)
  1 → 2 → 3 → 7 → 9   (critical path)
  ```

  Subissues #5 (torrust#1415), torrust#6 (torrust#1453), torrust#8 (torrust#889) are independent and can run in parallel.

  ## Checklist

  - [x] `linter all` passes
  - [x] All 9 subissues linked as child issues of EPIC torrust#1978 on GitHub
  - [x] GitHub issues created for the 4 new subissues
  - [x] Update comments posted on the 6 pre-existing issues

ACKs for top commit:
  josecelano:
    ACK dfe7b71

Tree-SHA512: 7b0a644f219d1c0d2ee365cd0cfe58b1c06c1c9cd2865048cffcbd880e7de3f047fb18e550be1f730b53013718fa6e085c9cd49e6bfe6987e48097e7712b967d
    Updating crates.io index
     Locking 54 packages to latest Rust 1.88 compatible versions
    Updating aws-lc-rs v1.17.0 -> v1.17.1
    Updating aws-lc-sys v0.41.0 -> v0.42.0
    Updating bytemuck v1.25.0 -> v1.25.1
    Updating bytes v1.12.0 -> v1.12.1
    Updating cc v1.2.65 -> v1.2.67
    Updating crossbeam-deque v0.8.6 -> v0.8.7
    Updating crossbeam-epoch v0.9.18 -> v0.9.20
    Updating crossbeam-queue v0.3.12 -> v0.3.13
    Updating crossbeam-utils v0.8.21 -> v0.8.22
    Updating fs-err v3.3.0 -> v3.3.1
    Updating http-body v1.0.1 -> v1.1.0
    Updating http-body-util v0.1.3 -> v0.1.4
    Updating jobserver v0.1.34 -> v0.1.35
    Updating libredox v0.1.17 -> v0.1.18
    Updating memchr v2.8.2 -> v2.8.3
    Updating mio v1.2.1 -> v1.2.2
    Updating num-bigint v0.4.6 -> v0.4.8
    Updating num-iter v0.1.45 -> v0.1.46
    Updating pest v2.8.6 -> v2.8.7
    Updating pest_derive v2.8.6 -> v2.8.7
    Updating pest_generator v2.8.6 -> v2.8.7
    Updating pest_meta v2.8.6 -> v2.8.7
    Updating quinn-proto v0.11.15 -> v0.11.16
    Updating quinn-udp v0.5.14 -> v0.5.15
    Removing rand v0.8.6
    Removing rand v0.9.4
    Removing rand v0.10.1
      Adding rand v0.8.7
      Adding rand v0.9.5 (available: v0.10.2)
      Adding rand v0.10.2
      Adding rand_pcg v0.10.2
    Updating redox_syscall v0.8.1 -> v0.9.0
    Updating regex v1.12.4 -> v1.13.0
    Updating regex-automata v0.4.14 -> v0.4.15
    Updating ringbuf v0.5.0 -> v0.5.1
    Updating rustc-hash v2.1.2 -> v2.1.3
    Updating rustls v0.23.41 -> v0.23.42
    Updating rustls-pki-types v1.14.1 -> v1.15.0
    Updating rustversion v1.0.22 -> v1.0.23
    Updating sha1 v0.10.6 -> v0.10.7
    Updating simd-adler32 v0.3.9 -> v0.3.10
    Updating simd_cesu8 v1.1.1 -> v1.2.0
    Updating socket2 v0.6.4 -> v0.6.5
    Updating spin v0.9.8 -> v0.9.9
    Updating syn v2.0.118 -> v2.0.119
    Updating thread_local v1.1.9 -> v1.1.10
    Updating time v0.3.51 -> v0.3.53
    Updating time-macros v0.2.30 -> v0.2.31
    Updating tinyvec v1.11.0 -> v1.12.0
    Updating toml v1.1.2+spec-1.1.0 -> v1.1.3+spec-1.1.0
    Updating toml_edit v0.25.12+spec-1.1.0 -> v0.25.13+spec-1.1.0
    Updating toml_writer v1.1.1+spec-1.1.0 -> v1.1.2+spec-1.1.0
    Updating uuid v1.23.4 -> v1.23.5
    Removing windows-sys v0.60.2
    Removing windows-targets v0.53.5
    Removing windows_aarch64_gnullvm v0.53.1
    Removing windows_aarch64_msvc v0.53.1
    Removing windows_i686_gnu v0.53.1
    Removing windows_i686_gnullvm v0.53.1
    Removing windows_i686_msvc v0.53.1
    Removing windows_x86_64_gnu v0.53.1
    Removing windows_x86_64_gnullvm v0.53.1
    Removing windows_x86_64_msvc v0.53.1
    Updating winnow v1.0.3 -> v1.0.4
    Updating zerocopy v0.8.52 -> v0.8.54
    Updating zerocopy-derive v0.8.52 -> v0.8.54
    Updating zmij v1.0.21 -> v1.0.23
note: pass `--verbose` to see 7 unchanged dependencies behind latest
- actions/setup-node: v6 -> v7
- aquasecurity/trivy-action: 0.35.0 -> 0.36.0
aquasecurity/trivy-action migrated to v-prefixed tags starting with
v0.35.0. The tag 0.36.0 does not exist; use v0.36.0 instead.
a0a6914 fix(ci): use v-prefixed trivy-action tag (Jose Celano)
05de36a chore(ci): bump GitHub Actions (Jose Celano)
4ea5be8 chore: update dependencies (Jose Celano)

Pull request description:

  Trivial dependency update — all patch-level bumps, no code changes needed.

  ```
      Updating crates.io index
       Locking 54 packages to latest Rust 1.88 compatible versions
      Updating aws-lc-rs v1.17.0 -> v1.17.1
      Updating aws-lc-sys v0.41.0 -> v0.42.0
      Updating bytemuck v1.25.0 -> v1.25.1
      Updating bytes v1.12.0 -> v1.12.1
      Updating cc v1.2.65 -> v1.2.67
      Updating crossbeam-deque v0.8.6 -> v0.8.7
      Updating crossbeam-epoch v0.9.18 -> v0.9.20
      Updating crossbeam-queue v0.3.12 -> v0.3.13
      Updating crossbeam-utils v0.8.21 -> v0.8.22
      Updating fs-err v3.3.0 -> v3.3.1
      Updating http-body v1.0.1 -> v1.1.0
      Updating http-body-util v0.1.3 -> v0.1.4
      Updating jobserver v0.1.34 -> v0.1.35
      Updating libredox v0.1.17 -> v0.1.18
      Updating memchr v2.8.2 -> v2.8.3
      Updating mio v1.2.1 -> v1.2.2
      Updating num-bigint v0.4.6 -> v0.4.8
      Updating num-iter v0.1.45 -> v0.1.46
      Updating pest v2.8.6 -> v2.8.7
      Updating pest_derive v2.8.6 -> v2.8.7
      Updating pest_generator v2.8.6 -> v2.8.7
      Updating pest_meta v2.8.6 -> v2.8.7
      Updating quinn-proto v0.11.15 -> v0.11.16
      Updating quinn-udp v0.5.14 -> v0.5.15
      Removing rand v0.8.6
      Removing rand v0.9.4
      Removing rand v0.10.1
        Adding rand v0.8.7
        Adding rand v0.9.5 (available: v0.10.2)
        Adding rand v0.10.2
        Adding rand_pcg v0.10.2
      Updating redox_syscall v0.8.1 -> v0.9.0
      Updating regex v1.12.4 -> v1.13.0
      Updating regex-automata v0.4.14 -> v0.4.15
      Updating ringbuf v0.5.0 -> v0.5.1
      Updating rustc-hash v2.1.2 -> v2.1.3
      Updating rustls v0.23.41 -> v0.23.42
      Updating rustls-pki-types v1.14.1 -> v1.15.0
      Updating rustversion v1.0.22 -> v1.0.23
      Updating sha1 v0.10.6 -> v0.10.7
      Updating simd-adler32 v0.3.9 -> v0.3.10
      Updating simd_cesu8 v1.1.1 -> v1.2.0
      Updating socket2 v0.6.4 -> v0.6.5
      Updating spin v0.9.8 -> v0.9.9
      Updating syn v2.0.118 -> v2.0.119
      Updating thread_local v1.1.9 -> v1.1.10
      Updating time v0.3.51 -> v0.3.53
      Updating time-macros v0.2.30 -> v0.2.31
      Updating tinyvec v1.11.0 -> v1.12.0
      Updating toml v1.1.2+spec-1.1.0 -> v1.1.3+spec-1.1.0
      Updating toml_edit v0.25.12+spec-1.1.0 -> v0.25.13+spec-1.1.0
      Updating toml_writer v1.1.1+spec-1.1.0 -> v1.1.2+spec-1.1.0
      Updating uuid v1.23.4 -> v1.23.5
      Removing windows-sys v0.60.2
      Removing windows-targets v0.53.5
      Removing windows_aarch64_gnullvm v0.53.1
      Removing windows_aarch64_msvc v0.53.1
      Removing windows_i686_gnu v0.53.1
      Removing windows_i686_gnullvm v0.53.1
      Removing windows_i686_msvc v0.53.1
      Removing windows_x86_64_gnu v0.53.1
      Removing windows_x86_64_gnullvm v0.53.1
      Removing windows_x86_64_msvc v0.53.1
      Updating winnow v1.0.3 -> v1.0.4
      Updating zerocopy v0.8.52 -> v0.8.54
      Updating zerocopy-derive v0.8.52 -> v0.8.54
      Updating zmij v1.0.21 -> v1.0.23
  ```

ACKs for top commit:
  josecelano:
    ACK a0a6914

Tree-SHA512: 08199b7dcc33f579a6dfe005edc8d2c552e7671565a2eff38859e4d4662571235c11f95ab86988ef8967e84202ddc641cbeecf437bd581d3925dc573179022fd
… docs/issues/open to docs/issues/closed

174904d chore(ci): point to ADR instead of closed issue spec in deployment-packages.yaml (Jose Celano)
2e2178f docs(skill): document branch-already-exists edge case in cleanup-completed-issues skill (Jose Celano)
1bfd306 chore(issues): archive closed issue specs torrust#1447, torrust#1459, torrust#1505, torrust#1926, torrust#1938, torrust#1944, torrust#1959, torrust#1964, torrust#1965, torrust#1969 to docs/issues/closed (Jose Celano)

Pull request description:

  Archives the following 10 issue specs that are closed on GitHub, moving them from `docs/issues/open/` to `docs/issues/closed/`:

  | Issue | Title | PR |
  |-------|-------|-----|
  | torrust#1447 | Change logging threshold for connection ID error to WARNING | torrust#1975 |
  | torrust#1459 | Docker Security Overhaul | torrust#1958 |
  | torrust#1505 | Optimize peer IP list from swarm (implementation rejected) | torrust#1949 |
  | torrust#1926 | Define package versioning strategy | torrust#1961 |
  | torrust#1938 | REST API Contract-First Migration EPIC | torrust#1960 (SI-1→5) |
  | torrust#1944 | SI-6: Align REST API client | torrust#1968 |
  | torrust#1959 | SI-7: Review tests, align v1 namespace | torrust#1963 |
  | torrust#1964 | Rename number-of-downloads BTreeMap type alias | torrust#1972 |
  | torrust#1965 | SI-34: Consolidate duplicate HTTP types | torrust#1974 |
  | torrust#1969 | SI-8: Eliminate unwraps from REST API client | torrust#1973 |

  ### Changes Made

  - All 10 specs verified `CLOSED` on GitHub with merged PRs
  - Files/directories moved via `git mv` to `docs/issues/closed/`
  - Frontmatter updated: `status: done`, `spec-path` → closed path, `last-updated-utc: 2026-07-15`
  - Workflow checkpoints updated and progress log entries added
  - Supplementary files in multi-file directories updated with new paths
  - Parent EPIC specs (torrust#1669, torrust#1938) updated: subissue status, spec paths, and table references
  - Fixed stale references in `.github/workflows/deployment-packages.yaml`, `docs/adrs/`, and `docs/issues/closed/` files
  - Pre-commit and pre-push hooks passed (linter, tests, doc-tests, nightly checks)

ACKs for top commit:
  josecelano:
    ACK 174904d

Tree-SHA512: c7e38354bb5898fc5125a0b68fd61a02ca273689593638eb3b955b9176038ef82c40fc98b0a2f722eb18d8d429d2f2dbb6f205eee3061211ab9906c5be46942b
…ring

Add a new custom agent that clones external tracker repositories,
searches their source code and issue trackers, and returns structured
findings. Used before writing issue specs or during implementation
when claims about other trackers need verification.

The agent uses /tmp/tracker-research/ or the workspace .tmp/ directory
for temporary artifacts.
…ref torrust#1985)

Add issue spec for renaming the non-standard peer_addr GET parameter
to the BEP 3-specified ip parameter. Includes an embedded ADR deciding
to accept only IP addresses (not DNS names) in the ip parameter.

Also add 'hostnames' to project-words.txt for the ADR text.
…orrust#1986)

Add issue spec for returning compact peer list by default when the
compact GET parameter is absent, aligning with the BEP 23 SUGGESTION.
Includes manual verification steps using the tracker client.
…orrust#1987)

Add issue spec for an opt-in per-HTTP-tracker configuration option to
honour the ip GET parameter value as the peer address instead of the
TCP connection IP. Sub-issue of torrust#1978 (configuration overhaul).

Includes evidence from opentracker and chihaya confirming that neither
tracker supports DNS names in the ip parameter.
- Fix broken relative link to docs/adrs/ in 1985 ISSUE.md (../adrs/ ->
  ../../adrs/ from the nested issue folder)
- Fix broken relative links to sibling issues in 1985 ISSUE.md
  (../open/1978-... -> ../1978-...)
- Fix broken relative links to sibling issues in 1987 ISSUE.md
  (../open/1978-... and ../open/1640-... -> ../1978-... and ../1640-...)
- Clarify tool naming in researcher.agent.md: github_text_search /
  github_repo tools are optional; fall back to gh CLI when unavailable
… parameter fixes (torrust#1985, torrust#1986, torrust#1987)

ac9ba0e fix(docs): address Copilot review comments on PR torrust#1988 (Jose Celano)
7c1fc8b docs(issue): add spec for use_ip_from_query_string config option (ref torrust#1987) (Jose Celano)
5f87b10 docs(issue): add spec for compact peer list default per BEP 23 (ref torrust#1986) (Jose Celano)
334fba6 docs(issue): add spec for renaming peer_addr to ip in HTTP announce (ref torrust#1985) (Jose Celano)
b5879fb feat(agents): add Researcher custom agent for external evidence gathering (Jose Celano)

Pull request description:

  ## Summary

  Add three new issue specs for HTTP announce request parameter improvements:

  ### torrust#1985 — Rename `peer_addr` GET param to `ip` (BEP 3 compliance)

  - Renames the non-standard `peer_addr` wire parameter to the BEP 3-specified `ip`
  - Renames the Rust struct field, constant, builder method, and extractor
  - Includes an embedded ADR: accept only IP addresses (not DNS names) in the `ip` parameter

  ### torrust#1986 — Return compact peer list by default (BEP 23 compliance)

  - Fixes the tracker to return compact peer list by default when `compact` is absent
  - Aligns with the BEP 23 SUGGESTION
  - Includes manual verification steps using the tracker client

  ### torrust#1987 — Add `use_ip_from_query_string` config option (sub-issue of torrust#1978)

  - Adds an opt-in per-HTTP-tracker config to honour the `ip` GET param as the peer address
  - Security: opt-in only, disabled by default, with documented IP spoofing risk
  - Includes evidence from opentracker and chihaya confirming neither supports DNS names
  - Depends on torrust#1985

  ## New Researcher Agent

  Also includes a new `.github/agents/researcher.agent.md` custom agent for evidence-gathering tasks (external repo research, source code analysis, GitHub issue search).

  ## Commits

  - `feat(agents)`: add Researcher custom agent for external evidence gathering
  - `docs(issue)`: add spec for renaming peer_addr to ip in HTTP announce (ref torrust#1985)
  - `docs(issue)`: add spec for compact peer list default per BEP 23 (ref torrust#1986)
  - `docs(issue)`: add spec for use_ip_from_query_string config option (ref torrust#1987)

ACKs for top commit:
  josecelano:
    ACK ac9ba0e

Tree-SHA512: e83d6ec5bc20922aa03dd660e706770e84f0009db7850df600aff83072640268e37c9f3554359cb0eefacf47ecd482ec0f901e93a8172bb9f2bf8fe58ad172e6
…1990

- Use  instead of  in
   helper to handle arbitrary binary
  data in compact peer strings.
- Change  column for  in the query-parameter table
  from  to   (compact)  for clarity, per
  Copilot review feedback.
…y default per BEP 23

25162a0 fix(axum-http-server): address Copilot review comments on PR torrust#1990 (Jose Celano)
08327f5 fix(axum-http-server): return compact peer list by default per BEP 23 (Jose Celano)

Pull request description:

  ## Description

  Aligns the HTTP tracker with [BEP 23](https://www.bittorrent.org/beps/bep_0023.html), which **SUGGESTS** that trackers return compact peer lists by default when the client omits the `compact` GET parameter.

  ### Changes

  1. **`packages/axum-http-server/src/v1/handlers/announce.rs`** — Inverted the compact logic in `build_response`. Now `None` (absent `compact` param) maps to compact response. Only `compact=0` returns dictionary format.

  2. **`packages/axum-http-server/src/lib.rs`** — Removed the BEP 23 deviation NOTICE. Updated the query-parameter table `Default` column for `compact` from `None` to `compact (BEP 23)`.

  3. **`packages/axum-http-server/tests/server/v1/contract/for_all_config_modes/receiving_an_announce_request.rs`** — Renamed test `should_not_return_the_compact_response_by_default` → `should_return_the_compact_response_by_default`. Flipped assertion. Removed `code-review` comment.

  4. **`packages/axum-http-server/tests/server/asserts.rs`** — Updated `assert_is_announce_response` helper to accept both compact and normal formats.

  ### Verification

  - ✅ 74 tests pass for `axum-http-server` package
  - ✅ Full workspace tests pass (all targets, all features)
  - ✅ `linter all` exits with code 0
  - ✅ Manual verification confirmed:
    - No `compact` param → compact response
    - `compact=1` → compact response
    - `compact=0` → dictionary response

  Closes torrust#1986

ACKs for top commit:
  josecelano:
    ACK 25162a0

Tree-SHA512: 34e8a10f252aad6051bc68b3e440a7ac02ba798c0a0eaa0889c5745cc33b29ddca92b8293af60f6b272e9d00a3b1a24f4eb2af8b83d8d1580457391c7e87ebd2
…date duplicate UDP types (torrust#1966)

- Consolidate ConnectionContext into udp-core, import from udp-server
- Move MAX_PACKET_SIZE to udp-protocol, import from consumers
- Remove dead PROTOCOL_ID from tracker-client
- Add adr: comments referencing protocol/domain decoupling ADR
- Update issue spec with completed statuses
Set related-pr in frontmatter after PR creation.
…orrust#1991)

The comment in udp-protocol/src/common.rs referenced
'bittorrent-primitives::InfoHash' which is a deprecated crate path.
Updated to 'torrust_info_hash::InfoHash' as suggested by Copilot review.

Also adds tracking documentation for the PR review process.
…ker-client): consolidate duplicate UDP types (torrust#1966)

8265e01 chore(review): fix outdated InfoHash comment referenced by Copilot (torrust#1991) (Jose Celano)
1dbf405 docs(issue): update spec with PR torrust#1991 link (Jose Celano)
c3209d2 refactor(udp-core, udp-server, udp-protocol, tracker-client): consolidate duplicate UDP types (torrust#1966) (Jose Celano)

Pull request description:

  ## Summary

  Consolidates duplicate UDP type definitions across the workspace per the issue spec.

  ### Changes

  - **ConnectionContext**: Consolidated into `udp-core` (private fields with accessors). Removed duplicate from `udp-server` — all consumers now import from `torrust_tracker_udp_core::event::ConnectionContext`.
  - **MAX_PACKET_SIZE**: Moved to `udp-protocol/src/common.rs`, imported by both `udp-server` and `tracker-client`.
  - **PROTOCOL_ID**: Removed dead constant from `tracker-client` (unused, confirmed via grep).
  - **adr: comments**: Added `// adr: docs/adrs/20260527175600_keep_protocol_and_domain_types_decoupled.md` to all 5 intentional duplication locations.
  - **Linter fixes**: Fixed `clippy::doc_markdown` in `primitives/src/announce.rs`, removed unused `super::RawRequest` import in `udp-server/src/server/mod.rs`.

  ### Verification

  - `linter all` — exit code 0
  - `cargo test --workspace --all-targets` — all pass
  - `cargo machete` — no new unused dependencies
  - Pre-commit and pre-push hooks — all pass
  - No duplicate `ConnectionContext` or `MAX_PACKET_SIZE` definitions remain

  Closes torrust#1966

ACKs for top commit:
  josecelano:
    ACK 8265e01

Tree-SHA512: 7ef2adc423ce6e108040a9b7c831ceebde4f89f54b1262d10073570dd452a02518c5d69bdd9566945ad870fc4d58d0120d5c0c160e883169d7d33385351e33bb
…BEP 3)

Align the HTTP tracker wire protocol with BEP 3 by renaming the
non-standard `peer_addr` GET parameter to the spec-defined `ip`.

Changes:
- Rename constant `PEER_ADDR` → `IP` (value "peer_addr" → "ip")
- Rename struct field `Announce::peer_addr` → `Announce::ip`
- Rename builder method `with_peer_addr` → `with_ip`
- Rename extractor function `extract_peer_addr` → `extract_ip`
- Fix `Display` impl to use `IP` constant instead of hardcoded literal
- Replace incorrect NOTICE (BEP 15 reference) in axum-http-server docs
  with correct BEP 3 description
- Update all sample URLs from `peer_addr=` to `ip=`
- Update test fixtures, integration tests, and inline test query strings
- Rename CLI flag `--peer-addr` → `--ip` in tracker-client binaries
- Update tracker-client JSON request-input docs
- Add ADR: accept only IP addresses (not DNS names) in announce `ip` param

Closes torrust#1985
josecelano and others added 22 commits July 28, 2026 14:00
…validation policy (torrust#1136)

2407165 fix(review): remove unnecessary cast in banning semantics test (Jose Celano)
c04d75e test(review): add banning semantics test for disabled-policy mode (torrust#1136) (Jose Celano)
9ce32b5 docs: fix doc comments and test assertions per Copilot review (torrust#1136) (Jose Celano)
ca35387 feat(udp-server): add configurable connection ID validation policy (torrust#1136) (Jose Celano)
cea84cf docs(udp-server): update spec for torrust#1136 connection ID validation policy (Jose Celano)

Pull request description:

  ## Description

  Implements issue torrust#1136 — add a global `connection_id_validation` option to the schema v3 UDP tracker server configuration, allowing operators to disable connection ID validation for compatibility with non-compliant BEP 15 clients.

  ### Changes

  **Configuration (T1–T2)**
  - `ConnectionIdValidationPolicy` enum with `strict` (default) and `disabled` variants in `v3_0_0/udp_tracker_server.rs` (global setting, not per-instance — the BanService is shared across all UDP listeners)
  - 6 serialization/deserialization tests

  **Runtime type (T3)**
  - Mirror enum in `udp-core` to avoid configuration crate dependency
  - `validate_cookie: bool` parameter on `AnnounceService::handle_announce` and `ScrapeService::handle_scrape`

  **Policy propagation (T4–T5)**
  - Threaded from launcher through processor to handlers
  - `CookieValidationContext` struct to stay within clippy's `too_many_arguments` limit

  **Observability and banning (T6)**
  - Disabled mode still validates the cookie for observability — emits `UdpError { ConnectionCookie }` event (objective fact)
  - Ban listener always counts invalid IDs; enforcement is gated in the main loop (`is_banned` check only when `Strict`)
  - ADR-20260727000000 "Events are objective facts" documents the design principle

  **Startup warning (T7)**
  - `WARN`-level log at startup when policy is `Disabled`

  **Integration tests (T8)**
  - 4 contract tests: connect issues valid ID, announce/scrape succeed with arbitrary ID, and ban enforcement is skipped in disabled mode

  **Documentation & Code Quality**
  - ADR-20260727180000: Shared services across tracker instances (peer repository, ban service, event buses)
  - All Copilot review suggestions processed and resolved with documented rationale
  - 100% linter compliance (markdown, YAML, TOML, Clippy, Rustfmt, ShellCheck)

  ### Commits

  | Commit | Description |
  |--------|-------------|
  | `cea84cff` | Spec updates after Q&A |
  | `ca35387f` | Full implementation (T1-T8, ADRs, global config pivot) |
  | `9ce32b50` | Fix doc comments and test assertions per Copilot review |
  | `c04d75ea` | Add banning semantics test for disabled-policy mode |
  | `24071657` | Fix unnecessary cast (clippy) |

  ### Related

  - Closes torrust#1136
  - Subissue 7 of EPIC torrust#1978
  - ADR: `docs/adrs/20260727000000_events_are_objective_facts.md`
  - ADR: `docs/adrs/20260727180000_shared_services_across_tracker_instances.md`

  ### Notes

  The per-instance/global configuration pivot was made after discovering that the global BanService would be polluted by per-instance policies. All Copilot suggestions were addressed with documented replies and the branch is linter-clean and test-passing.

ACKs for top commit:
  josecelano:
    ACK 2407165

Tree-SHA512: 9fefc63ee42843b811698cc32a6172a97cb3f4a2b5e70b40bdedc184dabe07ba4f3f350c0512d84562bdc76222cadea6d0fc3641ea20dce889d2c5b8260bcb95
…ructure

Issue spec for torrust#1419 covering:
- Three problems: logging, port conflicts, config isolation
- Temp directory pattern for complete test isolation
- 8-task implementation plan with prove-then-fix strategy
- 9 acceptance criteria and verification plan
Tracking issue for expanding main application-level integration tests.
Documents the three-layer testing strategy (unit/integration/E2E) and
lists 14 prioritized tests that require full application context.
Documents what belongs in main-level vs package-level tests,
infrastructure requirements (port 0, temp workspaces), and
references the draft issue for future test coverage expansion.
- Replace tests/integration.rs with tests/stats.rs (rename)
- Create tests/common/mod.rs with shared helpers (EphemeralTrackerWorkspace,
  port discovery via registar IP-based filtering)
- Create tests/scaffold.rs as a demo binary for future contributors
- Convert stats tests to single-suite with cross-instance aggregation focus
- Update tests/AGENTS.md with the new execution model
- Remove unused dev-dependencies (torrust-info-hash, torrust-tracker-client,
  torrust-tracker-http-protocol)
- Remove obsolete tests/helpers.rs
…tion

e3a4cd6 docs(tests): reference stats integration test binary (Jose Celano)
a1f7a75 docs(issues): add specs for torrust#2035 and torrust#2036 (Jose Celano)
a2186a1 docs(1419): plan runtime service registry refactor (Jose Celano)
935ceb9 refactor(tests): use Url type instead of String for URL values (Jose Celano)
8e42f8e feat(tests): add parallel integration test infrastructure (Jose Celano)
c5b2b89 docs(issues): revise integration test execution model (Jose Celano)
700e0aa docs(tests): add AI agent guidelines for integration tests (Jose Celano)
4dd469d docs(issues): add draft issue for integration test coverage expansion (Jose Celano)
26aae78 docs(issues): add specification for parallel integration test infrastructure (Jose Celano)

Pull request description:

  ## Summary

  Establishes the main-application integration-test foundation for torrust#1419 and documents the two prerequisites discovered while exercising it.

  ## Included

  - Replaces the prior top-level integration binary with `tests/stats.rs`, giving the suite one application instance per Cargo integration-test executable.
  - Adds an isolated `EphemeralTrackerWorkspace` helper that creates per-test configuration and storage, and uses port zero for listener allocation.
  - Adds a `tests/scaffold.rs` example binary and updates integration-test contributor guidance.
  - Uses `Url` rather than `String` for runtime listener URLs in test helpers.
  - Keeps the aggregate HTTP tracker statistics contract test running against two port-zero listeners.
  - Adds an ignored regression that exposes the duplicate `0.0.0.0:0` bootstrap defect: one disabled and one enabled tracker should contribute one global announce, but the current implementation reports two because both listeners inherit the later configuration.
  - Records the runtime service registry architecture in an ADR and documents the current discovery limitations.
  - Opens and documents the two follow-up issues required to complete torrust#1419:
    - torrust#2035 fixes duplicate port-zero HTTP/UDP tracker bootstrap identity.
    - torrust#2036 adds side-effect-free runtime service registry metadata and deterministic readiness.

  ## Deliberate Deferral

  This PR does not implement torrust#2035 or torrust#2036. The integration helpers temporarily classify services by bind IP and wait briefly for asynchronous registration. That workaround is documented and remains acceptable only until the prerequisite issues land. torrust#1419 stays open and resumes after them.

  ## Validation

  - `linter all`
  - `cargo test --test stats`
  - Full pre-push gate:
    - `cargo +nightly fmt --check`
    - `cargo +nightly check --tests --benches --examples --workspace --all-targets --all-features`
    - `cargo +nightly doc --no-deps --bins --examples --workspace --all-features`
    - `cargo +stable test --tests --benches --examples --workspace --all-targets --all-features`

  The known torrust#2035 regression was run explicitly and fails as expected: global `tcp4_announces_handled` is `2` rather than the required `1`. It remains `#[ignore]` until torrust#2035 is fixed.

ACKs for top commit:
  josecelano:
    ACK e3a4cd6

Tree-SHA512: ed5e38927090f6cad8f772920c8d0906a4282094cf1ad28e12c7c0c07a73696d07d377eda685bae025b07880459f34e770fe51d79c3bd1a5908651d6c654d163
…d to trace_filter

- Rename `threshold` to `trace_filter` in v3 `Logging` struct (level-only Threshold retained)
- Add `trace_style` field with four unit variants: full, pretty, compact, json
- Default trace style is `full` (backward-compatible behaviour)
- Redesign TraceStyle enum: rename Default→Full, drop Pretty(bool)→Pretty
- Add negative test: v3 Logging rejects the removed `threshold` key
- Update v3 generated default config and all v3 test fixtures
- Update issue torrust#889 spec and EPIC torrust#1978 status to IN_REVIEW

Co-authored-by: josecelano <josecelano@nautilus-cyberneering.de>
…st#1980

Add T8 to torrust#1980 implementation plan: run torrust#889 manual verification scenarios
(M1-M5) after consumer migration. These scenarios require the tracker to
use v3 config, which is not possible until this cleanup migrates global
callers.
- Move epic spec from standalone file to folder type: 1978-configuration-overhaul-epic/EPIC.md
- Add migration-guide.md with skeleton and completed sections (torrust#889, torrust#1640, torrust#1981, torrust#1417, torrust#1136)
- Add explicit TODOs for pending subissues (torrust#1490, torrust#1987, torrust#1980, torrust#2023) with reasons
- Update all 7 references across open/closed issue specs, AGENTS.md, and PR reviews
Update 7 files that referenced the old standalone epic path
to use the new folder-based path (1978-configuration-overhaul-epic/EPIC.md).
Added a subtask to all 12 EPIC torrust#1978 subissues reminding implementers to
update the migration guide if the subissue affects the configuration public API.
Also added this as step 4 in the EPIC's default completion policy.
- Updated progress log with PR-ready status
- Marked manual verification as deferred to torrust#1980 (final cleanup)
- Updated workflow checkpoints
Copilot AI review requested due to automatic review settings July 28, 2026 17:58

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.

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