Skip to content

refactor(statistics): [#2536] hide the statistics repositories' read lock and metric collection field - #2545

Merged
josecelano merged 25 commits into
torrust:developfrom
josecelano:2536-1669-hide-statistics-repository-read-lock
Oct 16, 2026
Merged

josecelano merged 25 commits into
torrust:developfrom
josecelano:2536-1669-hide-statistics-repository-read-lock

Conversation

@josecelano

@josecelano josecelano commented Oct 15, 2026 •

Copy link
Copy Markdown
Member

Summary

Closes #2536. Part of EPIC #1669.

The five statistics repositories (udp-core, udp-server, http-core, tracker-core, and swarm-coordination-registry) no longer expose the lock type or the MetricCollection field in their public read API. Each repository replaces get_stats() / get_metrics() with one closure-based read_metrics(|metrics| ...), and each Metrics type makes metric_collection pub(crate) behind a read-only metric_collection() accessor. None of the five crates is published yet, so this lands before their first publish and needs no semver-major bump. A root ADR records closure-based reads as the rule for statistics repositories.

Changes

  • One refactor(<package>): [#2536] hide the statistics read lock and metric collection field commit per package, each with its callers, tests and doctests, so every commit builds.
  • Callers updated: the event handlers (the debug log still reads inside the tracing::debug! arguments, so the lock is taken only when debug is enabled), tracker-core's own counter reads, rest-api-runtime-adapter, the axum-http-server and udp-server contract tests, the tracker-core test environment, and the src/bootstrap/jobs unit test.
  • Each crate has a compile_fail,E0616 doctest for the field and a compiling read_metrics() example; the Make the statistics repositories' metrics lock private #2517 companion doctests and their rustdoc links point to the new API.
  • New root ADR docs/adrs/20261015181650_read_statistics_repositories_through_a_closure.md, registered in docs/adrs/index.md.
  • Issue spec Hide the statistics repositories' read lock and metric collection field #2536, the Overhaul: Packages #1669 EPIC spec, and manual verification evidence updated (docs/issues/open/2536-1669-hide-statistics-repository-read-lock/).

Because the closure is synchronous, a caller cannot hold the lock across an .await. Keeping the closure short and non-blocking remains a caller obligation, stated in read_metrics()'s rustdoc and in the ADR.

Validation

  • linter all and the other pre-commit checks pass on every commit; the pre-push checks pass (nightly format, check, docs and library docs, and the full stable test suite).
  • cargo clippy --workspace --all-targets --all-features -- -D warnings is clean.
  • Each compile_fail,E0616 doctest was checked red (it fails while the field is temporarily pub) and green (it passes with pub(crate)) on the nightly toolchain.
  • Spec greps: the call grep prints only the two REST-port lines, and the pub metric_collection and Repository::(get_stats|get_metrics) greps print nothing.
  • Manual check M1: the same HTTP and UDP announces on develop and on this branch give byte-identical normalized /api/v1/stats and /api/v1/metrics outputs (five outputs per run, stored under evidence/). Debug logging was also checked: 0 stats: Metrics lines at info, 9 at debug. Details are in manual-verification-evidence.md.

No temporary local-only patches are part of this branch or of the verification.

Notes for review

josecelano and others added 9 commits October 15, 2026 18:56
Add task T9 and AC6 for a root ADR on closure-based statistics reads,
record that the agent runs manual check M1, and mark torrust#2536 in progress
in the torrust#1669 EPIC.

Co-authored-by: Copilot <[email protected]>
…metric collection field

Replace get_stats() with a closure-based read_metrics(), make the
Metrics.metric_collection field pub(crate) behind a read-only accessor,
and update the callers and doctests.

Co-authored-by: Copilot <[email protected]>
…d metric collection field

Replace get_stats() with a closure-based read_metrics(), make the
Metrics.metric_collection field pub(crate) behind a read-only accessor,
and update the callers, tests and doctests.

Co-authored-by: Copilot <[email protected]>
… metric collection field

Replace get_stats() with a closure-based read_metrics(), make the
Metrics.metric_collection field pub(crate) behind a read-only accessor,
and update the callers, tests and doctests.

Co-authored-by: Copilot <[email protected]>
…and metric collection field

Replace get_metrics() with a closure-based read_metrics(), make the
Metrics.metric_collection field pub(crate) behind a read-only accessor,
and update the callers, tests and doctests.

Co-authored-by: Copilot <[email protected]>
…tics read lock and metric collection field

Replace get_metrics() with a closure-based read_metrics(), make the
Metrics.metric_collection field pub(crate) behind a read-only accessor,
and update the callers, tests and doctests.

Co-authored-by: Copilot <[email protected]>
Copilot AI balanced review requested due to automatic review settings October 15, 2026 19:50

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.

🟢 Approval recommended

The migration is consistent, supplied validation supports unchanged behavior, and no blocking issues remain.

0 open findings

What changed in this PR

Encapsulates statistics reads across five packages before publication, continuing the package-boundary improvements in #1669.

Changes:

  • Replaces exposed read guards with read_metrics() closures and read-only collection accessors.
  • Migrates callers, tests, and doctests while preserving lazy debug logging.
  • Records the architectural decision and before/after verification evidence.
File Description
src/​bootstrap/​jobs/​udp_tracker_server.rs Migrates cleanup-test metric reads.
packages/​udp-server/​tests/​server/​contract.rs Migrates contract-test metric reads.
packages/​udp-server/​src/​statistics/​repository.rs Adds closure reads and privacy doctests.
packages/​udp-server/​src/​statistics/​metrics.rs Encapsulates the metric collection.
packages/​udp-server/​src/​statistics/​event/​listener.rs Migrates listener-test assertions.
packages/​udp-server/​src/​statistics/​event/​handler/​response_sent.rs Migrates response-statistics assertions.
packages/​udp-server/​src/​statistics/​event/​handler/​request_received.rs Migrates received-request assertions.
packages/​udp-server/​src/​statistics/​event/​handler/​request_discarded.rs Migrates discarded-request assertions.
packages/​udp-server/​src/​statistics/​event/​handler/​request_banned.rs Migrates banned-request assertions.
packages/​udp-server/​src/​statistics/​event/​handler/​request_accepted.rs Migrates accepted-request assertions.
packages/​udp-server/​src/​statistics/​event/​handler/​request_aborted.rs Migrates aborted-request assertions.
packages/​udp-server/​src/​statistics/​event/​handler/​mod.rs Preserves lazy logging through closure reads.
packages/​udp-server/​src/​statistics/​event/​handler/​error.rs Migrates error-metric assertions.
packages/​udp-server/​src/​banning/​mod.rs Migrates ban-reset assertions.
packages/​udp-server/​src/​banning/​event/​handler.rs Migrates ban-publication assertions.
packages/​udp-core/​src/​statistics/​repository.rs Adds closure reads and privacy doctests.
packages/​udp-core/​src/​statistics/​metrics.rs Encapsulates the metric collection.
packages/​udp-core/​src/​statistics/​event/​listener.rs Migrates listener-test assertions.
packages/​udp-core/​src/​statistics/​event/​handler.rs Migrates lazy logging and test reads.
packages/​tracker-core/​tests/​common/​test_env.rs Migrates the counter-reading helper.
packages/​tracker-core/​src/​statistics/​repository.rs Migrates public and internal reads.
packages/​tracker-core/​src/​statistics/​metrics.rs Encapsulates the metric collection.
packages/​swarm-coordination-registry/​src/​statistics/​repository.rs Adds closure reads and privacy doctests.
packages/​swarm-coordination-registry/​src/​statistics/​mod.rs Migrates inactive-peer test reads.
packages/​swarm-coordination-registry/​src/​statistics/​metrics.rs Encapsulates the metric collection.
packages/​swarm-coordination-registry/​src/​statistics/​event/​listener.rs Migrates listener-test metric reads.
packages/​swarm-coordination-registry/​src/​statistics/​event/​handler.rs Migrates counter and gauge helpers.
packages/​rest-api-runtime-adapter/​src/​v1/​adapters/​stats.rs Builds REST statistics through closure reads.
packages/​http-core/​src/​statistics/​repository.rs Adds closure reads and privacy doctests.
packages/​http-core/​src/​statistics/​metrics.rs Encapsulates the metric collection.
packages/​http-core/​src/​statistics/​event/​listener.rs Migrates listener-test assertions.
packages/​http-core/​src/​statistics/​event/​handler.rs Migrates lazy logging and test reads.
packages/​axum-http-server/​tests/​server/​v1/​contract/​for_all_config_modes/​receiving_an_scrape_request.rs Migrates scrape-statistics assertions.
packages/​axum-http-server/​tests/​server/​v1/​contract/​for_all_config_modes/​receiving_an_announce_request.rs Migrates announce-statistics assertions.
docs/​issues/​open/​2536-1669-hide-statistics-repository-read-lock/​manual-verification-evidence.md Records comparison steps and results.
docs/​issues/​open/​2536-1669-hide-statistics-repository-read-lock/​ISSUE.md Updates implementation and acceptance evidence.
docs/​issues/​open/​2536-1669-hide-statistics-repository-read-lock/​evidence/​m1-develop-stats-before.json Stores initial baseline statistics.
docs/​issues/​open/​2536-1669-hide-statistics-repository-read-lock/​evidence/​m1-develop-stats-after.json Stores baseline statistics after announces.
docs/​issues/​open/​2536-1669-hide-statistics-repository-read-lock/​evidence/​m1-develop-metrics-before.txt Stores initial baseline metrics.
docs/​issues/​open/​2536-1669-hide-statistics-repository-read-lock/​evidence/​m1-develop-metrics-after.txt Stores baseline metrics after announces.
docs/​issues/​open/​2536-1669-hide-statistics-repository-read-lock/​evidence/​m1-develop-client-responses.txt Stores baseline client responses.
docs/​issues/​open/​2536-1669-hide-statistics-repository-read-lock/​evidence/​m1-debug-log-stats-lines-by-target.txt Records debug-log counts by handler.
docs/​issues/​open/​2536-1669-hide-statistics-repository-read-lock/​evidence/​m1-branch-stats-before.json Stores initial branch statistics.
docs/​issues/​open/​2536-1669-hide-statistics-repository-read-lock/​evidence/​m1-branch-stats-after.json Stores branch statistics after announces.
docs/​issues/​open/​2536-1669-hide-statistics-repository-read-lock/​evidence/​m1-branch-metrics-before.txt Stores initial branch metrics.
docs/​issues/​open/​2536-1669-hide-statistics-repository-read-lock/​evidence/​m1-branch-metrics-after.txt Stores branch metrics after announces.
docs/​issues/​open/​2536-1669-hide-statistics-repository-read-lock/​evidence/​m1-branch-client-responses.txt Stores branch client responses.
docs/​issues/​open/​1669-overhaul-packages/​EPIC.md Updates the package-overhaul progress.
docs/​adrs/​index.md Registers the statistics-read decision.
docs/​adrs/​20261015181650_read_statistics_repositories_through_a_closure.md Defines closure-based reads and caller obligations.

🧠 Review effort: Balanced


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

@josecelano josecelano self-assigned this Oct 15, 2026
@josecelano
josecelano requested a review from da2ce7 October 15, 2026 20:32
da2ce7
da2ce7 previously approved these changes Oct 15, 2026

@da2ce7 da2ce7 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed at e7228207df678d49937c05feab38b8ca8dcd12cd. Recomputed from the bytes at this head, against the merge base fe5d8264a, which is develop; git merge-tree against it is clean.

The API. In all five repositories, get_stats()/get_metrics() (which returned RwLockReadGuard<'_, Metrics>) is replaced by pub async fn read_metrics<R>(&self, read: impl FnOnce(&Metrics) -> R) -> R. No other public read method changed: udp-server keeps its #[cfg(test)] pub(crate) write-lock helper, and tracker-core keeps its three get_torrents_downloads_*. metric_collection is now pub(crate) behind pub const fn metric_collection(&self) -> &MetricCollection.

R is fixed outside the closure's borrow, so a closure cannot return &Metrics or the accessor's reference; results must be owned. The closure cannot .await. It can still block, or drive a nested read_metrics through a blocking executor and deadlock behind a queued writer; the rustdoc states this as the caller's obligation.

Across 68 changed functions, every call site reads the same value as before, and none takes the lock more often; tuple closures replace guards that served several reads. The REST get_stats() still reads its four HTTP values in one acquisition and its UDP-server values in one, and it no longer holds the HTTP guard across the UDP-server .await. The three debug lines put read_metrics(...).await inside tracing::debug!'s arguments with {}, so the read runs only on the enabled path and the text stays stats: Metrics { .. }.

The spec. Every In Scope item and AC1-AC5 is met. Run verbatim at this head, the spec's greps give the expected results. The guard grep prints only udp-server's two cfg(test) lines. The call grep prints exactly the two REST-port lines; at develop it prints 80, as T1 records. The AC2 and AC3 greps print nothing. Each repository.rs now has two compile_fail,E0616 doctests. Against the approved text, this PR adds T9 and AC6, records const fn, and weakens nothing. The 17:56 "maintainer feedback" and the 19:40 maintainer review of T3-T7 cannot be checked from the bytes. The acceptance boxes were ticked by the implementer (F3), and several stamps are later than their commits (F2).

The ADR. Its shape, filename timestamp and index row follow the template and the recent ADRs. It agrees with the infallible-return ADR and with the versioning ADR it cites; no existing ADR rules on statistics locking. Its rule for "any new statistics repository" is the decision the spec records. Its consistency rule overstates what the code does (F1).

The evidence. All five develop/branch pairs are cmp-identical. The recorded flags exist: --config-toml-path, and tracker_client's --event, --left, --port and --peer-id. The files follow the normalization the spec states. The debug counts add up from the handlers: one HTTP announce event; a UDP connect and announce in udp-core; and three udp-server events per request, for 1 + 2 + 6 = 9.

Hygiene. The subjects are Conventional, scoped and tagged, and each package body names the accessor it replaces. Each commit has one footer line, author equals committer, and git diff --check is clean. The ADR commit also rewrites five Progress Log stamps (F2). From the diffs I expect every commit to build: each package commit moves every caller of that crate's accessor. The skill's PR-branch id check, run verbatim with UPSTREAM_REMOTE=work, prints nothing. project-words.txt is untouched. The body's note on the open specs is half right (F4).

The bot. Its overview raises no finding, and its file table matches the diff.

Findings. F1 and F2 (Minor), F3 and F4 (Nit), inline. None is blocking.

Checked, no finding. metric_collection() keeps MetricCollection as the storage type, which the approved spec chose. The T7 row's extra spaces are cosmetic. Every new Metrics import outside its crate is a declared dependency. No rustdoc in the touched crates still names a removed accessor.

Checks

On the loop's compute hub at this head, merge base fe5d8264a (receipt server-gates-krkavec-325, a target directory of its own): pre-commit profile gate exit 0 (63 s); linter markdown, linter cspell, linter lychee exit 0; frontmatter-validator --all: 19 errors / 4 warnings at this head and 19 / 4 at fe5d8264a re-measured, the same 23 diagnostics by path and category, none in the files this PR touches; cargo test -p for the eight packages this PR touches, all exit 0: udp-core 103 passed (3 ignored), udp-server 241 (1 ignored), http-core 35, tracker-core 179, swarm-coordination-registry 113, rest-api-runtime-adapter 3, axum-http-server 105, torrust-tracker 163, 0 failed; the statistics::repository doctests of the five crates on nightly: exit 0; RUSTDOCFLAGS="-D warnings" cargo doc --no-deps for the five crates: 0 diagnostics; cargo clippy --workspace --all-targets --all-features -- -D warnings: 0 diagnostics; cargo fmt --all --check exit 0; cargo machete exit 0; mutation check per crate: with metric_collection made pub again, each crate's doctests fail on the new compile_fail,E0616 example alone (exit 101 in all five), so each doctest guards the field it targets; grep -rnE 'pub +metric_collection' packages/*/src and grep -rnE 'Repository::(get_stats|get_metrics)' print nothing. GitHub checks at this head at posting time: "Publish (Release): completed/skipped; Publish (Development): completed/skipped; Context: completed/success; Package Coverage Regression: completed/success; Package Coverage (torrust-tracker-udp-server): completed/success; Package Coverage (torrust-tracker-core): completed/success; Package Coverage (torrust-tracker): completed/success; Package Coverage (torrust-tracker-udp-core): completed/success; Package Coverage (torrust-tracker-swarm-coordination-registry): completed/success; Package Coverage (torrust-tracker-axum-http-server): completed/success; Package Coverage (torrust-tracker-rest-api-runtime-adapter): completed/success; Package Coverage (torrust-tracker-http-core): completed/success; Layer Boundary Bans: completed/success; Unit (stable): completed/success; Docker E2E: completed/skipped; Documented Clippy Allows: completed/success; Unit (nightly): completed/success; Test (Docker) (release): completed/success; Generate Coverage Report: completed/success; Persistence Benchmark MySQL: completed/success; Discover Package Coverage: completed/success; Persistence Benchmark SQLite3: completed/success; Build on windows-latest (stable): completed/success; Persistence Benchmark PostgreSQL: completed/success; Database Compatibility PostgreSQL (17): completed/success; Database Compatibility PostgreSQL (16): completed/success; Database Compatibility PostgreSQL (15): completed/success; Database Compatibility MySQL (8.4): completed/success; Database Compatibility PostgreSQL (14): completed/success; Database Compatibility MySQL (8.0): completed/success; Build on ubuntu-latest (stable): completed/success; Build on macos-latest (stable): completed/success; Build on macos-latest (nightly): completed/success; Build on windows-latest (nightly): completed/success; Build on ubuntu-latest (nightly): completed/success; Docs Lint: completed/success". At posting, develop is fe5d8264a.

@da2ce7

da2ce7 commented Oct 15, 2026

Copy link
Copy Markdown
Contributor

ACK e722820 — the five read surfaces, every moved call site, the spec greps, the ADR and the byte-identical M1 evidence were recomputed against fe5d826, and only non-blocking findings stand

josecelano and others added 3 commits October 15, 2026 22:04
…epository serves together

Name the tracker-core per-value accessors as an accepted exception.

Co-authored-by: Copilot <[email protected]>
@josecelano

Copy link
Copy Markdown
Member Author

Thanks for the review. Round summary for review 5539892352 (da2ce7, APPROVED, 2026-10-15 21:02 UTC). Copilot's review 5539177165 (COMMENTED, 2026-10-15 20:03 UTC) is an overview that raised no finding, so it adds no row.

  • F1 (Minor): FIXED. The ADR's consistency rule now covers values one repository serves together, and names tracker-core's three get_torrents_downloads_* accessors as an accepted exception. Resolution: docs(adrs): [#2536] scope the consistency rule to values one repository serves together.
  • F2 (Minor): FIXED. The stamps later than their commits (the T7 and T8 entries, the evidence file's last-updated-utc, and the EPIC's entry and last-updated-utc) are corrected to the commits' time, with a Progress Log entry. The five stamps the ADR commit rewrote in place stay as history. Resolution: docs(issues): [#2536] correct progress-log stamps that were later than their commits.
  • F3 (Nit): FIXED. The "Reviewer validated acceptance criteria" checkpoint is ticked, with a Progress Log entry citing this review. Resolution: docs(issues): [#2536] record the reviewer's validation of the acceptance criteria.
  • F4 (Nit): FIXED. The PR body now says open spec Benchmark first HTTP announces into a swarm of fixed size #2518 mentions the removed accessors and open spec Drain listener queues on shutdown #2414 touches their callers (the listener files and the tracker-core test environment). The fix is the edit of this PR's description, so this comment is its resolution reference.

da2ce7
da2ce7 previously approved these changes Oct 15, 2026

@da2ce7 da2ce7 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed at 2c27dd0bb5b432bbada585cedb5423a7947c64df. Recomputed from the bytes at this head, against the merge base fe5d8264a, which is develop; git merge-tree against it exits 0 with no conflict.

Round-1 findings. F1 is RESOLVED. The ADR now scopes the rule to values one repository serves together (:79-82); the REST Stats reads its 19 UDP-server values in one closure (stats.rs:88-132). The ADR names the three tracker-core accessors (repository.rs:209-221) as an accepted exception and says how to read them together (:83-88), and Alternatives points at that exception (:100-102). A future repository can follow the rule. F2 is PARTLY resolved. Every stamp is now no later than its commit: the T7 entry reads 18:18 against 7e239784b at 18:18:42Z, and the T8 entry, the evidence stamp and the EPIC entry read 19:48 against 1c13ed568 at 19:48:30Z. The new 21:05, 21:06 and 21:09 stamps precede 32bff9258, d236fc679 and 2c27dd0bb. The stamps were corrected in place, with a 21:05 entry that names each change, which meets process-pr-review SKILL.md:267-268. Two gaps remain: two pointers still name the old times (F1), and the EPIC's last-updated-utc is recorded as 19:48 although it reads 21:05 (F2). F3 is RESOLVED as round 1 proposed. d236fc679 ticks the checkpoint that the template gives the reviewer (:299), and its 21:06 entry cites the review by URL. That entry calls the review the maintainer's (F3). F4 is RESOLVED. Only the overlap line of the body changed. #2518's spec (:248) names Repository::get_metrics, and this PR changes five of the files that #2414's spec lists: four listeners and test_env.rs. All four replies match these bytes, except the F2 reply's EPIC stamp.

Nothing else moved. Since round 1 there are four commits touching five docs files, and no byte under packages/ or src/ changed. No relative link was added or changed; the audit record's eleven links are absolute. The EPIC edit (two stamps) and the evidence edit (one stamp) match the subject of 32bff9258.

Hygiene. The subjects are Conventional, scoped and tagged. 55f66f839's one-line body matches its diff; the other three commits have no body beyond the footer, like round 1's docs commits. Each commit has one footer line, author equals committer, and git diff --check exits 0. The open-pull-request id check, run verbatim with UPSTREAM_REMOTE=work, prints nothing over 51 files. project-words.txt is untouched.

The audit record. The validator passes: run with --base fe5d8264a against the captured comments, it reports 4 rows, 1 log entry and 0 failures. The four rows match review 5539892352's four threads. Their severities match the brackets, Source and Reply URLs sit on their own threads, every row is Human, ORIGINAL and FIXED, and every row is RESOLVED, as all four threads are. The bot overview 5539177165 rightly adds no row; the four later reviews are the author's reply wrappers. The categories fit. The Concerns restate round 1 faithfully. No commit id appears, and the frontmatter is the template's. The Ownership section lacks the template's post-merge line (F4). The 21:09 log stamp precedes its commit. The claim that pushing dismissed the approval matches the timeline: the dismissal has no message and names d236fc679.

The bot. No review by the review bot after 21:02:29Z; its only review is 5539177165 at 20:03:35Z.

Findings. F1-F4 are all Nit and are inline. None is blocking.

Checked, no finding. The evidence stamp keeps the time of its content, while the spec and EPIC stamps take the time of the edit; all three meet the rule. The five stamps that 7e239784b rewrote (17:58 to 18:13) equal the minutes of the commits that first carried them. The citation by URL survives the dismissal. The log's description of the three fix commits matches their commit objects.

Checks

On the loop's compute hub at this head, merge base fe5d8264a (receipt server-gates-krkavec-326, a target directory of its own): pre-commit profile gate exit 0 (87 s); linter markdown, linter cspell, linter lychee exit 0; frontmatter-validator --all: 19 errors / 4 warnings at this head and 19 / 4 at fe5d8264a re-measured, the same 23 diagnostics by path and category, none in the files this PR touches; the PR-review audit validator on docs/pr-reviews/pr-2545-review/PR-REVIEW.md against the captured review comments: exit 0; cargo test -p for the eight packages this PR touches, all exit 0: udp-core 103 passed (3 ignored), udp-server 241 (1 ignored), http-core 35, tracker-core 179, swarm-coordination-registry 113, rest-api-runtime-adapter 3, axum-http-server 105, torrust-tracker 163, 0 failed; the statistics::repository doctests of the five crates on nightly: exit 0; RUSTDOCFLAGS="-D warnings" cargo doc --no-deps for the five crates: 0 diagnostics; cargo clippy --workspace --all-targets --all-features -- -D warnings: 0 diagnostics; cargo fmt --all --check exit 0; cargo machete exit 0; mutation check per crate: with metric_collection made pub again, each crate's doctests fail on the new compile_fail,E0616 example alone (exit 101 in all five), so each doctest guards the field it targets; grep -rnE 'pub +metric_collection' packages/*/src and grep -rnE 'Repository::(get_stats|get_metrics)' print nothing. GitHub checks at this head at posting time: "Package Coverage Regression: completed/success; Publish (Release): completed/skipped; Publish (Development): completed/skipped; Context: completed/success; Package Coverage (torrust-tracker-axum-http-server): completed/success; Package Coverage (torrust-tracker-udp-core): completed/success; Package Coverage (torrust-tracker-http-core): completed/success; Package Coverage (torrust-tracker-rest-api-runtime-adapter): completed/success; Package Coverage (torrust-tracker): completed/success; Package Coverage (torrust-tracker-udp-server): completed/success; Package Coverage (torrust-tracker-swarm-coordination-registry): completed/success; Package Coverage (torrust-tracker-core): completed/success; Test (Docker) (release): completed/success; Docker E2E: completed/skipped; Layer Boundary Bans: completed/success; Documented Clippy Allows: completed/success; Unit (stable): completed/success; Unit (nightly): completed/success; Docs Lint: completed/success; Build on windows-latest (nightly): completed/success; Build on macos-latest (stable): completed/success; Build on ubuntu-latest (stable): completed/success; Build on windows-latest (stable): completed/success; Build on ubuntu-latest (nightly): completed/success; Build on macos-latest (nightly): completed/success; Generate Coverage Report: completed/success; Database Compatibility PostgreSQL (15): completed/success; Database Compatibility MySQL (8.4): completed/success; Database Compatibility PostgreSQL (17): completed/success; Database Compatibility PostgreSQL (16): completed/success; Database Compatibility PostgreSQL (14): completed/success; Persistence Benchmark MySQL: completed/success; Persistence Benchmark SQLite3: completed/success; Discover Package Coverage: completed/success; Database Compatibility MySQL (8.0): completed/success; Persistence Benchmark PostgreSQL: completed/success". At posting, develop is fe5d8264a.

@da2ce7

da2ce7 commented Oct 15, 2026

Copy link
Copy Markdown
Contributor

ACK 2c27dd0 — the four round-1 findings, the untouched code, the four new commits and the audit record were recomputed against fe5d826, and only non-blocking findings stand

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.

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Copilot review overview

1 open finding

🧠 Review effort: Lite

@josecelano

Copy link
Copy Markdown
Member Author

Round summary for Copilot review 5545105221 (COMMENTED, 2026-10-16 08:35:45 UTC, Lite effort after an agentic-review timeout). It has one inline finding, F10 in the audit.

  • F10 (Medium, Copilot): NO_ACTION. Moving tracing::debug! into the read_metrics closure would take the read lock on every event even when debug is disabled, which the spec's Risks section ("Eager debug logging") and AC4 forbid and the ADR's "Debug logging stays lazy" rule rules out. As written, the read_metrics(...) call is inside the macro's arguments, so neither the lock nor the format! runs unless debug is enabled; the debug-enabled run logged the 9 stats: Metrics lines and the info run logged none (manual-verification-evidence.md, V1). Resolution: this response and the reply on the thread.

@josecelano
josecelano requested a review from da2ce7 October 16, 2026 10:23
da2ce7
da2ce7 previously approved these changes Oct 16, 2026

@da2ce7 da2ce7 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed at 6497b8f7e8eb71818398d982050a5457d611da3c. Recomputed from the bytes at this head, against the merge base fe5d8264a; git merge-tree against it exits 0 with no conflict, and against develop at 702cff6cc it also exits 0 with no conflict. The seventeen develop commits since the base share no file with this PR.

The review bot's finding. In handler.rs:23-26, the read_metrics(...) call and its format! are an argument of tracing::debug!. I rely on tracing 0.1's documented contract (0.1.44 in Cargo.lock; I have no source here): the macro checks the level and callsite interest before it evaluates its arguments. So with debug disabled, neither the lock nor the format! runs. V1's 0 lines at info fits this, though it does not prove it. With debug enabled, format! does allocate and format the whole Metrics under the read lock; the guard drops when the closure returns, before the subscriber writes. The suggested alternative would take the lock on every event at any level. With debug enabled it would also run the subscriber's formatting and write under the lock, against ADR :75-78. The spec's Risks (:575-579), AC4 (:465-466) and ADR :89-94 prescribe the code as written. I agree with no change.

The audit. Row F10 and its entry match the capture. The source is r4292535346 in review 5545105221, and the reply r4293529526 is on that thread, which is resolved. NO_ACTION/SUPERSEDED with a Superseded by F10: ... reply is the form SKILL.md:90-92 and the Completion Rules prescribe for a no-change thread, and the PR #2334 audit names its own ID the same way. The review body does carry the timeout warning, "Review effort: Lite", and no suppressed comments. The 10:20 entry shares the minute of the reply (10:20:31Z) and the summary (10:20:30Z), and precedes the commit (10:24:24Z). Run here, the validator reports 10 rows, 4 log entries and 0 failures. The round summary calls F10 "Medium", while the row says Suggestion (F1). The "Round 4" label skips the reviewer's fourth review (F2).

Nothing else moved. One file changed, +16/-1. The tree ids of packages, src, Cargo.toml, Cargo.lock, the spec folder and the EPIC all equal round 4's, and no link changed. I expect the docs gates to pass: project-words.txt carries "Agentic" and MD013 is off.

Hygiene. The subject is Conventional (docs(pr-reviews)), tagged [#2536], and matches the diff. There is no body. The one co-author footer names the review bot, which commit-changes SKILL.md:38 allows. Author equals committer, and git diff --check exits 0. The open-pull-request id check, run verbatim in wt-head-2545-r5 with UPSTREAM_REMOTE=work, prints nothing over 51 files. project-words.txt is untouched.

The bot. The capture holds no review by the review bot after 08:35:45Z.

Findings. F1 and F2 (Nit), inline. Nothing is blocking.

Checked, no finding. other fits a lock-hold concern. The reply URL as Resolution reference is what SKILL.md:235-236 asks.

Checks

On the loop's compute hub at this head, merge base fe5d8264a (receipt server-gates-krkavec-341; develop is 702cff6cc, and git merge-tree against it is clean): pre-commit profile gate exit 0 (85 s); linter markdown, linter cspell, linter lychee exit 0; frontmatter-validator --all: 19 errors / 4 warnings at this head and 19 / 4 at fe5d8264a re-measured, the same 23 diagnostics by path and category, none in the files this PR touches; the process-pr-review audit validator over docs/pr-reviews/pr-2545-review/PR-REVIEW.md with the live review comments: exit 0, 10 rows, 4 log entries, 0 failures; the tree ids of packages, src, Cargo.toml and Cargo.lock equal those of c8ccb9dfd, the round-4 head whose gate ran the eight package test suites, the nightly doctests, cargo doc -D warnings, clippy, fmt, machete and the five per-crate mutants, so no Rust step was re-run. GitHub checks at this head at posting time: "Publish (Release): completed/skipped; Publish (Development): completed/skipped; Context: completed/success; Package Coverage Regression: completed/success; Package Coverage (torrust-tracker-rest-api-runtime-adapter): completed/success; Package Coverage (torrust-tracker-core): completed/success; Package Coverage (torrust-tracker-swarm-coordination-registry): completed/success; Package Coverage (torrust-tracker): completed/success; Package Coverage (torrust-tracker-udp-core): completed/success; Package Coverage (torrust-tracker-udp-server): completed/success; Package Coverage (torrust-tracker-axum-http-server): completed/success; Package Coverage (torrust-tracker-http-core): completed/success; Docker E2E: completed/skipped; Unit (stable): completed/success; Build on macos-latest (stable): completed/success; Build on macos-latest (nightly): completed/success; Documented Clippy Allows: completed/success; Layer Boundary Bans: completed/success; Unit (nightly): completed/success; Build on ubuntu-latest (stable): completed/success; Build on ubuntu-latest (nightly): completed/success; Build on windows-latest (nightly): completed/success; Generate Coverage Report: completed/success; Build on windows-latest (stable): completed/success; Docs Lint: completed/success; Discover Package Coverage: completed/success; Persistence Benchmark MySQL: completed/success; Persistence Benchmark SQLite3: completed/success; Test (Docker) (release): completed/success; Database Compatibility PostgreSQL (17): completed/success; Database Compatibility MySQL (8.4): completed/success; Database Compatibility PostgreSQL (14): completed/success; Persistence Benchmark PostgreSQL: completed/success; Database Compatibility PostgreSQL (16): completed/success; Database Compatibility MySQL (8.0): completed/success; Database Compatibility PostgreSQL (15): completed/success". At posting, develop is 702cff6cc.

@da2ce7

da2ce7 commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

ACK 6497b8f — the review bot's finding against handler.rs, the spec and the ADR, audit row F10 against the capture, and the unchanged code trees were recomputed against fe5d826 and 702cff6, and only non-blocking findings stand

@josecelano

Copy link
Copy Markdown
Member Author

Round summary for review 5546973741 (da2ce7, APPROVED, 2026-10-16 11:09:54 UTC). Its two inline findings are numbered F11 and F12 in the audit, because its own F1 and F2 collide with earlier ones; the reviewer's IDs are kept in the audit entries.

  • F11 (reviewer's F1, Nit): FIXED. The audit's F10 row now records Minor (inferred), mapped from the reviewer's Medium label, and the F10 entry says why Medium is mapped to Minor. Resolution: docs(pr-reviews): [#2536] map the PR #2545 F10 severity from the reviewer's Medium label.
  • F12 (reviewer's F2, Nit): FIXED. The audit's intro now covers da2ce7's review 5545068167 (APPROVED, no findings, adds no row). The Processing Log is append-only, so its "Round 4" label (Copilot's second review) stays; the new Round 5 entry says that round numbers count processing rounds, not one reviewer's reviews. Resolution: docs(pr-reviews): [#2536] record da2ce7's no-finding approval in the PR #2545 audit.

@da2ce7 da2ce7 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed at a8165585f49e951ec2e55597caed801a0e7a8385. Recomputed from the bytes at this head, against the merge base fe5d8264a; git merge-tree against it exits 0 with no conflict, and against develop at ae4288087 it also exits 0 with no conflict. The forty develop commits since the base share no file with this PR.

The fixes. R5-F1 is RESOLVED: row F10 (:54) reads Minor (inferred), and its Concern (:183) states the mapping from the review body's "Medium severity" mark. This is the same mapping that develop's audit for #2546 records (b7b9bc984). R5-F2 is RESOLVED: the intro (:41) names review 5545068167 (APPROVED at 08:32:40Z on c8ccb9dfd, no findings) and its ACK comment. The "Round 4" label is left as it was, following the template's append-only rule, and the Round 5 entry (:222) explains that rounds count processing rounds.

The audit's account of round 5. Rows F11 and F12 carry my two comments (r4294017462, r4294017474), Nit as bracketed, with my IDs F1 and F2 kept. Their replies (r4294067924, r4294068140) are on those threads, which are resolved. Their Resolution references are the subjects of 0a33968a3 and e634da5c6, and the fifth response 6214298167 exists. The 11:15 entry shares the minute of the summary and replies (11:15:27Z-11:15:30Z) and precedes the commit (11:16:30Z). The replies and the summary already cite the Round 5 entry, which only a8165585f added: a promise kept at this head. The log does not record the dismissal at 11:15:28Z. Run here, the validator reports 12 rows, 5 log entries and 0 failures.

Nothing else moved. One file changed, +32/-3. The tree ids of packages, src, Cargo.toml, Cargo.lock, the spec folder and the EPIC all equal round 5's and c8ccb9dfd's, and no link changed.

Hygiene. The three subjects are Conventional (docs(pr-reviews)), tagged [#2536], and match their diffs. There are no bodies. Each commit has one co-author footer naming the review bot, which commit-changes SKILL.md:38 allows. Author equals committer, and git diff --check exits 0 for each. The open-pull-request id check, run verbatim in wt-head-2545-r6 with UPSTREAM_REMOTE=work, prints nothing over 51 files. project-words.txt is untouched.

The bot. The review bot has posted no review since 08:35:45Z, and all twelve threads are resolved.

Findings. None.

Checked, no finding. F11's metadata and F12's documentation categories fit.

Checks

On the loop's compute hub at this head, merge base fe5d8264a (receipt server-gates-krkavec-348; develop is ae4288087, and git merge-tree against it is clean): pre-commit profile gate exit 0 (85 s); linter markdown, linter cspell, linter lychee exit 0; frontmatter-validator --all: 19 errors / 4 warnings at this head and 19 / 4 at fe5d8264a re-measured, the same 23 diagnostics by path and category, none in the files this PR touches; the process-pr-review audit validator over docs/pr-reviews/pr-2545-review/PR-REVIEW.md with the live review comments: exit 0, 12 rows, 5 log entries, 0 failures; the tree ids of packages, src, Cargo.toml and Cargo.lock equal those of c8ccb9dfd, the round-4 head whose gate ran the eight package test suites, the nightly doctests, cargo doc -D warnings, clippy, fmt, machete and the five per-crate mutants, so no Rust step was re-run. GitHub checks at this head at posting time: "Package Coverage Regression: completed/success; Publish (Development): completed/skipped; Publish (Release): completed/skipped; Context: completed/success; Package Coverage (torrust-tracker-udp-core): completed/success; Package Coverage (torrust-tracker-axum-http-server): completed/success; Package Coverage (torrust-tracker-http-core): completed/success; Package Coverage (torrust-tracker): completed/success; Package Coverage (torrust-tracker-swarm-coordination-registry): completed/success; Package Coverage (torrust-tracker-udp-server): completed/success; Package Coverage (torrust-tracker-core): completed/success; Package Coverage (torrust-tracker-rest-api-runtime-adapter): completed/success; Docker E2E: completed/skipped; Unit (nightly): completed/success; Unit (stable): completed/success; Documented Clippy Allows: completed/success; Layer Boundary Bans: completed/success; Test (Docker) (release): completed/success; Database Compatibility PostgreSQL (17): completed/success; Database Compatibility PostgreSQL (15): completed/success; Database Compatibility PostgreSQL (14): completed/success; Build on windows-latest (nightly): completed/success; Database Compatibility MySQL (8.4): completed/success; Persistence Benchmark MySQL: completed/success; Persistence Benchmark PostgreSQL: completed/success; Discover Package Coverage: completed/success; Database Compatibility PostgreSQL (16): completed/success; Build on macos-latest (stable): completed/success; Docs Lint: completed/success; Build on ubuntu-latest (nightly): completed/success; Build on windows-latest (stable): completed/success; Persistence Benchmark SQLite3: completed/success; Build on macos-latest (nightly): completed/success; Database Compatibility MySQL (8.0): completed/success; Generate Coverage Report: completed/success; Build on ubuntu-latest (stable): completed/success". At posting, develop is ae4288087.

@da2ce7

da2ce7 commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

ACK a816558 — both round-5 fixes, audit rows F11 and F12 against the capture, and the unchanged code trees were recomputed against fe5d826 and ae42880, and no finding stands

@josecelano

Copy link
Copy Markdown
Member Author

ACK a816558 — all review threads are resolved (including Copilot's finding F10, declined with reasons), da2ce7 approved this head (review 5547313520) with his ACK comment and no finding, CI is green, and the PR is mergeable.

@josecelano
josecelano merged commit 04013e7 into torrust:develop Oct 16, 2026
36 checks passed
josecelano added a commit that referenced this pull request Oct 19, 2026
…ssues/closed

117f840 docs(pr-reviews): [#2536] record the second review round of PR #2554 (Jose Celano)
5f3549e docs(issues): [#2536] count both commits without a log entry and restamp the spec (Jose Celano)
03872ea docs(pr-reviews): [#2536] record the PR #2554 review audit (Jose Celano)
80b9d5f docs(issues): [#2536] correct two checkpoint ticks in the archived spec (Jose Celano)
62b2373 chore(issues): archive closed issue #2536 spec to docs/issues/closed (Jose Celano)

Pull request description:

  ## Summary

  Related to #2536. Archives the spec of #2536 (closed on GitHub when PR #2545 merged) from `docs/issues/open/` to `docs/issues/closed/`, and marks it done in the #1669 EPIC. This is a docs-only change; no code or behaviour changes.

  ## Changes

  - Move `docs/issues/open/2536-1669-hide-statistics-repository-read-lock/` to `docs/issues/closed/`, with `status: done`, the new `spec-path`, a current `last-updated-utc`, the remaining workflow checkpoints ticked, and a Progress Log entry that records the archival.
  - Repair the live references to the old path in the evidence file, the ADR's `related-artifacts`, and the #1669 EPIC (checkbox, table row with `DONE`, link list, and a log entry).
  - The immutable PR #2537 review audit keeps its original `related-artifacts` path, as the `cleanup-completed-issues` skill directs for past review records.

  ## Validation

  - The periodic audit in the `cleanup-completed-issues` skill reported only #2536 under "open/ specs whose issue is not open", and nothing under the other three headings.
  - `rg` for the old folder name finds only the #2537 audit's frontmatter and a historical branch-name mention in the EPIC log.
  - `git diff --cached --check` is clean and the pre-commit checks pass.

ACKs for top commit:
  da2ce7:
    ACK 117f840 — both round-2 fixes, the new stamps against their commit, audit rows F3 and F4 against the capture and the skill's renumbering rule, and the unchanged files were recomputed against 04013e7 and e9c01fb, and no finding stands
  josecelano:
    ACK 117f840 — all review threads are resolved, da2ce7 approved this head (review 5570269324) with his ACK comment and no finding, Copilot's review of the archive found 0 findings, CI is green, and the PR is mergeable.

Tree-SHA512: 468b05201744dfb069fa279c08c596db12ffc994683015ce588e589b13a8b5d9632b0873f782c637f79ee30e8c3b0a852d4655e9bbabf917699a7aa3388f8162
josecelano added a commit that referenced this pull request Oct 20, 2026
- #2414, #2415, #2416: `branch:` names each implementation branch, and the
  obsolete note about setting `epic` is removed.
- Sub-EPIC and #2416: the #2471 prerequisite of T9 is satisfied (merged in
  PR #2544 on 2026-10-16).
- Sub-EPIC T10 step and #2416: T10 adds the swarm bus, its producers, and its
  three consumers to docs/architecture/events.md (finding from #2413 T1).
- #2414: the Implementation Plan asks to revalidate the code that PRs #2545
  and #2552 changed after the spec was written.
- #1488: roadmap row 15 is In progress and notes #2413 done.

Co-authored-by: Copilot <[email protected]>
josecelano added a commit that referenced this pull request Oct 20, 2026
…three nits

The re-review of the prep branch passed (REVIEW PASSED) with three nits,
fixed here:

- N1: the #2414 revalidation note also names the statistics repositories and
  metrics that PR #2545 changed, including tracker-core's repository.
- N2: the #2413 retrospective quotes the search that was actually run and the
  two isolation helpers.
- N3: the retrospective drops a claim with no repository evidence.

The re-review is appended to agent-review-reports.md, and the #2413, #2414,
and sub-EPIC progress logs record it.

Co-authored-by: Copilot <[email protected]>
josecelano added a commit that referenced this pull request Oct 20, 2026
… the SI-22 specs before #2414

f24a690 docs(issues): [#2413] record the Task Reviewer re-review and fix its three nits (Jose Celano)
fb9f1ef docs(issues): [#2413] record the post-merge Task Reviewer report and the implementation retrospective (Jose Celano)
cbebd8d docs(shutdown): [#2413] attribute the publish-nothing facts to D Versus F, not entry 27 (Jose Celano)
dc537ee docs(issues): [#2410] refresh stale SI-22 spec text before #2414 (Jose Celano)

Pull request description:

  Prep work for SI-22 (sub-EPIC #2410, under EPIC #1488) before #2414 starts. It has two parts, each in its own signed commits. Documentation only: no code, tests, or workflows change.

  ## A. Close the two skipped delivery gates of #2413 (after merge)

  The sub-EPIC's Shared Delivery Gates required an independent Task Reviewer report and an implementation retrospective before PR #2553 was pushed. Both were skipped, so they are done here, after merge, and recorded as such.

  - `docs/issues/closed/2413-2410-si-22-1-document-event-flows-and-draft-adr/agent-review-reports.md`: the Task Reviewer report of 2026-10-19 17:12 UTC. Verdict `POST_MERGE_FINDINGS`: AC1 to AC3 and `linter all` pass on the merged tree, with four should-fix findings and two nits. The entry records the maintainer's decision on each finding. The file also holds the re-review of this branch (19:08 UTC, `REVIEW PASSED`, three nits, all fixed in the last commit).
  - `implementation-retrospective.md` in the same folder (the maintainer chose a retrospective over a log-only statement). It covers what the PR review retrospective `docs/pr-reviews/pr-2553-review/review-retrospective.md` does not: the pre-push hook's `GIT_DIR` leak into fixture tests, the entry 27 recheck error, a T1 finding that stayed in progress logs, and the skipped gates (including the missing Arrange-Act-Assert review of the two `clippy-allow-reasons` tests).
  - Finding F1 is fixed: the "Recheck of record entry 27" table in `docs/features/shutdown-process/task-inventory.md` credited entry 27 with two facts it does not state and reported a difference that did not exist. Those facts now sit in a table attributed to the sub-EPIC's "D Versus F" section, both marked Confirmed. Dated corrections are in the #2413 and sub-EPIC logs.
  - The #2413 spec's two gate checkpoints are ticked. A late log entry covers review rounds 9 and 10 of PR #2553, which were only in the audit.

  ## B. Refresh stale SI-22 spec text

  - #2414, #2415, #2416: `branch:` names each implementation branch (`2414-drain-listener-queues-on-shutdown`, `2415-per-component-cancellation-tokens`, `2416-stop-producers-before-listeners`), and the obsolete "`epic` is set ..." note is removed.
  - The #2471 prerequisite of T9 is now marked satisfied (merged in PR #2544 on 2026-10-16): sub-EPIC Subissues row 4, Chosen Design, the T9 row, Prerequisites, Dependencies, and #2416 Scope.
  - T10 (sub-EPIC step, #2416 Scope, and its T10 row) adds the swarm bus, its producers, and its three consumers to `docs/architecture/events.md`, which omits them (finding from #2413 T1).
  - #2414's Implementation Plan asks for a revalidation of the code that PRs #2545 and #2552 changed after the spec was written. The file lists come from `git diff --stat` of each merge commit against its first parent.
  - #1488: roadmap row 15 is `In progress` and notes #2413 done. This, plus its `last-updated-utc` (approved by the maintainer), is the only #1488 change.

  Each touched spec has a progress-log entry naming the model (GitHub Copilot, Claude Opus 5.5), and its `last-updated-utc` equals its newest entry.

  ## Validation

  - `linter all` exited 0 before each commit; the pre-commit hook passed for all four commits, which are GPG signed.
  - The `open-pull-request` check for PR-branch commit ids in changed files printed nothing.
  - `linter lychee` skips `docs/issues/closed/`, so the relative links in the two new files were checked by hand: all resolve.
  - Independent Task Reviewer re-review of the whole branch: `REVIEW PASSED` (recorded in `agent-review-reports.md`).

  Related to #2410, #2413, #2414, #2415, #2416, #1488

ACKs for top commit:
  josecelano:
    ACK f24a690

Tree-SHA512: 14a4ce5e3c8852615921745c3d7330b2cb4ec7a5cb4e5fc04112c4893c3f5e6f55272afd86a3dfec3d7dea69ca23cbd8432443df64d4b7a7a620db051dd82bf0
josecelano added a commit that referenced this pull request Oct 20, 2026
T1 of the #1349 specification. packages/http-core changed after the spec
baseline (#2536 through #2545), so the package is re-measured: unit-only
lines 1,746 / 1,962 (88.99%) from 32 unit tests. The evidence lists the 13
source files, the uncovered-line groups (including the early-return regions
that line coverage hides), and the test-technique assessment. The
specification goes in-progress and the EPIC baseline rows are updated.

Co-authored-by: Copilot <[email protected]>
josecelano added a commit that referenced this pull request Oct 20, 2026
…ry and the first test plan

f2ad929 docs(pr-reviews): [#2558] record the sixth review round in the audit (Jose Celano)
8a521b6 docs(issues): [#1349] link the PR 2558 review audit from the specification (Jose Celano)
4eabe37 docs(issues): [#1349] list the post-approval amendments of the announce plan (Jose Celano)
7b4fd60 docs(pr-reviews): [#2558] record the fifth review round in the audit (Jose Celano)
d855aa4 docs(pr-reviews): [#2558] correct F6's source finding ID and the claims about it (Jose Celano)
c44471d docs(pr-reviews): [#2558] record the fourth review round in the audit (Jose Celano)
a32b11c docs(pr-reviews): [#2558] record N/A as F5's reviewer finding ID (Jose Celano)
602c699 docs(pr-reviews): [#2558] record the third review round in the audit (Jose Celano)
9369d20 docs(issues): [#1349] run mutation M5 with the lint cap in the announce plan (Jose Celano)
87a67e8 docs(pr-reviews): [#2558] record the second review round in the audit (Jose Celano)
6ca22a0 docs(issues): [#1349] say that ClientConnectionContext::port is called by client_port (Jose Celano)
809f8df docs(issues): [#1349] name the mutations that prove the announce tests (Jose Celano)
91cce8b docs(issues): [#1349] add the instance public URL case to the announce plan (Jose Celano)
6c2c9ae docs(pr-reviews): [#2558] record the review audit for the #1349 S1 PR (Jose Celano)
11d051e docs(issues): [#1349] add the external-IP setup to the precedence test in the announce plan (Jose Celano)
223c961 docs(issues): [#1349] record the S1 pull request #2558 in the specification (Jose Celano)
1f8a578 docs(issues): [#1349] record the re-measurement review reports (Jose Celano)
79c6ce2 docs(issues): [#1349] point the coverage evidence at the re-measured reports (Jose Celano)
437f79b docs(issues): [#1349] re-measure the http core baseline after #2244 (Jose Celano)
046079d docs(issues): [#1349] record the S1 Task Reviewer reports and the review round (Jose Celano)
d76b143 docs(issues): [#1349] record the misleading tcp6 event test name in the announce plan (Jose Celano)
a48e168 docs(issues): [#1349] mark the announce ledger row in progress (Jose Celano)
eb066a0 docs(issues): [#1349] correct the listener, scrape and doc-test evidence (Jose Celano)
076f43b docs(issues): [#1349] record the approval of the announce plan and slices (Jose Celano)
b95b36c docs(issues): [#1349] add http core plan guidance and the announce test plan (Jose Celano)
85bc235 docs(issues): [#1349] record http core coverage baseline and inventory (Jose Celano)

Pull request description:

  ## Summary

  Slice S1 of #1349 (tests for the `torrust-tracker-http-core` package, EPIC #1347): the coverage baseline, the module inventory, the shared plan guidance, and the first file test plan. It changes documentation only; no Rust, test or manifest file changes. The implementation follows in the slices S2-S6 of [the specification](https://github.com/torrust/torrust-tracker/blob/develop/docs/issues/open/1349-1347-add-tests-http-core/ISSUE.md), each starting after the previous one merges.

  Related to #1349
  Parent EPIC: #1347

  ## What this slice adds

  - **T1, `coverage-evidence.md`.** The package was measured again, because `packages/http-core` changed on `develop` after the spec baseline (#2536 through #2545, and #2244 through #2552, both on statistics files): lines 1,737 / 1,953 (88.94%), regions 2,335 / 2,583 (90.40%), functions 160 / 190 (84.21%), from the same 32 unit tests, with unit-only equal to aggregate (no integration target). It records the 13 source files with per-file numbers and test counts, the uncovered-line groups with a hypothesis each, and the regions that line coverage hides: the early-return paths of every `?` in `handle_announce` and `handle_scrape`, which are the order-of-checks decisions. It flags dead-code candidates for the file plans to confirm (the `ConnectionContext` getters, `ClientConnectionContext::port` and `Metrics::set_gauge`), and an unprotected listener decision (no test dispatches a `TcpAnnounce` event).
  - **T2, plan guidance and first plan.** `test-refactor-plans/README.md` holds the shared guardrails and the two udp-core testing lessons that apply here (re-check "untestable" error paths against `tracker-core`'s exported store mocks; prove an ordering decision with an expectation-free double). `services-announce-tests.md` plans R1 (refactor the 8 existing tests) and R2a-R2j (private mode, listed mode, the order of the checks, loopback substitution for a non-loopback client, the request-to-announcement mapping, `numwant`, absent sender, failure reasons, and a failing downloads store), plus a peer-IP property that is kept only if a hand-made mutation survives the examples.
  - **T3, approval.** The maintainer approved the announce plan, the ledger order, the slices S1-S6, and adding `rstest` as a dev-dependency in S2 (recorded in the plan and the spec).
  - **Records.** The specification goes to `in-progress` (ledger row 1 `IN_PROGRESS`), the EPIC #1347 row and both coverage tables carry the baseline, and the independent Task Reviewer's reports are in `agent-review-reports.md`.

  ## Files

  - `docs/issues/open/1349-1347-add-tests-http-core/coverage-evidence.md` (new)
  - `docs/issues/open/1349-1347-add-tests-http-core/test-refactor-plans/README.md` (new)
  - `docs/issues/open/1349-1347-add-tests-http-core/test-refactor-plans/services-announce-tests.md` (new)
  - `docs/issues/open/1349-1347-add-tests-http-core/agent-review-reports.md` (new)
  - `docs/issues/open/1349-1347-add-tests-http-core/ISSUE.md`
  - `docs/issues/open/1347-overhaul-packages-testing/EPIC.md`

  ## Validation

  - Coverage: `cargo-llvm-cov 0.6.16` on stable Rust 1.99.0, clean aggregate and `--lib` runs at `develop` `a3810b813`; the commands are in the evidence file.
  - Independent Task Reviewer: three rounds, recorded in `agent-review-reports.md`. The first review failed with accuracy findings that were fixed; the re-measurement after the rebase failed on three stale-anchor findings that were fixed; the final confirmation passed.
  - Pre-commit (`./contrib/dev-tools/git/hooks/pre-commit.sh --format=json`) passed for every commit, including `linter all`.
  - Pre-push (`./contrib/dev-tools/git/hooks/pre-push.sh`: nightly Rust format, check and docs, then the stable Rust 1.99.0 test suite) passed on the final head.
  - `linter markdown`, `linter cspell` and `linter lychee`, and the commit-id citation check from the `open-pull-request` skill (no branch commit ids cited), pass.

ACKs for top commit:
  josecelano:
    ACK f2ad929

Tree-SHA512: 731d602c31342d8d2fdd413bf8b0b158412a3ffcfa9b28bffca5f4a8988fd2e2229ebf69fbb21f31d56f50132019f597ad29ccd30f57b8f8b7f4f2957ee5f949

This branch was previously deployed

1 inactive deployment
coverage — a8165585 Deployed Oct 16, 2026 by josecelano via Generate Coverage Report #2576
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.

Hide the statistics repositories' read lock and metric collection field

3 participants