From 690cfb5f5d2dbd061fdfe47a9353be608544966a Mon Sep 17 00:00:00 2001 From: josecelano-bot Date: Tue, 17 Nov 2026 10:59:42 +0000 Subject: [PATCH 01/22] docs(issues): [#2902] specify the tracker-core package tests Add the sub-issue specification and the baseline coverage evidence for torrust-tracker-core (EPIC #1347), and register the sub-issue in the EPIC. Co-Authored-By: Claude Sonnet 5.5 --- .../1347-overhaul-packages-testing/EPIC.md | 11 +- .../2902-1347-add-tests-tracker-core/ISSUE.md | 475 ++++++++++++++++++ .../coverage-evidence.md | 180 +++++++ 3 files changed, 663 insertions(+), 3 deletions(-) create mode 100644 docs/issues/open/2902-1347-add-tests-tracker-core/ISSUE.md create mode 100644 docs/issues/open/2902-1347-add-tests-tracker-core/coverage-evidence.md diff --git a/docs/issues/open/1347-overhaul-packages-testing/EPIC.md b/docs/issues/open/1347-overhaul-packages-testing/EPIC.md index ca96dab7c0..aa5764aced 100644 --- a/docs/issues/open/1347-overhaul-packages-testing/EPIC.md +++ b/docs/issues/open/1347-overhaul-packages-testing/EPIC.md @@ -6,7 +6,7 @@ epic: null github-issue: 1347 spec-path: docs/issues/open/1347-overhaul-packages-testing/EPIC.md epic-owner: josecelano -last-updated-utc: "2026-11-17 07:45" +last-updated-utc: "2026-11-17 10:57" semantic-links: skill-links: - create-issue @@ -99,7 +99,8 @@ Status values: `TODO`, `IN_PROGRESS`, `BLOCKED`, `DONE`. | 11 | #2824 - Add tests to the primitives package | `docs/issues/closed/2824-1347-add-tests-primitives/ISSUE.md` | DONE | S0 (the spec, #2828), S1 (the `PeerRole` JSON casing fix, #2834), S2 (the `peer.rs` tests, #2841), S3 (the configuration defaults and bounded values, #2852) and S4 (`swarm_metadata.rs`, the no-change files, the mutation run, the manual checks, #2864) are merged; the issue is closed. Unit-only lines 60.56% → 94.07%. Findings F1 (fixed through #2811), F2 (fixed in S1), F3 (#2804), F4 (#2823), F6 (#2838, #2850) and F5 (#2876, drafted through #2865) have owners. | | 12 | #2838 - UDP tracker accepts announces with a negative left, uploaded or downloaded | `docs/issues/closed/2838-1347-udp-reject-negative-announce-bytes/ISSUE.md` | DONE | Bug found by the #2824 primitives tests work. Fixed by the standalone issue #2850 (`docs/issues/closed/2850-non-negative-number-of-bytes/ISSUE.md`): its implementation PR #2872 merged on 2026-11-16 and closed this issue. The patch of PR #2839 was not merged; its tests were taken over by PR #2872. | | 13 | #2876 - Move `peer::Id::new` to a realistic test helper and decide whether `peer::fixture` goes behind a `testing` feature | `docs/issues/closed/2876-1347-peer-id-test-helper/ISSUE.md` | DONE | Finding F5 of #2824. Spec through #2878, implementation through #2888: `Id::new` removed, `qbittorrent_peer_id` helper, `peer::fixture` behind the new `testing` feature of `primitives`, test-support ADR amended. Breaking for the published `primitives` 3.0.0; adds to the 4.0.0 it owes (#2583). | -| 14 | Additional package-testing subissues | Create a folder-style spec when a concrete package need is identified | TODO | Permitted but not required upfront; retain scope in this EPIC. | +| 14 | #2902 - Add tests to the tracker-core package | `docs/issues/open/2902-1347-add-tests-tracker-core/ISSUE.md` | TODO | Largest remaining coverage gap among the core crates: unit-only lines 80.31% (MySQL/PostgreSQL drivers 0-4%, SQLite failure branches, `statistics/` reached only by the integration binary). Slices S0-S5 proposed; S0 is the spec-only PR. | +| 15 | Additional package-testing subissues | Create a folder-style spec when a concrete package need is identified | TODO | Permitted but not required upfront; retain scope in this EPIC. | ## Package Coverage Tracking @@ -124,6 +125,7 @@ level or determine whether unit coverage is adequate. | `torrust-tracker-http-core` | [#1349](../../closed/1349-1347-add-tests-http-core/ISSUE.md) | Lines: 88.88%; regions: 90.41%; functions: 84.29% | Lines: 99.28%; regions: 99.25%; functions: 99.74% | Lines: +10.40 pp; regions: +8.84 pp; functions: +15.45 pp | [Coverage evidence](../../closed/1349-1347-add-tests-http-core/coverage-evidence.md) | | `torrust-tracker-axum-rest-api-server` | [#2637](../../closed/2637-1347-add-tests-axum-rest-api-server/ISSUE.md) | Lines: 87.98%; regions: 84.10%; functions: 83.42% | Lines: 97.67%; regions: 97.13%; functions: 95.48% | Lines: +9.69 pp; regions: +13.03 pp; functions: +12.06 pp | [Coverage evidence](../../closed/2637-1347-add-tests-axum-rest-api-server/coverage-evidence.md) | | `torrust-tracker-primitives` | [#2824](../../closed/2824-1347-add-tests-primitives/ISSUE.md) | Lines: 60.56%; regions: 67.94%; functions: 57.23% | Lines: 94.07%; regions: 95.30%; functions: 94.17% | Lines: +33.51 pp; regions: +27.36 pp; functions: +36.94 pp | [Coverage evidence](../../closed/2824-1347-add-tests-primitives/coverage-evidence.md) | +| `torrust-tracker-core` | [#2902](../2902-1347-add-tests-tracker-core/ISSUE.md) | Lines: 82.15%; regions: 81.23%; functions: 73.38% | Not yet measured | Not yet measured | [Coverage evidence](../2902-1347-add-tests-tracker-core/coverage-evidence.md) | ### Unit-Only Coverage @@ -139,6 +141,7 @@ weak unit-only result with aggregate, integration, example, or end-to-end covera | `torrust-tracker-http-core` | [#1349](../../closed/1349-1347-add-tests-http-core/ISSUE.md) | Lines: 88.88%; regions: 90.41%; functions: 84.29% | Lines: 99.28%; regions: 99.25%; functions: 99.74% | Lines: +10.40 pp; regions: +8.84 pp; functions: +15.45 pp | [Coverage evidence](../../closed/1349-1347-add-tests-http-core/coverage-evidence.md) | | `torrust-tracker-axum-rest-api-server` | [#2637](../../closed/2637-1347-add-tests-axum-rest-api-server/ISSUE.md) | Lines: 63.87%; regions: 63.98%; functions: 51.34% | Lines: 96.67%; regions: 96.38%; functions: 93.97% | Lines: +32.80 pp; regions: +32.40 pp; functions: +42.63 pp | [Coverage evidence](../../closed/2637-1347-add-tests-axum-rest-api-server/coverage-evidence.md) | | `torrust-tracker-primitives` | [#2824](../../closed/2824-1347-add-tests-primitives/ISSUE.md) | Lines: 60.56%; regions: 67.94%; functions: 57.23% | Lines: 94.07%; regions: 95.30%; functions: 94.17% | Lines: +33.51 pp; regions: +27.36 pp; functions: +36.94 pp | [Coverage evidence](../../closed/2824-1347-add-tests-primitives/coverage-evidence.md) | +| `torrust-tracker-core` | [#2902](../2902-1347-add-tests-tracker-core/ISSUE.md) | Lines: 80.31%; regions: 80.20%; functions: 72.01% | Not yet measured | Not yet measured | [Coverage evidence](../2902-1347-add-tests-tracker-core/coverage-evidence.md) | ## Delivery Strategy @@ -356,6 +359,8 @@ For each subissue implementation, the completion policy is: - 2026-11-16 14:07 UTC - Claude Code (Opus 5.5) - #2838 closed by PR #2872 (merged 2026-11-16 14:05 UTC); row 12 set to `DONE` and the specifications of #2838 and #2850 archived to `docs/issues/closed/`. - 2026-11-16 21:52 UTC - Claude Code (Opus 5.5) - #2876 closed by PR #2888 (merged 2026-11-16 21:49 UTC); row 13 set to `DONE` and the spec archived to `docs/issues/closed/2876-1347-peer-id-test-helper/`. +- 2026-11-17 10:57 UTC - Claude Code (Sonnet 5.5) - Created #2902 (`tracker-core`, row 14; the link under #1347 is set by the maintainer). Clean baseline at `5833cdae9`, filtered to the package source: unit-only (`--all-features --lib`) lines 80.31% (4,099 / 5,104), regions 80.20%, functions 72.01%, 157 unit tests; aggregate lines 82.15%; integration-only 44.05% (12 tests). The MySQL and PostgreSQL driver suites skip themselves without Docker and two environment variables, so those 10 files count as 0-4% covered; the container-gated scope is not yet measured. Delivered in slices S0-S5; the row stays `TODO` until the first implementation slice starts. + ## Acceptance Criteria - [ ] All required package-testing subissues are created and linked. @@ -393,7 +398,7 @@ For each subissue implementation, the completion policy is: ## References - GitHub EPIC: https://github.com/torrust/torrust-tracker/issues/1347 -- Related issues: #1348, #1349, #2136, #2149, #2637, #2824 +- Related issues: #1348, #1349, #2136, #2149, #2637, #2824, #2902 - 2026-11-09 12:10 UTC - Claude Code - #2637 S6 merged through #2772 (2026-11-09 12:08 UTC) and issue #2637 closed: the `axum-rest-api-server` package is DONE. Final figures (unchanged): unit-only lines 96.67%, aggregate 97.67%. The spec was archived to `docs/issues/closed/` and the subissue row is `DONE`. - Package inventory: `docs/packages.md` - Reference package: `packages/tracker-core/` diff --git a/docs/issues/open/2902-1347-add-tests-tracker-core/ISSUE.md b/docs/issues/open/2902-1347-add-tests-tracker-core/ISSUE.md new file mode 100644 index 0000000000..10aeaf4ebd --- /dev/null +++ b/docs/issues/open/2902-1347-add-tests-tracker-core/ISSUE.md @@ -0,0 +1,475 @@ +--- +schema-version: 1 +doc-type: issue +issue-type: task +status: planned +priority: p2 +epic: 1347 +github-issue: 2902 +spec-path: docs/issues/open/2902-1347-add-tests-tracker-core/ISSUE.md +branch: "2902-1347-add-tests-tracker-core-spec" +related-pr: null +last-updated-utc: "2026-11-17 10:57" +semantic-links: + skill-links: + - create-issue + - write-unit-test + related-artifacts: + - .claude/skills/create-issue/SKILL.md + - .claude/skills/write-unit-test/SKILL.md + - docs/issues/open/1347-overhaul-packages-testing/EPIC.md + - docs/issues/open/1347-overhaul-packages-testing/subissue-spec-guidelines.md + - docs/issues/closed/2824-1347-add-tests-primitives/ISSUE.md + - docs/issues/closed/2637-1347-add-tests-axum-rest-api-server/ISSUE.md + - docs/issues/closed/1349-1347-add-tests-http-core/ISSUE.md + - docs/issues/closed/1348-1347-add-tests-udp-core/ISSUE.md + - docs/issues/open/2902-1347-add-tests-tracker-core/coverage-evidence.md + - packages/tracker-core +--- + + + +# Issue #2902 - Add Tests to the Tracker-Core Package + +Parent EPIC: #1347 - Overhaul: Packages Testing + +## Goal + +Increase the maintainable, package-local test coverage of `torrust-tracker-core` by going over +every Rust source file in `packages/tracker-core/src/`. For each file: review the existing tests +against the `write-unit-test` skill, analyse coverage, add unit tests for the package-owned +behavior (the persistence failure paths, the statistics counters and listeners, and the failing +collaborator cases), and record the resulting per-file coverage. Behavior that needs a real +database server is assessed and owned explicitly, not left implicit. + +Deliver the work as a short sequence of small pull requests, each merged before the next slice +starts. + +## Background + +`torrust-tracker-core` is the domain core of the tracker: the announce and scrape handlers, peer +authentication keys, the whitelist, torrent and swarm statistics, the in-memory and persisted +repositories, the database drivers (SQLite, MySQL, PostgreSQL) and the container that wires them. +It is 11,369 source lines in 62 files (51 with executable lines), with 157 unit tests, 12 integration tests +(`tests/integration.rs`) and a container-gated database suite. EPIC #1347 names it "the reference +for effective package-level test coverage" (see its Scope), and most of it is: 26 of the 51 files with +executable lines are at or above 98% unit-only coverage. The remaining gap is concentrated: + +- The MySQL and PostgreSQL drivers (10 files, 728 measured lines) are 0-4% covered because their + suite skips itself unless Docker and two environment variables are present. +- The SQLite stores and `databases/{error,setup}.rs` have their failure branches untested. +- `statistics/` (repository, metrics, persisted load, event listeners, handlers) is reached only by + the integration binary. +- Many `?` regions (a failing `Database` or whitelist) are untested in the handlers and repositories. + +The Phase 3 assessment of EPIC #1347 ranked it as the largest remaining gap among the published +core crates. Since the integration binary reaches only the `statistics/` files that no unit test +reaches, the aggregate and unit-only numbers differ in exactly that area. + +## Baseline Coverage + +Measured 2026-11-17 at `develop` commit `5833cdae9` with `cargo-llvm-cov 0.6.16` and stable Rust +1.99.1 from a clean workspace; totals include only `packages/tracker-core/src/` (in-file test +modules and `src/test_helpers.rs` included). + +| Scope | Tests | Lines | Regions | Functions | +| --- | ---: | ---: | ---: | ---: | +| Unit-only (`--all-features --lib`) | 157 unit | 4,099 / 5,104 (80.31%) | 5,716 / 7,127 (80.20%) | 687 / 954 (72.01%) | +| Integration-only (`--all-features --test integration`) | 12 integration | 841 / 1,909 (44.05%) | 936 / 2,506 (37.35%) | 145 / 484 (29.96%) | +| Aggregate (`--all-features`) | 157 unit + 12 integration | 4,230 / 5,149 (82.15%) | 5,834 / 7,182 (81.23%) | 703 / 958 (73.38%) | +| Unit-only without `db-compatibility-tests` (`--lib`) | 157 unit | 4,085 / 4,780 (85.46%) | 5,700 / 6,691 (85.19%) | 683 / 916 (74.56%) | + +The container-gated scope (the database suites run against real MySQL and PostgreSQL servers) is +not measured yet: pulling the images needs the maintainer's permission (question Q1, task T1b). +The per-file inventory and the uncovered-line groups are in [coverage-evidence.md](coverage-evidence.md). +Indirect coverage from other packages' tests is not accepted as evidence. + +## Key Package Responsibilities + +| Rank | Responsibility | Source modules | Why it matters | +| ---: | --- | --- | --- | +| 1 | Persistence boundary | `databases/` (traits, `error.rs`, `setup.rs`, SQLite, MySQL, PostgreSQL drivers) | Keys, the whitelist and the download counters survive restarts only through it; a malformed row, a negative timestamp or a broken connection must surface as a typed error, never as silent loss. | +| 2 | Statistics and startup load | `statistics/` (repository, metrics, persisted load, listeners, handlers) | Counters and gauges feed the `/stats` and metrics endpoints; `load_persisted_metrics` restores the downloads total at startup; listeners must drain on shutdown. | +| 3 | Authentication, whitelist, torrent state | `authentication/`, `whitelist/`, `torrent/` | Decide who may announce; every one of their repositories depends on a `Database` that can fail. Already well covered; the failure cases are the gap. | +| 4 | Announce and scrape | `announce_handler.rs`, `scrape_handler.rs` | The hot path of the tracker. 99-100% covered; confirm no decision is left to the integration binary. | +| 5 | Wiring | `container.rs`, `lib.rs`, `error.rs`, `test_helpers.rs`, `peer_tests.rs` | Composition and error conversions. | + +## Coverage Objectives + +EPIC #1347 sets qualitative, risk-based objectives, not a numeric target. + +1. **Highest** - the SQLite persistence boundary: every store's parse and query failure branch, the + `MalformedDatabaseRecord` mapping, `Sqlite::new` path handling, and the `sqlx` error to + `databases::error::Error` mapping (including the migration error). +2. **High** - the statistics counters, gauges and the persisted-load path, and the listener + wrappers (spawn, event handled, cancel); each must be protected by a unit test, not only the + integration binary. +3. **Medium** - failing-`Database` propagation in the authentication, whitelist and announce paths + (the `?` regions), the container's `Persistence` error mapping and the `TrackerCoreError` + conversions. +4. **Assessed, owner recorded** - the MySQL and PostgreSQL drivers: unit tests only for what needs + no server (error mapping against an unreachable endpoint, if non-flaky); the happy path stays + with the `db-compatibility` workflow and its owner is recorded (questions Q1-Q3). +5. **Low** - logging-only handlers, test support and assertion-only lines. + +The objective is met when every package-owned highest and high decision is protected by a unit +test, and every other uncovered group has a recorded owner-based reason, not when a percentage is +reached. + +## Test-Technique Assessment + +See the table in [coverage-evidence.md](coverage-evidence.md#test-technique-assessment-initial). +Unit tests are the primary level; the 12 existing integration tests stay as they are. Property-based +testing is assessed per seam: the candidates are the authentication `Key` round trip and the +expiry/`parse_valid_until` bounds (the package has no property-test dependency; `quickcheck` was +added to `primitives` and `udp-core` by their issues, following `add-rust-dependency`). A property +is added only if it protects a state that examples miss. + +## Scope + +### In Scope + +- The complete per-file inventory and baseline ([coverage-evidence.md](coverage-evidence.md)). +- Process every file through the per-file workflow below. Each file gets one concise decision record + (about 40 lines) in `test-refactor-plans/`; no-change files may share one record. +- Add focused, deterministic unit tests for package-owned decisions, using temp SQLite files, the + `testing` feature's `TorrentMetricsStore` mock and small failing fakes of the persistence traits. + Review existing tests against `write-unit-test` and refactor those that have smells only when a + record says so. +- Measure the container-gated scope once the maintainer permits it (T1b) and record the result. +- Dev-dependencies a record justifies (`quickcheck`), following `add-rust-dependency` and + `cargo machete --with-metadata`. +- Documentation-comment corrections in the files under test. +- Hand off production findings through the [findings procedure](#findings-during-implementation). +- A bounded mutation sample after the last test increment. +- Issue-local `lessons.md` for reusable lessons; promoting them elsewhere is a separate small PR. + +### Out of Scope + +- Production behavior changes in `packages/tracker-core/src/`, unless the maintainer decides a + small defect is fixed here (it then goes to its own `fix` commit in the first test slice that + needs it). +- Tests of other packages that use `tracker-core`; shared test-support reorganization; #2301 and + #2361. +- Changing the container-gated MySQL/PostgreSQL suites or their CI workflow (assessed only; see Q2). +- Refactoring the three copies of `parse_valid_until` and the row mapping into one helper + (finding F2). +- Coverage-percentage targets and tests added only to move line totals. +- Cross-cutting process, skill or pattern-catalog edits. + +## Architectural Decisions + +- Related ADRs: `docs/adrs/20260429000000_keep_database_as_aggregate_supertrait.md` (the `Database` + trait shape the failing fakes implement), + `docs/adrs/20261021190318_share_workspace_test_support_through_testing_features.md` (the + `testing` feature and the `TorrentMetricsStore` mock), + `docs/adrs/20260826124959_use_explicit_identifiers_for_test_log_assertions.md` (any log + assertion), `docs/adrs/20260603000000_keep_unit_tests_inside_container_build.md` (unit tests run + in the container build, so they must not need Docker) and + `docs/adrs/20260926142648_adopt_self_hosted_hetzner_runner_for_container_tests.md` (where the + container-gated suites run). +- No package-local ADRs. None to create; if a design question (Q2) needs a decision record, it goes + to its own issue under `create-adr`. + +## Design and Ownership Review + +Questions each file's record must answer; the first four are already in the +[Findings Register](#findings-register): + +- The database suites pass without running (F1): never claim their coverage from a green run. +- Three copies of the same row-to-key mapping (F2): a test of one copy does not protect the others. +- `Key` derives `Deserialize` without validation (F3): do not pin the accepted inputs of the derive. +- The persisted whitelist `add` and `remove` check then write (F4): do not pin the race. +- The swarm registry and the `events` package own the registry state and the drain behavior: this + package tests its own wiring and statistics, not theirs. + +## Bug-Fix Process + +The issue as a whole is coverage and test-design work, not a known defect. A defect found is handed +off through the findings procedure and fixed in its own issue under the `fix-bug` skill, unless the +maintainer decides a small one is fixed here; then the first slice that needs it follows the +`fix-bug` workflow and records the reproduction, the red and green regression-test results and the +final recheck in `manual-verification-evidence.md`. + +## Regression Test Strategy + +For each increment choose the smallest deterministic test that protects the package-owned behavior +and record it in the decision record. Never pin behavior that a handed-off finding reports as +wrong without a recorded maintainer decision: leave it uncovered with the finding as owner until +the fix merges. + +## Findings During Implementation + +A finding that needs a production change is handled this way (same procedure as #1348, #1349, #2637 +and #2824): + +1. Stop the current increment at a clean point. +2. Write a draft bug spec under `docs/issues/drafts//ISSUE.md` on its own branch cut + from `develop` (never on a slice branch), with the `Bug-Fix Process` and `Regression Test + Strategy` sections, and a git-ignored `.tmp/-/HANDOFF.md`. +3. Stop and tell the maintainer; he decides whether this work pauses. +4. Record a progress-log entry and a `lessons.md` row naming the draft or issue. +5. Resume after a pause: rebase, re-measure the affected rows, re-check their records. + +Non-bug findings (dead code, misleading docs) need only a `lessons.md` row. + +### Findings Register + +Found while writing this specification (code reading and the coverage runs, 2026-11-17). None is +fixed in this issue; each is a proposal for the maintainer. + +| ID | Finding | Evidence | Proposed owner | Status | +| --- | --- | --- | --- | --- | +| F1 | `run_mysql_driver_tests` and `run_postgres_driver_tests` return `Ok(())` immediately when `TORRUST_TRACKER_CORE_RUN_*_DRIVER_TEST` is unset, so `cargo test --all-features` reports them as passed without running anything, and the coverage runs count both drivers as 0-4% covered. A reader of a green run cannot tell. | `databases/driver/mysql/mod.rs:204-207`, `postgres/mod.rs:185-188`; the coverage log shows both tests `ok` in 0.00 s | A separate test-design issue: make the skip visible (`#[ignore = "..."]`, or a loud skip message) and keep the `db-compatibility` workflow as it is. Not part of this issue (Q2). | OPEN (proposed) | +| F2 | The row-to-`PeerKey` mapping and `parse_valid_until` (negative timestamp to `MalformedDatabaseRecord`) are copied in the SQLite, MySQL and PostgreSQL `auth_key_store.rs`; the `u32` conversion of the aggregate metric is copied likewise. A test of the SQLite copy protects none of the others, and Docker-less tests cannot reach the MySQL and PostgreSQL copies. | `parse_valid_until` is identical in the three files (lines 119-128) | A refactor issue extracting one helper (Q4); until then each driver's copy is assessed in its own record. | OPEN (proposed) | +| F3 | `authentication::key::Key` derives `Deserialize` over its inner `String`, so deserializing a key skips the 32-character, ASCII-alphanumeric validation of `Key::new`. To confirm in the `peer_key.rs` record: where (if anywhere) a `Key` is deserialized from untrusted input (REST path and JSON are the candidates). | `authentication/key/peer_key.rs:127` | Confirm first; if reachable, a bug issue under `fix-bug`. | TO CONFIRM | +| F4 | `PersistedWhitelist::add` and `remove` read `is_info_hash_whitelisted` and then write, without a transaction; two concurrent adds of the same hash can reach the driver's duplicate-insert error that `it_should_fail_trying_to_add_the_same_infohash_twice` shows is an error. Probably benign (the in-memory whitelist is the read path), but the behavior is unspecified. | `whitelist/repository/persisted.rs:29-54` | Confirm with a throwaway test in the whitelist record; at most a documentation or small fix issue. | TO CONFIRM | + +## Implementation Plan + +Status values: `TODO`, `IN_PROGRESS`, `BLOCKED`, `DONE`, `DEFERRED`. + +| ID | Status | Task | Notes / Expected Output | +| --- | ------ | ---- | ----------------------- | +| T1 | DONE | Coverage evidence and complete module inventory | [coverage-evidence.md](coverage-evidence.md): baseline in four scopes, per-file uncovered groups, property candidacy, initial hypothesis for the 62 files. Delivered with this spec (S0). | +| T1b | TODO | Measure the container-gated scope | The `--all-features` run with `TORRUST_TRACKER_CORE_RUN_MYSQL_DRIVER_TEST` and `TORRUST_TRACKER_CORE_RUN_POSTGRES_DRIVER_TEST` set, which pulls the `mysql` and `postgres` images. Needs the maintainer's permission (Q1). Recorded in `coverage-evidence.md`; decides the scope of S3. | +| T2 | TODO | Shared plan guidance | `test-refactor-plans/README.md`: two-phase sequence, guardrails, toolchain-pinned commands. First test slice (S1). | +| T3 | TODO | Process every ledger row through the per-file workflow | Each row ends in exactly one of: test added, no-change with reason, deferred with owner. | +| T4 | TODO | Bounded mutation assessment | `mutation-evidence.md`: configuration, survivors, reason for each unviable mutant. Last slice. | +| T5 | TODO | Reconcile evidence and progress state | Ledger, records, slice table, acceptance rows and both EPIC coverage tables agree; grep for `status: proposed` and stray `TODO` labels in finished records. | +| T6 | TODO | Final verification, acceptance review, retrospective | Automatic checks, manual verification, acceptance review, `implementation-retrospective.md` (or a log entry saying none was needed). | + +After the last test-producing increment, stop for maintainer review before T4-T6 and the final PR. + +## Pull-Request Slices + +Each slice is one PR, merged before the next slice branch is cut from `develop`. The slicing below +is the proposal for the maintainer's approval (questions Q5, Q6): + +| Slice | Content | Ledger rows | Branch | PR | Status | +| --- | --- | --- | --- | --- | --- | +| S0 | This specification, the T1 evidence, and the EPIC registration with the baseline | - | `2902-1347-add-tests-tracker-core-spec` | TBD | IN_PROGRESS | +| S1 | T2, then `statistics/`: `repository.rs`, `metrics.rs`, `persisted/mod.rs`, `persisted/downloads.rs`, `event/listener.rs`, `event/handler.rs`, `mod.rs` (the only area reached just by the integration binary) | 1-7 | `2902-1347-add-tests-tracker-core-statistics` | TBD | TODO | +| S2 | The SQLite persistence boundary: `sqlite/{auth_key_store,torrent_metrics_store,whitelist_store,mod,schema_migrator}.rs`, `databases/{error,setup}.rs`, `error.rs`, plus the `databases/traits` and `driver/mod.rs` no-change decisions | 8-17 | `2902-1347-add-tests-tracker-core-sqlite` | TBD | TODO | +| S3 | MySQL and PostgreSQL drivers: assess after T1b; Docker-free error-path tests if non-flaky, otherwise no-change rows with the `db-compatibility` workflow as owner | 18-27 | `2902-1347-add-tests-tracker-core-server-drivers` | TBD | TODO | +| S4 | Authentication and whitelist: failing-`Database` propagation, `Key` property decision (F3, F4 checks) | 28-39 | `2902-1347-add-tests-tracker-core-auth-whitelist` | TBD | TODO | +| S5 | `torrent/`, `announce_handler.rs`, `scrape_handler.rs`, `container.rs`, `lib.rs`, `test_helpers.rs`, `peer_tests.rs`, then T4-T6; updates the EPIC tables; the spec moves to `docs/issues/closed/` in a separate `cleanup-completed-issues` PR after the issue closes | 40-45 | `2902-1347-add-tests-tracker-core-final` | TBD | TODO | + +Rules: S0 to S4 use `Related to #2902`; only S5 uses `Closes #2902`. Do not stack branches; keep +at most one implementation PR open. Titles follow the repository convention, for example +`test(tracker-core): [#2902] cover the statistics counters and gauges`. Each PR updates the +ledger, the slice table, the slice measurement in `coverage-evidence.md` and the EPIC "Latest" +values. The tracker-wide manual scenarios (M1-M3) and the mutation run happen once, in S5. +Re-measure the baseline at the start of every slice, in all four scopes. + +## Commit Points + +| Task | Change set | Policy | +| --- | --- | --- | +| Spec (S0) | This specification, evidence, EPIC registration | One signed `docs(issues)` commit after approval, plus follow-ups recording the PR number and review fixes. | +| T3 | One source file: its decision record, tests and recorded coverage | One signed commit per completed file after the completed-file review. Never mix two source files. | +| Slice close | Measurement, EPIC update, records | One documentation commit per slice. | +| Review round | `docs/pr-reviews/pr--review/PR-REVIEW.md` and fixes | Audit commit separate from fix commits, as `process-pr-review` requires. | + +Conventional Commit messages, for example `test(tracker-core): cover the statistics counters`; all +commits GPG signed. Cite commits in issue-local evidence by their unique subject, never by SHA, +until merged. If work stops mid-task, record `interruption-note.md` (next action, validation state, +uncommitted-work location) and remove it on resume. + +## Per-File Workflow + +T3 applies to every row, one file at a time, in the ledger order within a slice. + +Each file has one decision record `test-refactor-plans/.md` of about 40 lines: current state +(unit-only coverage, existing tests, hypothesis); review of existing tests (`clean` or `refactor` +with smells); uncovered lines grouped by behavior, each classified **unit**, **collaborator-owned**, +**finding**, **container-gated** or **unselected** (with the answer to "hard to test, owned +elsewhere, or merely unselected?"); the property-test decision; the Prose-First AAA review of +every added or changed test; and results (before/after, mutation proofs). No-change rows share one +record. + +Two maintainer gates per file: approve the decision record before changing tests, then review the +completed result. Intra-file steps proceed without stopping unless the record flags a risk. +Validation per file: focused `cargo test -p torrust-tracker-core`, +`cargo +nightly fmt --all -- --check`, `git diff --check`, and the pre-commit gate; then re-run +unit-only coverage and record before and after. + +## Source File Ledger + +States: `PENDING`, `IN_PROGRESS`, `BLOCKED`, `DONE`. Unit-only lines are the baseline measurement +(`--all-features --lib`). The rows cover every one of the 62 `.rs` files under `packages/tracker-core/src/`, each once +(declaration-only files are grouped with their neighbors, so there are fewer rows than files); +rows are ordered by slice, then by risk. + +| Order | Source module | Slice | Unit-only lines | Initial hypothesis | State | +| ---: | --- | --- | ---: | --- | --- | +| 1 | `statistics/repository.rs` | S1 | 86 / 140 | Test candidate (four counter/gauge methods and error arms) | PENDING | +| 2 | `statistics/metrics.rs` | S1 | 11 / 45 | Test candidate | PENDING | +| 3 | `statistics/persisted/mod.rs` | S1 | 0 / 11 | Test candidate (`load_persisted_metrics`) | PENDING | +| 4 | `statistics/event/listener.rs` | S1 | 357 / 406 | Test candidate (spawn wrappers) | PENDING | +| 5 | `statistics/event/handler.rs` | S1 | 179 / 203 | Mostly logging-only; one error arm | PENDING | +| 6 | `statistics/persisted/downloads.rs` | S1 | 77 / 77 | No change (one assertion line) | PENDING | +| 7 | `statistics/mod.rs`, `statistics/event/mod.rs` | S1 | 40 / 40, no entries | No change | PENDING | +| 8 | `databases/driver/sqlite/auth_key_store.rs` | S2 | 29 / 50 | Test candidate | PENDING | +| 9 | `databases/driver/sqlite/torrent_metrics_store.rs` | S2 | 29 / 45 | Test candidate | PENDING | +| 10 | `databases/driver/sqlite/whitelist_store.rs` | S2 | 17 / 28 | Test candidate | PENDING | +| 11 | `databases/driver/sqlite/mod.rs` | S2 | 85 / 92 | Test candidate | PENDING | +| 12 | `databases/driver/sqlite/schema_migrator.rs` | S2 | 145 / 155 | No change likely; challenge each `?` | PENDING | +| 13 | `databases/error.rs` | S2 | 28 / 35 | Test candidate | PENDING | +| 14 | `databases/setup.rs` | S2 | 34 / 44 | Test candidate (SQLite arm and unreachable endpoint); server arms to S3 | PENDING | +| 15 | `error.rs` | S2 | 38 / 50 | Test candidate (`From` conversions) | PENDING | +| 16 | `databases/driver/mod.rs` | S2 | 185 / 188 | No change (test-only retry helper) | PENDING | +| 17 | `databases/mod.rs`, `databases/traits/*` (6 files) | S2 | 2 / 2, no entries | No change (declarations and the mock) | PENDING | +| 18-22 | `databases/driver/mysql/{mod,auth_key_store,schema_migrator,torrent_metrics_store,whitelist_store}.rs` | S3 | 7 / 212, 0 / 50, 0 / 75, 0 / 45, 0 / 28 | Container-gated; assess after T1b | PENDING | +| 23-27 | `databases/driver/postgres/{mod,auth_key_store,schema_migrator,torrent_metrics_store,whitelist_store}.rs` | S3 | 7 / 189, 0 / 50, 0 / 6, 0 / 45, 0 / 28 | Container-gated; assess after T1b | PENDING | +| 28 | `authentication/handler.rs` | S4 | 371 / 371 | Failing-`Database` cases (9 `?`/assertion regions) | PENDING | +| 29 | `authentication/key/peer_key.rs` | S4 | 100 / 101 | Property candidate (`Key`); finding F3 check | PENDING | +| 30 | `authentication/key/mod.rs` | S4 | 77 / 77 | Property candidate (expiry bounds) | PENDING | +| 31 | `authentication/key/repository/persisted.rs` | S4 | 73 / 74 | Failing-`Database` cases | PENDING | +| 32 | `authentication/key/repository/in_memory.rs` | S4 | 92 / 92 | No change | PENDING | +| 33 | `authentication/service.rs` | S4 | 144 / 144 | No change; review breadth | PENDING | +| 34 | `authentication/mod.rs`, `authentication/key/repository/mod.rs` | S4 | 123 / 123, no entries | No change | PENDING | +| 35 | `whitelist/repository/persisted.rs` | S4 | 74 / 74 | Failing-`Database` cases; finding F4 check | PENDING | +| 36 | `whitelist/manager.rs` | S4 | 99 / 99 | Failing-`Database` cases | PENDING | +| 37 | `whitelist/authorization.rs` | S4 | 74 / 74 | One `?` region | PENDING | +| 38 | `whitelist/repository/in_memory.rs` | S4 | 51 / 51 | No change | PENDING | +| 39 | `whitelist/{mod,setup,test_helpers}.rs`, `whitelist/repository/mod.rs` | S4 | 18 / 18, 7 / 7, 12 / 12, no entries | No change | PENDING | +| 40 | `torrent/repository/in_memory.rs` | S5 | 56 / 60 | Delegation of `get_torrent_peers` (owned by the registry) | PENDING | +| 41 | `torrent/manager.rs`, `torrent/services.rs`, `torrent/persisted_downloads.rs`, `torrent/mod.rs`, `torrent/repository/mod.rs` | S5 | 153 / 153, 267 / 267, 22 / 22, no entries | No change; review breadth | PENDING | +| 42 | `announce_handler.rs` | S5 | 400 / 401 | Challenge the three `?`/assertion lines | PENDING | +| 43 | `scrape_handler.rs` | S5 | 190 / 190 | No change (one assertion line) | PENDING | +| 44 | `container.rs` | S5 | 143 / 144 | Test candidate (`Persistence` error mapping) | PENDING | +| 45 | `lib.rs`, `peer_tests.rs`, `test_helpers.rs` | S5 | 58 / 58, 30 / 30, 109 / 123 | No change; test support classified | PENDING | + +The first slice's record checks the grouping against `find packages/tracker-core/src -name '*.rs'`. + +## Progress Tracking + +### Workflow Checkpoints + +- [x] Read EPIC #1347, the subissue guidelines, the `create-issue` workflow and the closed specs of + #1348, #1349, #2637 and #2824. +- [x] Clean baseline coverage measured in four scopes and the complete module inventory recorded (T1). +- [ ] Specification and slicing reviewed and approved by the maintainer. +- [x] GitHub issue #2902 created. Linking it as a subissue of #1347 needs the maintainer (the bot account gets 404 from the sub-issues API). +- [ ] Spec-only PR (S0) merged before implementation. +- [ ] Container-gated scope measured (T1b) once the maintainer permits it. +- [ ] Every ledger row `DONE` with a decision record, merged through its slice. +- [ ] Maintainer review after the final test-producing increment. +- [ ] Automatic verification with toolchain-qualified evidence. +- [ ] Manual verification in `manual-verification-evidence.md`. +- [ ] Bounded mutation assessment in `mutation-evidence.md`. +- [ ] Independent reviewer reports in `agent-review-reports.md` (if used). +- [ ] Acceptance criteria and implementation retrospective. +- [ ] Issue closed (by the S5 PR); spec moved to `docs/issues/closed/` (separate PR after the close). + +### Progress Log + +- 2026-11-17 10:57 UTC - Claude Code (Sonnet 5.5) - Created issue #2902; measured the baseline at `5833cdae9` in four scopes; drafted this specification and the coverage evidence; registered the subissue in EPIC #1347 (row 14). Open questions Q1-Q6 are for the maintainer. + +## Open Design Questions + +Each has a recommendation; the maintainer decides. + +| ID | Question | Recommendation | +| --- | --- | --- | +| Q1 | May the agent pull the `mysql` and `postgres` Docker images (hundreds of MB) to measure the container-gated scope (T1b)? | Yes, once, on the maintainer's go; or the maintainer runs the command in `coverage-evidence.md` himself. | +| Q2 | The two database suites skip themselves silently (F1). Is the visible-skip fix in scope here? | No: separate issue; this one only records the scope separately. | +| Q3 | Scope of S3 for the MySQL and PostgreSQL drivers? | Docker-free unit tests only for what needs no server (an unreachable endpoint gives `ConnectionError`), if they are not flaky or slow; the happy path stays with the `db-compatibility` workflow, recorded as owner. | +| Q4 | Extract the duplicated `parse_valid_until` and row mapping (F2)? | Separate refactor issue after this one; tests per driver meanwhile. | +| Q5 | Is `quickcheck` acceptable for `Key` and the expiry bounds, as in #2824 and #1348? | Decide in the `peer_key.rs` and `key/mod.rs` records; add only if examples leave a surviving mutant. | +| Q6 | Is the six-slice plan (S0-S5) right, or should S4 and S5 merge? | Keep six: S4 and S5 are mostly failing-fake cases and no-change decisions; merging them mixes a risky area with the closing tasks. | + +Which EPIC row is the "unit-only" baseline? Recommendation: `--all-features --lib` (80.31%), the same +command as the other packages, with the container-gated figure reported separately in +`coverage-evidence.md` and not in the EPIC tables. + +## Acceptance Criteria + +- [ ] AC1: Complete per-file inventory with unit-only coverage, property candidacy and hypothesis. +- [ ] AC2: Every row ends in test-added, no-change-with-reason, or deferred-with-owner, with its + decision record and recorded coverage. +- [ ] AC3: Clean, reproducible coverage evidence in all measured scopes with toolchain-qualified + results. +- [ ] AC4: Every highest and high objective is protected by a unit test or has a recorded owner. +- [ ] AC5: No-change and deferral decisions enumerate their uncovered lines with per-group reasons. +- [ ] AC6: Each added or changed test has a recorded prose-first AAA review. +- [ ] AC7: Bounded mutation assessment completed, with no score target or CI gate. +- [ ] AC8: Reconciliation confirms records, evidence, slice table and both EPIC tables agree. +- [ ] AC9: Every finding needing a production change has an owner, a log entry and a `lessons.md` + row, and no test pins its reported behavior without a recorded maintainer decision. +- [ ] AC10: Merged through the planned slices; only the last PR closes the issue. +- [ ] AC11: `cargo +nightly fmt --all -- --check`, `linter all` and + `cargo test -p torrust-tracker-core` pass. +- [ ] AC12: Manual verification executed and recorded. + +## Verification Plan + +### Automatic Checks + +- `cargo llvm-cov clean --workspace`, then the four commands of + [coverage-evidence.md](coverage-evidence.md) (stable Rust), each writing to git-ignored `.tmp/` +- `cargo test -p torrust-tracker-core` (stable Rust) +- `cargo +nightly fmt --all -- --check` (nightly rustfmt; the bare stable command is not valid evidence) +- `cargo machete --with-metadata` +- `linter all` +- `TORRUST_GIT_HOOKS_LOG_DIR=.tmp ./contrib/dev-tools/git/hooks/pre-commit.sh --format=json` +- Pre-push checks before each slice PR. + +Every evidence row names the toolchain that produced it. + +### Manual Verification + +Human-oriented interaction with the built tracker, run once in S5 with an isolated configuration +(automated tests never satisfy it): + +| ID | Scenario | Steps | Expected | Status | Evidence | +| --- | --- | --- | --- | --- | --- | +| M1 | Persisted downloads survive a restart | Start the tracker with SQLite persistence and the persistent completed statistic enabled; announce `completed` for a torrent; stop and start the tracker; scrape the torrent and read the stats endpoint. | The scrape `downloaded` count and the stats endpoint show the persisted value. | TODO | `manual-verification-evidence.md` (S5) | +| M2 | Private-mode keys | Start in private mode; create a key through the REST API; announce with the key and without it. | The announce with the key succeeds; without it, it is rejected with the authentication error. | TODO | `manual-verification-evidence.md` (S5) | +| M3 | Whitelist | Start in listed mode; announce an unlisted torrent; add it through the REST API; announce again. | The first announce is rejected as not whitelisted; the second succeeds. | TODO | `manual-verification-evidence.md` (S5) | + +### Acceptance Verification + +Reviewed against observed behavior after the last slice, before the issue is closed. + +| AC ID | Status | Evidence | +| ----- | ------ | -------- | +| AC1 | TODO | Inventory and T1 hypotheses in `coverage-evidence.md`. | +| AC2 | TODO | Ledger and `test-refactor-plans/`. | +| AC3 | TODO | `coverage-evidence.md`, final measurement. | +| AC4 | TODO | Records of the highest and high rows. | +| AC5 | TODO | No-change records. | +| AC6 | TODO | Prose-First AAA tables in the records. | +| AC7 | TODO | `mutation-evidence.md`. | +| AC8 | TODO | The T5 reconciliation. | +| AC9 | TODO | Findings Register and `lessons.md`. | +| AC10 | TODO | The merged slice PRs. | +| AC11 | TODO | Automatic checks of the last slice. | +| AC12 | TODO | `manual-verification-evidence.md`. | + +## Risks and Trade-offs + +- A green `cargo test --all-features` does not mean the MySQL and PostgreSQL suites ran (F1); + mitigate by recording the container-gated scope separately and never claiming it from a green run. +- Types and `?` regions produce lines that count as uncovered but carry no decision; mitigate by + testing behavior, not line totals. +- A test of a suspected defect would pin wrong behavior; mitigate with the findings procedure. +- Failing `Database` fakes can become large; mitigate by reusing the `testing` feature mock and one + shared fake per slice, justified in its record. +- Tests that need a SQLite file must use temp files unique per test; mitigate with the existing + `ephemeral_sqlite_database` helper. +- `develop` moves under the work; mitigate by re-measuring at every slice start. + +## Implementation Completion Review + +After implementation, compare the result with this specification and create +`implementation-retrospective.md` if there were material discoveries or deviations; otherwise add a +progress-log entry saying none was needed. + +## References + +- Parent EPIC: https://github.com/torrust/torrust-tracker/issues/1347 +- Template sub-issues: #2824, #2637, #1349, #1348 (`docs/issues/closed/`) +- Package: `packages/tracker-core/` +- Phase 3 assessment (coordinator, git-ignored): `.tmp/phase3-assessment.md` diff --git a/docs/issues/open/2902-1347-add-tests-tracker-core/coverage-evidence.md b/docs/issues/open/2902-1347-add-tests-tracker-core/coverage-evidence.md new file mode 100644 index 0000000000..ac731a1f47 --- /dev/null +++ b/docs/issues/open/2902-1347-add-tests-tracker-core/coverage-evidence.md @@ -0,0 +1,180 @@ +--- +doc-type: coverage-evidence +issue: 2902 +package: torrust-tracker-core +measured-commit: 5833cdae9 +measured-utc: 2026-11-17 +--- + +# Coverage Evidence - `torrust-tracker-core` + +Baseline for the sub-issue spec of #2902. Measured on 2026-11-17 at `develop` commit `5833cdae9` +(`Merge torrust/torrust-tracker#2900: chore(issues): [#2873] archive the closed spec and mark it DONE in EPIC #2003`), +with `cargo-llvm-cov 0.6.16` and stable Rust 1.99.1, from a clean workspace and a separate +`CARGO_LLVM_COV_TARGET_DIR`. Every figure is filtered to `packages/tracker-core/src/` (62 files, 51 with executable lines). The +totals include the in-file `#[cfg(test)]` modules (most unit tests live in the files they test), so +they are not production-only coverage; `tests/` is not counted. The package has no benches or examples. + +```console +cargo llvm-cov clean --workspace +cargo llvm-cov -p torrust-tracker-core --all-features --lib --json --output-path .tmp/cov/unit.json +cargo llvm-cov clean --workspace +cargo llvm-cov -p torrust-tracker-core --all-features --test integration --json --output-path .tmp/cov/integration.json +cargo llvm-cov clean --workspace +cargo llvm-cov -p torrust-tracker-core --all-features --json --output-path .tmp/cov/aggregate.json +cargo llvm-cov clean --workspace +cargo llvm-cov -p torrust-tracker-core --lib --json --output-path .tmp/cov/unit-default.json +``` + +| Scope | Tests | Lines | Regions | Functions | +| --- | ---: | ---: | ---: | ---: | +| Unit-only (`--all-features --lib`) | 157 unit | 4,099 / 5,104 (80.31%) | 5,716 / 7,127 (80.20%) | 687 / 954 (72.01%) | +| Integration-only (`--all-features --test integration`) | 12 integration | 841 / 1,909 (44.05%) | 936 / 2,506 (37.35%) | 145 / 484 (29.96%) | +| Aggregate (`--all-features`, all targets) | 157 unit + 12 integration | 4,230 / 5,149 (82.15%) | 5,834 / 7,182 (81.23%) | 703 / 958 (73.38%) | +| Unit-only without the `db-compatibility-tests` feature (`--lib`) | 157 unit | 4,085 / 4,780 (85.46%) | 5,700 / 6,691 (85.19%) | 683 / 916 (74.56%) | + +Reading the scopes: + +- The integration-only figure is low because the 12 tests drive the package through its container + and cover only the announce, scrape, persisted-downloads and shutdown paths. It is not evidence + for any unit seam. +- The MySQL and PostgreSQL driver tests (`run_mysql_driver_tests`, `run_postgres_driver_tests`) are + compiled by `--all-features` but **skip themselves and pass** unless + `TORRUST_TRACKER_CORE_RUN_MYSQL_DRIVER_TEST` / `TORRUST_TRACKER_CORE_RUN_POSTGRES_DRIVER_TEST` is + set, and they then need Docker and the `mysql` / `postgres` images. So the figures above do **not** + include them: the two drivers (728 measured lines in ten files, 0-4% covered) are measured here as + uncovered. A fifth, container-gated scope (the same `--all-features` aggregate run with both + variables set) is **not yet measured**: pulling the images needs the maintainer's permission + (the open question Q1 in the spec). Task T1b records it. +- Aggregate and unit-only lines differ in five files only, all under `statistics/` + (`event/handler.rs` 179 → 198 of 203 lines, `event/listener.rs` 357 → 419 of 421, `metrics.rs` + 11 → 20 of 45, `persisted/mod.rs` 0 → 26 of 32, `repository.rs` 86 → 101 of 149). That is the + one area where the integration binary protects code no unit test reaches; the EPIC rule says it + still needs focused unit tests (slice S1). The aggregate must not be used to claim unit coverage. +- The EPIC tables for the other packages use `--all-features --lib`; the same command is the + unit-only baseline here (80.31%). The scope without the feature (85.46%) is the one that matches + what a contributor's plain `cargo test -p torrust-tracker-core` runs. + +## Per-File Inventory + +Lines only; the integration-only and aggregate columns show where the integration binary adds +anything (a `-` means the file is not reached or has no executable entries). + +| File | Unit-only lines | Integration-only lines | Aggregate lines | +| --- | ---: | ---: | ---: | +| `announce_handler.rs` | 400 / 401 (99.75%) | 80 / 92 (86.96%) | 400 / 401 (99.75%) | +| `authentication/handler.rs` | 371 / 371 (100.00%) | 6 / 90 (6.67%) | 371 / 371 (100.00%) | +| `authentication/key/mod.rs` | 77 / 77 (100.00%) | 0 / 31 (0.00%) | 77 / 77 (100.00%) | +| `authentication/key/peer_key.rs` | 100 / 101 (99.01%) | 0 / 45 (0.00%) | 100 / 101 (99.01%) | +| `authentication/key/repository/in_memory.rs` | 92 / 92 (100.00%) | 0 / 21 (0.00%) | 92 / 92 (100.00%) | +| `authentication/key/repository/persisted.rs` | 73 / 74 (98.65%) | 5 / 20 (25.00%) | 73 / 74 (98.65%) | +| `authentication/mod.rs` | 123 / 123 (100.00%) | - | 123 / 123 (100.00%) | +| `authentication/service.rs` | 144 / 144 (100.00%) | 6 / 30 (20.00%) | 144 / 144 (100.00%) | +| `container.rs` | 143 / 144 (99.31%) | 72 / 73 (98.63%) | 143 / 144 (99.31%) | +| `databases/driver/mod.rs` | 185 / 188 (98.40%) | - | 185 / 188 (98.40%) | +| `databases/driver/mysql/auth_key_store.rs` | 0 / 50 (0.00%) | 0 / 50 (0.00%) | 0 / 50 (0.00%) | +| `databases/driver/mysql/mod.rs` | 7 / 212 (3.30%) | 0 / 38 (0.00%) | 7 / 212 (3.30%) | +| `databases/driver/mysql/schema_migrator.rs` | 0 / 75 (0.00%) | 0 / 75 (0.00%) | 0 / 75 (0.00%) | +| `databases/driver/mysql/torrent_metrics_store.rs` | 0 / 45 (0.00%) | 0 / 45 (0.00%) | 0 / 45 (0.00%) | +| `databases/driver/mysql/whitelist_store.rs` | 0 / 28 (0.00%) | 0 / 28 (0.00%) | 0 / 28 (0.00%) | +| `databases/driver/postgres/auth_key_store.rs` | 0 / 50 (0.00%) | 0 / 50 (0.00%) | 0 / 50 (0.00%) | +| `databases/driver/postgres/mod.rs` | 7 / 189 (3.70%) | 0 / 39 (0.00%) | 7 / 189 (3.70%) | +| `databases/driver/postgres/schema_migrator.rs` | 0 / 6 (0.00%) | 0 / 6 (0.00%) | 0 / 6 (0.00%) | +| `databases/driver/postgres/torrent_metrics_store.rs` | 0 / 45 (0.00%) | 0 / 45 (0.00%) | 0 / 45 (0.00%) | +| `databases/driver/postgres/whitelist_store.rs` | 0 / 28 (0.00%) | 0 / 28 (0.00%) | 0 / 28 (0.00%) | +| `databases/driver/sqlite/auth_key_store.rs` | 29 / 50 (58.00%) | 0 / 50 (0.00%) | 29 / 50 (58.00%) | +| `databases/driver/sqlite/mod.rs` | 85 / 92 (92.39%) | 32 / 37 (86.49%) | 85 / 92 (92.39%) | +| `databases/driver/sqlite/schema_migrator.rs` | 145 / 155 (93.55%) | 22 / 73 (30.14%) | 145 / 155 (93.55%) | +| `databases/driver/sqlite/torrent_metrics_store.rs` | 29 / 45 (64.44%) | 29 / 45 (64.44%) | 29 / 45 (64.44%) | +| `databases/driver/sqlite/whitelist_store.rs` | 17 / 28 (60.71%) | 0 / 28 (0.00%) | 17 / 28 (60.71%) | +| `databases/error.rs` | 28 / 35 (80.00%) | 0 / 23 (0.00%) | 28 / 35 (80.00%) | +| `databases/setup.rs` | 34 / 44 (77.27%) | 18 / 29 (62.07%) | 34 / 44 (77.27%) | +| `databases/traits/whitelist.rs` | 2 / 2 (100.00%) | 0 / 2 (0.00%) | 2 / 2 (100.00%) | +| `error.rs` | 38 / 50 (76.00%) | 0 / 12 (0.00%) | 38 / 50 (76.00%) | +| `lib.rs` | 58 / 58 (100.00%) | - | 58 / 58 (100.00%) | +| `peer_tests.rs` | 30 / 30 (100.00%) | - | 30 / 30 (100.00%) | +| `scrape_handler.rs` | 190 / 190 (100.00%) | 43 / 44 (97.73%) | 190 / 190 (100.00%) | +| `statistics/event/handler.rs` | 179 / 203 (88.18%) | 92 / 99 (92.93%) | 198 / 203 (97.54%) | +| `statistics/event/listener.rs` | 357 / 406 (87.93%) | 156 / 168 (92.86%) | 419 / 421 (99.52%) | +| `statistics/metrics.rs` | 11 / 45 (24.44%) | 20 / 45 (44.44%) | 20 / 45 (44.44%) | +| `statistics/mod.rs` | 40 / 40 (100.00%) | 40 / 40 (100.00%) | 40 / 40 (100.00%) | +| `statistics/persisted/downloads.rs` | 77 / 77 (100.00%) | 39 / 39 (100.00%) | 77 / 77 (100.00%) | +| `statistics/persisted/mod.rs` | 0 / 11 (0.00%) | 26 / 32 (81.25%) | 26 / 32 (81.25%) | +| `statistics/repository.rs` | 86 / 140 (61.43%) | 60 / 115 (52.17%) | 101 / 149 (67.79%) | +| `test_helpers.rs` | 109 / 123 (88.62%) | - | 109 / 123 (88.62%) | +| `torrent/manager.rs` | 153 / 153 (100.00%) | 15 / 48 (31.25%) | 153 / 153 (100.00%) | +| `torrent/persisted_downloads.rs` | 22 / 22 (100.00%) | 22 / 22 (100.00%) | 22 / 22 (100.00%) | +| `torrent/repository/in_memory.rs` | 56 / 60 (93.33%) | 30 / 60 (50.00%) | 56 / 60 (93.33%) | +| `torrent/services.rs` | 267 / 267 (100.00%) | 0 / 1 (0.00%) | 267 / 267 (100.00%) | +| `whitelist/authorization.rs` | 74 / 74 (100.00%) | 12 / 16 (75.00%) | 74 / 74 (100.00%) | +| `whitelist/manager.rs` | 99 / 99 (100.00%) | 6 / 26 (23.08%) | 99 / 99 (100.00%) | +| `whitelist/mod.rs` | 18 / 18 (100.00%) | - | 18 / 18 (100.00%) | +| `whitelist/repository/in_memory.rs` | 51 / 51 (100.00%) | 0 / 17 (0.00%) | 51 / 51 (100.00%) | +| `whitelist/repository/persisted.rs` | 74 / 74 (100.00%) | 3 / 25 (12.00%) | 74 / 74 (100.00%) | +| `whitelist/setup.rs` | 7 / 7 (100.00%) | 7 / 7 (100.00%) | 7 / 7 (100.00%) | +| `whitelist/test_helpers.rs` | 12 / 12 (100.00%) | - | 12 / 12 (100.00%) | + +## Uncovered Line Groups (unit-only, `--all-features --lib`) + +Line numbers are those of `5833cdae9`. Classes: **3A** unit-testable now; **3B** needs a boundary +above a unit test (a container, a real database); **owned** by a collaborator or another issue; +**unreachable / no decision** (logging-only code, `?` propagation regions, test-support). A +"hypothesis" is not a decision: each group is re-challenged per file in the decision records +(hard to test, owned elsewhere, or merely unselected?). + +| File | Uncovered lines | What they are | Class | Hypothesis | +| --- | --- | --- | --- | --- | +| `databases/driver/mysql/*` (5 files), `postgres/*` (5 files) | 0-4% of 728 measured lines | The whole MySQL and PostgreSQL drivers: schema migrator, three stores, `mod.rs` pool code | 3B (container-gated) | The suite exists (`run_tests`) and runs in the `db-compatibility` workflow; measure it (T1b) before choosing. Candidates for 3A: error mapping with an unreachable endpoint (no container) | +| `databases/driver/sqlite/auth_key_store.rs` | 18-100, 124-126 | Row-parse failure branches (`MalformedDatabaseRecord` for a bad key or a negative `valid_until`), `sqlx` failures, `parse_valid_until` negative case | 3A | Test through a temp SQLite file with a malformed row inserted by raw `sqlx`; the same helper is copied in three drivers (finding F2) | +| `databases/driver/sqlite/torrent_metrics_store.rs` | 15-124 (16 of 45 lines uncovered) | Aggregate metric load/save error branches, `u32` conversion failure (`MalformedDatabaseRecord`) | 3A | Same technique | +| `databases/driver/sqlite/whitelist_store.rs` | 18-75 (11 of 28) | Row-parse and query failure branches | 3A | Same technique | +| `databases/driver/sqlite/mod.rs` | 54-62, 79, 103, 119 | `Sqlite::new` path handling and the aggregate-metric helpers' error branches | 3A | Constructor with an invalid path; closed pool | +| `databases/driver/sqlite/schema_migrator.rs` | 38, 56, 90, 103, 122-123, 136, 139, 152, 275 | `?` error regions of the legacy bootstrap and `drop_database_tables`; line 275 is a test assertion line | mostly no decision | Legacy partial-state and migrated paths are already tested; challenge each `?` region | +| `databases/driver/mod.rs` | 67-68, 70 | Retry loop of the test-only `create_database_tables` helper | test support | No-change | +| `databases/error.rs` | 140-147, 160, 173 | `From<(MigrateError, Driver)>`, one `ConnectionError` arm group, `Display` pieces | 3A | Small table over the `sqlx::Error` variants and the migration error | +| `databases/setup.rs` | 114-128 | `initialize_database_from_configuration` for MySQL and PostgreSQL | 3B / 3A | Unreachable-endpoint error test is 3A; the success path is container-gated | +| `error.rs` | 47-49, 53-55, 59-61, 65-67 | The four `From` conversions into `TrackerCoreError` | 3A | Trivial but package-owned wiring; one table test | +| `statistics/repository.rs` | 104, 114-120, 139-146, 148-154, 157-158, 164-206 | `set_counter`, `set_gauge`, `increment_gauge`, `decrement_gauge` and their error-logging arms | 3A | Covered only by the integration binary today; direct unit tests (success and metric-type-mismatch error) | +| `statistics/metrics.rs` | 36-44, 49-57, 62-69, 74-81 | `Metrics::set_counter`, `set_gauge`, `increment_gauge`, `decrement_gauge` | 3A | Same | +| `statistics/persisted/mod.rs` | 21-25, 59-61, 65-67 | `load_persisted_metrics` (startup load into the in-memory counters) | 3A | Unit test with the `testing` feature's `TorrentMetricsStore` mock (ADR on test support) or a temp SQLite store | +| `statistics/persisted/downloads.rs` | 133 | One test-assertion line | no decision | No-change | +| `statistics/event/listener.rs` | 19-83, 283-284 | The two spawning wrappers (`run_*_event_listener`) and the `*_unspawned` entry points | 3A | Spawn, send an event, cancel, await the handle; drain behavior is owned by the `events` package | +| `statistics/event/handler.rs` | 19-58, 129 | Logging-only handlers (`handle_torrent_added`, `_removed`, `handle_peer_*`) and one error arm | no decision / 3A | The logging-only arms carry no state change; decide whether a log-assertion test (ADR on log identifiers) is worth it; line 129 is a metric-increment error arm | +| `statistics/mod.rs` | 49 | One region | no decision | Check | +| `container.rs` | 86, 193 | `Persistence` error mapping when the database cannot initialize; a multi-line assertion | 3A | Container built over an invalid SQLite path | +| `authentication/handler.rs` | 252, 280, 424, 479, 493, 531, 604, 656, 690 | `?` regions: database failures of `remove_peer_key`, `load_peer_keys_from_database`; multi-line assertion lines | 3A / no decision | Fake the `Database` failing; many of the 9 are assertion lines | +| `authentication/key/repository/persisted.rs` | 57, 71, 96 | `?` regions of `add`, `remove`, `load_keys` | 3A | Same fake | +| `authentication/key/{mod,peer_key}.rs` | 304 / 64 | One assertion line; one region | no decision | Check | +| `announce_handler.rs` | 184, 189, 634 | `?` regions of `handle_announcement` (whitelist failure, downloads load failure); an assertion line | 3A | Whitelist and database failure cases may exist elsewhere; challenge | +| `scrape_handler.rs` | 350 | One assertion line | no decision | No-change | +| `torrent/manager.rs` | 66 | One region | no decision | Check | +| `torrent/repository/in_memory.rs` | 177-179 | `get_torrent_peers` delegating to the swarm registry | owned (swarm-coordination-registry) | A thin delegation test is cheap; decide per file | +| `whitelist/authorization.rs`, `whitelist/manager.rs`, `whitelist/repository/persisted.rs` | 139 / 53, 66, 79 / 30, 36, 46, 52 | `?` regions: database failures of `add` / `remove` / `load` | 3A | Same failing-`Database` fake | +| `test_helpers.rs` | 144-156, 209 | Test-support builder branch for persistent completed statistics | test support | Not package-owned behavior; no test by decision, unless a slice uses it | + +Counts are by line class, not by decision: a "region" group can disappear when its neighbors are +tested. The grouping above is the T1 hypothesis the decision records revisit. + +## Test-Technique Assessment (initial) + +| Technique | Applicability | Initial decision | +| --- | --- | --- | +| Unit tests | The package is almost all in-process logic over traits | Primary level for every slice | +| Package-local integration (`tests/integration.rs`) | 12 tests over the container already exist | Keep; add only if a unit cannot reach the boundary (for example persistence plus listeners) | +| Container-gated database suite (MySQL, PostgreSQL) | Exists, skipped silently without the environment variables | Measure (T1b); change nothing without the maintainer's decision (Q1, Q2) | +| Runnable examples | None; `lib.rs` has doc examples | Out of scope | +| Property-based (`quickcheck`) | Candidates flagged below; the package has no property-test dependency | Per-seam decision in the records, with an `add-rust-dependency` justification | +| Mutation testing | Applicable after the last test increment | Bounded sample (T4) | +| Fuzzing | Not applicable (no parser of untrusted bytes in this package) | Not applicable | + +Property-test candidates (the guidelines' two triggers): + +- `authentication::key::Key` (`peer_key.rs`): `Key::new` / `value` and the random-key generator have a + round-trip and length invariant (a generated key always parses; a parsed key always prints back to + the same text; only 32 alphanumeric characters are accepted). +- `parse_valid_until` and the expiry arithmetic (`generate_expiring_key`, `verify_key_expiration`, + `PeerKey::expiry_time`): bounds (negative stored timestamps, `u64` seconds beyond `i64`, lifetime + overflow); the example-based tests cover the named boundaries, a property would cover the range. +- Persisted downloads (`u32` counters through `i64` columns): round-trip and saturation bounds. + +Everything else (policy branches over two or three cases, delegation) stays example-based. From 2b0c3fe36b09917cc4e0850a476f934e34e46ddf Mon Sep 17 00:00:00 2001 From: josecelano-bot Date: Tue, 17 Nov 2026 12:16:48 +0000 Subject: [PATCH 02/22] docs(issues): [#2902] record the container-gated coverage measurement The maintainer allowed the Docker image pull; with the MySQL and PostgreSQL driver suites running the aggregate is 93.80% of lines. Co-Authored-By: Claude Sonnet 5.5 --- .../1347-overhaul-packages-testing/EPIC.md | 4 ++-- .../2902-1347-add-tests-tracker-core/ISSUE.md | 18 +++++++++++------- .../coverage-evidence.md | 13 ++++++++----- 3 files changed, 21 insertions(+), 14 deletions(-) diff --git a/docs/issues/open/1347-overhaul-packages-testing/EPIC.md b/docs/issues/open/1347-overhaul-packages-testing/EPIC.md index aa5764aced..4fc6ced997 100644 --- a/docs/issues/open/1347-overhaul-packages-testing/EPIC.md +++ b/docs/issues/open/1347-overhaul-packages-testing/EPIC.md @@ -6,7 +6,7 @@ epic: null github-issue: 1347 spec-path: docs/issues/open/1347-overhaul-packages-testing/EPIC.md epic-owner: josecelano -last-updated-utc: "2026-11-17 10:57" +last-updated-utc: "2026-11-17 12:16" semantic-links: skill-links: - create-issue @@ -359,7 +359,7 @@ For each subissue implementation, the completion policy is: - 2026-11-16 14:07 UTC - Claude Code (Opus 5.5) - #2838 closed by PR #2872 (merged 2026-11-16 14:05 UTC); row 12 set to `DONE` and the specifications of #2838 and #2850 archived to `docs/issues/closed/`. - 2026-11-16 21:52 UTC - Claude Code (Opus 5.5) - #2876 closed by PR #2888 (merged 2026-11-16 21:49 UTC); row 13 set to `DONE` and the spec archived to `docs/issues/closed/2876-1347-peer-id-test-helper/`. -- 2026-11-17 10:57 UTC - Claude Code (Sonnet 5.5) - Created #2902 (`tracker-core`, row 14; the link under #1347 is set by the maintainer). Clean baseline at `5833cdae9`, filtered to the package source: unit-only (`--all-features --lib`) lines 80.31% (4,099 / 5,104), regions 80.20%, functions 72.01%, 157 unit tests; aggregate lines 82.15%; integration-only 44.05% (12 tests). The MySQL and PostgreSQL driver suites skip themselves without Docker and two environment variables, so those 10 files count as 0-4% covered; the container-gated scope is not yet measured. Delivered in slices S0-S5; the row stays `TODO` until the first implementation slice starts. +- 2026-11-17 10:57 UTC - Claude Code (Sonnet 5.5) - Created #2902 (`tracker-core`, row 14; the link under #1347 is set by the maintainer). Clean baseline at `5833cdae9`, filtered to the package source: unit-only (`--all-features --lib`) lines 80.31% (4,099 / 5,104), regions 80.20%, functions 72.01%, 157 unit tests; aggregate lines 82.15%; integration-only 44.05% (12 tests). The MySQL and PostgreSQL driver suites skip themselves without Docker and two environment variables, so those 10 files count as 0-4% covered; with the suites running (Docker) the aggregate is lines 93.80% (T1b). Delivered in slices S0-S5; the row stays `TODO` until the first implementation slice starts. ## Acceptance Criteria diff --git a/docs/issues/open/2902-1347-add-tests-tracker-core/ISSUE.md b/docs/issues/open/2902-1347-add-tests-tracker-core/ISSUE.md index 10aeaf4ebd..dd5770c23b 100644 --- a/docs/issues/open/2902-1347-add-tests-tracker-core/ISSUE.md +++ b/docs/issues/open/2902-1347-add-tests-tracker-core/ISSUE.md @@ -9,7 +9,7 @@ github-issue: 2902 spec-path: docs/issues/open/2902-1347-add-tests-tracker-core/ISSUE.md branch: "2902-1347-add-tests-tracker-core-spec" related-pr: null -last-updated-utc: "2026-11-17 10:57" +last-updated-utc: "2026-11-17 12:16" semantic-links: skill-links: - create-issue @@ -79,8 +79,11 @@ modules and `src/test_helpers.rs` included). | Aggregate (`--all-features`) | 157 unit + 12 integration | 4,230 / 5,149 (82.15%) | 5,834 / 7,182 (81.23%) | 703 / 958 (73.38%) | | Unit-only without `db-compatibility-tests` (`--lib`) | 157 unit | 4,085 / 4,780 (85.46%) | 5,700 / 6,691 (85.19%) | 683 / 916 (74.56%) | -The container-gated scope (the database suites run against real MySQL and PostgreSQL servers) is -not measured yet: pulling the images needs the maintainer's permission (question Q1, task T1b). +With the MySQL and PostgreSQL suites actually running (Docker `mysql:8.0` and `postgres:16`, both +`TORRUST_TRACKER_CORE_RUN_*_DRIVER_TEST=true`, measured 2026-11-17 with the maintainer's permission) +the aggregate is lines 4,830 / 5,149 (93.80%), regions 93.61%, functions 84.45%: the server drivers +reach 58-96% per file, and what stays uncovered there are the failure branches (F2). The default +runs above do not include them (F1). The per-file inventory and the uncovered-line groups are in [coverage-evidence.md](coverage-evidence.md). Indirect coverage from other packages' tests is not accepted as evidence. @@ -136,7 +139,7 @@ is added only if it protects a state that examples miss. `testing` feature's `TorrentMetricsStore` mock and small failing fakes of the persistence traits. Review existing tests against `write-unit-test` and refactor those that have smells only when a record says so. -- Measure the container-gated scope once the maintainer permits it (T1b) and record the result. +- Record the container-gated measurement (T1b, done). - Dev-dependencies a record justifies (`quickcheck`), following `add-rust-dependency` and `cargo machete --with-metadata`. - Documentation-comment corrections in the files under test. @@ -232,7 +235,7 @@ Status values: `TODO`, `IN_PROGRESS`, `BLOCKED`, `DONE`, `DEFERRED`. | ID | Status | Task | Notes / Expected Output | | --- | ------ | ---- | ----------------------- | | T1 | DONE | Coverage evidence and complete module inventory | [coverage-evidence.md](coverage-evidence.md): baseline in four scopes, per-file uncovered groups, property candidacy, initial hypothesis for the 62 files. Delivered with this spec (S0). | -| T1b | TODO | Measure the container-gated scope | The `--all-features` run with `TORRUST_TRACKER_CORE_RUN_MYSQL_DRIVER_TEST` and `TORRUST_TRACKER_CORE_RUN_POSTGRES_DRIVER_TEST` set, which pulls the `mysql` and `postgres` images. Needs the maintainer's permission (Q1). Recorded in `coverage-evidence.md`; decides the scope of S3. | +| T1b | DONE | Measure the container-gated scope | The `--all-features` run with `TORRUST_TRACKER_CORE_RUN_MYSQL_DRIVER_TEST` and `TORRUST_TRACKER_CORE_RUN_POSTGRES_DRIVER_TEST` set (images pulled with the maintainer's permission, 2026-11-17): lines 93.80%. Recorded in `coverage-evidence.md`; informs the scope of S3. | | T2 | TODO | Shared plan guidance | `test-refactor-plans/README.md`: two-phase sequence, guardrails, toolchain-pinned commands. First test slice (S1). | | T3 | TODO | Process every ledger row through the per-file workflow | Each row ends in exactly one of: test added, no-change with reason, deferred with owner. | | T4 | TODO | Bounded mutation assessment | `mutation-evidence.md`: configuration, survivors, reason for each unviable mutant. Last slice. | @@ -353,7 +356,7 @@ The first slice's record checks the grouping against `find packages/tracker-core - [ ] Specification and slicing reviewed and approved by the maintainer. - [x] GitHub issue #2902 created. Linking it as a subissue of #1347 needs the maintainer (the bot account gets 404 from the sub-issues API). - [ ] Spec-only PR (S0) merged before implementation. -- [ ] Container-gated scope measured (T1b) once the maintainer permits it. +- [x] Container-gated scope measured (T1b) with the maintainer's permission. - [ ] Every ledger row `DONE` with a decision record, merged through its slice. - [ ] Maintainer review after the final test-producing increment. - [ ] Automatic verification with toolchain-qualified evidence. @@ -366,6 +369,7 @@ The first slice's record checks the grouping against `find packages/tracker-core ### Progress Log - 2026-11-17 10:57 UTC - Claude Code (Sonnet 5.5) - Created issue #2902; measured the baseline at `5833cdae9` in four scopes; drafted this specification and the coverage evidence; registered the subissue in EPIC #1347 (row 14). Open questions Q1-Q6 are for the maintainer. +- 2026-11-17 12:16 UTC - Claude Code (Sonnet 5.5) - The maintainer allowed the Docker image pull (Q1); T1b measured the container-gated scope: lines 93.80% (server drivers 58-96% per file). No review of #2903 arrived within 60 minutes. ## Open Design Questions @@ -373,7 +377,7 @@ Each has a recommendation; the maintainer decides. | ID | Question | Recommendation | | --- | --- | --- | -| Q1 | May the agent pull the `mysql` and `postgres` Docker images (hundreds of MB) to measure the container-gated scope (T1b)? | Yes, once, on the maintainer's go; or the maintainer runs the command in `coverage-evidence.md` himself. | +| Q1 | May the agent pull the `mysql` and `postgres` Docker images (hundreds of MB) to measure the container-gated scope (T1b)? | ANSWERED: yes (maintainer, 2026-11-17); measured. | | Q2 | The two database suites skip themselves silently (F1). Is the visible-skip fix in scope here? | No: separate issue; this one only records the scope separately. | | Q3 | Scope of S3 for the MySQL and PostgreSQL drivers? | Docker-free unit tests only for what needs no server (an unreachable endpoint gives `ConnectionError`), if they are not flaky or slow; the happy path stays with the `db-compatibility` workflow, recorded as owner. | | Q4 | Extract the duplicated `parse_valid_until` and row mapping (F2)? | Separate refactor issue after this one; tests per driver meanwhile. | diff --git a/docs/issues/open/2902-1347-add-tests-tracker-core/coverage-evidence.md b/docs/issues/open/2902-1347-add-tests-tracker-core/coverage-evidence.md index ac731a1f47..9b5c4ec24a 100644 --- a/docs/issues/open/2902-1347-add-tests-tracker-core/coverage-evidence.md +++ b/docs/issues/open/2902-1347-add-tests-tracker-core/coverage-evidence.md @@ -32,6 +32,7 @@ cargo llvm-cov -p torrust-tracker-core --lib --json --output-path .tmp/cov/unit- | Integration-only (`--all-features --test integration`) | 12 integration | 841 / 1,909 (44.05%) | 936 / 2,506 (37.35%) | 145 / 484 (29.96%) | | Aggregate (`--all-features`, all targets) | 157 unit + 12 integration | 4,230 / 5,149 (82.15%) | 5,834 / 7,182 (81.23%) | 703 / 958 (73.38%) | | Unit-only without the `db-compatibility-tests` feature (`--lib`) | 157 unit | 4,085 / 4,780 (85.46%) | 5,700 / 6,691 (85.19%) | 683 / 916 (74.56%) | +| Container-gated aggregate (`--all-features`, both `TORRUST_TRACKER_CORE_RUN_*_DRIVER_TEST=true`, Docker `mysql:8.0` and `postgres:16`) | 157 unit + 12 integration, both driver suites run | 4,830 / 5,149 (93.80%) | 6,723 / 7,182 (93.61%) | 809 / 958 (84.45%) | Reading the scopes: @@ -43,9 +44,11 @@ Reading the scopes: `TORRUST_TRACKER_CORE_RUN_MYSQL_DRIVER_TEST` / `TORRUST_TRACKER_CORE_RUN_POSTGRES_DRIVER_TEST` is set, and they then need Docker and the `mysql` / `postgres` images. So the figures above do **not** include them: the two drivers (728 measured lines in ten files, 0-4% covered) are measured here as - uncovered. A fifth, container-gated scope (the same `--all-features` aggregate run with both - variables set) is **not yet measured**: pulling the images needs the maintainer's permission - (the open question Q1 in the spec). Task T1b records it. + uncovered. The fifth row above measures them with the suites running (T1b, 2026-11-17, images + `mysql:8.0` and `postgres:16`, the tests' defaults): the drivers' `mod.rs` files reach 95.8%, the + schema migrators 83-88%, and each store 58-64%: the same failure branches (malformed row, + failed query) that the SQLite stores leave uncovered. So the container-gated suite already + protects the server drivers' happy path; the remaining gap there is the failure branches (F2). - Aggregate and unit-only lines differ in five files only, all under `statistics/` (`event/handler.rs` 179 → 198 of 203 lines, `event/listener.rs` 357 → 419 of 421, `metrics.rs` 11 → 20 of 45, `persisted/mod.rs` 0 → 26 of 32, `repository.rs` 86 → 101 of 149). That is the @@ -124,7 +127,7 @@ above a unit test (a container, a real database); **owned** by a collaborator or | File | Uncovered lines | What they are | Class | Hypothesis | | --- | --- | --- | --- | --- | -| `databases/driver/mysql/*` (5 files), `postgres/*` (5 files) | 0-4% of 728 measured lines | The whole MySQL and PostgreSQL drivers: schema migrator, three stores, `mod.rs` pool code | 3B (container-gated) | The suite exists (`run_tests`) and runs in the `db-compatibility` workflow; measure it (T1b) before choosing. Candidates for 3A: error mapping with an unreachable endpoint (no container) | +| `databases/driver/mysql/*` (5 files), `postgres/*` (5 files) | 0-4% of 728 measured lines | The whole MySQL and PostgreSQL drivers: schema migrator, three stores, `mod.rs` pool code | 3B (container-gated) | With the suites running the files reach 58-96% (T1b). The suite exists (`run_tests`) and runs in the `db-compatibility` workflow; the uncovered rest is the failure branches (a malformed row needs a hand-written row). Candidates for 3A: error mapping with an unreachable endpoint (no container) | | `databases/driver/sqlite/auth_key_store.rs` | 18-100, 124-126 | Row-parse failure branches (`MalformedDatabaseRecord` for a bad key or a negative `valid_until`), `sqlx` failures, `parse_valid_until` negative case | 3A | Test through a temp SQLite file with a malformed row inserted by raw `sqlx`; the same helper is copied in three drivers (finding F2) | | `databases/driver/sqlite/torrent_metrics_store.rs` | 15-124 (16 of 45 lines uncovered) | Aggregate metric load/save error branches, `u32` conversion failure (`MalformedDatabaseRecord`) | 3A | Same technique | | `databases/driver/sqlite/whitelist_store.rs` | 18-75 (11 of 28) | Row-parse and query failure branches | 3A | Same technique | @@ -161,7 +164,7 @@ tested. The grouping above is the T1 hypothesis the decision records revisit. | --- | --- | --- | | Unit tests | The package is almost all in-process logic over traits | Primary level for every slice | | Package-local integration (`tests/integration.rs`) | 12 tests over the container already exist | Keep; add only if a unit cannot reach the boundary (for example persistence plus listeners) | -| Container-gated database suite (MySQL, PostgreSQL) | Exists, skipped silently without the environment variables | Measure (T1b); change nothing without the maintainer's decision (Q1, Q2) | +| Container-gated database suite (MySQL, PostgreSQL) | Exists, skipped silently without the environment variables | Measured (T1b); change nothing without the maintainer's decision (Q2, Q3) | | Runnable examples | None; `lib.rs` has doc examples | Out of scope | | Property-based (`quickcheck`) | Candidates flagged below; the package has no property-test dependency | Per-seam decision in the records, with an `add-rust-dependency` justification | | Mutation testing | Applicable after the last test increment | Bounded sample (T4) | From d6e004d51377318fcddfb29d2f65776a8fae522c Mon Sep 17 00:00:00 2001 From: josecelano-bot Date: Tue, 17 Nov 2026 12:37:37 +0000 Subject: [PATCH 03/22] docs(issues): [#2902] count 155 unit tests in the scope without the feature The MySQL and PostgreSQL driver tests sit in modules gated on the db-compatibility-tests feature, so a plain --lib run compiles 155 tests, as its coverage log shows. Review finding F2 of #2903. Co-Authored-By: Claude Opus 5.5 --- docs/issues/open/2902-1347-add-tests-tracker-core/ISSUE.md | 2 +- .../open/2902-1347-add-tests-tracker-core/coverage-evidence.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/issues/open/2902-1347-add-tests-tracker-core/ISSUE.md b/docs/issues/open/2902-1347-add-tests-tracker-core/ISSUE.md index dd5770c23b..339856f0c2 100644 --- a/docs/issues/open/2902-1347-add-tests-tracker-core/ISSUE.md +++ b/docs/issues/open/2902-1347-add-tests-tracker-core/ISSUE.md @@ -77,7 +77,7 @@ modules and `src/test_helpers.rs` included). | Unit-only (`--all-features --lib`) | 157 unit | 4,099 / 5,104 (80.31%) | 5,716 / 7,127 (80.20%) | 687 / 954 (72.01%) | | Integration-only (`--all-features --test integration`) | 12 integration | 841 / 1,909 (44.05%) | 936 / 2,506 (37.35%) | 145 / 484 (29.96%) | | Aggregate (`--all-features`) | 157 unit + 12 integration | 4,230 / 5,149 (82.15%) | 5,834 / 7,182 (81.23%) | 703 / 958 (73.38%) | -| Unit-only without `db-compatibility-tests` (`--lib`) | 157 unit | 4,085 / 4,780 (85.46%) | 5,700 / 6,691 (85.19%) | 683 / 916 (74.56%) | +| Unit-only without `db-compatibility-tests` (`--lib`) | 155 unit (the two driver tests are not compiled) | 4,085 / 4,780 (85.46%) | 5,700 / 6,691 (85.19%) | 683 / 916 (74.56%) | With the MySQL and PostgreSQL suites actually running (Docker `mysql:8.0` and `postgres:16`, both `TORRUST_TRACKER_CORE_RUN_*_DRIVER_TEST=true`, measured 2026-11-17 with the maintainer's permission) diff --git a/docs/issues/open/2902-1347-add-tests-tracker-core/coverage-evidence.md b/docs/issues/open/2902-1347-add-tests-tracker-core/coverage-evidence.md index 9b5c4ec24a..f422c408af 100644 --- a/docs/issues/open/2902-1347-add-tests-tracker-core/coverage-evidence.md +++ b/docs/issues/open/2902-1347-add-tests-tracker-core/coverage-evidence.md @@ -31,7 +31,7 @@ cargo llvm-cov -p torrust-tracker-core --lib --json --output-path .tmp/cov/unit- | Unit-only (`--all-features --lib`) | 157 unit | 4,099 / 5,104 (80.31%) | 5,716 / 7,127 (80.20%) | 687 / 954 (72.01%) | | Integration-only (`--all-features --test integration`) | 12 integration | 841 / 1,909 (44.05%) | 936 / 2,506 (37.35%) | 145 / 484 (29.96%) | | Aggregate (`--all-features`, all targets) | 157 unit + 12 integration | 4,230 / 5,149 (82.15%) | 5,834 / 7,182 (81.23%) | 703 / 958 (73.38%) | -| Unit-only without the `db-compatibility-tests` feature (`--lib`) | 157 unit | 4,085 / 4,780 (85.46%) | 5,700 / 6,691 (85.19%) | 683 / 916 (74.56%) | +| Unit-only without the `db-compatibility-tests` feature (`--lib`) | 155 unit (the two driver tests are not compiled) | 4,085 / 4,780 (85.46%) | 5,700 / 6,691 (85.19%) | 683 / 916 (74.56%) | | Container-gated aggregate (`--all-features`, both `TORRUST_TRACKER_CORE_RUN_*_DRIVER_TEST=true`, Docker `mysql:8.0` and `postgres:16`) | 157 unit + 12 integration, both driver suites run | 4,830 / 5,149 (93.80%) | 6,723 / 7,182 (93.61%) | 809 / 958 (84.45%) | Reading the scopes: From 2d175da8fee376cba8436b9588a86bb68be35bfd Mon Sep 17 00:00:00 2001 From: josecelano-bot Date: Tue, 17 Nov 2026 12:38:42 +0000 Subject: [PATCH 04/22] docs(issues): [#2902] add the container-gated command and per-file column The fifth coverage scope had no reproducible command and no per-file figures, and the reading note still said the figures above excluded the drivers. Review finding F8 of #2903. Co-Authored-By: Claude Opus 5.5 --- .../coverage-evidence.md | 126 ++++++++++-------- 1 file changed, 69 insertions(+), 57 deletions(-) diff --git a/docs/issues/open/2902-1347-add-tests-tracker-core/coverage-evidence.md b/docs/issues/open/2902-1347-add-tests-tracker-core/coverage-evidence.md index f422c408af..7f0c2ededf 100644 --- a/docs/issues/open/2902-1347-add-tests-tracker-core/coverage-evidence.md +++ b/docs/issues/open/2902-1347-add-tests-tracker-core/coverage-evidence.md @@ -26,6 +26,17 @@ cargo llvm-cov clean --workspace cargo llvm-cov -p torrust-tracker-core --lib --json --output-path .tmp/cov/unit-default.json ``` +The container-gated row (T1b) was measured afterwards on the S0 branch at `690cfb5f5`, whose +`packages/` tree is identical to `5833cdae9` (`git diff --stat 5833cdae9 690cfb5f5 -- packages` prints +nothing), after `docker pull mysql:8.0` and `docker pull postgres:16` (the tests' default tags, +`mysql/mod.rs:115` and `postgres/mod.rs:102`), with the same separate target directory: + +```console +cargo llvm-cov clean --workspace +TORRUST_TRACKER_CORE_RUN_MYSQL_DRIVER_TEST=true TORRUST_TRACKER_CORE_RUN_POSTGRES_DRIVER_TEST=true \ + cargo llvm-cov -p torrust-tracker-core --all-features --json --output-path .tmp/cov/container.json +``` + | Scope | Tests | Lines | Regions | Functions | | --- | ---: | ---: | ---: | ---: | | Unit-only (`--all-features --lib`) | 157 unit | 4,099 / 5,104 (80.31%) | 5,716 / 7,127 (80.20%) | 687 / 954 (72.01%) | @@ -42,8 +53,8 @@ Reading the scopes: - The MySQL and PostgreSQL driver tests (`run_mysql_driver_tests`, `run_postgres_driver_tests`) are compiled by `--all-features` but **skip themselves and pass** unless `TORRUST_TRACKER_CORE_RUN_MYSQL_DRIVER_TEST` / `TORRUST_TRACKER_CORE_RUN_POSTGRES_DRIVER_TEST` is - set, and they then need Docker and the `mysql` / `postgres` images. So the figures above do **not** - include them: the two drivers (728 measured lines in ten files, 0-4% covered) are measured here as + set, and they then need Docker and the `mysql` / `postgres` images. So the four default rows above do + **not** include them: the two drivers (728 measured lines in ten files, 0-4% covered) are measured here as uncovered. The fifth row above measures them with the suites running (T1b, 2026-11-17, images `mysql:8.0` and `postgres:16`, the tests' defaults): the drivers' `mod.rs` files reach 95.8%, the schema migrators 83-88%, and each store 58-64%: the same failure branches (malformed row, @@ -61,61 +72,62 @@ Reading the scopes: ## Per-File Inventory Lines only; the integration-only and aggregate columns show where the integration binary adds -anything (a `-` means the file is not reached or has no executable entries). - -| File | Unit-only lines | Integration-only lines | Aggregate lines | -| --- | ---: | ---: | ---: | -| `announce_handler.rs` | 400 / 401 (99.75%) | 80 / 92 (86.96%) | 400 / 401 (99.75%) | -| `authentication/handler.rs` | 371 / 371 (100.00%) | 6 / 90 (6.67%) | 371 / 371 (100.00%) | -| `authentication/key/mod.rs` | 77 / 77 (100.00%) | 0 / 31 (0.00%) | 77 / 77 (100.00%) | -| `authentication/key/peer_key.rs` | 100 / 101 (99.01%) | 0 / 45 (0.00%) | 100 / 101 (99.01%) | -| `authentication/key/repository/in_memory.rs` | 92 / 92 (100.00%) | 0 / 21 (0.00%) | 92 / 92 (100.00%) | -| `authentication/key/repository/persisted.rs` | 73 / 74 (98.65%) | 5 / 20 (25.00%) | 73 / 74 (98.65%) | -| `authentication/mod.rs` | 123 / 123 (100.00%) | - | 123 / 123 (100.00%) | -| `authentication/service.rs` | 144 / 144 (100.00%) | 6 / 30 (20.00%) | 144 / 144 (100.00%) | -| `container.rs` | 143 / 144 (99.31%) | 72 / 73 (98.63%) | 143 / 144 (99.31%) | -| `databases/driver/mod.rs` | 185 / 188 (98.40%) | - | 185 / 188 (98.40%) | -| `databases/driver/mysql/auth_key_store.rs` | 0 / 50 (0.00%) | 0 / 50 (0.00%) | 0 / 50 (0.00%) | -| `databases/driver/mysql/mod.rs` | 7 / 212 (3.30%) | 0 / 38 (0.00%) | 7 / 212 (3.30%) | -| `databases/driver/mysql/schema_migrator.rs` | 0 / 75 (0.00%) | 0 / 75 (0.00%) | 0 / 75 (0.00%) | -| `databases/driver/mysql/torrent_metrics_store.rs` | 0 / 45 (0.00%) | 0 / 45 (0.00%) | 0 / 45 (0.00%) | -| `databases/driver/mysql/whitelist_store.rs` | 0 / 28 (0.00%) | 0 / 28 (0.00%) | 0 / 28 (0.00%) | -| `databases/driver/postgres/auth_key_store.rs` | 0 / 50 (0.00%) | 0 / 50 (0.00%) | 0 / 50 (0.00%) | -| `databases/driver/postgres/mod.rs` | 7 / 189 (3.70%) | 0 / 39 (0.00%) | 7 / 189 (3.70%) | -| `databases/driver/postgres/schema_migrator.rs` | 0 / 6 (0.00%) | 0 / 6 (0.00%) | 0 / 6 (0.00%) | -| `databases/driver/postgres/torrent_metrics_store.rs` | 0 / 45 (0.00%) | 0 / 45 (0.00%) | 0 / 45 (0.00%) | -| `databases/driver/postgres/whitelist_store.rs` | 0 / 28 (0.00%) | 0 / 28 (0.00%) | 0 / 28 (0.00%) | -| `databases/driver/sqlite/auth_key_store.rs` | 29 / 50 (58.00%) | 0 / 50 (0.00%) | 29 / 50 (58.00%) | -| `databases/driver/sqlite/mod.rs` | 85 / 92 (92.39%) | 32 / 37 (86.49%) | 85 / 92 (92.39%) | -| `databases/driver/sqlite/schema_migrator.rs` | 145 / 155 (93.55%) | 22 / 73 (30.14%) | 145 / 155 (93.55%) | -| `databases/driver/sqlite/torrent_metrics_store.rs` | 29 / 45 (64.44%) | 29 / 45 (64.44%) | 29 / 45 (64.44%) | -| `databases/driver/sqlite/whitelist_store.rs` | 17 / 28 (60.71%) | 0 / 28 (0.00%) | 17 / 28 (60.71%) | -| `databases/error.rs` | 28 / 35 (80.00%) | 0 / 23 (0.00%) | 28 / 35 (80.00%) | -| `databases/setup.rs` | 34 / 44 (77.27%) | 18 / 29 (62.07%) | 34 / 44 (77.27%) | -| `databases/traits/whitelist.rs` | 2 / 2 (100.00%) | 0 / 2 (0.00%) | 2 / 2 (100.00%) | -| `error.rs` | 38 / 50 (76.00%) | 0 / 12 (0.00%) | 38 / 50 (76.00%) | -| `lib.rs` | 58 / 58 (100.00%) | - | 58 / 58 (100.00%) | -| `peer_tests.rs` | 30 / 30 (100.00%) | - | 30 / 30 (100.00%) | -| `scrape_handler.rs` | 190 / 190 (100.00%) | 43 / 44 (97.73%) | 190 / 190 (100.00%) | -| `statistics/event/handler.rs` | 179 / 203 (88.18%) | 92 / 99 (92.93%) | 198 / 203 (97.54%) | -| `statistics/event/listener.rs` | 357 / 406 (87.93%) | 156 / 168 (92.86%) | 419 / 421 (99.52%) | -| `statistics/metrics.rs` | 11 / 45 (24.44%) | 20 / 45 (44.44%) | 20 / 45 (44.44%) | -| `statistics/mod.rs` | 40 / 40 (100.00%) | 40 / 40 (100.00%) | 40 / 40 (100.00%) | -| `statistics/persisted/downloads.rs` | 77 / 77 (100.00%) | 39 / 39 (100.00%) | 77 / 77 (100.00%) | -| `statistics/persisted/mod.rs` | 0 / 11 (0.00%) | 26 / 32 (81.25%) | 26 / 32 (81.25%) | -| `statistics/repository.rs` | 86 / 140 (61.43%) | 60 / 115 (52.17%) | 101 / 149 (67.79%) | -| `test_helpers.rs` | 109 / 123 (88.62%) | - | 109 / 123 (88.62%) | -| `torrent/manager.rs` | 153 / 153 (100.00%) | 15 / 48 (31.25%) | 153 / 153 (100.00%) | -| `torrent/persisted_downloads.rs` | 22 / 22 (100.00%) | 22 / 22 (100.00%) | 22 / 22 (100.00%) | -| `torrent/repository/in_memory.rs` | 56 / 60 (93.33%) | 30 / 60 (50.00%) | 56 / 60 (93.33%) | -| `torrent/services.rs` | 267 / 267 (100.00%) | 0 / 1 (0.00%) | 267 / 267 (100.00%) | -| `whitelist/authorization.rs` | 74 / 74 (100.00%) | 12 / 16 (75.00%) | 74 / 74 (100.00%) | -| `whitelist/manager.rs` | 99 / 99 (100.00%) | 6 / 26 (23.08%) | 99 / 99 (100.00%) | -| `whitelist/mod.rs` | 18 / 18 (100.00%) | - | 18 / 18 (100.00%) | -| `whitelist/repository/in_memory.rs` | 51 / 51 (100.00%) | 0 / 17 (0.00%) | 51 / 51 (100.00%) | -| `whitelist/repository/persisted.rs` | 74 / 74 (100.00%) | 3 / 25 (12.00%) | 74 / 74 (100.00%) | -| `whitelist/setup.rs` | 7 / 7 (100.00%) | 7 / 7 (100.00%) | 7 / 7 (100.00%) | -| `whitelist/test_helpers.rs` | 12 / 12 (100.00%) | - | 12 / 12 (100.00%) | +anything, and the last column is the container-gated run (T1b) with both driver suites running (a `-` +means the file is not reached). + +| File | Unit-only lines | Integration-only lines | Aggregate lines | Container-gated aggregate lines | +| --- | ---: | ---: | ---: | ---: | +| `announce_handler.rs` | 400 / 401 (99.75%) | 80 / 92 (86.96%) | 400 / 401 (99.75%) | 400 / 401 (99.75%) | +| `authentication/handler.rs` | 371 / 371 (100.00%) | 6 / 90 (6.67%) | 371 / 371 (100.00%) | 371 / 371 (100.00%) | +| `authentication/key/mod.rs` | 77 / 77 (100.00%) | 0 / 31 (0.00%) | 77 / 77 (100.00%) | 77 / 77 (100.00%) | +| `authentication/key/peer_key.rs` | 100 / 101 (99.01%) | 0 / 45 (0.00%) | 100 / 101 (99.01%) | 100 / 101 (99.01%) | +| `authentication/key/repository/in_memory.rs` | 92 / 92 (100.00%) | 0 / 21 (0.00%) | 92 / 92 (100.00%) | 92 / 92 (100.00%) | +| `authentication/key/repository/persisted.rs` | 73 / 74 (98.65%) | 5 / 20 (25.00%) | 73 / 74 (98.65%) | 73 / 74 (98.65%) | +| `authentication/mod.rs` | 123 / 123 (100.00%) | - | 123 / 123 (100.00%) | 123 / 123 (100.00%) | +| `authentication/service.rs` | 144 / 144 (100.00%) | 6 / 30 (20.00%) | 144 / 144 (100.00%) | 144 / 144 (100.00%) | +| `container.rs` | 143 / 144 (99.31%) | 72 / 73 (98.63%) | 143 / 144 (99.31%) | 143 / 144 (99.31%) | +| `databases/driver/mod.rs` | 185 / 188 (98.40%) | - | 185 / 188 (98.40%) | 187 / 188 (99.47%) | +| `databases/driver/mysql/auth_key_store.rs` | 0 / 50 (0.00%) | 0 / 50 (0.00%) | 0 / 50 (0.00%) | 29 / 50 (58.00%) | +| `databases/driver/mysql/mod.rs` | 7 / 212 (3.30%) | 0 / 38 (0.00%) | 7 / 212 (3.30%) | 203 / 212 (95.75%) | +| `databases/driver/mysql/schema_migrator.rs` | 0 / 75 (0.00%) | 0 / 75 (0.00%) | 0 / 75 (0.00%) | 66 / 75 (88.00%) | +| `databases/driver/mysql/torrent_metrics_store.rs` | 0 / 45 (0.00%) | 0 / 45 (0.00%) | 0 / 45 (0.00%) | 29 / 45 (64.44%) | +| `databases/driver/mysql/whitelist_store.rs` | 0 / 28 (0.00%) | 0 / 28 (0.00%) | 0 / 28 (0.00%) | 17 / 28 (60.71%) | +| `databases/driver/postgres/auth_key_store.rs` | 0 / 50 (0.00%) | 0 / 50 (0.00%) | 0 / 50 (0.00%) | 29 / 50 (58.00%) | +| `databases/driver/postgres/mod.rs` | 7 / 189 (3.70%) | 0 / 39 (0.00%) | 7 / 189 (3.70%) | 181 / 189 (95.77%) | +| `databases/driver/postgres/schema_migrator.rs` | 0 / 6 (0.00%) | 0 / 6 (0.00%) | 0 / 6 (0.00%) | 5 / 6 (83.33%) | +| `databases/driver/postgres/torrent_metrics_store.rs` | 0 / 45 (0.00%) | 0 / 45 (0.00%) | 0 / 45 (0.00%) | 29 / 45 (64.44%) | +| `databases/driver/postgres/whitelist_store.rs` | 0 / 28 (0.00%) | 0 / 28 (0.00%) | 0 / 28 (0.00%) | 17 / 28 (60.71%) | +| `databases/driver/sqlite/auth_key_store.rs` | 29 / 50 (58.00%) | 0 / 50 (0.00%) | 29 / 50 (58.00%) | 29 / 50 (58.00%) | +| `databases/driver/sqlite/mod.rs` | 85 / 92 (92.39%) | 32 / 37 (86.49%) | 85 / 92 (92.39%) | 85 / 92 (92.39%) | +| `databases/driver/sqlite/schema_migrator.rs` | 145 / 155 (93.55%) | 22 / 73 (30.14%) | 145 / 155 (93.55%) | 145 / 155 (93.55%) | +| `databases/driver/sqlite/torrent_metrics_store.rs` | 29 / 45 (64.44%) | 29 / 45 (64.44%) | 29 / 45 (64.44%) | 29 / 45 (64.44%) | +| `databases/driver/sqlite/whitelist_store.rs` | 17 / 28 (60.71%) | 0 / 28 (0.00%) | 17 / 28 (60.71%) | 17 / 28 (60.71%) | +| `databases/error.rs` | 28 / 35 (80.00%) | 0 / 23 (0.00%) | 28 / 35 (80.00%) | 35 / 35 (100.00%) | +| `databases/setup.rs` | 34 / 44 (77.27%) | 18 / 29 (62.07%) | 34 / 44 (77.27%) | 34 / 44 (77.27%) | +| `databases/traits/whitelist.rs` | 2 / 2 (100.00%) | 0 / 2 (0.00%) | 2 / 2 (100.00%) | 2 / 2 (100.00%) | +| `error.rs` | 38 / 50 (76.00%) | 0 / 12 (0.00%) | 38 / 50 (76.00%) | 38 / 50 (76.00%) | +| `lib.rs` | 58 / 58 (100.00%) | - | 58 / 58 (100.00%) | 58 / 58 (100.00%) | +| `peer_tests.rs` | 30 / 30 (100.00%) | - | 30 / 30 (100.00%) | 30 / 30 (100.00%) | +| `scrape_handler.rs` | 190 / 190 (100.00%) | 43 / 44 (97.73%) | 190 / 190 (100.00%) | 190 / 190 (100.00%) | +| `statistics/event/handler.rs` | 179 / 203 (88.18%) | 92 / 99 (92.93%) | 198 / 203 (97.54%) | 198 / 203 (97.54%) | +| `statistics/event/listener.rs` | 357 / 406 (87.93%) | 156 / 168 (92.86%) | 419 / 421 (99.52%) | 419 / 421 (99.52%) | +| `statistics/metrics.rs` | 11 / 45 (24.44%) | 20 / 45 (44.44%) | 20 / 45 (44.44%) | 20 / 45 (44.44%) | +| `statistics/mod.rs` | 40 / 40 (100.00%) | 40 / 40 (100.00%) | 40 / 40 (100.00%) | 40 / 40 (100.00%) | +| `statistics/persisted/downloads.rs` | 77 / 77 (100.00%) | 39 / 39 (100.00%) | 77 / 77 (100.00%) | 77 / 77 (100.00%) | +| `statistics/persisted/mod.rs` | 0 / 11 (0.00%) | 26 / 32 (81.25%) | 26 / 32 (81.25%) | 26 / 32 (81.25%) | +| `statistics/repository.rs` | 86 / 140 (61.43%) | 60 / 115 (52.17%) | 101 / 149 (67.79%) | 101 / 149 (67.79%) | +| `test_helpers.rs` | 109 / 123 (88.62%) | - | 109 / 123 (88.62%) | 109 / 123 (88.62%) | +| `torrent/manager.rs` | 153 / 153 (100.00%) | 15 / 48 (31.25%) | 153 / 153 (100.00%) | 153 / 153 (100.00%) | +| `torrent/persisted_downloads.rs` | 22 / 22 (100.00%) | 22 / 22 (100.00%) | 22 / 22 (100.00%) | 22 / 22 (100.00%) | +| `torrent/repository/in_memory.rs` | 56 / 60 (93.33%) | 30 / 60 (50.00%) | 56 / 60 (93.33%) | 56 / 60 (93.33%) | +| `torrent/services.rs` | 267 / 267 (100.00%) | 0 / 1 (0.00%) | 267 / 267 (100.00%) | 267 / 267 (100.00%) | +| `whitelist/authorization.rs` | 74 / 74 (100.00%) | 12 / 16 (75.00%) | 74 / 74 (100.00%) | 74 / 74 (100.00%) | +| `whitelist/manager.rs` | 99 / 99 (100.00%) | 6 / 26 (23.08%) | 99 / 99 (100.00%) | 99 / 99 (100.00%) | +| `whitelist/mod.rs` | 18 / 18 (100.00%) | - | 18 / 18 (100.00%) | 18 / 18 (100.00%) | +| `whitelist/repository/in_memory.rs` | 51 / 51 (100.00%) | 0 / 17 (0.00%) | 51 / 51 (100.00%) | 51 / 51 (100.00%) | +| `whitelist/repository/persisted.rs` | 74 / 74 (100.00%) | 3 / 25 (12.00%) | 74 / 74 (100.00%) | 74 / 74 (100.00%) | +| `whitelist/setup.rs` | 7 / 7 (100.00%) | 7 / 7 (100.00%) | 7 / 7 (100.00%) | 7 / 7 (100.00%) | +| `whitelist/test_helpers.rs` | 12 / 12 (100.00%) | - | 12 / 12 (100.00%) | 12 / 12 (100.00%) | ## Uncovered Line Groups (unit-only, `--all-features --lib`) From 0837f90f5a14d66e25e2bc5863ea35202fbf506d Mon Sep 17 00:00:00 2001 From: josecelano-bot Date: Tue, 17 Nov 2026 12:40:37 +0000 Subject: [PATCH 05/22] docs(issues): [#2902] separate production and test-module uncovered lines Several uncovered-line groups counted test-module lines as production regions and one production region as a test assertion. Each group now lists production lines first and test-module lines after a slash, and the ledger hypotheses follow. The sweep also reclassified statistics/mod.rs:49 (usage statistics disabled), peer_key.rs:64 and torrent/manager.rs:66 as production regions. Review finding F3 of #2903. Co-Authored-By: Claude Opus 5.5 --- .../2902-1347-add-tests-tracker-core/ISSUE.md | 18 +++++----- .../coverage-evidence.md | 34 ++++++++++--------- 2 files changed, 27 insertions(+), 25 deletions(-) diff --git a/docs/issues/open/2902-1347-add-tests-tracker-core/ISSUE.md b/docs/issues/open/2902-1347-add-tests-tracker-core/ISSUE.md index 339856f0c2..e1f82e3959 100644 --- a/docs/issues/open/2902-1347-add-tests-tracker-core/ISSUE.md +++ b/docs/issues/open/2902-1347-add-tests-tracker-core/ISSUE.md @@ -311,22 +311,22 @@ rows are ordered by slice, then by risk. | 3 | `statistics/persisted/mod.rs` | S1 | 0 / 11 | Test candidate (`load_persisted_metrics`) | PENDING | | 4 | `statistics/event/listener.rs` | S1 | 357 / 406 | Test candidate (spawn wrappers) | PENDING | | 5 | `statistics/event/handler.rs` | S1 | 179 / 203 | Mostly logging-only; one error arm | PENDING | -| 6 | `statistics/persisted/downloads.rs` | S1 | 77 / 77 | No change (one assertion line) | PENDING | -| 7 | `statistics/mod.rs`, `statistics/event/mod.rs` | S1 | 40 / 40, no entries | No change | PENDING | +| 6 | `statistics/persisted/downloads.rs` | S1 | 77 / 77 | Failing-`Database` case (line 133, `increase_global_downloads`) | PENDING | +| 7 | `statistics/mod.rs`, `statistics/event/mod.rs` | S1 | 40 / 40, no entries | Test candidate (`statistics/mod.rs:49`, usage statistics disabled); `event/mod.rs` declarations only | PENDING | | 8 | `databases/driver/sqlite/auth_key_store.rs` | S2 | 29 / 50 | Test candidate | PENDING | | 9 | `databases/driver/sqlite/torrent_metrics_store.rs` | S2 | 29 / 45 | Test candidate | PENDING | | 10 | `databases/driver/sqlite/whitelist_store.rs` | S2 | 17 / 28 | Test candidate | PENDING | -| 11 | `databases/driver/sqlite/mod.rs` | S2 | 85 / 92 | Test candidate | PENDING | +| 11 | `databases/driver/sqlite/mod.rs` | S2 | 85 / 92 | Test candidate (aggregate-metric error branches) | PENDING | | 12 | `databases/driver/sqlite/schema_migrator.rs` | S2 | 145 / 155 | No change likely; challenge each `?` | PENDING | -| 13 | `databases/error.rs` | S2 | 28 / 35 | Test candidate | PENDING | +| 13 | `databases/error.rs` | S2 | 28 / 35 | Test candidate (migration-error mapping) | PENDING | | 14 | `databases/setup.rs` | S2 | 34 / 44 | Test candidate (SQLite arm and unreachable endpoint); server arms to S3 | PENDING | | 15 | `error.rs` | S2 | 38 / 50 | Test candidate (`From` conversions) | PENDING | | 16 | `databases/driver/mod.rs` | S2 | 185 / 188 | No change (test-only retry helper) | PENDING | | 17 | `databases/mod.rs`, `databases/traits/*` (6 files) | S2 | 2 / 2, no entries | No change (declarations and the mock) | PENDING | | 18-22 | `databases/driver/mysql/{mod,auth_key_store,schema_migrator,torrent_metrics_store,whitelist_store}.rs` | S3 | 7 / 212, 0 / 50, 0 / 75, 0 / 45, 0 / 28 | Container-gated; assess after T1b | PENDING | | 23-27 | `databases/driver/postgres/{mod,auth_key_store,schema_migrator,torrent_metrics_store,whitelist_store}.rs` | S3 | 7 / 189, 0 / 50, 0 / 6, 0 / 45, 0 / 28 | Container-gated; assess after T1b | PENDING | -| 28 | `authentication/handler.rs` | S4 | 371 / 371 | Failing-`Database` cases (9 `?`/assertion regions) | PENDING | -| 29 | `authentication/key/peer_key.rs` | S4 | 100 / 101 | Property candidate (`Key`); finding F3 check | PENDING | +| 28 | `authentication/handler.rs` | S4 | 371 / 371 | Failing-`Database` cases (two production `?` regions; seven assertion lines) | PENDING | +| 29 | `authentication/key/peer_key.rs` | S4 | 100 / 101 | `PartialEq` mixed-expiry arm; property candidate (`Key`); finding F3 check | PENDING | | 30 | `authentication/key/mod.rs` | S4 | 77 / 77 | Property candidate (expiry bounds) | PENDING | | 31 | `authentication/key/repository/persisted.rs` | S4 | 73 / 74 | Failing-`Database` cases | PENDING | | 32 | `authentication/key/repository/in_memory.rs` | S4 | 92 / 92 | No change | PENDING | @@ -334,12 +334,12 @@ rows are ordered by slice, then by risk. | 34 | `authentication/mod.rs`, `authentication/key/repository/mod.rs` | S4 | 123 / 123, no entries | No change | PENDING | | 35 | `whitelist/repository/persisted.rs` | S4 | 74 / 74 | Failing-`Database` cases; finding F4 check | PENDING | | 36 | `whitelist/manager.rs` | S4 | 99 / 99 | Failing-`Database` cases | PENDING | -| 37 | `whitelist/authorization.rs` | S4 | 74 / 74 | One `?` region | PENDING | +| 37 | `whitelist/authorization.rs` | S4 | 74 / 74 | No change (one test assertion line) | PENDING | | 38 | `whitelist/repository/in_memory.rs` | S4 | 51 / 51 | No change | PENDING | | 39 | `whitelist/{mod,setup,test_helpers}.rs`, `whitelist/repository/mod.rs` | S4 | 18 / 18, 7 / 7, 12 / 12, no entries | No change | PENDING | | 40 | `torrent/repository/in_memory.rs` | S5 | 56 / 60 | Delegation of `get_torrent_peers` (owned by the registry) | PENDING | -| 41 | `torrent/manager.rs`, `torrent/services.rs`, `torrent/persisted_downloads.rs`, `torrent/mod.rs`, `torrent/repository/mod.rs` | S5 | 153 / 153, 267 / 267, 22 / 22, no entries | No change; review breadth | PENDING | -| 42 | `announce_handler.rs` | S5 | 400 / 401 | Challenge the three `?`/assertion lines | PENDING | +| 41 | `torrent/manager.rs`, `torrent/services.rs`, `torrent/persisted_downloads.rs`, `torrent/mod.rs`, `torrent/repository/mod.rs` | S5 | 153 / 153, 267 / 267, 22 / 22, no entries | `manager.rs`: failing-`Database` case (line 66); the others no change, review breadth | PENDING | +| 42 | `announce_handler.rs` | S5 | 400 / 401 | Challenge the two `?` regions (one assertion line) | PENDING | | 43 | `scrape_handler.rs` | S5 | 190 / 190 | No change (one assertion line) | PENDING | | 44 | `container.rs` | S5 | 143 / 144 | Test candidate (`Persistence` error mapping) | PENDING | | 45 | `lib.rs`, `peer_tests.rs`, `test_helpers.rs` | S5 | 58 / 58, 30 / 30, 109 / 123 | No change; test support classified | PENDING | diff --git a/docs/issues/open/2902-1347-add-tests-tracker-core/coverage-evidence.md b/docs/issues/open/2902-1347-add-tests-tracker-core/coverage-evidence.md index 7f0c2ededf..9adbe76d5a 100644 --- a/docs/issues/open/2902-1347-add-tests-tracker-core/coverage-evidence.md +++ b/docs/issues/open/2902-1347-add-tests-tracker-core/coverage-evidence.md @@ -131,9 +131,11 @@ means the file is not reached). ## Uncovered Line Groups (unit-only, `--all-features --lib`) -Line numbers are those of `5833cdae9`. Classes: **3A** unit-testable now; **3B** needs a boundary +Line numbers are those of `5833cdae9`. Where a file has a `#[cfg(test)]` module, production lines are +listed first and test-module lines after a `/`; a test-module line is never a decision to test. Classes: **3A** unit-testable now; **3B** needs a boundary above a unit test (a container, a real database); **owned** by a collaborator or another issue; -**unreachable / no decision** (logging-only code, `?` propagation regions, test-support). A +**no decision** (logging-only code, code-region artifacts); **test code** (lines in a `#[cfg(test)]` +module or in test support). A "hypothesis" is not a decision: each group is re-challenged per file in the decision records (hard to test, owned elsewhere, or merely unselected?). @@ -143,28 +145,28 @@ above a unit test (a container, a real database); **owned** by a collaborator or | `databases/driver/sqlite/auth_key_store.rs` | 18-100, 124-126 | Row-parse failure branches (`MalformedDatabaseRecord` for a bad key or a negative `valid_until`), `sqlx` failures, `parse_valid_until` negative case | 3A | Test through a temp SQLite file with a malformed row inserted by raw `sqlx`; the same helper is copied in three drivers (finding F2) | | `databases/driver/sqlite/torrent_metrics_store.rs` | 15-124 (16 of 45 lines uncovered) | Aggregate metric load/save error branches, `u32` conversion failure (`MalformedDatabaseRecord`) | 3A | Same technique | | `databases/driver/sqlite/whitelist_store.rs` | 18-75 (11 of 28) | Row-parse and query failure branches | 3A | Same technique | -| `databases/driver/sqlite/mod.rs` | 54-62, 79, 103, 119 | `Sqlite::new` path handling and the aggregate-metric helpers' error branches | 3A | Constructor with an invalid path; closed pool | -| `databases/driver/sqlite/schema_migrator.rs` | 38, 56, 90, 103, 122-123, 136, 139, 152, 275 | `?` error regions of the legacy bootstrap and `drop_database_tables`; line 275 is a test assertion line | mostly no decision | Legacy partial-state and migrated paths are already tested; challenge each `?` region | +| `databases/driver/sqlite/mod.rs` | 54, 58, 60, 62, 79 / 103, 119 | Production: the error branches of the aggregate-metric helpers (`load_torrent_aggregate_metric`: query failure, `try_get` failure, the `u32` conversion to `MalformedDatabaseRecord`; `save_torrent_aggregate_metric`: query failure). Test module: lines 103 and 119 are `unreachable!` arms of the test helpers | 3A / test code | A row with an out-of-range value inserted by raw `sqlx`; a dropped table. `Sqlite::new` (lines 38-47) is fully covered | +| `databases/driver/sqlite/schema_migrator.rs` | 38, 56, 90, 103, 122-123, 136, 139, 152 / 275 | Production: `?` error regions of the legacy bootstrap and `drop_database_tables`. Test module: line 275 is an assertion | mostly no decision / test code | Legacy partial-state and migrated paths are already tested; challenge each `?` region | | `databases/driver/mod.rs` | 67-68, 70 | Retry loop of the test-only `create_database_tables` helper | test support | No-change | -| `databases/error.rs` | 140-147, 160, 173 | `From<(MigrateError, Driver)>`, one `ConnectionError` arm group, `Display` pieces | 3A | Small table over the `sqlx::Error` variants and the migration error | +| `databases/error.rs` | 140-147 / 160, 173 | Production: `From<(MigrateError, Driver)>` (the `MigrationError` mapping). Test module: lines 160 and 173 are assertions | 3A / test code | One test of the migration-error mapping; the `sqlx::Error` arms are already tested | | `databases/setup.rs` | 114-128 | `initialize_database_from_configuration` for MySQL and PostgreSQL | 3B / 3A | Unreachable-endpoint error test is 3A; the success path is container-gated | | `error.rs` | 47-49, 53-55, 59-61, 65-67 | The four `From` conversions into `TrackerCoreError` | 3A | Trivial but package-owned wiring; one table test | | `statistics/repository.rs` | 104, 114-120, 139-146, 148-154, 157-158, 164-206 | `set_counter`, `set_gauge`, `increment_gauge`, `decrement_gauge` and their error-logging arms | 3A | Covered only by the integration binary today; direct unit tests (success and metric-type-mismatch error) | | `statistics/metrics.rs` | 36-44, 49-57, 62-69, 74-81 | `Metrics::set_counter`, `set_gauge`, `increment_gauge`, `decrement_gauge` | 3A | Same | | `statistics/persisted/mod.rs` | 21-25, 59-61, 65-67 | `load_persisted_metrics` (startup load into the in-memory counters) | 3A | Unit test with the `testing` feature's `TorrentMetricsStore` mock (ADR on test support) or a temp SQLite store | -| `statistics/persisted/downloads.rs` | 133 | One test-assertion line | no decision | No-change | -| `statistics/event/listener.rs` | 19-83, 283-284 | The two spawning wrappers (`run_*_event_listener`) and the `*_unspawned` entry points | 3A | Spawn, send an event, cancel, await the handle; drain behavior is owned by the `events` package | +| `statistics/persisted/downloads.rs` | 133 | Production: the `?` of `increase_global_downloads` when `load_global_downloads` fails | 3A (medium) | Failing-`Database` case | +| `statistics/event/listener.rs` | 19-83 / 283-284 | Production: the two spawning wrappers (`run_*_event_listener`) and the `*_unspawned` entry points. Test module: lines 283-284 belong to the test `ScriptedReceiver` | 3A / test code | Spawn, send an event, cancel, await the handle; drain behavior is owned by the `events` package | | `statistics/event/handler.rs` | 19-58, 129 | Logging-only handlers (`handle_torrent_added`, `_removed`, `handle_peer_*`) and one error arm | no decision / 3A | The logging-only arms carry no state change; decide whether a log-assertion test (ADR on log identifiers) is worth it; line 129 is a metric-increment error arm | -| `statistics/mod.rs` | 49 | One region | no decision | Check | -| `container.rs` | 86, 193 | `Persistence` error mapping when the database cannot initialize; a multi-line assertion | 3A | Container built over an invalid SQLite path | -| `authentication/handler.rs` | 252, 280, 424, 479, 493, 531, 604, 656, 690 | `?` regions: database failures of `remove_peer_key`, `load_peer_keys_from_database`; multi-line assertion lines | 3A / no decision | Fake the `Database` failing; many of the 9 are assertion lines | -| `authentication/key/repository/persisted.rs` | 57, 71, 96 | `?` regions of `add`, `remove`, `load_keys` | 3A | Same fake | -| `authentication/key/{mod,peer_key}.rs` | 304 / 64 | One assertion line; one region | no decision | Check | -| `announce_handler.rs` | 184, 189, 634 | `?` regions of `handle_announcement` (whitelist failure, downloads load failure); an assertion line | 3A | Whitelist and database failure cases may exist elsewhere; challenge | -| `scrape_handler.rs` | 350 | One assertion line | no decision | No-change | -| `torrent/manager.rs` | 66 | One region | no decision | Check | +| `statistics/mod.rs` | 49 | Production: the implicit `else` of `if tracker_usage_statistics_enabled` (the in-session counter is not described when usage statistics are disabled) | 3A | A metrics test with usage statistics disabled | +| `container.rs` | 86 / 193 | Production: the `Persistence` error mapping when the database cannot initialize. Test module: line 193 is an assertion | 3A / test code | Container built over an invalid SQLite path | +| `authentication/handler.rs` | 252, 280 / 424, 479, 493, 531, 604, 656, 690 | Production: the `?` regions of `remove_peer_key` and `load_peer_keys_from_database` (database failure). Test module: the other seven lines are assertions | 3A / test code | Fake the `Database` failing | +| `authentication/key/repository/persisted.rs` | 57, 71 / 96 | Production: the `?` regions of `remove` and `load_keys`. Test module: line 96 is an `unreachable!` arm of a test helper | 3A / test code | Same fake | +| `authentication/key/peer_key.rs`, `authentication/key/mod.rs` | 64 / 304 | Production: `peer_key.rs:64`, the `_ => false` arm of `PeerKey`'s `PartialEq` (one key expiring, the other permanent). Test module: `mod.rs:304` is an assertion | 3A / test code | One equality case | +| `announce_handler.rs` | 184, 189 / 634 | Production: the `?` regions of the announce (whitelist failure, downloads load failure). Test module: line 634 is an assertion | 3A / test code | Whitelist and database failure cases may exist elsewhere; challenge | +| `scrape_handler.rs` | 350 | Test module: an assertion | test code | No-change | +| `torrent/manager.rs` | 66 | Production: the `?` of `load_torrents_from_database` when the database fails | 3A (medium) | Failing-`Database` case | | `torrent/repository/in_memory.rs` | 177-179 | `get_torrent_peers` delegating to the swarm registry | owned (swarm-coordination-registry) | A thin delegation test is cheap; decide per file | -| `whitelist/authorization.rs`, `whitelist/manager.rs`, `whitelist/repository/persisted.rs` | 139 / 53, 66, 79 / 30, 36, 46, 52 | `?` regions: database failures of `add` / `remove` / `load` | 3A | Same failing-`Database` fake | +| `whitelist/manager.rs`, `whitelist/repository/persisted.rs`, `whitelist/authorization.rs` | 53, 66, 79 / 30, 36, 46, 52 / 139 | Production: the `?` regions of `add`, `remove` and `load` (manager) and of the read and write in `add` and `remove` (persisted). Test module: `authorization.rs:139` is an assertion | 3A / test code | Same failing-`Database` fake | | `test_helpers.rs` | 144-156, 209 | Test-support builder branch for persistent completed statistics | test support | Not package-owned behavior; no test by decision, unless a slice uses it | Counts are by line class, not by decision: a "region" group can disappear when its neighbors are From 28037cb0a44e9ff221dfb300ddf4f6ce0cad0ebf Mon Sep 17 00:00:00 2001 From: josecelano-bot Date: Tue, 17 Nov 2026 12:41:18 +0000 Subject: [PATCH 06/22] docs(issues): [#2902] cite the exact parse_valid_until line ranges Review finding F4 of #2903. Co-Authored-By: Claude Opus 5.5 --- docs/issues/open/2902-1347-add-tests-tracker-core/ISSUE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/issues/open/2902-1347-add-tests-tracker-core/ISSUE.md b/docs/issues/open/2902-1347-add-tests-tracker-core/ISSUE.md index e1f82e3959..89e9aeae49 100644 --- a/docs/issues/open/2902-1347-add-tests-tracker-core/ISSUE.md +++ b/docs/issues/open/2902-1347-add-tests-tracker-core/ISSUE.md @@ -224,7 +224,7 @@ fixed in this issue; each is a proposal for the maintainer. | ID | Finding | Evidence | Proposed owner | Status | | --- | --- | --- | --- | --- | | F1 | `run_mysql_driver_tests` and `run_postgres_driver_tests` return `Ok(())` immediately when `TORRUST_TRACKER_CORE_RUN_*_DRIVER_TEST` is unset, so `cargo test --all-features` reports them as passed without running anything, and the coverage runs count both drivers as 0-4% covered. A reader of a green run cannot tell. | `databases/driver/mysql/mod.rs:204-207`, `postgres/mod.rs:185-188`; the coverage log shows both tests `ok` in 0.00 s | A separate test-design issue: make the skip visible (`#[ignore = "..."]`, or a loud skip message) and keep the `db-compatibility` workflow as it is. Not part of this issue (Q2). | OPEN (proposed) | -| F2 | The row-to-`PeerKey` mapping and `parse_valid_until` (negative timestamp to `MalformedDatabaseRecord`) are copied in the SQLite, MySQL and PostgreSQL `auth_key_store.rs`; the `u32` conversion of the aggregate metric is copied likewise. A test of the SQLite copy protects none of the others, and Docker-less tests cannot reach the MySQL and PostgreSQL copies. | `parse_valid_until` is identical in the three files (lines 119-128) | A refactor issue extracting one helper (Q4); until then each driver's copy is assessed in its own record. | OPEN (proposed) | +| F2 | The row-to-`PeerKey` mapping and `parse_valid_until` (negative timestamp to `MalformedDatabaseRecord`) are copied in the SQLite, MySQL and PostgreSQL `auth_key_store.rs`; the `u32` conversion of the aggregate metric is copied likewise. A test of the SQLite copy protects none of the others, and Docker-less tests cannot reach the MySQL and PostgreSQL copies. | `parse_valid_until` is identical in the three files (MySQL and PostgreSQL lines 119-125, SQLite lines 122-128) | A refactor issue extracting one helper (Q4); until then each driver's copy is assessed in its own record. | OPEN (proposed) | | F3 | `authentication::key::Key` derives `Deserialize` over its inner `String`, so deserializing a key skips the 32-character, ASCII-alphanumeric validation of `Key::new`. To confirm in the `peer_key.rs` record: where (if anywhere) a `Key` is deserialized from untrusted input (REST path and JSON are the candidates). | `authentication/key/peer_key.rs:127` | Confirm first; if reachable, a bug issue under `fix-bug`. | TO CONFIRM | | F4 | `PersistedWhitelist::add` and `remove` read `is_info_hash_whitelisted` and then write, without a transaction; two concurrent adds of the same hash can reach the driver's duplicate-insert error that `it_should_fail_trying_to_add_the_same_infohash_twice` shows is an error. Probably benign (the in-memory whitelist is the read path), but the behavior is unspecified. | `whitelist/repository/persisted.rs:29-54` | Confirm with a throwaway test in the whitelist record; at most a documentation or small fix issue. | TO CONFIRM | From b4389353d5ba381eb8f3be46751b53b571328593 Mon Sep 17 00:00:00 2001 From: josecelano-bot Date: Tue, 17 Nov 2026 12:42:24 +0000 Subject: [PATCH 07/22] docs(issues): [#2902] state the coverage ranking from the EPIC table The ranking cited a git-ignored assessment no reader can open; it now gives the unit-only figures of the EPIC coverage table. Review finding F6 of #2903. Co-Authored-By: Claude Opus 5.5 --- docs/issues/open/1347-overhaul-packages-testing/EPIC.md | 2 +- docs/issues/open/2902-1347-add-tests-tracker-core/ISSUE.md | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/issues/open/1347-overhaul-packages-testing/EPIC.md b/docs/issues/open/1347-overhaul-packages-testing/EPIC.md index 4fc6ced997..c9a6014aab 100644 --- a/docs/issues/open/1347-overhaul-packages-testing/EPIC.md +++ b/docs/issues/open/1347-overhaul-packages-testing/EPIC.md @@ -99,7 +99,7 @@ Status values: `TODO`, `IN_PROGRESS`, `BLOCKED`, `DONE`. | 11 | #2824 - Add tests to the primitives package | `docs/issues/closed/2824-1347-add-tests-primitives/ISSUE.md` | DONE | S0 (the spec, #2828), S1 (the `PeerRole` JSON casing fix, #2834), S2 (the `peer.rs` tests, #2841), S3 (the configuration defaults and bounded values, #2852) and S4 (`swarm_metadata.rs`, the no-change files, the mutation run, the manual checks, #2864) are merged; the issue is closed. Unit-only lines 60.56% → 94.07%. Findings F1 (fixed through #2811), F2 (fixed in S1), F3 (#2804), F4 (#2823), F6 (#2838, #2850) and F5 (#2876, drafted through #2865) have owners. | | 12 | #2838 - UDP tracker accepts announces with a negative left, uploaded or downloaded | `docs/issues/closed/2838-1347-udp-reject-negative-announce-bytes/ISSUE.md` | DONE | Bug found by the #2824 primitives tests work. Fixed by the standalone issue #2850 (`docs/issues/closed/2850-non-negative-number-of-bytes/ISSUE.md`): its implementation PR #2872 merged on 2026-11-16 and closed this issue. The patch of PR #2839 was not merged; its tests were taken over by PR #2872. | | 13 | #2876 - Move `peer::Id::new` to a realistic test helper and decide whether `peer::fixture` goes behind a `testing` feature | `docs/issues/closed/2876-1347-peer-id-test-helper/ISSUE.md` | DONE | Finding F5 of #2824. Spec through #2878, implementation through #2888: `Id::new` removed, `qbittorrent_peer_id` helper, `peer::fixture` behind the new `testing` feature of `primitives`, test-support ADR amended. Breaking for the published `primitives` 3.0.0; adds to the 4.0.0 it owes (#2583). | -| 14 | #2902 - Add tests to the tracker-core package | `docs/issues/open/2902-1347-add-tests-tracker-core/ISSUE.md` | TODO | Largest remaining coverage gap among the core crates: unit-only lines 80.31% (MySQL/PostgreSQL drivers 0-4%, SQLite failure branches, `statistics/` reached only by the integration binary). Slices S0-S5 proposed; S0 is the spec-only PR. | +| 14 | #2902 - Add tests to the tracker-core package | `docs/issues/open/2902-1347-add-tests-tracker-core/ISSUE.md` | TODO | Lowest unit-only lines of the packages in the EPIC coverage table: 80.31% (MySQL/PostgreSQL drivers 0-4%, SQLite failure branches, `statistics/` reached only by the integration binary). Slices S0-S5 proposed; S0 is the spec-only PR. | | 15 | Additional package-testing subissues | Create a folder-style spec when a concrete package need is identified | TODO | Permitted but not required upfront; retain scope in this EPIC. | ## Package Coverage Tracking diff --git a/docs/issues/open/2902-1347-add-tests-tracker-core/ISSUE.md b/docs/issues/open/2902-1347-add-tests-tracker-core/ISSUE.md index 89e9aeae49..45523347ee 100644 --- a/docs/issues/open/2902-1347-add-tests-tracker-core/ISSUE.md +++ b/docs/issues/open/2902-1347-add-tests-tracker-core/ISSUE.md @@ -62,8 +62,9 @@ executable lines are at or above 98% unit-only coverage. The remaining gap is co the integration binary. - Many `?` regions (a failing `Database` or whitelist) are untested in the handlers and repositories. -The Phase 3 assessment of EPIC #1347 ranked it as the largest remaining gap among the published -core crates. Since the integration binary reaches only the `statistics/` files that no unit test +Its unit-only lines (80.31%) are the lowest of the packages with a unit-only figure in the EPIC +coverage table: the latest figures there are `primitives` 94.07%, `axum-rest-api-server` 96.67%, +`udp-core` 98.04%, `udp-server` 98.18% and `http-core` 99.28%. Since the integration binary reaches only the `statistics/` files that no unit test reaches, the aggregate and unit-only numbers differ in exactly that area. ## Baseline Coverage @@ -476,4 +477,3 @@ progress-log entry saying none was needed. - Parent EPIC: https://github.com/torrust/torrust-tracker/issues/1347 - Template sub-issues: #2824, #2637, #1349, #1348 (`docs/issues/closed/`) - Package: `packages/tracker-core/` -- Phase 3 assessment (coordinator, git-ignored): `.tmp/phase3-assessment.md` From 058b52a83fedefd325fb90f170aeaecfcbe37a61 Mon Sep 17 00:00:00 2001 From: josecelano-bot Date: Tue, 17 Nov 2026 12:43:25 +0000 Subject: [PATCH 08/22] docs(issues): [#1347] restore the 10:57 EPIC log entry and append T1b The T1b commit rewrote the 10:57 entry in place; its original text is restored and a dated entry records T1b. The blank line that split the progress log into a loose list is removed. Review findings F5 and F9 of #2903. Co-Authored-By: Claude Opus 5.5 --- docs/issues/open/1347-overhaul-packages-testing/EPIC.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/issues/open/1347-overhaul-packages-testing/EPIC.md b/docs/issues/open/1347-overhaul-packages-testing/EPIC.md index c9a6014aab..d6023e4b2f 100644 --- a/docs/issues/open/1347-overhaul-packages-testing/EPIC.md +++ b/docs/issues/open/1347-overhaul-packages-testing/EPIC.md @@ -6,7 +6,7 @@ epic: null github-issue: 1347 spec-path: docs/issues/open/1347-overhaul-packages-testing/EPIC.md epic-owner: josecelano -last-updated-utc: "2026-11-17 12:16" +last-updated-utc: "2026-11-17 12:43" semantic-links: skill-links: - create-issue @@ -358,8 +358,8 @@ For each subissue implementation, the completion policy is: - 2026-11-15 21:22 UTC - Claude Code (Opus 5.5) - Row 12 (#2838): the fix is the implementation of the standalone issue #2850, PR #2872 (open), which closes #2838 on merge. It removes the `primitives` test that pinned a negative `left` as a seeder (finding F6 of #2824) and the `-1` rows of the role table. - 2026-11-16 14:07 UTC - Claude Code (Opus 5.5) - #2838 closed by PR #2872 (merged 2026-11-16 14:05 UTC); row 12 set to `DONE` and the specifications of #2838 and #2850 archived to `docs/issues/closed/`. - 2026-11-16 21:52 UTC - Claude Code (Opus 5.5) - #2876 closed by PR #2888 (merged 2026-11-16 21:49 UTC); row 13 set to `DONE` and the spec archived to `docs/issues/closed/2876-1347-peer-id-test-helper/`. - -- 2026-11-17 10:57 UTC - Claude Code (Sonnet 5.5) - Created #2902 (`tracker-core`, row 14; the link under #1347 is set by the maintainer). Clean baseline at `5833cdae9`, filtered to the package source: unit-only (`--all-features --lib`) lines 80.31% (4,099 / 5,104), regions 80.20%, functions 72.01%, 157 unit tests; aggregate lines 82.15%; integration-only 44.05% (12 tests). The MySQL and PostgreSQL driver suites skip themselves without Docker and two environment variables, so those 10 files count as 0-4% covered; with the suites running (Docker) the aggregate is lines 93.80% (T1b). Delivered in slices S0-S5; the row stays `TODO` until the first implementation slice starts. +- 2026-11-17 10:57 UTC - Claude Code (Sonnet 5.5) - Created #2902 (`tracker-core`, row 14; the link under #1347 is set by the maintainer). Clean baseline at `5833cdae9`, filtered to the package source: unit-only (`--all-features --lib`) lines 80.31% (4,099 / 5,104), regions 80.20%, functions 72.01%, 157 unit tests; aggregate lines 82.15%; integration-only 44.05% (12 tests). The MySQL and PostgreSQL driver suites skip themselves without Docker and two environment variables, so those 10 files count as 0-4% covered; the container-gated scope is not yet measured. Delivered in slices S0-S5; the row stays `TODO` until the first implementation slice starts. +- 2026-11-17 12:43 UTC - Claude Code (Opus 5.5) - #2902 T1b, measured on 2026-11-17 after the maintainer allowed pulling the `mysql:8.0` and `postgres:16` images: with both driver suites running, the `tracker-core` aggregate is lines 93.80% (4,830 / 5,149). Correction: the commit that recorded T1b edited the 10:57 entry above in place; its original text is restored (review finding F9 of #2903). ## Acceptance Criteria From 4ce9553624da61e0ca50dce82ebe7584b1907abd Mon Sep 17 00:00:00 2001 From: josecelano-bot Date: Tue, 17 Nov 2026 12:45:10 +0000 Subject: [PATCH 09/22] docs(issues): [#2902] define the async, cleanup and fixture rules Add the responsibility and ownership map, the normal and failure-path lifetime invariants, the absolute deadlines and the design-review checkpoint (T2b) that create-issue requires for listener and temporary database tests. Record the temporary SQLite file leak of the existing tests as finding F5 with question Q7. Review finding F1 of #2903. Co-Authored-By: Claude Opus 5.5 --- .../2902-1347-add-tests-tracker-core/ISSUE.md | 46 ++++++++++++++++++- 1 file changed, 44 insertions(+), 2 deletions(-) diff --git a/docs/issues/open/2902-1347-add-tests-tracker-core/ISSUE.md b/docs/issues/open/2902-1347-add-tests-tracker-core/ISSUE.md index 45523347ee..7a5b233823 100644 --- a/docs/issues/open/2902-1347-add-tests-tracker-core/ISSUE.md +++ b/docs/issues/open/2902-1347-add-tests-tracker-core/ISSUE.md @@ -187,6 +187,44 @@ Questions each file's record must answer; the first four are already in the - The swarm registry and the `events` package own the registry state and the drain behavior: this package tests its own wiring and statistics, not theirs. +## Asynchronous Work, Cleanup and Test Fixtures + +S1 spawns and cancels the statistics listeners, S2, S4 and S5 open SQLite databases on disk, and +each slice may add a failing fake of the persistence traits, so the `create-issue` rules for +asynchronous I/O, resource cleanup and reusable fixtures apply. Each file's decision record that adds +such a test restates the parts it uses. + +Responsibility and ownership map: + +| Resource | Created by | Owner of normal cleanup | Owner of failure and drop-path cleanup | +| --- | --- | --- | --- | +| Spawned listener task (`run_*_event_listener`) | The test | The test: cancels the `CancellationToken`, then awaits the `JoinHandle` | The `#[tokio::test]` runtime: when a test panics, dropping the per-test runtime drops the task. The test never relies on a detached task finishing | +| Event sender and receiver | The test, through the swarm registry's channel | The test drops the sender after the last event | Dropped with the test's stack frame | +| SQLite database file (new tests) | The test, in a `tempfile::TempDir` it owns | `TempDir` drop at the end of the test | `TempDir` drop during unwinding after a failed assertion | +| SQLite database file (existing tests) | `ephemeral_sqlite_database()` (`packages/test-helpers/src/configuration.rs:85`), directly or through `test_helpers::ephemeral_configuration` | **None today**: the helper returns a bare `PathBuf` under `env::temp_dir()`, so every run leaves `data_*.db` files behind (finding F5) | None today (F5) | +| Failing fake of a persistence trait | The slice's test module | Dropped with the test | Dropped with the test; holds no global or shared state | +| MySQL and PostgreSQL containers | `testcontainers` in the existing suites | `testcontainers` (unchanged by this issue) | `testcontainers` (unchanged) | +| Drain of queued events after cancellation | `torrust-tracker-events` (`drain`) | The `events` package; this package tests only that its listeners call it | The `events` package | + +Lifetime invariants: + +- Normal path: when a test returns, its listener task has finished (the `JoinHandle` was awaited), its + temporary directory is removed and no fake is shared with another test. +- Failure and drop path: a failed assertion unwinds through the `TempDir` (directory removed) and + ends the per-test runtime (task dropped); no test leaves a running task or a new file behind. +- New tests do not call `ephemeral_sqlite_database()` without a cleanup owner. + +Deadlines: every awaited operation that waits on another task (awaiting a listener's `JoinHandle`, +waiting until an event has been handled, a drain) is wrapped in `tokio::time::timeout` with an +absolute deadline (5 seconds unless the record justifies another value) and fails with a message +naming the operation. Database calls on a local temporary SQLite file use the same bound when they +can wait on the pool. No test sleeps for a fixed time to wait for a result. + +Design-review checkpoint (T2b): after the first passing vertical slice, meaning the first listener +test (spawn, handle one event, cancel, join under a deadline) and the first `TempDir`-owned SQLite +test pass in S1, stop and ask the maintainer to review the fixture shape before any other file +reuses it. + ## Bug-Fix Process The issue as a whole is coverage and test-design work, not a known defect. A defect found is handed @@ -228,6 +266,7 @@ fixed in this issue; each is a proposal for the maintainer. | F2 | The row-to-`PeerKey` mapping and `parse_valid_until` (negative timestamp to `MalformedDatabaseRecord`) are copied in the SQLite, MySQL and PostgreSQL `auth_key_store.rs`; the `u32` conversion of the aggregate metric is copied likewise. A test of the SQLite copy protects none of the others, and Docker-less tests cannot reach the MySQL and PostgreSQL copies. | `parse_valid_until` is identical in the three files (MySQL and PostgreSQL lines 119-125, SQLite lines 122-128) | A refactor issue extracting one helper (Q4); until then each driver's copy is assessed in its own record. | OPEN (proposed) | | F3 | `authentication::key::Key` derives `Deserialize` over its inner `String`, so deserializing a key skips the 32-character, ASCII-alphanumeric validation of `Key::new`. To confirm in the `peer_key.rs` record: where (if anywhere) a `Key` is deserialized from untrusted input (REST path and JSON are the candidates). | `authentication/key/peer_key.rs:127` | Confirm first; if reachable, a bug issue under `fix-bug`. | TO CONFIRM | | F4 | `PersistedWhitelist::add` and `remove` read `is_info_hash_whitelisted` and then write, without a transaction; two concurrent adds of the same hash can reach the driver's duplicate-insert error that `it_should_fail_trying_to_add_the_same_infohash_twice` shows is an error. Probably benign (the in-memory whitelist is the read path), but the behavior is unspecified. | `whitelist/repository/persisted.rs:29-54` | Confirm with a throwaway test in the whitelist record; at most a documentation or small fix issue. | TO CONFIRM | +| F5 | `ephemeral_sqlite_database()` (`packages/test-helpers/src/configuration.rs:85`) returns a bare `PathBuf` under `env::temp_dir()` with no cleanup owner. In this package it is called directly by `src/test_helpers.rs`, three other source files (`databases/driver/sqlite/mod.rs`, `sqlite/schema_migrator.rs`, `authentication/key/repository/persisted.rs`) and `tests/common/fixtures.rs`, and indirectly through `test_helpers::ephemeral_configuration` by most test modules that open a database, so every run leaves `data_*.db` files behind, the leak #2637 fixed for its own package in its S5. | Code reading, 2026-11-17 (review finding F1 of #2903); `grep -rn ephemeral_sqlite_database packages/tracker-core` | Q7: fix the package's shared test helpers once, in S1, as a test-support commit, or hand off to a separate issue. New tests never use the helper without a cleanup owner either way. | OPEN (proposed) | ## Implementation Plan @@ -238,6 +277,7 @@ Status values: `TODO`, `IN_PROGRESS`, `BLOCKED`, `DONE`, `DEFERRED`. | T1 | DONE | Coverage evidence and complete module inventory | [coverage-evidence.md](coverage-evidence.md): baseline in four scopes, per-file uncovered groups, property candidacy, initial hypothesis for the 62 files. Delivered with this spec (S0). | | T1b | DONE | Measure the container-gated scope | The `--all-features` run with `TORRUST_TRACKER_CORE_RUN_MYSQL_DRIVER_TEST` and `TORRUST_TRACKER_CORE_RUN_POSTGRES_DRIVER_TEST` set (images pulled with the maintainer's permission, 2026-11-17): lines 93.80%. Recorded in `coverage-evidence.md`; informs the scope of S3. | | T2 | TODO | Shared plan guidance | `test-refactor-plans/README.md`: two-phase sequence, guardrails, toolchain-pinned commands. First test slice (S1). | +| T2b | TODO | Design-review checkpoint | After the first listener test and the first `TempDir`-owned SQLite test pass in S1, the maintainer reviews the fixture shape (see [Asynchronous Work, Cleanup and Test Fixtures](#asynchronous-work-cleanup-and-test-fixtures)) before other files reuse it. | | T3 | TODO | Process every ledger row through the per-file workflow | Each row ends in exactly one of: test added, no-change with reason, deferred with owner. | | T4 | TODO | Bounded mutation assessment | `mutation-evidence.md`: configuration, survivors, reason for each unviable mutant. Last slice. | | T5 | TODO | Reconcile evidence and progress state | Ledger, records, slice table, acceptance rows and both EPIC coverage tables agree; grep for `status: proposed` and stray `TODO` labels in finished records. | @@ -384,6 +424,7 @@ Each has a recommendation; the maintainer decides. | Q4 | Extract the duplicated `parse_valid_until` and row mapping (F2)? | Separate refactor issue after this one; tests per driver meanwhile. | | Q5 | Is `quickcheck` acceptable for `Key` and the expiry bounds, as in #2824 and #1348? | Decide in the `peer_key.rs` and `key/mod.rs` records; add only if examples leave a surviving mutant. | | Q6 | Is the six-slice plan (S0-S5) right, or should S4 and S5 merge? | Keep six: S4 and S5 are mostly failing-fake cases and no-change decisions; merging them mixes a risky area with the closing tasks. | +| Q7 | The temporary SQLite files the existing tests leave behind (F5): fix them here or hand them off? | Fix here, as the first commit of S1: make `test_helpers::ephemeral_configuration` and the integration fixtures return a `TempDir` guard with the configuration, a package-local test-support change with no production change; the shared `test-helpers` function stays for the other packages. | Which EPIC row is the "unit-only" baseline? Recommendation: `--all-features --lib` (80.31%), the same command as the other packages, with the container-gated figure reported separately in @@ -462,8 +503,9 @@ Reviewed against observed behavior after the last slice, before the issue is clo - A test of a suspected defect would pin wrong behavior; mitigate with the findings procedure. - Failing `Database` fakes can become large; mitigate by reusing the `testing` feature mock and one shared fake per slice, justified in its record. -- Tests that need a SQLite file must use temp files unique per test; mitigate with the existing - `ephemeral_sqlite_database` helper. +- Tests that need a SQLite file can leak it: `ephemeral_sqlite_database()` has no cleanup owner + (F5); mitigate by giving every new test a `tempfile::TempDir` it owns, added as a dev-dependency + under `add-rust-dependency`. - `develop` moves under the work; mitigate by re-measuring at every slice start. ## Implementation Completion Review From 3d20b5271ac8e2707064b5829a5df46d064b0dfb Mon Sep 17 00:00:00 2001 From: josecelano-bot Date: Tue, 17 Nov 2026 12:46:07 +0000 Subject: [PATCH 10/22] docs(issues): [#2902] correct the log entry that missed the first review Append a correction: the first review of #2903 arrived at 12:08:23 UTC, before the 12:16 entry said no review had arrived. Review finding F7 of #2903. Co-Authored-By: Claude Opus 5.5 --- docs/issues/open/2902-1347-add-tests-tracker-core/ISSUE.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/issues/open/2902-1347-add-tests-tracker-core/ISSUE.md b/docs/issues/open/2902-1347-add-tests-tracker-core/ISSUE.md index 7a5b233823..89c0a998a2 100644 --- a/docs/issues/open/2902-1347-add-tests-tracker-core/ISSUE.md +++ b/docs/issues/open/2902-1347-add-tests-tracker-core/ISSUE.md @@ -9,7 +9,7 @@ github-issue: 2902 spec-path: docs/issues/open/2902-1347-add-tests-tracker-core/ISSUE.md branch: "2902-1347-add-tests-tracker-core-spec" related-pr: null -last-updated-utc: "2026-11-17 12:16" +last-updated-utc: "2026-11-17 12:45" semantic-links: skill-links: - create-issue @@ -411,6 +411,7 @@ The first slice's record checks the grouping against `find packages/tracker-core - 2026-11-17 10:57 UTC - Claude Code (Sonnet 5.5) - Created issue #2902; measured the baseline at `5833cdae9` in four scopes; drafted this specification and the coverage evidence; registered the subissue in EPIC #1347 (row 14). Open questions Q1-Q6 are for the maintainer. - 2026-11-17 12:16 UTC - Claude Code (Sonnet 5.5) - The maintainer allowed the Docker image pull (Q1); T1b measured the container-gated scope: lines 93.80% (server drivers 58-96% per file). No review of #2903 arrived within 60 minutes. +- 2026-11-17 12:45 UTC - Claude Code (Opus 5.5) - Correction of the 12:16 UTC entry above: its last sentence is wrong as written. The poller I started right after the PR opened (11:05:26 UTC) timed out after its 60-minute wait with no review, but Cameron (`da2ce7`) had submitted a review of `690cfb5f5` with findings F1-F6 at 12:08:23 UTC, before that entry was written, and the six threads had no reply. A second review of `2b0c3fe36` (F7-F10) followed at 12:28:40 UTC. The ten findings are processed in `docs/pr-reviews/pr-2903-review/PR-REVIEW.md` (review finding F7 of #2903). ## Open Design Questions From 37d9b1218712fed889439b541fe4886318b65907 Mon Sep 17 00:00:00 2001 From: josecelano-bot Date: Tue, 17 Nov 2026 12:46:47 +0000 Subject: [PATCH 11/22] docs(issues): [#2902] state the measured run times behind finding F1 The F1 evidence claimed a per-test time of 0.00 s that no log shows; it now cites the whole-run times of both logs. Found by the sweep for review finding F7 of #2903. Co-Authored-By: Claude Opus 5.5 --- docs/issues/open/2902-1347-add-tests-tracker-core/ISSUE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/issues/open/2902-1347-add-tests-tracker-core/ISSUE.md b/docs/issues/open/2902-1347-add-tests-tracker-core/ISSUE.md index 89c0a998a2..af9af3eb86 100644 --- a/docs/issues/open/2902-1347-add-tests-tracker-core/ISSUE.md +++ b/docs/issues/open/2902-1347-add-tests-tracker-core/ISSUE.md @@ -262,7 +262,7 @@ fixed in this issue; each is a proposal for the maintainer. | ID | Finding | Evidence | Proposed owner | Status | | --- | --- | --- | --- | --- | -| F1 | `run_mysql_driver_tests` and `run_postgres_driver_tests` return `Ok(())` immediately when `TORRUST_TRACKER_CORE_RUN_*_DRIVER_TEST` is unset, so `cargo test --all-features` reports them as passed without running anything, and the coverage runs count both drivers as 0-4% covered. A reader of a green run cannot tell. | `databases/driver/mysql/mod.rs:204-207`, `postgres/mod.rs:185-188`; the coverage log shows both tests `ok` in 0.00 s | A separate test-design issue: make the skip visible (`#[ignore = "..."]`, or a loud skip message) and keep the `db-compatibility` workflow as it is. Not part of this issue (Q2). | OPEN (proposed) | +| F1 | `run_mysql_driver_tests` and `run_postgres_driver_tests` return `Ok(())` immediately when `TORRUST_TRACKER_CORE_RUN_*_DRIVER_TEST` is unset, so `cargo test --all-features` reports them as passed without running anything, and the coverage runs count both drivers as 0-4% covered. A reader of a green run cannot tell. | `databases/driver/mysql/mod.rs:204-207`, `postgres/mod.rs:185-188`; the unit-only coverage log reports both tests `ok` in a 157-test run that finished in 0.13 s, and the run with the variables set took 9.32 s | A separate test-design issue: make the skip visible (`#[ignore = "..."]`, or a loud skip message) and keep the `db-compatibility` workflow as it is. Not part of this issue (Q2). | OPEN (proposed) | | F2 | The row-to-`PeerKey` mapping and `parse_valid_until` (negative timestamp to `MalformedDatabaseRecord`) are copied in the SQLite, MySQL and PostgreSQL `auth_key_store.rs`; the `u32` conversion of the aggregate metric is copied likewise. A test of the SQLite copy protects none of the others, and Docker-less tests cannot reach the MySQL and PostgreSQL copies. | `parse_valid_until` is identical in the three files (MySQL and PostgreSQL lines 119-125, SQLite lines 122-128) | A refactor issue extracting one helper (Q4); until then each driver's copy is assessed in its own record. | OPEN (proposed) | | F3 | `authentication::key::Key` derives `Deserialize` over its inner `String`, so deserializing a key skips the 32-character, ASCII-alphanumeric validation of `Key::new`. To confirm in the `peer_key.rs` record: where (if anywhere) a `Key` is deserialized from untrusted input (REST path and JSON are the candidates). | `authentication/key/peer_key.rs:127` | Confirm first; if reachable, a bug issue under `fix-bug`. | TO CONFIRM | | F4 | `PersistedWhitelist::add` and `remove` read `is_info_hash_whitelisted` and then write, without a transaction; two concurrent adds of the same hash can reach the driver's duplicate-insert error that `it_should_fail_trying_to_add_the_same_infohash_twice` shows is an error. Probably benign (the in-memory whitelist is the read path), but the behavior is unspecified. | `whitelist/repository/persisted.rs:29-54` | Confirm with a throwaway test in the whitelist record; at most a documentation or small fix issue. | TO CONFIRM | From 2c3d8ed11d2296b91c79a22065f2f1e1976b89a2 Mon Sep 17 00:00:00 2001 From: josecelano-bot Date: Tue, 17 Nov 2026 12:53:03 +0000 Subject: [PATCH 12/22] docs(pr-reviews): [#2902] record the review rounds of #2903 Audit record for the two review rounds of #2903 (findings F1-F10): every finding fixed, replied to and resolved. Co-Authored-By: Claude Opus 5.5 --- docs/pr-reviews/pr-2903-review/PR-REVIEW.md | 215 ++++++++++++++++++++ 1 file changed, 215 insertions(+) create mode 100644 docs/pr-reviews/pr-2903-review/PR-REVIEW.md diff --git a/docs/pr-reviews/pr-2903-review/PR-REVIEW.md b/docs/pr-reviews/pr-2903-review/PR-REVIEW.md new file mode 100644 index 0000000000..094d843ce8 --- /dev/null +++ b/docs/pr-reviews/pr-2903-review/PR-REVIEW.md @@ -0,0 +1,215 @@ +--- +semantic-links: + skill-links: + - process-pr-review + related-artifacts: + - .claude/skills/process-pr-review/SKILL.md +--- + + + +# PR #2903 Review Audit + +Source: pull-request reviews and inline review threads for https://github.com/torrust/torrust-tracker/pull/2903. + +## Ownership + +The PR author owns this tracked audit record. Reviewers, including repository review agents, +deliver findings through GitHub and have no repository-artifact obligation. + +- Post-merge workflow approval: N/A + +## Status Values + +- Relationship: `ORIGINAL`, `RE_RAISE_OF:` +- Disposition: `FIXED`, `NO_ACTION`, `SUPERSEDED`, `FOLLOW_UP` +- Thread state: `OPEN`, `RESOLVED`, `NON_RESOLVABLE`, `SUPERSEDED`. `OPEN` applies prospectively + to audits created or updated for approved follow-up work; historical audits remain valid without + bulk migration. +- Severity: `Blocker`, `Major`, `Minor`, `Nit`, `Suggestion`; append `(inferred)` when derived + from free prose. +- Author class: `Copilot`, `Human`, `Unknown` +- Category: `link-integrity`, `formatting`, `metadata`, `testing`, `correctness`, + `documentation`, `maintainability`, `security`, `other` +- An outdated thread whose concern was fixed is `FIXED`/`RESOLVED`, even when GitHub marks the + original thread outdated after the push. For in-PR feedback, use `NO_ACTION`/`SUPERSEDED` only + for a duplicate, superseded, or no-change concern. A post-merge `NO_ACTION` requires maintainer + approval to decline the follow-up work. +- When the current identity cannot resolve a thread (`viewerCanResolve` is `false`), keep the + disposition established from the current tree and record `Thread state=OPEN`. The reviewer or PR + author resolves it; permission says nothing about whether the concern was fixed. + +## Findings + +Round 1 is da2ce7's review `5938095803` of `690cfb5f5` (submitted as an approval, later dismissed by the +push), round 2 his review `5938377458` of `2b0c3fe36` (comment). Their inline findings keep the +reviewer's IDs F1 to F10; the review bodies only summarize them. + +| Finding ID | Review finding reference | Author class | Severity | Category | Relationship | Disposition | Thread state | +| ---------- | ------------------------ | ------------ | -------- | -------- | ------------ | ----------- | ------------ | +| F1 | review-finding:pr-2903-f1 | Human | Minor | testing | ORIGINAL | FIXED | RESOLVED | +| F2 | review-finding:pr-2903-f2 | Human | Minor | correctness | ORIGINAL | FIXED | RESOLVED | +| F3 | review-finding:pr-2903-f3 | Human | Minor | correctness | ORIGINAL | FIXED | RESOLVED | +| F4 | review-finding:pr-2903-f4 | Human | Nit | documentation | ORIGINAL | FIXED | RESOLVED | +| F5 | review-finding:pr-2903-f5 | Human | Nit | formatting | ORIGINAL | FIXED | RESOLVED | +| F6 | review-finding:pr-2903-f6 | Human | Nit | documentation | ORIGINAL | FIXED | RESOLVED | +| F7 | review-finding:pr-2903-f7 | Human | Minor | correctness | ORIGINAL | FIXED | RESOLVED | +| F8 | review-finding:pr-2903-f8 | Human | Minor | documentation | ORIGINAL | FIXED | RESOLVED | +| F9 | review-finding:pr-2903-f9 | Human | Nit | documentation | ORIGINAL | FIXED | RESOLVED | +| F10 | review-finding:pr-2903-f10 | Human | Minor | metadata | ORIGINAL | FIXED | RESOLVED | + +## Finding Details + +### F1 - The async, cleanup and fixture rules of `create-issue` are missing + +- PR number: 2903 +- Source review ID: 5938095803 +- Reviewer finding ID: F1 +- Source URL: https://github.com/torrust/torrust-tracker/pull/2903#discussion_r4599332949 +- Concern: The `create-issue` skill requires, for asynchronous I/O, resource cleanup or reusable fixtures, a responsibility and ownership map, normal and failure-path lifetime invariants, absolute deadlines and a design-review checkpoint after the first vertical slice; the spec has none, and its mitigation offers `ephemeral_sqlite_database`, which returns a bare `PathBuf` with no cleanup owner, the leak #2637 fixed in its S5. +- Solution: Added the section `Asynchronous Work, Cleanup and Test Fixtures` to `ISSUE.md`: an ownership map (listener tasks, channels, SQLite files, fakes, containers, the `events` drain), the normal and failure-path invariants, a 5-second absolute deadline for every wait on another task, and the design-review checkpoint T2b in the task table. New tests own a `tempfile::TempDir`. The existing leak is recorded as finding F5 with question Q7 (recommendation: fix the package's shared test helpers in S1), and the risk line no longer offers the helper as a mitigation. +- Current-tree verification: `grep -n 'Asynchronous Work, Cleanup and Test Fixtures\|T2b\|^| F5 |\|^| Q7 |' docs/issues/open/2902-1347-add-tests-tracker-core/ISSUE.md` shows the section, the task, the finding and the question; `packages/test-helpers/src/configuration.rs:85-89` returns `temp_directory.join(...)` with no guard. +- Resolution reference: docs(issues): [#2902] define the async, cleanup and fixture rules +- Follow-up PR URL: N/A +- Reply URL: https://github.com/torrust/torrust-tracker/pull/2903#discussion_r4599795368 + +### F2 - The scope without the feature runs 155 unit tests, not 157 + +- PR number: 2903 +- Source review ID: 5938095803 +- Reviewer finding ID: F2 +- Source URL: https://github.com/torrust/torrust-tracker/pull/2903#discussion_r4599332966 +- Concern: The two driver tests sit in modules gated on `db-compatibility-tests`, so a plain `--lib` run compiles 155 tests; `coverage-evidence.md:34` and `ISSUE.md:80` said 157. +- Solution: Both rows now say 155 and why. +- Current-tree verification: `grep -n '^running' .tmp/cov/log.txt` (the local log of the four baseline runs) prints `running 155 tests` for the `--lib` run without the feature; `grep -n '155 unit' docs/issues/open/2902-1347-add-tests-tracker-core/*.md` shows both rows. +- Resolution reference: docs(issues): [#2902] count 155 unit tests in the scope without the feature +- Follow-up PR URL: N/A +- Reply URL: https://github.com/torrust/torrust-tracker/pull/2903#discussion_r4599796065 + +### F3 - Uncovered-line groups mixed test-module lines and production regions + +- PR number: 2903 +- Source review ID: 5938095803 +- Reviewer finding ID: F3 +- Source URL: https://github.com/torrust/torrust-tracker/pull/2903#discussion_r4599332974 +- Concern: Several groups classed test-module lines as production regions (`whitelist/authorization.rs:139`, `authentication/key/repository/persisted.rs:96`, `sqlite/mod.rs:103` and `:119`, `listener.rs:283-284`, `databases/error.rs:160` and `:173`) and one production region as a test assertion (`statistics/persisted/downloads.rs:133`). +- Solution: Each group now lists production lines first and test-module lines after a slash, with the class `test code` for the latter; ledger rows 6, 7, 11, 13, 28, 29, 37, 41 and 42 follow. The sweep of every group against the `#[cfg(test)]` line of its file found three more production regions the first table had called `no decision` or `one region`: `statistics/mod.rs:49` (the usage-statistics-disabled branch), `peer_key.rs:64` (the mixed-expiry `PartialEq` arm) and `torrent/manager.rs:66` (a failing-database `?`). +- Current-tree verification: Read each cited line at `5833cdae9`-equivalent source (`packages/` unchanged on this branch) and the first `#[cfg(test)]` line of each file (`grep -n 'cfg(test)\]'`), for example `authentication/handler.rs` tests start at 288, `databases/error.rs` at 150, `statistics/event/listener.rs` at 237. +- Resolution reference: docs(issues): [#2902] separate production and test-module uncovered lines +- Follow-up PR URL: N/A +- Reply URL: https://github.com/torrust/torrust-tracker/pull/2903#discussion_r4599796661 + +### F4 - `parse_valid_until` line ranges were off + +- PR number: 2903 +- Source review ID: 5938095803 +- Reviewer finding ID: F4 +- Source URL: https://github.com/torrust/torrust-tracker/pull/2903#discussion_r4599332988 +- Concern: The function is at lines 119-125 in the MySQL and PostgreSQL copies and 122-128 in the SQLite copy, not 119-128 in all three. +- Solution: The F2 evidence cites both ranges. +- Current-tree verification: `grep -n 'fn parse_valid_until' -A6 packages/tracker-core/src/databases/driver/*/auth_key_store.rs` shows 119-125, 122-128 and 119-125. +- Resolution reference: docs(issues): [#2902] cite the exact parse_valid_until line ranges +- Follow-up PR URL: N/A +- Reply URL: https://github.com/torrust/torrust-tracker/pull/2903#discussion_r4599797283 + +### F5 - The EPIC log entry followed the blank line that closed the list + +- PR number: 2903 +- Source review ID: 5938095803 +- Reviewer finding ID: F5 +- Source URL: https://github.com/torrust/torrust-tracker/pull/2903#discussion_r4599332994 +- Concern: Appending the 10:57 entry after the blank line before `## Acceptance Criteria` split the progress log into a loose list. +- Solution: The blank line is removed, so the entries form one tight list again. +- Current-tree verification: `git diff 690cfb5f5 -- docs/issues/open/1347-overhaul-packages-testing/EPIC.md` shows the removed blank line and no other change to the earlier entries. +- Resolution reference: docs(issues): [#1347] restore the 10:57 EPIC log entry and append T1b +- Follow-up PR URL: N/A +- Reply URL: https://github.com/torrust/torrust-tracker/pull/2903#discussion_r4599797846 + +### F6 - The ranking rested on a git-ignored assessment + +- PR number: 2903 +- Source review ID: 5938095803 +- Reviewer finding ID: F6 +- Source URL: https://github.com/torrust/torrust-tracker/pull/2903#discussion_r4599333003 +- Concern: `ISSUE.md:65` and the EPIC row 14 note cited the Phase 3 assessment, whose only source is the git-ignored `.tmp/phase3-assessment.md`. +- Solution: The spec now states the ranking from the EPIC coverage table (the unit-only figures of the five packages that have one), the EPIC row says the same, and the reference to the git-ignored file is removed. +- Current-tree verification: `grep -rn -i 'phase3\|largest remaining' docs/issues/open/2902-1347-add-tests-tracker-core docs/issues/open/1347-overhaul-packages-testing/EPIC.md` prints nothing. +- Resolution reference: docs(issues): [#2902] state the coverage ranking from the EPIC table +- Follow-up PR URL: N/A +- Reply URL: https://github.com/torrust/torrust-tracker/pull/2903#discussion_r4599798461 + +### F7 - A log entry said no review arrived after one had + +- PR number: 2903 +- Source review ID: 5938377458 +- Reviewer finding ID: F7 +- Source URL: https://github.com/torrust/torrust-tracker/pull/2903#discussion_r4599550865 +- Concern: The 12:16 UTC entry says no review of #2903 arrived within 60 minutes, eight minutes after a review with six findings was submitted (12:08:23 UTC), and the six threads had no reply. +- Solution: Appended a correction entry to the spec's progress log (the log is append-only): the poller started when the PR opened (11:05:26 UTC) timed out with no review, the first review arrived at 12:08:23 UTC before the entry was written, and the findings are processed in this record. The sweep for statements that went further than what ran found one more: the F1 evidence claimed a per-test time of 0.00 s that no log shows; it now cites the run times of both logs. +- Current-tree verification: `gh-bot api repos/torrust/torrust-tracker/pulls/2903 --jq .created_at` prints `2026-11-17T11:05:26Z`; review `5938095803` was submitted at `2026-11-17T12:08:23Z`; the two `test result` lines of the coverage logs read `finished in 0.13s` and `finished in 9.32s`. +- Resolution reference: docs(issues): [#2902] correct the log entry that missed the first review +- Follow-up PR URL: N/A +- Reply URL: https://github.com/torrust/torrust-tracker/pull/2903#discussion_r4599799088 + +### F8 - The container-gated scope had no command and no per-file figures + +- PR number: 2903 +- Source review ID: 5938377458 +- Reviewer finding ID: F8 +- Source URL: https://github.com/torrust/torrust-tracker/pull/2903#discussion_r4599550883 +- Concern: The fifth scope existed only as row text, with no reproducible command and per-file results only as prose, and the reading note still said the figures above excluded the drivers. +- Solution: `coverage-evidence.md` now gives the command (both variables, after `cargo llvm-cov clean --workspace`, the separate target directory, the image tags) and the measured commit (`690cfb5f5`, whose `packages/` tree equals `5833cdae9`), adds a container-gated column to all 51 inventory rows, and the note says the four default rows exclude the drivers. +- Current-tree verification: `git diff --stat 5833cdae9 690cfb5f5 -- packages` prints nothing; the per-file inventory rows each have five columns (`awk -F'|'` counts 7 fields on all 51 rows). +- Resolution reference: docs(issues): [#2902] add the container-gated command and per-file column +- Follow-up PR URL: N/A +- Reply URL: https://github.com/torrust/torrust-tracker/pull/2903#discussion_r4599799711 + +### F9 - The EPIC 10:57 entry was rewritten instead of a new entry appended + +- PR number: 2903 +- Source review ID: 5938377458 +- Reviewer finding ID: F9 +- Source URL: https://github.com/torrust/torrust-tracker/pull/2903#discussion_r4599550894 +- Concern: The T1b commit edited the 10:57 EPIC entry so that an entry dated before the measurement reported it. +- Solution: The original 10:57 text is restored byte for byte from `690cfb5f5`, and a dated entry records T1b with a correction note. +- Current-tree verification: `git show 690cfb5f5:docs/issues/open/1347-overhaul-packages-testing/EPIC.md | sed -n 362p` equals the restored line; `git diff 690cfb5f5` shows only the row 14 note, the removed blank line and the appended entry in the log area. +- Resolution reference: docs(issues): [#1347] restore the 10:57 EPIC log entry and append T1b +- Follow-up PR URL: N/A +- Reply URL: https://github.com/torrust/torrust-tracker/pull/2903#discussion_r4599800327 + +### F10 - The PR description was stale + +- PR number: 2903 +- Source review ID: 5938377458 +- Reviewer finding ID: F10 +- Source URL: https://github.com/torrust/torrust-tracker/pull/2903#discussion_r4599550887 +- Concern: The description still said the container-gated scope was not measured and that Q1-Q6 were open; the merge tool copies it into the merge commit. +- Solution: The description was edited after the push: it states the T1b result, the async and fixture rules, findings F1-F5 and questions Q2-Q7 (Q1 answered), and names this audit record. +- Current-tree verification: `gh-bot pr view 2903 --repo torrust/torrust-tracker --json body` after the edit. +- Resolution reference: https://github.com/torrust/torrust-tracker/pull/2903#issuecomment-6948544053 +- Follow-up PR URL: N/A +- Reply URL: https://github.com/torrust/torrust-tracker/pull/2903#discussion_r4599800899 + +## Processing Log + +- 2026-11-17 12:48 UTC - Started audit late: the round 1 threads (12:08:23 UTC) and round 2 threads (12:28:40 UTC) had no reply before this record; the fixes were committed first, between 12:37 and 12:46 UTC, one commit per finding (F5 and F9 share one). +- 2026-11-17 12:51 UTC - Pushed the fix commits (head `37d9b1218`), edited the PR description and posted the F10 note at 12:51:13 UTC (issue comment 6948544053); replied to the ten threads between 12:51:24 and 12:51:57 UTC and resolved each after its reply. + +## Completion Rules + +- Re-derive the reply claim against the current tree before replying or resolving a thread. +- Reply on every resolvable thread before resolving it. +- For an outdated thread whose concern was fixed, record `Disposition=FIXED` and + `Thread state=RESOLVED`, even if GitHub marks the thread outdated after the push. For a + duplicate, superseded, or no-change in-PR thread, reply exactly + `Superseded by : .`, record `Disposition=NO_ACTION` and + `Thread state=SUPERSEDED`, then resolve it. A post-merge `NO_ACTION` requires maintainer + approval to decline the follow-up work. When the current identity cannot resolve a thread + (`viewerCanResolve` is `false`), still reply, keep the disposition established from the current + tree, and record `Thread state=OPEN`; the reviewer or PR author resolves it. +- A consolidated PR conversation response may cover multiple review rounds only when it names + every review ID and every finding ID with its disposition and resolution reference. Record its + durable URL in each related row. +- Cite a fix by its unique Conventional Commit subject or durable reply URL, never by a branch SHA + that can change after a rebase. +- Refresh review threads using GraphQL and confirm that no unresolved actionable thread remains. From 8c64552f198717df40164b03f6e25eeb0930aec9 Mon Sep 17 00:00:00 2001 From: josecelano-bot Date: Tue, 17 Nov 2026 12:57:09 +0000 Subject: [PATCH 13/22] docs(issues): [#2902] label production and test-module uncovered lines The slash between production and test-module lines read like a fraction and did not say which file a set belonged to in the multi-file rows. Each lines cell now labels its production and test-module lines, and the multi-file rows are split per file. Copilot review comments on #2903. Co-Authored-By: Claude Opus 5.5 --- .../coverage-evidence.md | 40 ++++++++++--------- 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/docs/issues/open/2902-1347-add-tests-tracker-core/coverage-evidence.md b/docs/issues/open/2902-1347-add-tests-tracker-core/coverage-evidence.md index 9adbe76d5a..ae7d6f208c 100644 --- a/docs/issues/open/2902-1347-add-tests-tracker-core/coverage-evidence.md +++ b/docs/issues/open/2902-1347-add-tests-tracker-core/coverage-evidence.md @@ -131,8 +131,9 @@ means the file is not reached). ## Uncovered Line Groups (unit-only, `--all-features --lib`) -Line numbers are those of `5833cdae9`. Where a file has a `#[cfg(test)]` module, production lines are -listed first and test-module lines after a `/`; a test-module line is never a decision to test. Classes: **3A** unit-testable now; **3B** needs a boundary +Line numbers are those of `5833cdae9`. Each row covers one file, or one family of files with the same +class; where a file has a `#[cfg(test)]` module, the lines column labels its `production:` lines and +its `test module:` lines separately. A test-module line is never a decision to test. Classes: **3A** unit-testable now; **3B** needs a boundary above a unit test (a container, a real database); **owned** by a collaborator or another issue; **no decision** (logging-only code, code-region artifacts); **test code** (lines in a `#[cfg(test)]` module or in test support). A @@ -145,28 +146,31 @@ module or in test support). A | `databases/driver/sqlite/auth_key_store.rs` | 18-100, 124-126 | Row-parse failure branches (`MalformedDatabaseRecord` for a bad key or a negative `valid_until`), `sqlx` failures, `parse_valid_until` negative case | 3A | Test through a temp SQLite file with a malformed row inserted by raw `sqlx`; the same helper is copied in three drivers (finding F2) | | `databases/driver/sqlite/torrent_metrics_store.rs` | 15-124 (16 of 45 lines uncovered) | Aggregate metric load/save error branches, `u32` conversion failure (`MalformedDatabaseRecord`) | 3A | Same technique | | `databases/driver/sqlite/whitelist_store.rs` | 18-75 (11 of 28) | Row-parse and query failure branches | 3A | Same technique | -| `databases/driver/sqlite/mod.rs` | 54, 58, 60, 62, 79 / 103, 119 | Production: the error branches of the aggregate-metric helpers (`load_torrent_aggregate_metric`: query failure, `try_get` failure, the `u32` conversion to `MalformedDatabaseRecord`; `save_torrent_aggregate_metric`: query failure). Test module: lines 103 and 119 are `unreachable!` arms of the test helpers | 3A / test code | A row with an out-of-range value inserted by raw `sqlx`; a dropped table. `Sqlite::new` (lines 38-47) is fully covered | -| `databases/driver/sqlite/schema_migrator.rs` | 38, 56, 90, 103, 122-123, 136, 139, 152 / 275 | Production: `?` error regions of the legacy bootstrap and `drop_database_tables`. Test module: line 275 is an assertion | mostly no decision / test code | Legacy partial-state and migrated paths are already tested; challenge each `?` region | -| `databases/driver/mod.rs` | 67-68, 70 | Retry loop of the test-only `create_database_tables` helper | test support | No-change | -| `databases/error.rs` | 140-147 / 160, 173 | Production: `From<(MigrateError, Driver)>` (the `MigrationError` mapping). Test module: lines 160 and 173 are assertions | 3A / test code | One test of the migration-error mapping; the `sqlx::Error` arms are already tested | -| `databases/setup.rs` | 114-128 | `initialize_database_from_configuration` for MySQL and PostgreSQL | 3B / 3A | Unreachable-endpoint error test is 3A; the success path is container-gated | +| `databases/driver/sqlite/mod.rs` | production: 54, 58, 60, 62, 79; test module: 103, 119 | Production: the error branches of the aggregate-metric helpers (`load_torrent_aggregate_metric`: query failure, `try_get` failure, the `u32` conversion to `MalformedDatabaseRecord`; `save_torrent_aggregate_metric`: query failure). Test module: lines 103 and 119 are `unreachable!` arms of the test helpers | 3A (production), test code (test module) | A row with an out-of-range value inserted by raw `sqlx`; a dropped table. `Sqlite::new` (lines 38-47) is fully covered | +| `databases/driver/sqlite/schema_migrator.rs` | production: 38, 56, 90, 103, 122-123, 136, 139, 152; test module: 275 | Production: `?` error regions of the legacy bootstrap and `drop_database_tables`. Test module: line 275 is an assertion | mostly no decision (production), test code (test module) | Legacy partial-state and migrated paths are already tested; challenge each `?` region | +| `databases/driver/mod.rs` | test module: 67-68, 70 | Retry loop of the test-only `create_database_tables` helper | test support | No-change | +| `databases/error.rs` | production: 140-147; test module: 160, 173 | Production: `From<(MigrateError, Driver)>` (the `MigrationError` mapping). Test module: lines 160 and 173 are assertions | 3A (production), test code (test module) | One test of the migration-error mapping; the `sqlx::Error` arms are already tested | +| `databases/setup.rs` | production: 114-128 | `initialize_database_from_configuration` for MySQL and PostgreSQL | 3B (success path) or 3A (unreachable endpoint) | Unreachable-endpoint error test is 3A; the success path is container-gated | | `error.rs` | 47-49, 53-55, 59-61, 65-67 | The four `From` conversions into `TrackerCoreError` | 3A | Trivial but package-owned wiring; one table test | | `statistics/repository.rs` | 104, 114-120, 139-146, 148-154, 157-158, 164-206 | `set_counter`, `set_gauge`, `increment_gauge`, `decrement_gauge` and their error-logging arms | 3A | Covered only by the integration binary today; direct unit tests (success and metric-type-mismatch error) | | `statistics/metrics.rs` | 36-44, 49-57, 62-69, 74-81 | `Metrics::set_counter`, `set_gauge`, `increment_gauge`, `decrement_gauge` | 3A | Same | | `statistics/persisted/mod.rs` | 21-25, 59-61, 65-67 | `load_persisted_metrics` (startup load into the in-memory counters) | 3A | Unit test with the `testing` feature's `TorrentMetricsStore` mock (ADR on test support) or a temp SQLite store | -| `statistics/persisted/downloads.rs` | 133 | Production: the `?` of `increase_global_downloads` when `load_global_downloads` fails | 3A (medium) | Failing-`Database` case | -| `statistics/event/listener.rs` | 19-83 / 283-284 | Production: the two spawning wrappers (`run_*_event_listener`) and the `*_unspawned` entry points. Test module: lines 283-284 belong to the test `ScriptedReceiver` | 3A / test code | Spawn, send an event, cancel, await the handle; drain behavior is owned by the `events` package | -| `statistics/event/handler.rs` | 19-58, 129 | Logging-only handlers (`handle_torrent_added`, `_removed`, `handle_peer_*`) and one error arm | no decision / 3A | The logging-only arms carry no state change; decide whether a log-assertion test (ADR on log identifiers) is worth it; line 129 is a metric-increment error arm | +| `statistics/persisted/downloads.rs` | production: 133 | Production: the `?` of `increase_global_downloads` when `load_global_downloads` fails | 3A (medium) | Failing-`Database` case | +| `statistics/event/listener.rs` | production: 19-83; test module: 283-284 | Production: the two spawning wrappers (`run_*_event_listener`) and the `*_unspawned` entry points. Test module: lines 283-284 belong to the test `ScriptedReceiver` | 3A (production), test code (test module) | Spawn, send an event, cancel, await the handle; drain behavior is owned by the `events` package | +| `statistics/event/handler.rs` | production: 19-58, 129 | Logging-only handlers (`handle_torrent_added`, `_removed`, `handle_peer_*`) and one error arm | no decision (logging-only arms), 3A (line 129) | The logging-only arms carry no state change; decide whether a log-assertion test (ADR on log identifiers) is worth it; line 129 is a metric-increment error arm | | `statistics/mod.rs` | 49 | Production: the implicit `else` of `if tracker_usage_statistics_enabled` (the in-session counter is not described when usage statistics are disabled) | 3A | A metrics test with usage statistics disabled | -| `container.rs` | 86 / 193 | Production: the `Persistence` error mapping when the database cannot initialize. Test module: line 193 is an assertion | 3A / test code | Container built over an invalid SQLite path | -| `authentication/handler.rs` | 252, 280 / 424, 479, 493, 531, 604, 656, 690 | Production: the `?` regions of `remove_peer_key` and `load_peer_keys_from_database` (database failure). Test module: the other seven lines are assertions | 3A / test code | Fake the `Database` failing | -| `authentication/key/repository/persisted.rs` | 57, 71 / 96 | Production: the `?` regions of `remove` and `load_keys`. Test module: line 96 is an `unreachable!` arm of a test helper | 3A / test code | Same fake | -| `authentication/key/peer_key.rs`, `authentication/key/mod.rs` | 64 / 304 | Production: `peer_key.rs:64`, the `_ => false` arm of `PeerKey`'s `PartialEq` (one key expiring, the other permanent). Test module: `mod.rs:304` is an assertion | 3A / test code | One equality case | -| `announce_handler.rs` | 184, 189 / 634 | Production: the `?` regions of the announce (whitelist failure, downloads load failure). Test module: line 634 is an assertion | 3A / test code | Whitelist and database failure cases may exist elsewhere; challenge | -| `scrape_handler.rs` | 350 | Test module: an assertion | test code | No-change | -| `torrent/manager.rs` | 66 | Production: the `?` of `load_torrents_from_database` when the database fails | 3A (medium) | Failing-`Database` case | +| `container.rs` | production: 86; test module: 193 | Production: the `Persistence` error mapping when the database cannot initialize. Test module: line 193 is an assertion | 3A (production), test code (test module) | Container built over an invalid SQLite path | +| `authentication/handler.rs` | production: 252, 280; test module: 424, 479, 493, 531, 604, 656, 690 | Production: the `?` regions of `remove_peer_key` and `load_peer_keys_from_database` (database failure). Test module: the other seven lines are assertions | 3A (production), test code (test module) | Fake the `Database` failing | +| `authentication/key/repository/persisted.rs` | production: 57, 71; test module: 96 | Production: the `?` regions of `remove` and `load_keys`. Test module: line 96 is an `unreachable!` arm of a test helper | 3A (production), test code (test module) | Same fake | +| `authentication/key/peer_key.rs` | production: 64 | The `_ => false` arm of `PeerKey`'s `PartialEq` (one key expiring, the other permanent) | 3A | One equality case | +| `authentication/key/mod.rs` | test module: 304 | An assertion | test code | No-change | +| `announce_handler.rs` | production: 184, 189; test module: 634 | Production: the `?` regions of the announce (whitelist failure, downloads load failure). Test module: line 634 is an assertion | 3A (production), test code (test module) | Whitelist and database failure cases may exist elsewhere; challenge | +| `scrape_handler.rs` | test module: 350 | Test module: an assertion | test code | No-change | +| `torrent/manager.rs` | production: 66 | Production: the `?` of `load_torrents_from_database` when the database fails | 3A (medium) | Failing-`Database` case | | `torrent/repository/in_memory.rs` | 177-179 | `get_torrent_peers` delegating to the swarm registry | owned (swarm-coordination-registry) | A thin delegation test is cheap; decide per file | -| `whitelist/manager.rs`, `whitelist/repository/persisted.rs`, `whitelist/authorization.rs` | 53, 66, 79 / 30, 36, 46, 52 / 139 | Production: the `?` regions of `add`, `remove` and `load` (manager) and of the read and write in `add` and `remove` (persisted). Test module: `authorization.rs:139` is an assertion | 3A / test code | Same failing-`Database` fake | +| `whitelist/manager.rs` | production: 53, 66, 79 | The `?` regions of `add`, `remove` and `load` (database failure) | 3A | Same failing-`Database` fake | +| `whitelist/repository/persisted.rs` | production: 30, 36, 46, 52 | The `?` regions of the read and the write in `add` and `remove` | 3A | Same fake (finding F4 check) | +| `whitelist/authorization.rs` | test module: 139 | An assertion | test code | No-change | | `test_helpers.rs` | 144-156, 209 | Test-support builder branch for persistent completed statistics | test support | Not package-owned behavior; no test by decision, unless a slice uses it | Counts are by line class, not by decision: a "region" group can disappear when its neighbors are From 8f42a03a60b9177d3d8e904fa656257b6f301d53 Mon Sep 17 00:00:00 2001 From: josecelano-bot Date: Tue, 17 Nov 2026 12:57:41 +0000 Subject: [PATCH 14/22] docs(issues): [#2902] record the full commit SHAs of the measurements Copilot review comment on #2903: a short SHA can become ambiguous. Co-Authored-By: Claude Opus 5.5 --- .../2902-1347-add-tests-tracker-core/coverage-evidence.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/issues/open/2902-1347-add-tests-tracker-core/coverage-evidence.md b/docs/issues/open/2902-1347-add-tests-tracker-core/coverage-evidence.md index ae7d6f208c..66b00ecddb 100644 --- a/docs/issues/open/2902-1347-add-tests-tracker-core/coverage-evidence.md +++ b/docs/issues/open/2902-1347-add-tests-tracker-core/coverage-evidence.md @@ -2,13 +2,14 @@ doc-type: coverage-evidence issue: 2902 package: torrust-tracker-core -measured-commit: 5833cdae9 +measured-commit: 5833cdae98c0cfe3c2523c7f17e33bcfd3d7292f measured-utc: 2026-11-17 --- # Coverage Evidence - `torrust-tracker-core` Baseline for the sub-issue spec of #2902. Measured on 2026-11-17 at `develop` commit `5833cdae9` +(full SHA `5833cdae98c0cfe3c2523c7f17e33bcfd3d7292f`) (`Merge torrust/torrust-tracker#2900: chore(issues): [#2873] archive the closed spec and mark it DONE in EPIC #2003`), with `cargo-llvm-cov 0.6.16` and stable Rust 1.99.1, from a clean workspace and a separate `CARGO_LLVM_COV_TARGET_DIR`. Every figure is filtered to `packages/tracker-core/src/` (62 files, 51 with executable lines). The @@ -26,7 +27,8 @@ cargo llvm-cov clean --workspace cargo llvm-cov -p torrust-tracker-core --lib --json --output-path .tmp/cov/unit-default.json ``` -The container-gated row (T1b) was measured afterwards on the S0 branch at `690cfb5f5`, whose +The container-gated row (T1b) was measured afterwards on the S0 branch at `690cfb5f5` +(`690cfb5f5d2dbd061fdfe47a9353be608544966a`), whose `packages/` tree is identical to `5833cdae9` (`git diff --stat 5833cdae9 690cfb5f5 -- packages` prints nothing), after `docker pull mysql:8.0` and `docker pull postgres:16` (the tests' default tags, `mysql/mod.rs:115` and `postgres/mod.rs:102`), with the same separate target directory: From 289cf16da04557cf9a6d499de2d7adab3986a898 Mon Sep 17 00:00:00 2001 From: josecelano-bot Date: Tue, 17 Nov 2026 13:02:40 +0000 Subject: [PATCH 15/22] docs(pr-reviews): [#2902] record Copilot's review of #2903 Add F11-F13 from Copilot's review 5938522893, which the first round of replies missed, with their fixes, replies and resolutions. Co-Authored-By: Claude Opus 5.5 --- docs/pr-reviews/pr-2903-review/PR-REVIEW.md | 48 ++++++++++++++++++++- 1 file changed, 47 insertions(+), 1 deletion(-) diff --git a/docs/pr-reviews/pr-2903-review/PR-REVIEW.md b/docs/pr-reviews/pr-2903-review/PR-REVIEW.md index 094d843ce8..54352fb195 100644 --- a/docs/pr-reviews/pr-2903-review/PR-REVIEW.md +++ b/docs/pr-reviews/pr-2903-review/PR-REVIEW.md @@ -43,7 +43,9 @@ deliver findings through GitHub and have no repository-artifact obligation. Round 1 is da2ce7's review `5938095803` of `690cfb5f5` (submitted as an approval, later dismissed by the push), round 2 his review `5938377458` of `2b0c3fe36` (comment). Their inline findings keep the -reviewer's IDs F1 to F10; the review bodies only summarize them. +reviewer's IDs F1 to F10; the review bodies only summarize them. Round 3 is Copilot's review `5938522893` +of `2b0c3fe36` (12:38:26 UTC, comment, empty body), found only after the first reply push; its three +inline comments have no IDs and get F11 to F13 in source order. | Finding ID | Review finding reference | Author class | Severity | Category | Relationship | Disposition | Thread state | | ---------- | ------------------------ | ------------ | -------- | -------- | ------------ | ----------- | ------------ | @@ -57,6 +59,9 @@ reviewer's IDs F1 to F10; the review bodies only summarize them. | F8 | review-finding:pr-2903-f8 | Human | Minor | documentation | ORIGINAL | FIXED | RESOLVED | | F9 | review-finding:pr-2903-f9 | Human | Nit | documentation | ORIGINAL | FIXED | RESOLVED | | F10 | review-finding:pr-2903-f10 | Human | Minor | metadata | ORIGINAL | FIXED | RESOLVED | +| F11 | review-finding:pr-2903-f11 | Copilot | Nit (inferred) | metadata | ORIGINAL | FIXED | RESOLVED | +| F12 | review-finding:pr-2903-f12 | Copilot | Minor (inferred) | documentation | ORIGINAL | FIXED | RESOLVED | +| F13 | review-finding:pr-2903-f13 | Copilot | Minor (inferred) | documentation | RE_RAISE_OF:F12 | NO_ACTION | SUPERSEDED | ## Finding Details @@ -190,10 +195,51 @@ reviewer's IDs F1 to F10; the review bodies only summarize them. - Follow-up PR URL: N/A - Reply URL: https://github.com/torrust/torrust-tracker/pull/2903#discussion_r4599800899 +### F11 - The measured commits were cited by short SHA + +- PR number: 2903 +- Source review ID: 5938522893 +- Reviewer finding ID: N/A +- Source URL: https://github.com/torrust/torrust-tracker/pull/2903#discussion_r4599655402 +- Concern: Coverage evidence meant to be reproducible should record the full 40-character SHA, since a short one can become ambiguous. +- Solution: `coverage-evidence.md` records the full SHAs of `5833cdae9` (also in its `measured-commit` frontmatter) and of `690cfb5f5`, the commit of the container-gated run; the short forms stay in prose. +- Current-tree verification: `git rev-parse 5833cdae9 690cfb5f5` prints the two SHAs the file now cites. +- Resolution reference: docs(issues): [#2902] record the full commit SHAs of the measurements +- Follow-up PR URL: N/A +- Reply URL: https://github.com/torrust/torrust-tracker/pull/2903#discussion_r4599904133 + +### F12 - The slash in the uncovered-lines column was ambiguous + +- PR number: 2903 +- Source review ID: 5938522893 +- Reviewer finding ID: N/A +- Source URL: https://github.com/torrust/torrust-tracker/pull/2903#discussion_r4599655482 +- Concern: In the combined rows, `304 / 64` reads like a fraction and the slash does not say which file each set of lines belongs to; split the rows per file or label them. +- Solution: The slash came from the first table and spread with the F3 fix, which used it between production and test-module lines. Every lines cell of a file with a test module now labels its `production:` and `test module:` lines, the two multi-file rows are split into one row per file (`peer_key.rs`, `key/mod.rs`; `whitelist/manager.rs`, `repository/persisted.rs`, `authorization.rs`), and the class column names alternatives in words instead of a slash. +- Current-tree verification: `grep -n ' / [0-9]' docs/issues/open/2902-1347-add-tests-tracker-core/coverage-evidence.md` prints nothing after the `## Uncovered Line Groups` heading. +- Resolution reference: docs(issues): [#2902] label production and test-module uncovered lines +- Follow-up PR URL: N/A +- Reply URL: https://github.com/torrust/torrust-tracker/pull/2903#discussion_r4599905007 + +### F13 - The same slash ambiguity on a second row + +- PR number: 2903 +- Source review ID: 5938522893 +- Reviewer finding ID: N/A +- Source URL: https://github.com/torrust/torrust-tracker/pull/2903#discussion_r4599655543 +- Concern: The same comment as F12, on a second combined row. +- Solution: Same change as F12; no separate fix. +- Current-tree verification: As F12. +- Resolution reference: https://github.com/torrust/torrust-tracker/pull/2903#discussion_r4599905897 +- Follow-up PR URL: N/A +- Reply URL: https://github.com/torrust/torrust-tracker/pull/2903#discussion_r4599905897 + ## Processing Log - 2026-11-17 12:48 UTC - Started audit late: the round 1 threads (12:08:23 UTC) and round 2 threads (12:28:40 UTC) had no reply before this record; the fixes were committed first, between 12:37 and 12:46 UTC, one commit per finding (F5 and F9 share one). - 2026-11-17 12:51 UTC - Pushed the fix commits (head `37d9b1218`), edited the PR description and posted the F10 note at 12:51:13 UTC (issue comment 6948544053); replied to the ten threads between 12:51:24 and 12:51:57 UTC and resolved each after its reply. +- 2026-11-17 12:53 UTC - Found Copilot's review `5938522893` (12:38:26 UTC, three threads), which the 12:51 replies had missed: the thread check right after pushing the audit commit (committed 12:53:03 UTC) showed three unresolved threads. Recorded as F11-F13. +- 2026-11-17 13:01 UTC - Pushed the F11 and F12 fixes (head `8f42a03a6`); replied to the three threads between 13:01:41 and 13:01:48 UTC and resolved each after its reply (F13 superseded by F12). ## Completion Rules From 798d53f7410473f7aad5f103943023a95272b052 Mon Sep 17 00:00:00 2001 From: josecelano-bot Date: Tue, 17 Nov 2026 13:15:01 +0000 Subject: [PATCH 16/22] docs(issues): [#2902] label the last unlabeled uncovered-line cells error.rs and statistics/repository.rs have test modules but their cells had no production label; test_helpers.rs is test support. Review finding F15 of #2903. Co-Authored-By: Claude Opus 5.5 --- .../2902-1347-add-tests-tracker-core/coverage-evidence.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/issues/open/2902-1347-add-tests-tracker-core/coverage-evidence.md b/docs/issues/open/2902-1347-add-tests-tracker-core/coverage-evidence.md index 66b00ecddb..ac6aead14b 100644 --- a/docs/issues/open/2902-1347-add-tests-tracker-core/coverage-evidence.md +++ b/docs/issues/open/2902-1347-add-tests-tracker-core/coverage-evidence.md @@ -153,8 +153,8 @@ module or in test support). A | `databases/driver/mod.rs` | test module: 67-68, 70 | Retry loop of the test-only `create_database_tables` helper | test support | No-change | | `databases/error.rs` | production: 140-147; test module: 160, 173 | Production: `From<(MigrateError, Driver)>` (the `MigrationError` mapping). Test module: lines 160 and 173 are assertions | 3A (production), test code (test module) | One test of the migration-error mapping; the `sqlx::Error` arms are already tested | | `databases/setup.rs` | production: 114-128 | `initialize_database_from_configuration` for MySQL and PostgreSQL | 3B (success path) or 3A (unreachable endpoint) | Unreachable-endpoint error test is 3A; the success path is container-gated | -| `error.rs` | 47-49, 53-55, 59-61, 65-67 | The four `From` conversions into `TrackerCoreError` | 3A | Trivial but package-owned wiring; one table test | -| `statistics/repository.rs` | 104, 114-120, 139-146, 148-154, 157-158, 164-206 | `set_counter`, `set_gauge`, `increment_gauge`, `decrement_gauge` and their error-logging arms | 3A | Covered only by the integration binary today; direct unit tests (success and metric-type-mismatch error) | +| `error.rs` | production: 47-49, 53-55, 59-61, 65-67 | The four `From` conversions into `TrackerCoreError` | 3A | Trivial but package-owned wiring; one table test | +| `statistics/repository.rs` | production: 104, 114-120, 139-146, 148-154, 157-158, 164-206 | `set_counter`, `set_gauge`, `increment_gauge`, `decrement_gauge` and their error-logging arms | 3A | Covered only by the integration binary today; direct unit tests (success and metric-type-mismatch error) | | `statistics/metrics.rs` | 36-44, 49-57, 62-69, 74-81 | `Metrics::set_counter`, `set_gauge`, `increment_gauge`, `decrement_gauge` | 3A | Same | | `statistics/persisted/mod.rs` | 21-25, 59-61, 65-67 | `load_persisted_metrics` (startup load into the in-memory counters) | 3A | Unit test with the `testing` feature's `TorrentMetricsStore` mock (ADR on test support) or a temp SQLite store | | `statistics/persisted/downloads.rs` | production: 133 | Production: the `?` of `increase_global_downloads` when `load_global_downloads` fails | 3A (medium) | Failing-`Database` case | @@ -173,7 +173,7 @@ module or in test support). A | `whitelist/manager.rs` | production: 53, 66, 79 | The `?` regions of `add`, `remove` and `load` (database failure) | 3A | Same failing-`Database` fake | | `whitelist/repository/persisted.rs` | production: 30, 36, 46, 52 | The `?` regions of the read and the write in `add` and `remove` | 3A | Same fake (finding F4 check) | | `whitelist/authorization.rs` | test module: 139 | An assertion | test code | No-change | -| `test_helpers.rs` | 144-156, 209 | Test-support builder branch for persistent completed statistics | test support | Not package-owned behavior; no test by decision, unless a slice uses it | +| `test_helpers.rs` | test module: 144-156, 209 | Test-support builder branch for persistent completed statistics | test support | Not package-owned behavior; no test by decision, unless a slice uses it | Counts are by line class, not by decision: a "region" group can disappear when its neighbors are tested. The grouping above is the T1 hypothesis the decision records revisit. From 7c835ddffd2f1a71d02f6fe01bfc275c02042a29 Mon Sep 17 00:00:00 2001 From: josecelano-bot Date: Tue, 17 Nov 2026 13:15:50 +0000 Subject: [PATCH 17/22] docs(issues): [#2902] cite the container-gated run by commit subject The evidence cited a branch commit id that a rebase can rewrite; it now names the commit by subject and the unchanged develop source by its full id. Review finding F14 of #2903. Co-Authored-By: Claude Opus 5.5 --- .../2902-1347-add-tests-tracker-core/coverage-evidence.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/issues/open/2902-1347-add-tests-tracker-core/coverage-evidence.md b/docs/issues/open/2902-1347-add-tests-tracker-core/coverage-evidence.md index ac6aead14b..e33bfdb3b7 100644 --- a/docs/issues/open/2902-1347-add-tests-tracker-core/coverage-evidence.md +++ b/docs/issues/open/2902-1347-add-tests-tracker-core/coverage-evidence.md @@ -27,9 +27,10 @@ cargo llvm-cov clean --workspace cargo llvm-cov -p torrust-tracker-core --lib --json --output-path .tmp/cov/unit-default.json ``` -The container-gated row (T1b) was measured afterwards on the S0 branch at `690cfb5f5` -(`690cfb5f5d2dbd061fdfe47a9353be608544966a`), whose -`packages/` tree is identical to `5833cdae9` (`git diff --stat 5833cdae9 690cfb5f5 -- packages` prints +The container-gated row (T1b) was measured afterwards on the S0 branch, at its commit +`docs(issues): [#2902] specify the tracker-core package tests`. The branch changes no file under +`packages/`, so the measured source is that of `develop` at +`5833cdae98c0cfe3c2523c7f17e33bcfd3d7292f` (`git diff --stat 5833cdae9 HEAD -- packages` prints nothing), after `docker pull mysql:8.0` and `docker pull postgres:16` (the tests' default tags, `mysql/mod.rs:115` and `postgres/mod.rs:102`), with the same separate target directory: From 9d53ef493731daa069031b5f624f55163cf45438 Mon Sep 17 00:00:00 2001 From: josecelano-bot Date: Tue, 17 Nov 2026 13:21:02 +0000 Subject: [PATCH 18/22] docs(pr-reviews): [#2902] record the fourth review round of #2903 Add F14-F16 from da2ce7's review 5939100172, cite heads and commits by subject in the round descriptions and details, and correct the description of Copilot's review. Co-Authored-By: Claude Opus 5.5 --- docs/pr-reviews/pr-2903-review/PR-REVIEW.md | 69 +++++++++++++++++---- 1 file changed, 58 insertions(+), 11 deletions(-) diff --git a/docs/pr-reviews/pr-2903-review/PR-REVIEW.md b/docs/pr-reviews/pr-2903-review/PR-REVIEW.md index 54352fb195..c463c8581e 100644 --- a/docs/pr-reviews/pr-2903-review/PR-REVIEW.md +++ b/docs/pr-reviews/pr-2903-review/PR-REVIEW.md @@ -41,11 +41,15 @@ deliver findings through GitHub and have no repository-artifact obligation. ## Findings -Round 1 is da2ce7's review `5938095803` of `690cfb5f5` (submitted as an approval, later dismissed by the -push), round 2 his review `5938377458` of `2b0c3fe36` (comment). Their inline findings keep the +Round 1 is da2ce7's review `5938095803` of the head whose last commit is `docs(issues): [#2902] specify the tracker-core package tests` (submitted as an +approval, later dismissed by the push), round 2 his review `5938377458` of the head whose last commit is +`docs(issues): [#2902] record the container-gated coverage measurement` (comment). Their inline findings keep the reviewer's IDs F1 to F10; the review bodies only summarize them. Round 3 is Copilot's review `5938522893` -of `2b0c3fe36` (12:38:26 UTC, comment, empty body), found only after the first reply push; its three -inline comments have no IDs and get F11 to F13 in source order. +of the head whose last commit is `docs(issues): [#2902] specify the tracker-core package tests` (submitted 12:38:27 UTC as a comment; its body is an overview +with no request, so it needs no row), found only after the first reply push; its three +inline comments have no IDs and get F11 to F13 in source order. Round 4 is da2ce7's review `5939100172` +(approval) of the head whose last commit is `docs(pr-reviews): [#2902] record Copilot's review of #2903`; +its inline findings keep the reviewer's IDs F14 to F16. | Finding ID | Review finding reference | Author class | Severity | Category | Relationship | Disposition | Thread state | | ---------- | ------------------------ | ------------ | -------- | -------- | ------------ | ----------- | ------------ | @@ -62,6 +66,9 @@ inline comments have no IDs and get F11 to F13 in source order. | F11 | review-finding:pr-2903-f11 | Copilot | Nit (inferred) | metadata | ORIGINAL | FIXED | RESOLVED | | F12 | review-finding:pr-2903-f12 | Copilot | Minor (inferred) | documentation | ORIGINAL | FIXED | RESOLVED | | F13 | review-finding:pr-2903-f13 | Copilot | Minor (inferred) | documentation | RE_RAISE_OF:F12 | NO_ACTION | SUPERSEDED | +| F14 | review-finding:pr-2903-f14 | Human | Minor | metadata | ORIGINAL | FIXED | RESOLVED | +| F15 | review-finding:pr-2903-f15 | Human | Nit | documentation | ORIGINAL | FIXED | RESOLVED | +| F16 | review-finding:pr-2903-f16 | Human | Minor | correctness | ORIGINAL | FIXED | RESOLVED | ## Finding Details @@ -125,7 +132,7 @@ inline comments have no IDs and get F11 to F13 in source order. - Source URL: https://github.com/torrust/torrust-tracker/pull/2903#discussion_r4599332994 - Concern: Appending the 10:57 entry after the blank line before `## Acceptance Criteria` split the progress log into a loose list. - Solution: The blank line is removed, so the entries form one tight list again. -- Current-tree verification: `git diff 690cfb5f5 -- docs/issues/open/1347-overhaul-packages-testing/EPIC.md` shows the removed blank line and no other change to the earlier entries. +- Current-tree verification: `git diff $(git log --format=%H --fixed-strings --grep='specify the tracker-core package tests' -1) -- docs/issues/open/1347-overhaul-packages-testing/EPIC.md` (the diff against the S0 commit `docs(issues): [#2902] specify the tracker-core package tests`) shows the removed blank line and no other change to the earlier entries. - Resolution reference: docs(issues): [#1347] restore the 10:57 EPIC log entry and append T1b - Follow-up PR URL: N/A - Reply URL: https://github.com/torrust/torrust-tracker/pull/2903#discussion_r4599797846 @@ -163,8 +170,8 @@ inline comments have no IDs and get F11 to F13 in source order. - Reviewer finding ID: F8 - Source URL: https://github.com/torrust/torrust-tracker/pull/2903#discussion_r4599550883 - Concern: The fifth scope existed only as row text, with no reproducible command and per-file results only as prose, and the reading note still said the figures above excluded the drivers. -- Solution: `coverage-evidence.md` now gives the command (both variables, after `cargo llvm-cov clean --workspace`, the separate target directory, the image tags) and the measured commit (`690cfb5f5`, whose `packages/` tree equals `5833cdae9`), adds a container-gated column to all 51 inventory rows, and the note says the four default rows exclude the drivers. -- Current-tree verification: `git diff --stat 5833cdae9 690cfb5f5 -- packages` prints nothing; the per-file inventory rows each have five columns (`awk -F'|'` counts 7 fields on all 51 rows). +- Solution: `coverage-evidence.md` now gives the command (both variables, after `cargo llvm-cov clean --workspace`, the separate target directory, the image tags) and the measured commit (the S0 commit `docs(issues): [#2902] specify the tracker-core package tests`; the branch changes nothing under `packages/`, so the source is that of `5833cdae9`), adds a container-gated column to all 51 inventory rows, and the note says the four default rows exclude the drivers. +- Current-tree verification: `git diff --stat 5833cdae9 HEAD -- packages` prints nothing; the per-file inventory rows each have five columns (`awk -F'|'` counts 7 fields on all 51 rows). - Resolution reference: docs(issues): [#2902] add the container-gated command and per-file column - Follow-up PR URL: N/A - Reply URL: https://github.com/torrust/torrust-tracker/pull/2903#discussion_r4599799711 @@ -176,8 +183,8 @@ inline comments have no IDs and get F11 to F13 in source order. - Reviewer finding ID: F9 - Source URL: https://github.com/torrust/torrust-tracker/pull/2903#discussion_r4599550894 - Concern: The T1b commit edited the 10:57 EPIC entry so that an entry dated before the measurement reported it. -- Solution: The original 10:57 text is restored byte for byte from `690cfb5f5`, and a dated entry records T1b with a correction note. -- Current-tree verification: `git show 690cfb5f5:docs/issues/open/1347-overhaul-packages-testing/EPIC.md | sed -n 362p` equals the restored line; `git diff 690cfb5f5` shows only the row 14 note, the removed blank line and the appended entry in the log area. +- Solution: The original 10:57 text is restored byte for byte from the S0 commit `docs(issues): [#2902] specify the tracker-core package tests`, and a dated entry records T1b with a correction note. +- Current-tree verification: line 362 of the EPIC at the S0 commit (`git show :docs/issues/open/1347-overhaul-packages-testing/EPIC.md`) equals the restored line; the diff against that commit shows only the row 14 note, the removed blank line and the appended entry in the log area. - Resolution reference: docs(issues): [#1347] restore the 10:57 EPIC log entry and append T1b - Follow-up PR URL: N/A - Reply URL: https://github.com/torrust/torrust-tracker/pull/2903#discussion_r4599800327 @@ -202,8 +209,8 @@ inline comments have no IDs and get F11 to F13 in source order. - Reviewer finding ID: N/A - Source URL: https://github.com/torrust/torrust-tracker/pull/2903#discussion_r4599655402 - Concern: Coverage evidence meant to be reproducible should record the full 40-character SHA, since a short one can become ambiguous. -- Solution: `coverage-evidence.md` records the full SHAs of `5833cdae9` (also in its `measured-commit` frontmatter) and of `690cfb5f5`, the commit of the container-gated run; the short forms stay in prose. -- Current-tree verification: `git rev-parse 5833cdae9 690cfb5f5` prints the two SHAs the file now cites. +- Solution: `coverage-evidence.md` records the full SHA of `5833cdae9` (also in its `measured-commit` frontmatter). It first also recorded the full SHA of the branch commit of the container-gated run; F14 replaced that with the commit subject, since a rebase can rewrite a branch id. +- Current-tree verification: `git rev-parse 5833cdae9` prints the SHA the file cites. - Resolution reference: docs(issues): [#2902] record the full commit SHAs of the measurements - Follow-up PR URL: N/A - Reply URL: https://github.com/torrust/torrust-tracker/pull/2903#discussion_r4599904133 @@ -234,12 +241,52 @@ inline comments have no IDs and get F11 to F13 in source order. - Follow-up PR URL: N/A - Reply URL: https://github.com/torrust/torrust-tracker/pull/2903#discussion_r4599905897 +### F14 - Durable text cited branch commit ids + +- PR number: 2903 +- Source review ID: 5939100172 +- Reviewer finding ID: F14 +- Source URL: https://github.com/torrust/torrust-tracker/pull/2903#discussion_r4600053985 +- Concern: The evidence, the spec log and the audit cited branch commit ids (`2b0c3fe36`, `37d9b1218`, `690cfb5f5` short and full, `8f42a03a6`) that a rebase can rewrite. +- Solution: `coverage-evidence.md` names the container-gated run's commit by subject and the measured source by the full id of `5833cdae9` on `develop`; the audit's round descriptions and finding details name heads and commits by subject. The ids left are in append-only progress and processing log entries (`ISSUE.md:414`, `PR-REVIEW.md` processing log), which are not rewritten; they resolve at this head and stay reachable after the merge. +- Current-tree verification: `grep -n -E '2b0c3fe36|37d9b1218|690cfb5f5|8f42a03a6' docs/issues/open/2902-1347-add-tests-tracker-core/coverage-evidence.md` prints nothing; in `PR-REVIEW.md` the ids appear only in Processing Log entries and in this entry. +- Resolution reference: docs(issues): [#2902] cite the container-gated run by commit subject +- Follow-up PR URL: N/A +- Reply URL: PENDING_REPLY_F14 + +### F15 - Two lines cells in files with a test module had no label + +- PR number: 2903 +- Source review ID: 5939100172 +- Reviewer finding ID: F15 +- Source URL: https://github.com/torrust/torrust-tracker/pull/2903#discussion_r4600053992 +- Concern: `error.rs` and `statistics/repository.rs` have test modules but their cells listed production lines without a `production:` label, against the rule above the table and the F12 entry. +- Solution: Both cells are labeled `production:`. Checking every row against its file found one more: `test_helpers.rs` (test support), now labeled `test module:`. +- Current-tree verification: a loop over the table rows that checks each file for a `cfg(test)` attribute and an unlabeled cell prints nothing. +- Resolution reference: docs(issues): [#2902] label the last unlabeled uncovered-line cells +- Follow-up PR URL: N/A +- Reply URL: PENDING_REPLY_F15 + +### F16 - The record described Copilot's review wrongly + +- PR number: 2903 +- Source review ID: 5939100172 +- Reviewer finding ID: F16 +- Source URL: https://github.com/torrust/torrust-tracker/pull/2903#discussion_r4600054002 +- Concern: The record said Copilot's review was of the second head and had an empty body; it was of the first head (`commit_id` of the S0 commit) and has a 3,254-character overview with no request. +- Solution: The Findings introduction now gives the reviewed head (by commit subject), the submission time 12:38:27 UTC and the body as an overview with no request. The processing log entry of 12:53 UTC, which gives 12:38:26 UTC (the time of the inline comments), is corrected by an appended entry. +- Current-tree verification: `gh-bot api repos/torrust/torrust-tracker/pulls/2903/reviews/5938522893 --jq '[.commit_id,.submitted_at,(.body|length)]'` prints the S0 commit's full id, `2026-11-17T12:38:27Z` and `3254`. +- Resolution reference: docs(pr-reviews): [#2902] record the fourth review round of #2903 +- Follow-up PR URL: N/A +- Reply URL: PENDING_REPLY_F16 + ## Processing Log - 2026-11-17 12:48 UTC - Started audit late: the round 1 threads (12:08:23 UTC) and round 2 threads (12:28:40 UTC) had no reply before this record; the fixes were committed first, between 12:37 and 12:46 UTC, one commit per finding (F5 and F9 share one). - 2026-11-17 12:51 UTC - Pushed the fix commits (head `37d9b1218`), edited the PR description and posted the F10 note at 12:51:13 UTC (issue comment 6948544053); replied to the ten threads between 12:51:24 and 12:51:57 UTC and resolved each after its reply. - 2026-11-17 12:53 UTC - Found Copilot's review `5938522893` (12:38:26 UTC, three threads), which the 12:51 replies had missed: the thread check right after pushing the audit commit (committed 12:53:03 UTC) showed three unresolved threads. Recorded as F11-F13. - 2026-11-17 13:01 UTC - Pushed the F11 and F12 fixes (head `8f42a03a6`); replied to the three threads between 13:01:41 and 13:01:48 UTC and resolved each after its reply (F13 superseded by F12). +- 2026-11-17 13:16 UTC - Round 4 (da2ce7's review `5939100172`, 13:13:35 UTC, approval with F14-F16) processed: F15 and F14 fixed in their own commits; the round descriptions and finding details now cite commits by subject. Correction of the 12:53 UTC entry above: Copilot's review was submitted at 12:38:27 UTC (12:38:26 UTC is the time of its first inline comments) and was of the first head, not the second (F16). ## Completion Rules From 10aab479029e954f1ddb1b1c1c7b9fbbbf114800 Mon Sep 17 00:00:00 2001 From: josecelano-bot Date: Tue, 17 Nov 2026 13:25:46 +0000 Subject: [PATCH 19/22] docs(pr-reviews): [#2902] record the round 4 replies of #2903 Co-Authored-By: Claude Opus 5.5 --- docs/pr-reviews/pr-2903-review/PR-REVIEW.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/pr-reviews/pr-2903-review/PR-REVIEW.md b/docs/pr-reviews/pr-2903-review/PR-REVIEW.md index c463c8581e..0b8b2a1ad9 100644 --- a/docs/pr-reviews/pr-2903-review/PR-REVIEW.md +++ b/docs/pr-reviews/pr-2903-review/PR-REVIEW.md @@ -252,7 +252,7 @@ its inline findings keep the reviewer's IDs F14 to F16. - Current-tree verification: `grep -n -E '2b0c3fe36|37d9b1218|690cfb5f5|8f42a03a6' docs/issues/open/2902-1347-add-tests-tracker-core/coverage-evidence.md` prints nothing; in `PR-REVIEW.md` the ids appear only in Processing Log entries and in this entry. - Resolution reference: docs(issues): [#2902] cite the container-gated run by commit subject - Follow-up PR URL: N/A -- Reply URL: PENDING_REPLY_F14 +- Reply URL: https://github.com/torrust/torrust-tracker/pull/2903#discussion_r4600182264 ### F15 - Two lines cells in files with a test module had no label @@ -265,7 +265,7 @@ its inline findings keep the reviewer's IDs F14 to F16. - Current-tree verification: a loop over the table rows that checks each file for a `cfg(test)` attribute and an unlabeled cell prints nothing. - Resolution reference: docs(issues): [#2902] label the last unlabeled uncovered-line cells - Follow-up PR URL: N/A -- Reply URL: PENDING_REPLY_F15 +- Reply URL: https://github.com/torrust/torrust-tracker/pull/2903#discussion_r4600182958 ### F16 - The record described Copilot's review wrongly @@ -278,7 +278,7 @@ its inline findings keep the reviewer's IDs F14 to F16. - Current-tree verification: `gh-bot api repos/torrust/torrust-tracker/pulls/2903/reviews/5938522893 --jq '[.commit_id,.submitted_at,(.body|length)]'` prints the S0 commit's full id, `2026-11-17T12:38:27Z` and `3254`. - Resolution reference: docs(pr-reviews): [#2902] record the fourth review round of #2903 - Follow-up PR URL: N/A -- Reply URL: PENDING_REPLY_F16 +- Reply URL: https://github.com/torrust/torrust-tracker/pull/2903#discussion_r4600183671 ## Processing Log @@ -287,6 +287,7 @@ its inline findings keep the reviewer's IDs F14 to F16. - 2026-11-17 12:53 UTC - Found Copilot's review `5938522893` (12:38:26 UTC, three threads), which the 12:51 replies had missed: the thread check right after pushing the audit commit (committed 12:53:03 UTC) showed three unresolved threads. Recorded as F11-F13. - 2026-11-17 13:01 UTC - Pushed the F11 and F12 fixes (head `8f42a03a6`); replied to the three threads between 13:01:41 and 13:01:48 UTC and resolved each after its reply (F13 superseded by F12). - 2026-11-17 13:16 UTC - Round 4 (da2ce7's review `5939100172`, 13:13:35 UTC, approval with F14-F16) processed: F15 and F14 fixed in their own commits; the round descriptions and finding details now cite commits by subject. Correction of the 12:53 UTC entry above: Copilot's review was submitted at 12:38:27 UTC (12:38:26 UTC is the time of its first inline comments) and was of the first head, not the second (F16). +- 2026-11-17 13:25 UTC - Pushed the round 4 fixes and audit commits; replied to the F14-F16 threads between 13:24:53 and 13:25:01 UTC and resolved each after its reply. ## Completion Rules From 7f716f6cfc1df6c86f1771f020b9afbd7134b20f Mon Sep 17 00:00:00 2001 From: josecelano-bot Date: Tue, 17 Nov 2026 13:32:47 +0000 Subject: [PATCH 20/22] docs(pr-reviews): [#2902] record Copilot's fifth-round finding of #2903 Co-Authored-By: Claude Opus 5.5 --- docs/pr-reviews/pr-2903-review/PR-REVIEW.md | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/docs/pr-reviews/pr-2903-review/PR-REVIEW.md b/docs/pr-reviews/pr-2903-review/PR-REVIEW.md index 0b8b2a1ad9..14ae6ca198 100644 --- a/docs/pr-reviews/pr-2903-review/PR-REVIEW.md +++ b/docs/pr-reviews/pr-2903-review/PR-REVIEW.md @@ -49,7 +49,9 @@ of the head whose last commit is `docs(issues): [#2902] specify the tracker-core with no request, so it needs no row), found only after the first reply push; its three inline comments have no IDs and get F11 to F13 in source order. Round 4 is da2ce7's review `5939100172` (approval) of the head whose last commit is `docs(pr-reviews): [#2902] record Copilot's review of #2903`; -its inline findings keep the reviewer's IDs F14 to F16. +its inline findings keep the reviewer's IDs F14 to F16. Round 5 is Copilot's review `5939369230` +(13:30:51 UTC, comment) of the head whose last commit is `docs(pr-reviews): [#2902] record the fourth +review round of #2903`; its one inline finding keeps the reviewer's ID F17. | Finding ID | Review finding reference | Author class | Severity | Category | Relationship | Disposition | Thread state | | ---------- | ------------------------ | ------------ | -------- | -------- | ------------ | ----------- | ------------ | @@ -69,6 +71,7 @@ its inline findings keep the reviewer's IDs F14 to F16. | F14 | review-finding:pr-2903-f14 | Human | Minor | metadata | ORIGINAL | FIXED | RESOLVED | | F15 | review-finding:pr-2903-f15 | Human | Nit | documentation | ORIGINAL | FIXED | RESOLVED | | F16 | review-finding:pr-2903-f16 | Human | Minor | correctness | ORIGINAL | FIXED | RESOLVED | +| F17 | review-finding:pr-2903-f17 | Copilot | Minor | metadata | ORIGINAL | FIXED | RESOLVED | ## Finding Details @@ -280,6 +283,19 @@ its inline findings keep the reviewer's IDs F14 to F16. - Follow-up PR URL: N/A - Reply URL: https://github.com/torrust/torrust-tracker/pull/2903#discussion_r4600183671 +### F17 - Pending reply markers in the round 4 rows + +- PR number: 2903 +- Source review ID: 5939369230 +- Reviewer finding ID: F17 +- Source URL: https://github.com/torrust/torrust-tracker/pull/2903#discussion_r4600249246 +- Concern: F14-F16 were marked `FIXED`/`RESOLVED` while their Reply URL fields held `PENDING_REPLY_*` markers, which fail the validator's same-thread reply check. +- Solution: The markers were in the audit commit made before the replies existed; the next commit replaced them with the three reply URLs, which are the ones the comment lists. No further change was needed beyond recording this row. +- Current-tree verification: `grep -c PENDING docs/pr-reviews/pr-2903-review/PR-REVIEW.md` prints 0; the audit validator reports no failure. +- Resolution reference: docs(pr-reviews): [#2902] record the round 4 replies of #2903 +- Follow-up PR URL: N/A +- Reply URL: https://github.com/torrust/torrust-tracker/pull/2903#discussion_r4600261767 + ## Processing Log - 2026-11-17 12:48 UTC - Started audit late: the round 1 threads (12:08:23 UTC) and round 2 threads (12:28:40 UTC) had no reply before this record; the fixes were committed first, between 12:37 and 12:46 UTC, one commit per finding (F5 and F9 share one). @@ -288,6 +304,7 @@ its inline findings keep the reviewer's IDs F14 to F16. - 2026-11-17 13:01 UTC - Pushed the F11 and F12 fixes (head `8f42a03a6`); replied to the three threads between 13:01:41 and 13:01:48 UTC and resolved each after its reply (F13 superseded by F12). - 2026-11-17 13:16 UTC - Round 4 (da2ce7's review `5939100172`, 13:13:35 UTC, approval with F14-F16) processed: F15 and F14 fixed in their own commits; the round descriptions and finding details now cite commits by subject. Correction of the 12:53 UTC entry above: Copilot's review was submitted at 12:38:27 UTC (12:38:26 UTC is the time of its first inline comments) and was of the first head, not the second (F16). - 2026-11-17 13:25 UTC - Pushed the round 4 fixes and audit commits; replied to the F14-F16 threads between 13:24:53 and 13:25:01 UTC and resolved each after its reply. +- 2026-11-17 13:31 UTC - Round 5 (Copilot's review `5939369230`, 13:30:51 UTC, F17) was about the head before the round 4 replies were recorded; replied at 13:31:57 UTC and resolved the thread. ## Completion Rules From 0a46512af886ba46d5547b3f7145f7a7f70998f3 Mon Sep 17 00:00:00 2001 From: josecelano-bot Date: Tue, 17 Nov 2026 13:37:09 +0000 Subject: [PATCH 21/22] docs(issues): [#2902] name the S0 commit in the unchanged-source check The check compared develop with HEAD, which holds only while HEAD is on this branch; it now names the S0 commit by subject. Review finding F18 of #2903. Co-Authored-By: Claude Opus 5.5 --- .../coverage-evidence.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/docs/issues/open/2902-1347-add-tests-tracker-core/coverage-evidence.md b/docs/issues/open/2902-1347-add-tests-tracker-core/coverage-evidence.md index e33bfdb3b7..3edae1b579 100644 --- a/docs/issues/open/2902-1347-add-tests-tracker-core/coverage-evidence.md +++ b/docs/issues/open/2902-1347-add-tests-tracker-core/coverage-evidence.md @@ -28,10 +28,11 @@ cargo llvm-cov -p torrust-tracker-core --lib --json --output-path .tmp/cov/unit- ``` The container-gated row (T1b) was measured afterwards on the S0 branch, at its commit -`docs(issues): [#2902] specify the tracker-core package tests`. The branch changes no file under -`packages/`, so the measured source is that of `develop` at -`5833cdae98c0cfe3c2523c7f17e33bcfd3d7292f` (`git diff --stat 5833cdae9 HEAD -- packages` prints -nothing), after `docker pull mysql:8.0` and `docker pull postgres:16` (the tests' default tags, +`docs(issues): [#2902] specify the tracker-core package tests`. That commit changes no file +under `packages/`, so the measured source is that of `develop` at +`5833cdae98c0cfe3c2523c7f17e33bcfd3d7292f`: `git diff --stat 5833cdae9 -- packages`, with +`` from `git log --format=%H --fixed-strings --grep='specify the tracker-core package tests'`, +prints nothing. The run followed `docker pull mysql:8.0` and `docker pull postgres:16` (the tests' default tags, `mysql/mod.rs:115` and `postgres/mod.rs:102`), with the same separate target directory: ```console From 0eb2ac6006acbe3fc7c1255865f557d015d711b0 Mon Sep 17 00:00:00 2001 From: josecelano-bot Date: Tue, 17 Nov 2026 13:42:13 +0000 Subject: [PATCH 22/22] docs(pr-reviews): [#2902] record the sixth review round of #2903 Co-Authored-By: Claude Opus 5.5 --- docs/pr-reviews/pr-2903-review/PR-REVIEW.md | 36 +++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/docs/pr-reviews/pr-2903-review/PR-REVIEW.md b/docs/pr-reviews/pr-2903-review/PR-REVIEW.md index 14ae6ca198..8417f5345a 100644 --- a/docs/pr-reviews/pr-2903-review/PR-REVIEW.md +++ b/docs/pr-reviews/pr-2903-review/PR-REVIEW.md @@ -51,7 +51,10 @@ inline comments have no IDs and get F11 to F13 in source order. Round 4 is da2ce (approval) of the head whose last commit is `docs(pr-reviews): [#2902] record Copilot's review of #2903`; its inline findings keep the reviewer's IDs F14 to F16. Round 5 is Copilot's review `5939369230` (13:30:51 UTC, comment) of the head whose last commit is `docs(pr-reviews): [#2902] record the fourth -review round of #2903`; its one inline finding keeps the reviewer's ID F17. +review round of #2903`; its one inline finding keeps the reviewer's ID F17. Round 6 is da2ce7's review `5939412622` (13:33:52 UTC, +submitted as an approval and dismissed by the next push) of the head whose last commit is +`docs(pr-reviews): [#2902] record the round 4 replies of #2903`; its findings keep the reviewer's IDs F18 +and F19. | Finding ID | Review finding reference | Author class | Severity | Category | Relationship | Disposition | Thread state | | ---------- | ------------------------ | ------------ | -------- | -------- | ------------ | ----------- | ------------ | @@ -72,6 +75,8 @@ review round of #2903`; its one inline finding keeps the reviewer's ID F17. | F15 | review-finding:pr-2903-f15 | Human | Nit | documentation | ORIGINAL | FIXED | RESOLVED | | F16 | review-finding:pr-2903-f16 | Human | Minor | correctness | ORIGINAL | FIXED | RESOLVED | | F17 | review-finding:pr-2903-f17 | Copilot | Minor | metadata | ORIGINAL | FIXED | RESOLVED | +| F18 | review-finding:pr-2903-f18 | Human | Nit | correctness | ORIGINAL | FIXED | RESOLVED | +| F19 | review-finding:pr-2903-f19 | Human | Nit | metadata | RE_RAISE_OF:F17 | NO_ACTION | SUPERSEDED | ## Finding Details @@ -174,7 +179,7 @@ review round of #2903`; its one inline finding keeps the reviewer's ID F17. - Source URL: https://github.com/torrust/torrust-tracker/pull/2903#discussion_r4599550883 - Concern: The fifth scope existed only as row text, with no reproducible command and per-file results only as prose, and the reading note still said the figures above excluded the drivers. - Solution: `coverage-evidence.md` now gives the command (both variables, after `cargo llvm-cov clean --workspace`, the separate target directory, the image tags) and the measured commit (the S0 commit `docs(issues): [#2902] specify the tracker-core package tests`; the branch changes nothing under `packages/`, so the source is that of `5833cdae9`), adds a container-gated column to all 51 inventory rows, and the note says the four default rows exclude the drivers. -- Current-tree verification: `git diff --stat 5833cdae9 HEAD -- packages` prints nothing; the per-file inventory rows each have five columns (`awk -F'|'` counts 7 fields on all 51 rows). +- Current-tree verification: `git diff --stat 5833cdae9 -- packages` prints nothing (the S0 commit found by its subject; the first version of this line used `HEAD`, which holds only on this branch, F18); the per-file inventory rows each have five columns (`awk -F'|'` counts 7 fields on all 51 rows). - Resolution reference: docs(issues): [#2902] add the container-gated command and per-file column - Follow-up PR URL: N/A - Reply URL: https://github.com/torrust/torrust-tracker/pull/2903#discussion_r4599799711 @@ -296,6 +301,32 @@ review round of #2903`; its one inline finding keeps the reviewer's ID F17. - Follow-up PR URL: N/A - Reply URL: https://github.com/torrust/torrust-tracker/pull/2903#discussion_r4600261767 +### F18 - The unchanged-source check compared with HEAD + +- PR number: 2903 +- Source review ID: 5939412622 +- Reviewer finding ID: F18 +- Source URL: https://github.com/torrust/torrust-tracker/pull/2903#discussion_r4600282774 +- Concern: `git diff --stat 5833cdae9 HEAD -- packages` prints nothing only while `HEAD` is on this branch; after the merge, later slices change `packages/` and the check stops holding. +- Solution: `coverage-evidence.md` and F8's verification name the range by the S0 commit, found by its subject, instead of `HEAD`. +- Current-tree verification: `git diff --stat 5833cdae9 $(git log --format=%H --fixed-strings --grep='specify the tracker-core package tests' -1) -- packages | wc -l` prints 0. +- Resolution reference: docs(issues): [#2902] name the S0 commit in the unchanged-source check +- Follow-up PR URL: N/A +- Reply URL: https://github.com/torrust/torrust-tracker/pull/2903#discussion_r4600363938 + +### F19 - Copilot's F17 comment had no reply, row or resolution + +- PR number: 2903 +- Source review ID: 5939412622 +- Reviewer finding ID: F19 +- Source URL: https://github.com/torrust/torrust-tracker/pull/2903#discussion_r4600282784 +- Concern: Copilot's comment of 13:30:51 UTC had no reply, row or resolution when this review was written. +- Solution: Same concern as F17, which was recorded, replied to and resolved in the commit after the head this review saw; no separate change. +- Current-tree verification: the F17 row and detail entry exist and its thread is resolved. +- Resolution reference: https://github.com/torrust/torrust-tracker/pull/2903#discussion_r4600364534 +- Follow-up PR URL: N/A +- Reply URL: https://github.com/torrust/torrust-tracker/pull/2903#discussion_r4600364534 + ## Processing Log - 2026-11-17 12:48 UTC - Started audit late: the round 1 threads (12:08:23 UTC) and round 2 threads (12:28:40 UTC) had no reply before this record; the fixes were committed first, between 12:37 and 12:46 UTC, one commit per finding (F5 and F9 share one). @@ -305,6 +336,7 @@ review round of #2903`; its one inline finding keeps the reviewer's ID F17. - 2026-11-17 13:16 UTC - Round 4 (da2ce7's review `5939100172`, 13:13:35 UTC, approval with F14-F16) processed: F15 and F14 fixed in their own commits; the round descriptions and finding details now cite commits by subject. Correction of the 12:53 UTC entry above: Copilot's review was submitted at 12:38:27 UTC (12:38:26 UTC is the time of its first inline comments) and was of the first head, not the second (F16). - 2026-11-17 13:25 UTC - Pushed the round 4 fixes and audit commits; replied to the F14-F16 threads between 13:24:53 and 13:25:01 UTC and resolved each after its reply. - 2026-11-17 13:31 UTC - Round 5 (Copilot's review `5939369230`, 13:30:51 UTC, F17) was about the head before the round 4 replies were recorded; replied at 13:31:57 UTC and resolved the thread. +- 2026-11-17 13:41 UTC - Round 6 (da2ce7's review `5939412622`, 13:33:52 UTC, F18-F19): F18 fixed in its own commit and pushed; replied to both threads at 13:41:03 and 13:41:07 UTC and resolved each after its reply (F19 superseded by F17). ## Completion Rules