From 60517c3e8ec0aca9b4f2491e00f393f068431a11 Mon Sep 17 00:00:00 2001 From: josecelano-bot Date: Tue, 10 Nov 2026 17:49:00 +0000 Subject: [PATCH 1/6] docs(issues): add the T1-T3 inventory for #2804 Co-Authored-By: Claude Sonnet 5.5 --- .../ISSUE.md | 9 +- .../inventory.md | 176 ++++++++++++++++++ project-words.txt | 1 + 3 files changed, 182 insertions(+), 4 deletions(-) create mode 100644 docs/issues/open/2804-location-caller-track-caller-audit/inventory.md diff --git a/docs/issues/open/2804-location-caller-track-caller-audit/ISSUE.md b/docs/issues/open/2804-location-caller-track-caller-audit/ISSUE.md index d6f74a09ac..1cb33fc6d5 100644 --- a/docs/issues/open/2804-location-caller-track-caller-audit/ISSUE.md +++ b/docs/issues/open/2804-location-caller-track-caller-audit/ISSUE.md @@ -9,7 +9,7 @@ github-issue: 2804 spec-path: docs/issues/open/2804-location-caller-track-caller-audit/ISSUE.md branch: "2804-location-caller-track-caller-audit-spec" related-pr: null -last-updated-utc: "2026-11-10 14:25" +last-updated-utc: "2026-11-10 17:49" semantic-links: skill-links: - create-issue @@ -206,9 +206,9 @@ Status values: `TODO`, `IN_PROGRESS`, `BLOCKED`, `DONE`. | ID | Status | Task | Notes / Expected Output | | --- | ------ | ----------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| T1 | TODO | Inventory and classify every site | Issue-local `inventory.md` with one row per `Location::caller()`/`#[track_caller]`/`Located(..).into()`: package, file:line, enclosing fn (async, closure, trait impl), test or production, class (correct/wrong/internal). Includes the small experiments on `parse`, async fn, closures and `Located::into`. | -| T2 | TODO | Trace production exposure | For each wrong site, the path to output (HTTP failure reason, UDP error message, REST API, CLI, logs, metrics, events), with the exact line that formats it. Mark "user-visible" or "developer-only". | -| T3 | TODO | Check guidance and enforceability | What the skill, ADRs, `Cargo.toml` lints and clippy config say. Is there a clippy lint (candidates: none known for this; verify) or a test that can enforce the rule? Record the answer even if "no". | +| T1 | DONE | Inventory and classify every site | Issue-local `inventory.md` with one row per `Location::caller()`/`#[track_caller]`/`Located(..).into()`: package, file:line, enclosing fn (async, closure, trait impl), test or production, class (correct/wrong/internal). Includes the small experiments on `parse`, async fn, closures and `Located::into`. | +| T2 | DONE | Trace production exposure | For each wrong site, the path to output (HTTP failure reason, UDP error message, REST API, CLI, logs, metrics, events), with the exact line that formats it. Mark "user-visible" or "developer-only". | +| T3 | DONE | Check guidance and enforceability | What the skill, ADRs, `Cargo.toml` lints and clippy config say. Is there a clippy lint (candidates: none known for this; verify) or a test that can enforce the rule? Record the answer even if "no". | | T4 | TODO | Analyse fix options, recommend one | See options below; semver impact per published crate; recommended option with reasoning. Maintainer approves before any fix. | | T5 | TODO | Write the ADR and the slicing plan | ADR if the convention changes. Create sub-issues or fix PRs per package from the slicing below. | | T6 | TODO | Red regression tests per slice | For each slice (primitives; http-protocol, http-core, axum-http-server; tracker-core and database drivers; udp-server, axum-server, configuration and the rest from T1), a maintained test that fails against current code, with the red output recorded. Primitives first: `PeerRole`, `peer::Id` through `parse`/`try_into`; this closes the reported finding F3. | @@ -287,6 +287,7 @@ with the narrow affected scope, and sign every commit with GPG. - 2026-11-10 13:45 UTC - Claude Code (Sonnet 5.5) - Corrected the UDP exposure analysis after review F1. - 2026-11-10 13:50 UTC - Claude Code (Sonnet 5.5) - Addressed review round 1 (F1-F9 and Copilot): recorded the reproduction, split the red/fix/green tasks, restored template passages, corrected facts and wording. Evidence: `manual-verification-evidence.md`. - 2026-11-10 14:25 UTC - Claude Code (Sonnet 5.5) - Addressed review round 2 (F10-F16): UDP paths, timestamps, evidence numbering, audit record `docs/pr-reviews/pr-2805-review/PR-REVIEW.md`. +- 2026-11-10 17:49 UTC - Claude Code (Sonnet 5.5) - T1 to T3 done: `inventory.md` (classification, experiments, exposure trace, guidance and enforceability check). ## Acceptance Criteria diff --git a/docs/issues/open/2804-location-caller-track-caller-audit/inventory.md b/docs/issues/open/2804-location-caller-track-caller-audit/inventory.md new file mode 100644 index 0000000000..37f764187d --- /dev/null +++ b/docs/issues/open/2804-location-caller-track-caller-audit/inventory.md @@ -0,0 +1,176 @@ +--- +doc-type: issue-inventory +issue-spec: docs/issues/open/2804-location-caller-track-caller-audit/ISSUE.md +last-updated-utc: "2026-11-10 17:49" +--- + +# Inventory of `Location::caller()` and `#[track_caller]` (tasks T1 to T3) + +Snapshot of `torrust/develop` on 2026-11-10 (toolchain: stable `rustc 1.99.1`). It covers every `.rs` +file in `packages/`, `src/`, `console/` and `contrib/`. The standalone crate `torrust-located-error` +3.0.0 is covered by the experiments below. Line numbers are those of this snapshot. + +## Method + +A throwaway script listed every line matching `Location::caller`, `#[track_caller]`, `Located(` or +`(Arc::new(..) as DynError).into()`, skipped comments, and marked a line as test code when it is +under `tests/` or after a `#[cfg(test)]` module. The enclosing `fn` was found by looking upwards. +Each production row was then classified by hand. The script is not kept: the table is the result. + +Counts: 86 matching lines. 58 are production: 38 `Location::caller()`, 3 `#[track_caller]` and +17 `.into()` conversions into a `LocatedError`. 28 are test code: 26 `Location::caller()` and 2 +`.into()`. (The spec's "68 lines" counted one comment, the 6 lines of `asserts.rs` and no `.into()` lines.) + +## Experiments (what `Location::caller()` returns) + +Single-file experiment compiled with `rustc 1.99.1 --edition 2021`, and a throwaway test in +`packages/configuration` for `torrust-located-error` (both deleted). `L` is the line of the call +site named in the first column. + +| # | Shape | Reported location | Meaning | +| --- | -------------------------------------------------------------- | ------------------------------------ | -------------------------------------------------- | +| E1 | `#[track_caller] fn`, called from `main` | the call line in `main` | correct | +| E2 | non-`#[track_caller]` helper that calls a `#[track_caller] fn` | the line inside the helper | the chain is broken at the helper | +| E3 | closure calling a `#[track_caller] fn` | the line inside the closure | the closure body, not the closure's caller | +| E4 | `map(\|_\| loc())` | the line inside the closure | same as E3 | +| E5 | trait method with `#[track_caller]` on the impl, direct call | the call line | correct | +| E6 | the same method called through a generic bound `X: Trait` | the line inside the generic function | the chain breaks at the generic function | +| E7 | `#[track_caller] const fn` | the call line | correct | +| E8 | `#[track_caller] async fn` | the line inside the `async fn` | no-op: rustc warns `ungated_async_fn_track_caller` | +| E9 | `Located(e).into()` written in `fn main`-like code | that line | correct | +| E10 | `Located(e).into()` written inside a helper fn | the line inside the helper | the location is the helper's | +| E11 | `(Arc::new(e) as DynError).into()` inside a helper fn | the line inside the helper | same, `DynError` conversion | +| E12 | `Located(e).into()` inside a closure | the line inside the closure | same as E3 | + +Consequences: `#[track_caller]` helps only for a synchronous chain in which every function is +`#[track_caller]` and the last link is called by code that is itself a meaningful call site. +It cannot help through `str::parse` (see `manual-verification-evidence.md`, D1), generic bounds +(E6), closures (E3) or `async fn` (E8). A `LocatedError` written inline in the function that +detects the error carries that function's line, which is a source location of the _detection_, not +of the caller (E10, E11). + +## Classification + +Classes: + +- **C (correct)**: a `#[track_caller]` chain reaches a call site that means something to the reader. +- **D (detection site)**: the location is a fixed line in the library, correct as "where the library + detected this" but not as "who called it". +- **W (wrong)**: the error is created in a trait impl or conversion whose callers are anonymous + (`FromStr`, `TryFrom`, `From`), or in a helper, so the location says nothing about the caller and + cannot be fixed by `#[track_caller]` alone. +- **T (test only)**: in test code. + +### Production sites with `#[track_caller]` (3) + +| File:line | What | Class | Note | +| ----------------------------------------- | -------------------------------- | ----- | ----------------------------------------------------------------------- | +| `configuration/src/lib.rs:348` | `From for Error` | C | Used with `?` in the configuration loader; the `?` line is reported | +| `tracker-core/src/databases/error.rs:112` | `From<(SqlxError, Driver)>` | C | Reported line is the `.map_err(\|e\| (e, DRIVER))?` site in each driver | +| `tracker-core/src/databases/error.rs:139` | `From<(MigrateError, Driver)>` | C | Same | + +Note on the databases sites: the `?`/`.into()` caller is inside an `async fn` of a driver, and the +line inside an `async fn` body is correct (E9); only the _attribute_ is a no-op there (E8). + +### Production sites with `Location::caller()` (38) + +| # | Package, file:line | Enclosing fn | Class | Reason | +| --- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------ | ----- | ------------------------------------------------------------------------ | +| P1 | `primitives/src/peer.rs:73` | `FromStr for PeerRole::from_str` | W | Reached through `str::parse` (D1 evidence) | +| P2 | `primitives/src/peer.rs:391`, `:397` | `TryFrom> for Id::try_from` | W | Reached through `try_into`/generic code | +| P3 | `http-protocol/src/v1/query.rs:176` | `FromStr for NameValuePair::from_str` | W | Called from `parse` | +| P4 | `http-protocol/src/v1/requests/announce.rs:258`, `:312` | `FromStr for Event`, `FromStr for Compact` | W | Called from `parse` | +| P5 | `http-protocol/src/v1/requests/announce.rs:548`, `:564`, `:575`, `:578`, `:604`, `:611`, `:647` | `extract_info_hash`, `extract_peer_id`, `extract_port`, `extract_number_of_bytes_from_param`, `extract_numwant` | D | Private sync helpers; the location is the helper line, never the request | +| P6 | `http-protocol/src/v1/requests/scrape.rs:93` | `extract_info_hashes` (in `TryFrom`) | D | Same, private helper | +| P7 | `http-protocol/src/v1/services/peer_ip_resolver.rs:86`, `:96` | `try_client_ip_from_connection_info`, `try_client_ip_from_proxy_header` | D | `const fn` helpers; fixed line | +| P8 | `axum-http-server/src/v1/extractors/announce_request.rs:66` | `extract_announce_from` | D | Fixed line in the extractor | +| P9 | `axum-http-server/src/v1/extractors/scrape_request.rs:66` | `extract_scrape_from` | D | Same | +| P10 | `axum-http-server/src/v1/extractors/authentication_key.rs:109`, `:118`, `:122` | `parse_key`, `custom_error` | D | Same | +| P11 | `http-core/src/services/announce.rs:308` | `authenticate` (async) | D | Fixed line inside an `async fn`; attribute would be a no-op | +| P12 | `tracker-core/src/whitelist/authorization.rs:61` | `authorize` (async) | D | Same | +| P13 | `tracker-core/src/authentication/service.rs:98` | `verify_auth_key` (async) | D | Same | +| P14 | `tracker-core/src/authentication/key/mod.rs:158` | `verify_key_expiration` (sync, public) | D | Could be `#[track_caller]`; its callers are `async fn`s | +| P15 | `tracker-core/src/databases/driver/{sqlite,mysql,postgres}/whitelist_store.rs:59`, `:82`/`:83`; `auth_key_store.rs:82`-`:84`, `:105`-`:108` (12 sites in total) | `add_info_hash_to_whitelist`, `remove_info_hash_from_whitelist`, `add_key_to_keys`, `remove_key_from_keys` (async trait impls) | D | Fixed line inside async trait-impl methods | +| P16 | `axum-server/src/tls.rs:43` | `make_rust_tls` (async) | D | Fixed line | + +That is 38 lines: P1 (1), P2 (2), P3 (1), P4 (2), P5 (7), P6 (1), P7 (2), P8 (1), P9 (1), P10 (3), +P11 (1), P12 (1), P13 (1), P14 (1), P15 (12), P16 (1). + +### Production `.into()` conversions into `LocatedError` (17) + +| Package, file:line | Enclosing fn | Class | Note | +| ------------------------------------------------------------------------------------------------- | ---------------------------------------- | ----- | ----------------------------------------------------------------------------------------- | +| `configuration/src/lib.rs:351`, `tracker-core/src/databases/error.rs:118`, `:127`, `:131`, `:144` | the `#[track_caller]` `From` impls above | C | Covered by the three attributes | +| `tracker-core/src/authentication/key/mod.rs:198` | `From for Error::from` | W | A `From` impl without `#[track_caller]`: the location is that line, whatever the `?` site | +| `configuration/src/lib.rs:258` | `attach_explicit_config_path` | D | Plain method; fixed line | +| `axum-server/src/tls.rs:53` | `make_rust_tls` (async) | D | Inline in a `map_err` closure | +| `http-protocol/src/v1/requests/announce.rs:543`, `:560`; `scrape.rs:84` | `extract_*` helpers | D | Inline in `map_err` closures | +| `tracker-core/src/authentication/handler.rs:103`, `:108`, `:120`, `:125`, `:141`, `:150` | `add_peer_key` (async) | D | Inline in the handler | + +The table names all 17: 5 in the `#[track_caller]` impls (class C), 1 W and 11 D. + +### Test code (28) + +26 `Location::caller()` and 2 `.into()` lines in `#[cfg(test)]` modules and `tests/`: in +`http-core` (`error_mapping.rs`, `announce.rs`, `scrape.rs`), `http-protocol/.../responses/error.rs`, +`tracker-core` (`error.rs`, `statistics/event/handler.rs`, `authentication/handler.rs`), +`udp-server` (`event.rs`, `handlers/error.rs`) and `axum-http-server/tests/server/asserts.rs`. +Class T. They construct error values for assertions; they change with the production types. + +## T2 - Which wrong or detection-site locations reach production output + +"Reaches" means that the error's `Display` is formatted into something that leaves the process or is +written to a log. Checked by reading the formatting code, not by running the server (that is the job +of the fix slices, M1 and M2 of the spec). + +| Error type (location in `Display`) | Origin sites | Output path (the formatting line) | Audience | +| ---------------------------------------------------------------------------------------------------- | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------- | +| `ParseQueryError::InvalidParam` (`invalid param {raw_param} in {location}`) | P3 | `From` into `responses::error::Error` (`failure_reason: "Bad request. Cannot parse query params: {err}"`), bencoded to the BitTorrent client | HTTP client | +| `ParseAnnounceQueryError::*`, `ParseScrapeQueryError::*` (`missing param ... in {location}`, others) | P4-P6 | `failure_reason: "... for announce request: {err}"` and the scrape equivalent | HTTP client | +| `auth::Error::*` (`... Error in {location}`) | P10 | `From`: `"Tracker authentication error: {err}"` | HTTP client | +| `PeerIpResolutionError::*` (`... in {location}`) | P7 | `From`: `"Error resolving peer IP: {err}"` | HTTP client | +| `ParsePeerRoleError`, `peer::IdConversionError` | P1, P2 | Not formatted into a response in the production code read for this inventory; they surface only where a caller formats `{e}` | Library consumers | +| `WhitelistError::TorrentNotWhitelisted` (`..., {location}`) | P12 | Announce: `ErrorResponse { message: error.to_string() }` (`udp-server/src/handlers/error.rs:57-59`); HTTP announce: tracker-core error wrapped by `authenticate`; REST: `format!("failed to whitelist torrent: {e}")` (`axum-rest-api-server/.../whitelist/responses.rs`) | UDP client, HTTP client, REST API client | +| `authentication::key::Error::*` (`Key has expired, {location}`, ...) | P13, P14 | HTTP announce through the authentication path; REST: `format!("failed to add key: {e}")` and the other messages in `auth_key/responses.rs` | HTTP client, REST API client | +| `databases::error::Error::{InsertFailed, DeleteFailed, ...}` (`..., {location}`) | P15 | REST: `format!("failed to add key: {e}")`, `failed to whitelist torrent: {e}`, `failed to reload ...`; UDP when `persistent_torrent_completed_stat` loads from the database | REST API client, UDP client | +| `axum_server::tls::Error::BadTlsConfig` (`LocatedError` source) | P16 | Startup failure, printed by the process: operator-facing | Operator | +| `LocatedError` sources of `configuration::Error` | C rows | Startup failure, operator-facing; the location is correct here | Operator | + +Not checked, to be covered by the fix slices: metrics labels (none of the `Display` strings were +found in label code), event payloads (`udp-server/src/event.rs` stores `source.to_string()` as a +string in `ErrorKind::Whitelist`, so the location can reach an event consumer and a log), CLI output +of `console/` (no `location` use found with `grep -rn location console`). + +Result: **at least five production surfaces show a library path to a user**: the HTTP tracker +failure reason, the UDP error message, the REST API error text, the event payload string, and +(by the same `Display`) logs. It is not only developer-facing. + +## T3 - Guidance and enforceability + +- **Skill** `.github/skills/dev/rust-code-quality/handle-errors-in-code/SKILL.md` recommends the + `located-error` package ("Consider `located-error` for diagnostics-rich errors") and says nothing + about `#[track_caller]`, about keeping locations out of user-facing `Display`, or about the + chain-breaking shapes E2 to E12. Its own advice (clarity, context, actionability) argues against + a `Display` that ends in a library path. +- **ADRs**: none about located errors. `20261005145329_return_result_only_for_concretely_fallible_public_apis.md` + covers `#[non_exhaustive]` on public error enums, which matters for the fix options. +- **Lint configuration**: the workspace `Cargo.toml` denies `clippy::all`, `pedantic`, `nursery` + (warn) and the usual rustc groups. There is no `clippy.toml`. +- **Enforcement options**: rustc has the lints `ungated_async_fn_track_caller` (warns on the + attribute on an `async fn`, already active through `warnings = "deny"`) and `tail_call_track_caller`. + Neither clippy 1.99.1 nor rustc has a lint for "`Location::caller()` in a function without + `#[track_caller]`", so a lint is not available. A repository test or a `grep`-based check can + enforce a narrower rule: for example that `Location::caller()` appears only in an allow-list of + files, or never inside an `impl FromStr|TryFrom|From`. That is T9's design question. + +## What this changes in the spec + +- Class counts for planning: W rows (P1 to P4 and `key/mod.rs:198`) are the certain bugs; D rows are + the audit's real question, because their location is correct as a detection site and wrong only + where it reaches a user (T2 table, first six rows). +- The first fix slice (primitives) is confirmed. The second (`http-protocol` and the extractors) + has the largest client-visible exposure. The REST API exposure (not in the original spec text) is a + third path that `axum-rest-api-server` slices must cover. +- T4 (options) now has evidence for the recommendation: option 3 (context instead of location) for + everything that reaches a client, since options 1 and 2 cannot fix P1 to P4 (E6, `str::parse`) + or P11 to P16 (E8). diff --git a/project-words.txt b/project-words.txt index ba3727cb59..2afebc763b 100644 --- a/project-words.txt +++ b/project-words.txt @@ -582,6 +582,7 @@ udpv ulnp unconfigured underflows +ungated ungetwc uninit unistd From 9bda8f584e19ef9c4cf856c21afab99c3d3655a8 Mon Sep 17 00:00:00 2001 From: josecelano-bot Date: Tue, 10 Nov 2026 21:31:22 +0000 Subject: [PATCH 2/6] docs(pr-reviews): add the review retrospective for PR #2805 Co-Authored-By: Claude Sonnet 5.5 --- .../pr-2805-review/review-retrospective.md | 118 ++++++++++++++++++ 1 file changed, 118 insertions(+) create mode 100644 docs/pr-reviews/pr-2805-review/review-retrospective.md diff --git a/docs/pr-reviews/pr-2805-review/review-retrospective.md b/docs/pr-reviews/pr-2805-review/review-retrospective.md new file mode 100644 index 0000000000..b7036da3e7 --- /dev/null +++ b/docs/pr-reviews/pr-2805-review/review-retrospective.md @@ -0,0 +1,118 @@ +--- +semantic-links: + skill-links: + - process-pr-review + related-artifacts: + - docs/templates/PR-REVIEW-RETROSPECTIVE.md + - docs/pr-reviews/pr-2805-review/PR-REVIEW.md + - .github/skills/dev/pr-reviews/process-pr-review/SKILL.md +--- + + + +# PR Review Retrospective — PR #2805 + +Spec-only PR for issue #2804 (`Location::caller()` without `#[track_caller]`). It is carried to +`develop` by PR #2814, which also holds the first work of the issue; PR #2814 had no review findings +when this was written. The location follows `docs/templates/PR-REVIEW-TEMPLATE.md`: beside the +audit record of the PR whose findings it analyses. + +## Review Summary + +| Metric | Value | +| ------------------------------------------ | ------------------------------------------------------------------------------------ | +| Reviews submitted | 7 (6 human, 1 bot); findings came in 5 rounds, and the last 3 human reviews approved | +| Audit findings | 24 (21 human, 3 bot) | +| Re-raised findings (`RE_RAISE_OF`) | 0 | +| Findings about the audit record or replies | 8 of 24 (F12, F13, F14, F15, F20, F21, F23, F24) | +| Findings about statements in the spec | 10 (F1, F2, F5, F6, F7, F8, F10, F11, F16, F17) | +| Commits on the branch | 13 (8 audit-only) | +| First review to last thread resolution | 13:45 to 15:59 UTC on 2026-11-10 (about 2 h 15 min) | +| AI models used | Claude Sonnet 5.5 (author); reviewers unknown | + +Derived from `PR-REVIEW.md` (rows and Processing Log) and `gh api .../pulls/2805/commits`. The +grouping of findings by theme is this author's reading, not a reviewer statement. + +## Findings: cause, type and prevention + +| Finding(s) | Reviewer flagged | Root cause | Type | What would have prevented it | +| ------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------- | ---------------------------------------- | ------------------------------------------------------------------------------------------------------------------- | +| F1, F10, F11 | UDP exposure claims named variants never built in production; scrape path wrong; database path missing | Traced the output path from the error types, not from the call graph; F10 repeated a wrong suggestion from F1 | Misread code path; wrong claim in a spec | Trace every claimed path to a production constructor and a test before writing it; mark unchecked paths "to verify" | +| F2 | Cited a draft folder that does not exist | Copied a path from the briefing without checking it in the tree | Doc/code mismatch | `ls` every cited path before citing it | +| F3 | Reproduction not recorded, no toolchain, red/fix/green folded into one task | Skipped the `fix-bug` "Reproduce Before Review" step and the template's toolchain rule | Process (skill not followed) | Read the skill's pre-review checklist before presenting the spec | +| F4 | Template passages dropped | Wrote the spec from memory of the template instead of copying it | Process | Copy the template and edit; diff against it before review | +| F5, F6, F7, F8 | Wrong conversion names, wrong HTTP messages, wrong test/prod split, wrong semver step | Facts stated from a first pass without recomputing | Doc/code mismatch | Recompute every number and quote every message from the source before stating it | +| F9, F22 | PR description missing sections, then missing the new audit file | Wrote the description once and did not update it when the branch gained files | Process | Regenerate the Files list from `git diff --stat` on every push | +| F12, F14, F20, F24 (stamps, references, wording) | Log stamps later than commits; run time later than its commit; one fix cited one of two commits; round order | Wrote times from the clock or from memory, not from `git log`; wrote references from the last commit only | Doc/code mismatch (self-statements) | Take every stamp from `git log --format=%cI`; cite all commits a change touched; sweep after the first such finding | +| F13, F23 | Replies cited branch SHAs; an edited reply restated a value the tree later changed | Reply text written before the final commit existed; replies are outside the tree, so no check re-reads them | Process / tooling gap | A checker that scans replies for SHAs and for stale values; cite subjects only | +| F15 | No audit record | The author-owned audit step was not part of the first round plan | Process | Create `PR-REVIEW.md` at the first review, not after the second | +| F16 | Evidence section numbering clashed with scenarios | Named the drafting section `V1` without checking the scenario table | Doc/code mismatch | Number drafting sections apart from scenario IDs from the start | +| F17, F18, F19 (bot) | Async claim stated as fact; table syntax; test paths not fully specified | F17 and F19 were fair: a claim marked "to verify" was worded as fact; F18 was a false positive | Missed edge case (F17, F19) | Word unverified claims as hypotheses; define portable substrings in the first draft | + +## What Went Well + +1. Every reviewer claim was re-derived from the tree before replying, which is why the false + positive (F18) was declined with evidence and no reviewer claim was applied blindly. +2. Reproducing the defect for F3 and re-running it with `#[track_caller]` turned a spec claim into a + measured fact (the std line in `str::parse`). +3. The audit validator found a real problem in the first audit commit (padded table rows) before the + reviewer could. + +## What Made the Review Costly + +- **Self-statements without a source check** (F5 to F8, F12, F14, F20, F23, F24): the same cause + appeared in rounds 1, 2, 4 and 5. Stamps later than their commits were flagged in round 2 (F12, + F14); a restated value that the tree later changed was flagged in round 4 (F23). The sweep rule + (search all records for the same kind of statement) was applied to the value flagged, not to all + values of the same kind. +- **Replies outside the tree** (F13, F23): replies are written once, edited later, and read by no + tool. Two findings (F13, F23) and edits of the earlier replies came from them. +- **Wrong claims in the spec's central analysis** (F1, F10, F11): the exposure analysis is the main + content of the spec, and it was corrected twice; the second correction was caused by following a + reviewer's suggestion without re-checking the code. +- **Late audit record** (F15 and its follow-ups): the audit rows then needed a new commit for each + later round, and eight of the 13 commits are audit-only. + +## Root Causes + +1. No mechanical check of timestamps, commit references and reply text; only the skill's prose + ("Stamp an event only after it happened"). +2. Facts were stated from a first pass; the recomputation step existed only as a reviewer action. +3. The author did not start the audit record at the first review, so the first complete audit + arrived with round 2. +4. A suggestion in a review was treated as a verified fact (F10). + +## What We Learnt + +1. A suggestion from a reviewer is a claim to verify, not a fact to copy. +2. When a finding corrects a statement, search every record for the same kind of statement and fix + them all in the same commit. +3. A value that changes (a date, a count, a field) should be stated once or derived, not restated in + replies. +4. Create the audit record when the first review arrives. + +## Improvements for Future Reviews + +1. A check that fails when a Processing Log or progress-log stamp is later than the commit that + carries it — `validate-audit-record.py` / a spec checker — `PROPOSED`. +2. A check that reports branch SHAs in review replies and in audit records — `validate-audit-record.py` + — `PROPOSED`. +3. State in `process-pr-review` that a reviewer-suggested trigger or path is verified against the + code before it is written into a spec — `process-pr-review` skill — `PROPOSED`. +4. Say in the `process-pr-review` intake step that the audit record is created at the first review — + `process-pr-review` skill — `PROPOSED`. + +None is applied in this PR; they change workflow artifacts and need maintainer approval. + +## Avoiding Overcorrection + +- The review cost came mostly from a few repeated causes; a new field or template section per + finding is not justified. +- F18 (table syntax) was a false positive of one bot: it does not justify a new table lint. +- The five rounds were mostly nits after round 2; asking for fewer rounds is not an author decision. + +## Evidence + +- Audit record: `docs/pr-reviews/pr-2805-review/PR-REVIEW.md` +- Pull requests: (reviewed), + (carries this file) From af93923c4374cce26e029437c4052a664217b858 Mon Sep 17 00:00:00 2001 From: josecelano-bot Date: Tue, 10 Nov 2026 21:51:50 +0000 Subject: [PATCH 3/6] docs(issues): correct the T2 exposure trace and record the experiments for #2804 Co-Authored-By: Claude Sonnet 5.5 --- .../ISSUE.md | 3 +- .../experiments.md | 139 +++++++++++++++++ .../inventory.md | 143 ++++++++++-------- 3 files changed, 225 insertions(+), 60 deletions(-) create mode 100644 docs/issues/open/2804-location-caller-track-caller-audit/experiments.md diff --git a/docs/issues/open/2804-location-caller-track-caller-audit/ISSUE.md b/docs/issues/open/2804-location-caller-track-caller-audit/ISSUE.md index 1cb33fc6d5..bf263f3b14 100644 --- a/docs/issues/open/2804-location-caller-track-caller-audit/ISSUE.md +++ b/docs/issues/open/2804-location-caller-track-caller-audit/ISSUE.md @@ -9,7 +9,7 @@ github-issue: 2804 spec-path: docs/issues/open/2804-location-caller-track-caller-audit/ISSUE.md branch: "2804-location-caller-track-caller-audit-spec" related-pr: null -last-updated-utc: "2026-11-10 17:49" +last-updated-utc: "2026-11-10 21:51" semantic-links: skill-links: - create-issue @@ -288,6 +288,7 @@ with the narrow affected scope, and sign every commit with GPG. - 2026-11-10 13:50 UTC - Claude Code (Sonnet 5.5) - Addressed review round 1 (F1-F9 and Copilot): recorded the reproduction, split the red/fix/green tasks, restored template passages, corrected facts and wording. Evidence: `manual-verification-evidence.md`. - 2026-11-10 14:25 UTC - Claude Code (Sonnet 5.5) - Addressed review round 2 (F10-F16): UDP paths, timestamps, evidence numbering, audit record `docs/pr-reviews/pr-2805-review/PR-REVIEW.md`. - 2026-11-10 17:49 UTC - Claude Code (Sonnet 5.5) - T1 to T3 done: `inventory.md` (classification, experiments, exposure trace, guidance and enforceability check). +- 2026-11-10 21:51 UTC - Claude Code (Sonnet 5.5) - Reworked the T2 trace, the closure and class columns, the standalone-crate scan and the experiment record after review of PR #2814 (`experiments.md`). ## Acceptance Criteria diff --git a/docs/issues/open/2804-location-caller-track-caller-audit/experiments.md b/docs/issues/open/2804-location-caller-track-caller-audit/experiments.md new file mode 100644 index 0000000000..50f8852da7 --- /dev/null +++ b/docs/issues/open/2804-location-caller-track-caller-audit/experiments.md @@ -0,0 +1,139 @@ +--- +doc-type: issue-experiments +issue-spec: docs/issues/open/2804-location-caller-track-caller-audit/ISSUE.md +last-updated-utc: "2026-11-10 21:51" +--- + +# Experiments E1 to E12: where `Location::caller()` reports what + +Programs, commands and output behind the table in [`inventory.md`](inventory.md). Toolchain: stable +`rustc 1.99.1 (58cf8f9c3 2026-10-13)`, `cargo 1.99.1`, on Linux x86_64. `torrust-located-error` 3.0.0. + +## E1 to E8: plain `rustc` + +Command (one file, no dependencies): `rustc --edition 2021 track_caller_shapes.rs -o shapes && ./shapes`. + +```rust +use std::future::Future; +use std::panic::Location; + +#[track_caller] +fn loc() -> &'static Location<'static> { + Location::caller() +} + +fn helper() -> &'static Location<'static> { + loc() +} + +fn via_closure() -> &'static Location<'static> { + let f = || loc(); + f() +} + +fn via_map() -> &'static Location<'static> { + Some(1).map(|_| loc()).unwrap() +} + +trait Tr { + fn m(&self) -> &'static Location<'static>; +} +struct S; +impl Tr for S { + #[track_caller] + fn m(&self) -> &'static Location<'static> { + Location::caller() + } +} +fn generic(x: &X) -> &'static Location<'static> { + x.m() +} + +#[track_caller] +const fn const_tc() -> &'static Location<'static> { + Location::caller() +} + +#[track_caller] +async fn async_tc() -> &'static Location<'static> { + Location::caller() +} + +fn main() { + println!("E1 direct call of a track_caller fn : {}", loc()); + println!("E2 helper without track_caller : {}", helper()); + println!("E3 closure calling a track_caller fn : {}", via_closure()); + println!("E4 map(|_| loc()) : {}", via_map()); + println!("E5 track_caller trait impl, direct call : {}", S.m()); + println!("E6 same method through a generic bound : {}", generic(&S)); + println!("E7 track_caller const fn : {}", const_tc()); + let waker = std::task::Waker::noop(); + let mut cx = std::task::Context::from_waker(waker); + let mut fut = Box::pin(async_tc()); + if let std::task::Poll::Ready(l) = fut.as_mut().poll(&mut cx) { + println!("E8 track_caller async fn : {l}"); + } +} +``` + +Compiler output: `warning: #[track_caller] on async functions is a no-op` (lint +`ungated_async_fn_track_caller`). Program output: + +```text +E1 direct call of a track_caller fn : track_caller_shapes.rs:47:63 +E2 helper without track_caller : track_caller_shapes.rs:10:5 +E3 closure calling a track_caller fn : track_caller_shapes.rs:14:16 +E4 map(|_| loc()) : track_caller_shapes.rs:19:21 +E5 track_caller trait impl, direct call : track_caller_shapes.rs:51:65 +E6 same method through a generic bound : track_caller_shapes.rs:33:7 +E7 track_caller const fn : track_caller_shapes.rs:53:63 +E8 track_caller async fn : track_caller_shapes.rs:43:5 +``` + +Reading: E1, E5 and E7 report the line of the call in `main` (47, 51 and 53). E2, E3, E4 and E6 +report a line inside the intermediate function or closure (10, 14, 19, 33). E8 reports line 43, +inside the `async fn` body, so the attribute does nothing. + +## E9 to E12: `torrust-located-error` + +Command: the program below was placed as `packages/configuration/tests/located_error_shapes.rs` +(deleted after the run) and run with +`cargo test -p torrust-tracker-configuration --test located_error_shapes -- --nocapture`. + +```rust +use std::sync::Arc; + +use torrust_located_error::{DynError, Located, LocatedError}; + +#[derive(Debug, thiserror::Error)] +#[error("boom")] +struct Boom; + +fn helper() -> LocatedError<'static, Boom> { + Located(Boom).into() +} + +fn helper_dyn() -> LocatedError<'static, dyn std::error::Error + Send + Sync> { + (Arc::new(Boom) as DynError).into() +} + +#[test] +fn located() { + let direct: LocatedError<'static, Boom> = Located(Boom).into(); + println!("E9 Located(..).into() written inline : {direct}"); + println!("E10 Located(..).into() inside a helper : {}", helper()); + println!("E11 DynError .into() inside a helper : {}", helper_dyn()); + let closure = || -> LocatedError<'static, Boom> { Located(Boom).into() }; + println!("E12 Located(..).into() inside a closure : {}", closure()); +} +``` + +```text +E9 Located(..).into() written inline : boom, packages/configuration/tests/located_error_shapes.rs:19:61 +E10 Located(..).into() inside a helper : boom, packages/configuration/tests/located_error_shapes.rs:10:19 +E11 DynError .into() inside a helper : boom, packages/configuration/tests/located_error_shapes.rs:14:34 +E12 Located(..).into() inside a closure : boom, packages/configuration/tests/located_error_shapes.rs:23:69 +``` + +Reading: `Display` of a `LocatedError` is `{source}, {location}`; E9 reports the call line (19), E10 and +E11 the line inside the helper (10, 14), and E12 the closure line (23). diff --git a/docs/issues/open/2804-location-caller-track-caller-audit/inventory.md b/docs/issues/open/2804-location-caller-track-caller-audit/inventory.md index 37f764187d..7d6009672d 100644 --- a/docs/issues/open/2804-location-caller-track-caller-audit/inventory.md +++ b/docs/issues/open/2804-location-caller-track-caller-audit/inventory.md @@ -1,14 +1,15 @@ --- doc-type: issue-inventory issue-spec: docs/issues/open/2804-location-caller-track-caller-audit/ISSUE.md -last-updated-utc: "2026-11-10 17:49" +last-updated-utc: "2026-11-10 21:51" --- # Inventory of `Location::caller()` and `#[track_caller]` (tasks T1 to T3) Snapshot of `torrust/develop` on 2026-11-10 (toolchain: stable `rustc 1.99.1`). It covers every `.rs` -file in `packages/`, `src/`, `console/` and `contrib/`. The standalone crate `torrust-located-error` -3.0.0 is covered by the experiments below. Line numbers are those of this snapshot. +file in `packages/`, `src/`, `console/` and `contrib/`, and the eight standalone `torrust-*` registry +crates of `Cargo.lock` (see [Standalone crates](#standalone-crates-in-the-dependency-tree)). Line +numbers are those of this snapshot. ## Method @@ -23,9 +24,8 @@ Counts: 86 matching lines. 58 are production: 38 `Location::caller()`, 3 `#[trac ## Experiments (what `Location::caller()` returns) -Single-file experiment compiled with `rustc 1.99.1 --edition 2021`, and a throwaway test in -`packages/configuration` for `torrust-located-error` (both deleted). `L` is the line of the call -site named in the first column. +Programs, commands, toolchain and raw output are in [`experiments.md`](experiments.md). `L` below +means the line the call is written on. | # | Shape | Reported location | Meaning | | --- | -------------------------------------------------------------- | ------------------------------------ | -------------------------------------------------- | @@ -57,8 +57,8 @@ Classes: - **D (detection site)**: the location is a fixed line in the library, correct as "where the library detected this" but not as "who called it". - **W (wrong)**: the error is created in a trait impl or conversion whose callers are anonymous - (`FromStr`, `TryFrom`, `From`), or in a helper, so the location says nothing about the caller and - cannot be fixed by `#[track_caller]` alone. + (`FromStr`, `TryFrom`, `From`), so the location says nothing about the caller and cannot be fixed + by `#[track_caller]` alone. Helper functions are class D, not W. - **T (test only)**: in test code. ### Production sites with `#[track_caller]` (3) @@ -69,32 +69,37 @@ Classes: | `tracker-core/src/databases/error.rs:112` | `From<(SqlxError, Driver)>` | C | Reported line is the `.map_err(\|e\| (e, DRIVER))?` site in each driver | | `tracker-core/src/databases/error.rs:139` | `From<(MigrateError, Driver)>` | C | Same | -Note on the databases sites: the `?`/`.into()` caller is inside an `async fn` of a driver, and the -line inside an `async fn` body is correct (E9); only the _attribute_ is a no-op there (E8). +Note on the databases sites: the `?`/`.into()` caller is inside an `async fn` of a driver, and the line written inside an `async fn` body is the real line of that code (E8 reports the line of +the body); only the _attribute_ is a no-op there. ### Production sites with `Location::caller()` (38) -| # | Package, file:line | Enclosing fn | Class | Reason | -| --- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------ | ----- | ------------------------------------------------------------------------ | -| P1 | `primitives/src/peer.rs:73` | `FromStr for PeerRole::from_str` | W | Reached through `str::parse` (D1 evidence) | -| P2 | `primitives/src/peer.rs:391`, `:397` | `TryFrom> for Id::try_from` | W | Reached through `try_into`/generic code | -| P3 | `http-protocol/src/v1/query.rs:176` | `FromStr for NameValuePair::from_str` | W | Called from `parse` | -| P4 | `http-protocol/src/v1/requests/announce.rs:258`, `:312` | `FromStr for Event`, `FromStr for Compact` | W | Called from `parse` | -| P5 | `http-protocol/src/v1/requests/announce.rs:548`, `:564`, `:575`, `:578`, `:604`, `:611`, `:647` | `extract_info_hash`, `extract_peer_id`, `extract_port`, `extract_number_of_bytes_from_param`, `extract_numwant` | D | Private sync helpers; the location is the helper line, never the request | -| P6 | `http-protocol/src/v1/requests/scrape.rs:93` | `extract_info_hashes` (in `TryFrom`) | D | Same, private helper | -| P7 | `http-protocol/src/v1/services/peer_ip_resolver.rs:86`, `:96` | `try_client_ip_from_connection_info`, `try_client_ip_from_proxy_header` | D | `const fn` helpers; fixed line | -| P8 | `axum-http-server/src/v1/extractors/announce_request.rs:66` | `extract_announce_from` | D | Fixed line in the extractor | -| P9 | `axum-http-server/src/v1/extractors/scrape_request.rs:66` | `extract_scrape_from` | D | Same | -| P10 | `axum-http-server/src/v1/extractors/authentication_key.rs:109`, `:118`, `:122` | `parse_key`, `custom_error` | D | Same | -| P11 | `http-core/src/services/announce.rs:308` | `authenticate` (async) | D | Fixed line inside an `async fn`; attribute would be a no-op | -| P12 | `tracker-core/src/whitelist/authorization.rs:61` | `authorize` (async) | D | Same | -| P13 | `tracker-core/src/authentication/service.rs:98` | `verify_auth_key` (async) | D | Same | -| P14 | `tracker-core/src/authentication/key/mod.rs:158` | `verify_key_expiration` (sync, public) | D | Could be `#[track_caller]`; its callers are `async fn`s | -| P15 | `tracker-core/src/databases/driver/{sqlite,mysql,postgres}/whitelist_store.rs:59`, `:82`/`:83`; `auth_key_store.rs:82`-`:84`, `:105`-`:108` (12 sites in total) | `add_info_hash_to_whitelist`, `remove_info_hash_from_whitelist`, `add_key_to_keys`, `remove_key_from_keys` (async trait impls) | D | Fixed line inside async trait-impl methods | -| P16 | `axum-server/src/tls.rs:43` | `make_rust_tls` (async) | D | Fixed line | - -That is 38 lines: P1 (1), P2 (2), P3 (1), P4 (2), P5 (7), P6 (1), P7 (2), P8 (1), P9 (1), P10 (3), -P11 (1), P12 (1), P13 (1), P14 (1), P15 (12), P16 (1). +"Shape" says what stands between the site and a meaningful caller: `trait impl` (called through +`parse`, `try_into` or a generic bound, E6), `closure` (the site is written inside a closure, E3), +`async` (the site is inside an `async fn`, E8), or `plain` (a synchronous function, E2). + +| # | Package, file:line | Enclosing fn | Class | Shape | Reason | +| --- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ----- | ----------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- | +| P1 | `primitives/src/peer.rs:73` | `FromStr for PeerRole::from_str` | W | trait impl | Reached through `str::parse` (D1 evidence) | +| P2 | `primitives/src/peer.rs:391`, `:397` | `TryFrom> for Id::try_from` | W | trait impl | Reached through `try_into` or generic code | +| P3 | `http-protocol/src/v1/query.rs:176` | `FromStr for NameValuePair::from_str` | W | trait impl | Called from `parse` | +| P4 | `http-protocol/src/v1/requests/announce.rs:258`, `:312` | `FromStr for Event`, `FromStr for Compact` | W | trait impl | Called from `parse` | +| P5a | `http-protocol/src/v1/requests/announce.rs:548`, `:564`, `:578` | `extract_info_hash`, `extract_peer_id`, `extract_port` (`None` arms) | D | plain; reached only through `TryFrom for Announce` (`announce.rs:334`) | Private helper; `#[track_caller]` would stop at the `TryFrom` impl (E6) | +| P5b | `http-protocol/src/v1/requests/announce.rs:575`, `:604`, `:611`, `:647` | `extract_port`, `extract_number_of_bytes_from_param`, `extract_numwant` | D | closure (`map_err`, `map_or`) | The site is inside a closure, so `#[track_caller]` on the helper would not change it (E3) | +| P6 | `http-protocol/src/v1/requests/scrape.rs:93` | `extract_info_hashes` | D | plain; reached only through `TryFrom for Scrape` (`scrape.rs:64`) | Same as P5a | +| P7 | `http-protocol/src/v1/services/peer_ip_resolver.rs:86`, `:96` | `try_client_ip_from_connection_info`, `try_client_ip_from_proxy_header` | D | plain (`const fn`) | Fixed line | +| P8 | `axum-http-server/src/v1/extractors/announce_request.rs:66` | `extract_announce_from` | D | plain | Fixed line in the extractor | +| P9 | `axum-http-server/src/v1/extractors/scrape_request.rs:66` | `extract_scrape_from` | D | plain | Same | +| P10 | `axum-http-server/src/v1/extractors/authentication_key.rs:109`, `:118`, `:122` | `parse_key`, `custom_error` | D | plain | Same | +| P11 | `http-core/src/services/announce.rs:308` | `authenticate` | D | async | Fixed line inside an `async fn`; the attribute would be a no-op | +| P12 | `tracker-core/src/whitelist/authorization.rs:61` | `authorize` | D | async | Same | +| P13 | `tracker-core/src/authentication/service.rs:98` | `verify_auth_key` | D | async | Same | +| P14 | `tracker-core/src/authentication/key/mod.rs:158` | `verify_key_expiration` (sync, public) | D | closure (`map_or_else`, line 155) | The site is inside a closure, so `#[track_caller]` on the function would not change it (E3) | +| P15 | `tracker-core/src/databases/driver/{sqlite,mysql,postgres}/whitelist_store.rs:59`, `:82`/`:83`; `auth_key_store.rs:82`-`:84`, `:105`-`:108` (12 sites in total) | `add_info_hash_to_whitelist`, `remove_info_hash_from_whitelist`, `add_key_to_keys`, `remove_key_from_keys` | D | async (trait impl methods) | Fixed line inside async trait-impl methods | +| P16 | `axum-server/src/tls.rs:43` | `make_rust_tls` | D | async | Fixed line | + +That is 38 lines: P1 (1), P2 (2), P3 (1), P4 (2), P5a (3), P5b (4), P6 (1), P7 (2), P8 (1), P9 (1), +P10 (3), P11 (1), P12 (1), P13 (1), P14 (1), P15 (12), P16 (1). ### Production `.into()` conversions into `LocatedError` (17) @@ -117,33 +122,54 @@ The table names all 17: 5 in the `#[track_caller]` impls (class C), 1 W and 11 D `udp-server` (`event.rs`, `handlers/error.rs`) and `axum-http-server/tests/server/asserts.rs`. Class T. They construct error values for assertions; they change with the production types. -## T2 - Which wrong or detection-site locations reach production output +## T2 - Which locations reach production output "Reaches" means that the error's `Display` is formatted into something that leaves the process or is -written to a log. Checked by reading the formatting code, not by running the server (that is the job -of the fix slices, M1 and M2 of the spec). - -| Error type (location in `Display`) | Origin sites | Output path (the formatting line) | Audience | -| ---------------------------------------------------------------------------------------------------- | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------- | -| `ParseQueryError::InvalidParam` (`invalid param {raw_param} in {location}`) | P3 | `From` into `responses::error::Error` (`failure_reason: "Bad request. Cannot parse query params: {err}"`), bencoded to the BitTorrent client | HTTP client | -| `ParseAnnounceQueryError::*`, `ParseScrapeQueryError::*` (`missing param ... in {location}`, others) | P4-P6 | `failure_reason: "... for announce request: {err}"` and the scrape equivalent | HTTP client | -| `auth::Error::*` (`... Error in {location}`) | P10 | `From`: `"Tracker authentication error: {err}"` | HTTP client | -| `PeerIpResolutionError::*` (`... in {location}`) | P7 | `From`: `"Error resolving peer IP: {err}"` | HTTP client | -| `ParsePeerRoleError`, `peer::IdConversionError` | P1, P2 | Not formatted into a response in the production code read for this inventory; they surface only where a caller formats `{e}` | Library consumers | -| `WhitelistError::TorrentNotWhitelisted` (`..., {location}`) | P12 | Announce: `ErrorResponse { message: error.to_string() }` (`udp-server/src/handlers/error.rs:57-59`); HTTP announce: tracker-core error wrapped by `authenticate`; REST: `format!("failed to whitelist torrent: {e}")` (`axum-rest-api-server/.../whitelist/responses.rs`) | UDP client, HTTP client, REST API client | -| `authentication::key::Error::*` (`Key has expired, {location}`, ...) | P13, P14 | HTTP announce through the authentication path; REST: `format!("failed to add key: {e}")` and the other messages in `auth_key/responses.rs` | HTTP client, REST API client | -| `databases::error::Error::{InsertFailed, DeleteFailed, ...}` (`..., {location}`) | P15 | REST: `format!("failed to add key: {e}")`, `failed to whitelist torrent: {e}`, `failed to reload ...`; UDP when `persistent_torrent_completed_stat` loads from the database | REST API client, UDP client | -| `axum_server::tls::Error::BadTlsConfig` (`LocatedError` source) | P16 | Startup failure, printed by the process: operator-facing | Operator | -| `LocatedError` sources of `configuration::Error` | C rows | Startup failure, operator-facing; the location is correct here | Operator | +written to a log. Checked by reading the producers and the formatting code at `4a46f98b2`, not by +running the server (that is the job of the fix slices, M1 and M2 of the spec). Each row names the +producers (rows of the tables above, plus the class-C conversion `databases/error.rs:112` and the +standalone crates), then the formatting line, then the audience. Class C rows are listed because a +`#[track_caller]` chain that ends at a line in a library driver is correct for the chain and still +shows a library path to a user. + +| Error (location in `Display`) | Producers | Output path (formatting line) | Audience | +| ------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------- | +| `ParseQueryError::InvalidParam` | P3 | `From`: `"Bad request. Cannot parse query params: {err}"` (`requests/announce.rs:318-323`) | HTTP tracker client | +| `ParseAnnounceQueryError::*` | P4, P5a, P5b, P8 (`MissingParams`) | `"... for announce request: {err}"` (`announce.rs:329`) | HTTP tracker client | +| `ParseScrapeQueryError::*` | P6, P9 (`MissingParams`) | `"... for scrape request: {err}"` (`scrape.rs:59`) | HTTP tracker client | +| `auth::Error::{InvalidKeyFormat, CannotExtractKeyParam}` | P10 | `"Tracker authentication error: {err}"` (`responses/error.rs:54`) | HTTP tracker client | +| `PeerIpResolutionError::*` | P7 | `"Error resolving peer IP: {err}"` (`responses/error.rs:62`) | HTTP tracker client | +| `authentication::key::Error::{MissingAuthKey, UnableToReadKey, KeyExpired}` | P11 (`MissingAuthKey`), P13 (`UnableToReadKey`), P14 (`KeyExpired`) | `"Tracker authentication error: {source}"` (`http-core/src/services/error_mapping.rs`). Never REST: the REST key handlers receive `PeerKeyError` or database errors (`rest-api-runtime-adapter/.../adapters/auth_key.rs:74-85`). UDP has no key authentication | HTTP tracker client | +| `WhitelistError::TorrentNotWhitelisted` | P12 | HTTP: returned by `authorize` (`http-core/src/services/announce.rs:213`, `From` at `:403`), formatted `"Tracker whitelist error: {source}"` (`error_mapping.rs:13`). UDP announce: `handle_announce` calls `authorize` at `udp-core/src/services/announce.rs:109`, then `ErrorResponse { message: error.to_string() }` (`udp-server/src/handlers/error.rs:57-59`). Not REST | HTTP and UDP tracker clients | +| `databases::error::Error::{InsertFailed, DeleteFailed}` | P15 (12 sites). Built only in the driver add/remove methods, called only from `whitelist/repository/persisted.rs:36,52` and `authentication/key/repository/persisted.rs:43,57` | REST: `failed to whitelist torrent: {e}` and the other messages in `whitelist/responses.rs`; for keys, `PeerKeyError::DatabaseError` mapped at `adapters/auth_key.rs:85` into `failed to add key: {e}`. Never UDP | REST API client | +| `databases::error::Error::{QueryReturnedNoRows, ConnectionError, InvalidQuery, ...}` through the class-C `From<(SqlxError, Driver)>` | Every `.map_err(\|e\| (e, DRIVER))?` in the drivers, for example `load_torrent_downloads` (`sqlite/torrent_metrics_store.rs:69`) | The `LocatedError` source prints the driver line. UDP: reached when `core.tracker_policy.persistent_torrent_completed_stat` loads downloads from the database, through `UdpAnnounceError`/`UdpScrapeError` into `error.to_string()`. REST: `failed to reload ...` and the add/remove messages above. This is the path through which class C reaches clients | UDP tracker client, REST API client | +| `PeerKeyError::{DatabaseError, InvalidKey}` sources | `authentication/handler.rs:103`, `:108`, `:120`, `:125`, `:141`, `:150` (`Located(..).into()`, class D) | `map_peer_key_error`: `AuthKeyError::Database(source.to_string())` and `reason: source.to_string()` (`adapters/auth_key.rs:80-84`), then `failed to add key: {e}` and the generate messages in `auth_key/responses.rs`. These carry the handler line plus the inner database location | REST API client | +| `torrust_info_hash::ConversionError::{NotEnoughBytes, TooManyBytes}` (standalone crate, class W) | `torrust-info-hash` 0.2.0 `info_hash.rs:273`, `:279`, reached through `percent_decode_info_hash` (`http-protocol/src/percent_encoding.rs:55-58`) | Wrapped in `ParseAnnounceQueryError::InvalidInfoHashParam` / `ParseScrapeQueryError::InvalidInfoHashParam` with `Located(err).into()` (`announce.rs:543`, `scrape.rs:84`), then the HTTP failure reasons above: the response then holds two locations, one inside a registry crate | HTTP tracker client | +| `ErrorKind::Whitelist(String)` event payload | P12 through `source.to_string()` (`udp-server/src/event.rs:135`, `:145`) | Event consumers (statistics, logs) | Operators, event consumers | +| `axum_server::tls::Error::{MissingTlsConfig, BadTlsConfig}`, `configuration::Error` sources | P16, class-C configuration impl | Startup failure printed by the process. The configuration location is correct there | Operator | +| `ParsePeerRoleError`, `peer::IdConversionError` | P1, P2 | No production path found: `ParsePeerRoleError` and `IdConversionError` are not used outside `primitives/src/peer.rs` | Library consumers only | Not checked, to be covered by the fix slices: metrics labels (none of the `Display` strings were -found in label code), event payloads (`udp-server/src/event.rs` stores `source.to_string()` as a -string in `ErrorKind::Whitelist`, so the location can reach an event consumer and a log), CLI output -of `console/` (no `location` use found with `grep -rn location console`). +found in label code), and CLI output of `console/` (`grep -rn location console` finds no use). -Result: **at least five production surfaces show a library path to a user**: the HTTP tracker -failure reason, the UDP error message, the REST API error text, the event payload string, and -(by the same `Display`) logs. It is not only developer-facing. +Result: **a library path reaches a user on at least five surfaces**: the HTTP tracker failure +reason, the UDP error message, the REST API error text, event payload strings and logs. It is not +only developer-facing. Class C does not protect users: the database conversion reaches UDP and REST +clients with a driver line. + +### Standalone crates in the dependency tree + +`Cargo.lock` at `4a46f98b2` lists eight registry `torrust-*` crates. Scanned in `~/.cargo/registry/src` +with `grep -rn 'Location::caller\|track_caller' --include=*.rs`: + +| Crate | Matches | Result | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | +| `torrust-info-hash` 0.2.0 | 2 | `src/info_hash.rs:273`, `:279`: `Location::caller()` in `TryFrom> for InfoHash` (class W, same shape as P2). Reaches HTTP clients (T2 table) | +| `torrust-located-error` 3.0.0 | 8 | `src/lib.rs:89`, `:102`: `#[track_caller]` on both `Into` impls (class C). The other lines are the doc example and a test helper | +| `torrust-bencode` 3.0.0, `torrust-clock` 3.0.0, `torrust-metrics` 0.2.0, `torrust-net-primitives` 0.1.0, `torrust-peer-id` 0.1.0, `torrust-server-lib` 0.5.0 | 0 | No use | + +A fix for `torrust-info-hash` belongs in its own repository, so T9 must open an issue there; the +workspace slices cannot change it. ## T3 - Guidance and enforceability @@ -165,12 +191,11 @@ failure reason, the UDP error message, the REST API error text, the event payloa ## What this changes in the spec -- Class counts for planning: W rows (P1 to P4 and `key/mod.rs:198`) are the certain bugs; D rows are +- Class counts for planning: W rows (P1 to P4, `key/mod.rs:198` and `torrust-info-hash`) are the certain bugs; D rows are the audit's real question, because their location is correct as a detection site and wrong only - where it reaches a user (T2 table, first six rows). + where it reaches a user (T2 table). - The first fix slice (primitives) is confirmed. The second (`http-protocol` and the extractors) - has the largest client-visible exposure. The REST API exposure (not in the original spec text) is a - third path that `axum-rest-api-server` slices must cover. + has the largest client-visible exposure. The REST API exposure (not in the original spec text) is a third path that the REST slices must cover, and the class-C database conversion reaches UDP and REST clients, so the `tracker-core` slice must change it too, not only the class-D driver sites. - T4 (options) now has evidence for the recommendation: option 3 (context instead of location) for - everything that reaches a client, since options 1 and 2 cannot fix P1 to P4 (E6, `str::parse`) - or P11 to P16 (E8). + everything that reaches a client, since options 1 and 2 cannot fix P1 to P4 (E6, `str::parse`), P5a and P6 (reached only through a `TryFrom` impl, E6), P5b and P14 (the site is in a closure, E3) + or P11 to P13, P15 and P16 (async, E8). From a33c278c9dfda8bc61ef0a5067f92f308bb61fa4 Mon Sep 17 00:00:00 2001 From: josecelano-bot Date: Tue, 10 Nov 2026 21:52:20 +0000 Subject: [PATCH 4/6] docs(pr-reviews): correct the intro and figures of the PR #2805 retrospective Co-Authored-By: Claude Sonnet 5.5 --- .../pr-2805-review/review-retrospective.md | 43 +++++++++++-------- 1 file changed, 25 insertions(+), 18 deletions(-) diff --git a/docs/pr-reviews/pr-2805-review/review-retrospective.md b/docs/pr-reviews/pr-2805-review/review-retrospective.md index b7036da3e7..3b1ee0b638 100644 --- a/docs/pr-reviews/pr-2805-review/review-retrospective.md +++ b/docs/pr-reviews/pr-2805-review/review-retrospective.md @@ -12,23 +12,30 @@ semantic-links: # PR Review Retrospective — PR #2805 -Spec-only PR for issue #2804 (`Location::caller()` without `#[track_caller]`). It is carried to -`develop` by PR #2814, which also holds the first work of the issue; PR #2814 had no review findings -when this was written. The location follows `docs/templates/PR-REVIEW-TEMPLATE.md`: beside the -audit record of the PR whose findings it analyses. +PR #2805 was the spec-only PR for issue #2804 (`Location::caller()` without `#[track_caller]`). It +was merged into `develop` on its own (`3fe63d04b`). This file analyses its review and is carried to +`develop` by PR #2814, the next PR of the same issue, because #2805 was already merged when it was +written. It lives beside the audit record of the reviewed PR, as `PR-REVIEW-RETROSPECTIVE.md` +asks. It does not cover the review of #2814 itself. + +## Purpose + +Record, blamelessly and from evidence, why the review of #2805 took 24 findings over five rounds, +and what would have prevented the avoidable ones. It complements `PR-REVIEW.md`, which records what +each finding was; this file records why the process cost what it did. ## Review Summary -| Metric | Value | -| ------------------------------------------ | ------------------------------------------------------------------------------------ | -| Reviews submitted | 7 (6 human, 1 bot); findings came in 5 rounds, and the last 3 human reviews approved | -| Audit findings | 24 (21 human, 3 bot) | -| Re-raised findings (`RE_RAISE_OF`) | 0 | -| Findings about the audit record or replies | 8 of 24 (F12, F13, F14, F15, F20, F21, F23, F24) | -| Findings about statements in the spec | 10 (F1, F2, F5, F6, F7, F8, F10, F11, F16, F17) | -| Commits on the branch | 13 (8 audit-only) | -| First review to last thread resolution | 13:45 to 15:59 UTC on 2026-11-10 (about 2 h 15 min) | -| AI models used | Claude Sonnet 5.5 (author); reviewers unknown | +| Metric | Value | +| ------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| Reviews submitted | 7 by reviewers (6 human, 1 bot); findings came in 5 rounds and the last review (16:19 UTC) approved with no finding. Source: `gh api repos/torrust/torrust-tracker/pulls/2805/reviews --paginate`, excluding the replies posted as `josecelano-bot` | +| Audit findings | 24 (21 human, 3 bot) | +| Re-raised findings (`RE_RAISE_OF`) | 0 | +| Findings about the audit record or replies | 6 of 24 (F13, F15, F20, F21, F23, F24) | +| Findings about statements in the spec or evidence | 12 (F1, F2, F5, F6, F7, F8, F10, F11, F12, F14, F16, F17) | +| Commits on the branch | 13 (7 audit-only; `406d1bb7d` also changes `ISSUE.md`). Source: `gh api .../pulls/2805/commits` and `git show --stat` | +| First review to last thread resolution | 13:45:12 UTC (first review, forge) to 15:59 UTC (last resolution, audit Processing Log), 2 h 14 min; the final approval was at 16:19:06 UTC | +| AI models used | Claude Sonnet 5.5 (author); reviewers unknown | Derived from `PR-REVIEW.md` (rows and Processing Log) and `gh api .../pulls/2805/commits`. The grouping of findings by theme is this author's reading, not a reviewer statement. @@ -47,7 +54,7 @@ grouping of findings by theme is this author's reading, not a reviewer statement | F13, F23 | Replies cited branch SHAs; an edited reply restated a value the tree later changed | Reply text written before the final commit existed; replies are outside the tree, so no check re-reads them | Process / tooling gap | A checker that scans replies for SHAs and for stale values; cite subjects only | | F15 | No audit record | The author-owned audit step was not part of the first round plan | Process | Create `PR-REVIEW.md` at the first review, not after the second | | F16 | Evidence section numbering clashed with scenarios | Named the drafting section `V1` without checking the scenario table | Doc/code mismatch | Number drafting sections apart from scenario IDs from the start | -| F17, F18, F19 (bot) | Async claim stated as fact; table syntax; test paths not fully specified | F17 and F19 were fair: a claim marked "to verify" was worded as fact; F18 was a false positive | Missed edge case (F17, F19) | Word unverified claims as hypotheses; define portable substrings in the first draft | +| F17, F18, F19 (bot) | Async claim stated as fact; table syntax; test paths not fully specified | F17 and F19 were fair: a claim marked "to verify" was worded as fact; F18 was a false positive | Missed edge case (F17, F19) | Word unverified claims as hypotheses; define portable substrings in the first draft | ## What Went Well @@ -61,8 +68,8 @@ grouping of findings by theme is this author's reading, not a reviewer statement ## What Made the Review Costly - **Self-statements without a source check** (F5 to F8, F12, F14, F20, F23, F24): the same cause - appeared in rounds 1, 2, 4 and 5. Stamps later than their commits were flagged in round 2 (F12, - F14); a restated value that the tree later changed was flagged in round 4 (F23). The sweep rule + appeared in all five rounds. Round 1 (F5 to F8), round 2 (F12, F14: stamps later than their commits), round 3 (F20: one of two + commits cited); a restated value that the tree later changed was flagged in round 4 (F23), and a misleading order and wording in round 5 (F24). The sweep rule (search all records for the same kind of statement) was applied to the value flagged, not to all values of the same kind. - **Replies outside the tree** (F13, F23): replies are written once, edited later, and read by no @@ -71,7 +78,7 @@ grouping of findings by theme is this author's reading, not a reviewer statement content of the spec, and it was corrected twice; the second correction was caused by following a reviewer's suggestion without re-checking the code. - **Late audit record** (F15 and its follow-ups): the audit rows then needed a new commit for each - later round, and eight of the 13 commits are audit-only. + later round, and seven of the 13 commits are audit-only. ## Root Causes From a8f622e0141cf95aa8208b31eddd2cd0d3d1eb75 Mon Sep 17 00:00:00 2001 From: josecelano-bot Date: Tue, 10 Nov 2026 21:55:44 +0000 Subject: [PATCH 5/6] docs(pr-reviews): add the review audit record for PR #2814 Co-Authored-By: Claude Sonnet 5.5 --- docs/pr-reviews/pr-2814-review/PR-REVIEW.md | 226 ++++++++++++++++++++ 1 file changed, 226 insertions(+) create mode 100644 docs/pr-reviews/pr-2814-review/PR-REVIEW.md diff --git a/docs/pr-reviews/pr-2814-review/PR-REVIEW.md b/docs/pr-reviews/pr-2814-review/PR-REVIEW.md new file mode 100644 index 0000000000..b013fbce0e --- /dev/null +++ b/docs/pr-reviews/pr-2814-review/PR-REVIEW.md @@ -0,0 +1,226 @@ +--- +semantic-links: + skill-links: + - process-pr-review + related-artifacts: + - .github/skills/dev/pr-reviews/process-pr-review/SKILL.md +--- + + + +# PR #2814 Review Audit + +Source: pull-request reviews and inline review threads for https://github.com/torrust/torrust-tracker/pull/2814. + +## 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 `5848125288` (F1 to F5) and Copilot's review `5848148251` (F11, numbered after the reviewer-provided IDs). Round 2 is da2ce7's review `5849963483` (F6 to F10). Both rounds were processed together because the first was found late. + +| Finding ID | Review finding reference | Author class | Severity | Category | Relationship | Disposition | Thread state | +| ---------- | ------------------------ | ------------ | -------- | -------- | ------------ | ----------- | ------------ | +| F1 | review-finding:pr-2814-f1 | Human | Major | correctness | ORIGINAL | FIXED | RESOLVED | +| F2 | review-finding:pr-2814-f2 | Human | Minor | correctness | ORIGINAL | FIXED | RESOLVED | +| F3 | review-finding:pr-2814-f3 | Human | Minor | documentation | ORIGINAL | FIXED | RESOLVED | +| F4 | review-finding:pr-2814-f4 | Human | Minor | documentation | ORIGINAL | FIXED | RESOLVED | +| F5 | review-finding:pr-2814-f5 | Human | Nit | documentation | ORIGINAL | FIXED | RESOLVED | +| F6 | review-finding:pr-2814-f6 | Human | Minor | documentation | ORIGINAL | FIXED | RESOLVED | +| F7 | review-finding:pr-2814-f7 | Human | Nit | documentation | ORIGINAL | FIXED | RESOLVED | +| F8 | review-finding:pr-2814-f8 | Human | Minor | correctness | ORIGINAL | FIXED | RESOLVED | +| F9 | review-finding:pr-2814-f9 | Human | Nit | correctness | ORIGINAL | FIXED | RESOLVED | +| F10 | review-finding:pr-2814-f10 | Human | Minor | documentation | ORIGINAL | FIXED | RESOLVED | +| F11 | review-finding:pr-2814-f11 | Copilot | Suggestion (inferred) | formatting | ORIGINAL | NO_ACTION | SUPERSEDED | + +## Finding Details + +### F1 - The T2 exposure table attributes client exposure to the wrong origin sites + +- PR number: 2814 +- Source review ID: 5848125288 +- Reviewer finding ID: N/A +- Source URL: https://github.com/torrust/torrust-tracker/pull/2814#discussion_r4529566733 +- Concern: The table mapped InsertFailed and DeleteFailed to UDP, key errors to REST and the whitelist error to REST, and left out the class-C database conversion and P8, P9, P11. +- Solution: Re-traced every row from its producers to the formatting line and added the missing rows. +- Current-tree verification: Read the T2 table against persisted.rs, adapters/auth_key.rs, error_mapping.rs and torrent_metrics_store.rs. +- Resolution reference: docs(issues): correct the T2 exposure trace and record the experiments for #2804 +- Follow-up PR URL: N/A +- Reply URL: https://github.com/torrust/torrust-tracker/pull/2814#discussion_r4531015171 + +### F2 - Closures are not marked and the P14 note contradicts E3 + +- PR number: 2814 +- Source review ID: 5848125288 +- Reviewer finding ID: N/A +- Source URL: https://github.com/torrust/torrust-tracker/pull/2814#discussion_r4529566745 +- Concern: Closure sites were not marked and E8 was cited for a synchronous site. +- Solution: Added a Shape column and corrected the citations. +- Current-tree verification: Read the Shape column and the last section. +- Resolution reference: docs(issues): correct the T2 exposure trace and record the experiments for #2804 +- Follow-up PR URL: N/A +- Reply URL: https://github.com/torrust/torrust-tracker/pull/2814#discussion_r4531015658 + +### F3 - The experiments are recorded without program, commands or output + +- PR number: 2814 +- Source review ID: 5848125288 +- Reviewer finding ID: N/A +- Source URL: https://github.com/torrust/torrust-tracker/pull/2814#discussion_r4529566750 +- Concern: Only the results of E1 to E12 were recorded. +- Solution: Added experiments.md with programs, commands, toolchain and output, and fixed the E9 citation. +- Current-tree verification: Re-ran both programs and compared the output. +- Resolution reference: docs(issues): correct the T2 exposure trace and record the experiments for #2804 +- Follow-up PR URL: N/A +- Reply URL: https://github.com/torrust/torrust-tracker/pull/2814#discussion_r4531016115 + +### F4 - The dependency-tree standalone crates are outside the scan + +- PR number: 2814 +- Source review ID: 5848125288 +- Reviewer finding ID: N/A +- Source URL: https://github.com/torrust/torrust-tracker/pull/2814#discussion_r4529566756 +- Concern: The scan covered workspace directories only. +- Solution: Scanned the eight registry crates and recorded the result. +- Current-tree verification: Ran grep over each unpacked crate. +- Resolution reference: docs(issues): correct the T2 exposure trace and record the experiments for #2804 +- Follow-up PR URL: N/A +- Reply URL: https://github.com/torrust/torrust-tracker/pull/2814#discussion_r4531016709 + +### F5 - Class W includes or in a helper, but the helper sites are class D + +- PR number: 2814 +- Source review ID: 5848125288 +- Reviewer finding ID: N/A +- Source URL: https://github.com/torrust/torrust-tracker/pull/2814#discussion_r4529566762 +- Concern: The class definitions overlapped. +- Solution: Removed the helper clause from class W. +- Current-tree verification: Read the Classification section. +- Resolution reference: docs(issues): correct the T2 exposure trace and record the experiments for #2804 +- Follow-up PR URL: N/A +- Reply URL: https://github.com/torrust/torrust-tracker/pull/2814#discussion_r4531017130 + +### F6 - The introduction misstates this PR's review state and which PR is carried + +- PR number: 2814 +- Source review ID: 5849963483 +- Reviewer finding ID: N/A +- Source URL: https://github.com/torrust/torrust-tracker/pull/2814#discussion_r4530936821 +- Concern: The retrospective said PR 2814 had no findings, which was false when it was committed, and made PR 2805 the subject of the carried sentence. +- Solution: Rewrote the introduction. +- Current-tree verification: Read the first paragraph after the edit. +- Resolution reference: docs(pr-reviews): correct the intro and figures of the PR #2805 retrospective +- Follow-up PR URL: N/A +- Reply URL: https://github.com/torrust/torrust-tracker/pull/2814#discussion_r4531017916 + +### F7 - The file cites the wrong template and has no Purpose section + +- PR number: 2814 +- Source review ID: 5849963483 +- Reviewer finding ID: N/A +- Source URL: https://github.com/torrust/torrust-tracker/pull/2814#discussion_r4530936829 +- Concern: The text cited the audit template for the location rule and lacked the Purpose section. +- Solution: Cited PR-REVIEW-RETROSPECTIVE.md and added a Purpose section. +- Current-tree verification: Read the frontmatter and the Purpose section. +- Resolution reference: docs(pr-reviews): correct the intro and figures of the PR #2805 retrospective +- Follow-up PR URL: N/A +- Reply URL: https://github.com/torrust/torrust-tracker/pull/2814#discussion_r4531018417 + +### F8 - Three summary figures do not recompute from the sources + +- PR number: 2814 +- Source review ID: 5849963483 +- Reviewer finding ID: N/A +- Source URL: https://github.com/torrust/torrust-tracker/pull/2814#discussion_r4530936836 +- Concern: The audit-only commit count, the audit-record finding count, the review count source and the first review time were wrong or without a source. +- Solution: Recomputed each figure and named its source. +- Current-tree verification: Ran gh api for reviews and commits and git show --stat. +- Resolution reference: docs(pr-reviews): correct the intro and figures of the PR #2805 retrospective +- Follow-up PR URL: N/A +- Reply URL: https://github.com/torrust/torrust-tracker/pull/2814#discussion_r4531018894 + +### F9 - rounds 1, 2, 4 and 5 leaves out round 3 yet the list includes F20 + +- PR number: 2814 +- Source review ID: 5849963483 +- Reviewer finding ID: N/A +- Source URL: https://github.com/torrust/torrust-tracker/pull/2814#discussion_r4530936843 +- Concern: The round list was incomplete. +- Solution: Said all five rounds and named the finding of each. +- Current-tree verification: Read the Root Causes list. +- Resolution reference: docs(pr-reviews): correct the intro and figures of the PR #2805 retrospective +- Follow-up PR URL: N/A +- Reply URL: https://github.com/torrust/torrust-tracker/pull/2814#discussion_r4531019411 + +### F10 - The description's Files list does not include this file + +- PR number: 2814 +- Source review ID: 5849963483 +- Reviewer finding ID: N/A +- Source URL: https://github.com/torrust/torrust-tracker/pull/2814#discussion_r4530936850 +- Concern: The PR description omitted the retrospective. +- Solution: Edited the PR description to list all six files and say why the retrospective is carried here. +- Current-tree verification: Read the PR body after the edit. +- Resolution reference: https://github.com/torrust/torrust-tracker/pull/2814#discussion_r4531019787 +- Follow-up PR URL: N/A +- Reply URL: https://github.com/torrust/torrust-tracker/pull/2814#discussion_r4531019787 + +### F11 - Tables use a double leading pipe + +- PR number: 2814 +- Source review ID: 5848148251 +- Reviewer finding ID: N/A +- Source URL: https://github.com/torrust/torrust-tracker/pull/2814#discussion_r4529583761 +- Concern: The reviewer saw rows starting with two pipes. +- Solution: No change: the tables use a single leading pipe. +- Current-tree verification: grep -n '^||' finds nothing in the inventory; prettier and markdownlint pass. +- Resolution reference: https://github.com/torrust/torrust-tracker/pull/2814#discussion_r4531017591 +- Follow-up PR URL: N/A +- Reply URL: https://github.com/torrust/torrust-tracker/pull/2814#discussion_r4531017591 + +## Processing Log + +- 2026-11-10 21:55 UTC - Started audit for review rounds 1 and 2. + +## 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 6c0b3178da385500441b93c6ee82e0176e45c781 Mon Sep 17 00:00:00 2001 From: josecelano-bot Date: Tue, 10 Nov 2026 21:56:52 +0000 Subject: [PATCH 6/6] docs(pr-reviews): log the round 1 and 2 resolution of PR #2814 Co-Authored-By: Claude Sonnet 5.5 --- docs/pr-reviews/pr-2814-review/PR-REVIEW.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/pr-reviews/pr-2814-review/PR-REVIEW.md b/docs/pr-reviews/pr-2814-review/PR-REVIEW.md index b013fbce0e..224b143159 100644 --- a/docs/pr-reviews/pr-2814-review/PR-REVIEW.md +++ b/docs/pr-reviews/pr-2814-review/PR-REVIEW.md @@ -205,6 +205,8 @@ Round 1 is da2ce7's review `5848125288` (F1 to F5) and Copilot's review `5848148 ## Processing Log - 2026-11-10 21:55 UTC - Started audit for review rounds 1 and 2. +- 2026-11-10 21:55 UTC - Committed the audit record; validate-audit-record.py reported 11 rows and 0 failures. +- 2026-11-10 21:56 UTC - Resolved the eleven threads; a GraphQL refresh showed 0 unresolved threads. ## Completion Rules