diff --git a/docs/issues/drafts/peer-id-test-helper/ISSUE.md b/docs/issues/drafts/peer-id-test-helper/ISSUE.md new file mode 100644 index 0000000000..19b0f1b386 --- /dev/null +++ b/docs/issues/drafts/peer-id-test-helper/ISSUE.md @@ -0,0 +1,525 @@ +--- +schema-version: 1 +doc-type: issue +issue-type: task +status: draft +priority: p2 +epic: null +github-issue: null +spec-path: docs/issues/drafts/peer-id-test-helper/ISSUE.md +branch: "{issue-number}-peer-id-test-helper" +related-pr: null +last-updated-utc: "2026-11-16 07:54" +semantic-links: + skill-links: + - create-issue + related-artifacts: + - .github/skills/dev/debugging/fix-bug/SKILL.md + - .github/skills/dev/planning/create-issue/SKILL.md + - docs/adrs/20261021190318_share_workspace_test_support_through_testing_features.md + - docs/issues/closed/2482-1669-reorganize-shared-test-support/test-support-inventory.md + - docs/issues/closed/2824-1347-add-tests-primitives/ISSUE.md + - packages/primitives/src/peer.rs + - packages/torrent-repository-benchmarking/tests/common/torrent_peer_builder.rs + - packages/torrent-repository-benchmarking/tests/entry/mod.rs +--- + + + +# Issue #[To be assigned] - Move `peer::Id::new` to a realistic test helper and decide whether `peer::fixture` goes behind a `testing` feature + +## Goal + +Take `peer::Id::new`, a test-only helper, out of the production API of `torrust-tracker-primitives`, +replace it with a test helper that builds peer ids a real client could send, and decide whether +`peer::fixture` (and `Id::new` with it) moves behind a `testing` feature, as the ADR on shared test +support asks. + +## Background + +This is finding F5 of #2824 (tests for `torrust-tracker-primitives`, EPIC #1347). The maintainer +handed it off to its own issue on 2026-11-11, with this direction: + +- prove that `Id::new` is not used in production; +- move it to a testing helper that generates realistic ids; +- decide whether `peer::fixture` and `Id::new` move behind a `testing` feature. + +The Findings Register of #2824 (row F5) records the finding. What it says, re-checked on `develop` at +`abd7a10ff` (2026-11-15): + +- `peer::Id::new` (`packages/primitives/src/peer.rs`, lines 367-382) is `pub` in a production crate. + It takes any `T: Into` and builds a 20-byte id: 4 zero bytes, then the 16 little-endian bytes + of the number. The conversion is correct and lossless, negative numbers included (two's + complement). It has no doc comment and no tests. +- Its ids look like no real client: `get_client_name()` returns `None` for them. +- `peer::fixture` (lines 498-638) is compiled unconditionally. It holds `PeerBuilder` and the + `Default` impls of `Peer` and `Id`. +- Both are already public in the published crate: `torrust-tracker-primitives` 3.0.0 on crates.io + (tag `v3.0.0`) has `pub fn new` and `pub mod fixture`. Its version in the workspace is 3.1.0. +- The ADR + [`20261021190318_share_workspace_test_support_through_testing_features.md`](../../../adrs/20261021190318_share_workspace_test_support_through_testing_features.md) + says that test support other packages use sits behind a `testing` feature that is off by default + (criterion 1, rules A and D). EPIC #2482, which applied it, is closed and did not touch + `peer::fixture`. Its + [inventory](../../closed/2482-1669-reorganize-shared-test-support/test-support-inventory.md) + searched for module names such as `testing`, `test_helpers`, `environment` and `fixtures` + (plural), which is a likely reason the singular `peer::fixture` was missed. +- #2824 measured that the `Id::new` lines (12) and the `peer::fixture` lines (55) are the only + uncovered lines left in `peer.rs` (plus one dead `Display` branch), and left their tests to this + issue. When this spec was drafted (`develop` at `abd7a10ff`) the package also had 9 uncovered + lines in `swarm_metadata.rs`; the S4 slice of #2824 (#2864) covered them (31 / 31), and #2824's + final measurement puts all 68 uncovered lines of the package (1,078 / 1,146) in `peer.rs`. +- #2824 also found that the fixture's own ids (`-qB00000000000000000`, `...01`, `...02`) are not valid + Azureus-style ids (the character after the four version characters must be `-`), so the client + registry reports no client for them. Its new tests use `-qB4650-abcdefghijkl`, which the registry + knows as qBittorrent. + +The behavior of `Id::new` is not wrong. The problem is where it lives and what kind of ids it makes: +test data in a production API, with ids no tracker ever receives. + +### Caller inventory (`develop` at `abd7a10ff`, 2026-11-15) + +Searched with `grep -rn --include=*.rs` over `packages/`, `src/` and `tests/`, then checked by +compiling (below). + +**`peer::Id::new`**: three calls, all in the integration tests of one package, which has +`publish = false`. + +| File | Line | Use | +| --- | --- | --- | +| `packages/torrent-repository-benchmarking/tests/common/torrent_peer_builder.rs` | 8 | `a_completed_peer(id: i32)` | +| `packages/torrent-repository-benchmarking/tests/common/torrent_peer_builder.rs` | 20 | `a_started_peer(id: i32)` | +| `packages/torrent-repository-benchmarking/tests/entry/mod.rs` | 402 | 75 distinct peers (`1..=75`) to pass the scrape limit | + +The two wrappers take an `i32` and pass it on, so their call sites are callers too. Every call site +in the package, with its arguments: + +| File | Lines | Call and arguments | +| --- | --- | --- | +| `tests/entry/mod.rs` | 75, 80, 85, 93, 96, 99, 401 | `a_started_peer` / `a_completed_peer` with `1`, `2` or `3` | +| `tests/entry/mod.rs` | 192, 233 | `a_started_peer(-1)` | +| `tests/entry/mod.rs` | 427 | `a_completed_peer(-1)`; the test asserts `peers.len() + 1` after the upsert, so `-1` must give an id distinct from the made peers `1` to `3` | +| `tests/repository/mod.rs` | 84, 91, 98, 110, 115, 120 | `a_started_peer` / `a_completed_peer` with `1`, `2` or `3` | +| `tests/repository/mod.rs` | 140, 155 | `a_started_peer(i)`, with the `i32` loop variable over `0..408` (zero included); `i` also feeds `InfoHash::from(&i)` and `hash.write_i32(i)` | +| `tests/repository/mod.rs` | 548 | `a_completed_peer(-1)` | + +(Paths are under `packages/torrent-repository-benchmarking/`.) So the callers pass zero and the +negative sentinel `-1`, which stands for "a peer not among the made ones". They depend on distinct ids +for distinct numbers, but not on the byte layout or on the `i128` range. + +**`peer::fixture`** (`PeerBuilder`): imported by six packages besides `primitives`. Every import in +`src/` sits after the file's first `#[cfg(test)]`. + +| Package | Where | +| --- | --- | +| `axum-http-server` | `src/` unit tests (1 file), `tests/` (5 files) | +| `axum-rest-api-server` | `tests/` (2 files) | +| `swarm-coordination-registry` | `src/` unit tests (2 files, 8 imports) | +| `torrent-repository-benchmarking` | `src/` unit tests (1 file), `tests/` (1 file) | +| `udp-core` | `src/` unit tests (1 file) | +| `udp-server` | `src/` unit tests (2 files), `benches/` (1 file) | + +**`Peer::default()`** (its `impl Default` lives in `peer::fixture`): also used, outside the files +above, by `#[cfg(test)]` code in `http-core` (`src/event.rs`), `swarm-coordination-registry` +(`src/event.rs`) and the root crate (`src/app.rs`). Of these, only `http-core` and the root crate +are packages not listed above. + +**Compile proof.** A throwaway change put `#[cfg(test)]` on the `impl Id` block that holds `new` and +on `pub mod fixture`, then ran `cargo check --workspace --lib --bins` (stable, cargo 1.99.1). It +finished with exit code 0 and no warnings, and the change was reverted. So no library or binary +target of the workspace uses `Id::new`, `PeerBuilder`, or the `Default` impls of `Peer` and `Id`. +Only test, bench and `#[cfg(test)]` code does. Code outside this workspace that depends on the +published 3.0.0 is not covered by this proof. + +## Scope + +### In Scope + +- Re-run the caller inventory and the compile proof at the start of implementation. +- A test helper that builds realistic peer ids (ids the client registry recognizes), with unit + tests, in the place decided in Q1. +- Move the three `torrent-repository-benchmarking` callers to it. +- Take `Id::new` out of the unconditional public API (remove or deprecate, Q3). +- Apply the `peer::fixture` decision (Q2, Q5): either gate it behind a `testing` feature of + `primitives` and update every consumer's `[dev-dependencies]`, or record why it stays. +- If the fixture's ids change (Q6), update the tests that assert on them. +- Tests, or a recorded no-test decision, for every line of the new helper and of the fixture that + remains, so `primitives` has no uncovered line owned by F5. +- The ADR record the decisions need (Q7). + +### Out of Scope + +- Other behavior of `peer::Id` (`From`, `TryFrom`, `Display`, `Serialize`, `get_client_name`): #2824 + tested it. +- Peer id literals written by hand in other packages' tests and benches (for example + `-qB00000000000000001` in `tracker-core` and root `tests/`, and `-qB00000000000000000` in the + `http-core` bench helper). They are not in + `primitives`. If Q6 shows they should change, a separate issue does it. +- Publishing a new version of `primitives` (#2583 owns version bumps). +- The `testing` feature of other packages. + +## Architectural Decisions + +- Related ADRs: + [`20261021190318_share_workspace_test_support_through_testing_features.md`](../../../adrs/20261021190318_share_workspace_test_support_through_testing_features.md) + (rules A, D and E; the ownership map has no row for `peer::fixture`) and + [`20260629000000_adopt_independent_package_versioning.md`](../../../adrs/20260629000000_adopt_independent_package_versioning.md) + (removing a public item is a breaking change for the published crate). +- ADRs to create: none expected. An amendment of the test-support ADR is expected (Q7), adding a + row for `peer::fixture` to the ownership map. That would be the first amendment to add a row: the + amendments of #2681 and #2699 only added a dated note at the top of the ADR (the first qualifies + an existing row in prose, the second settles the examples question). + +During implementation, stop and create an ADR when a decision affects project +architecture or design patterns, selects an approach among meaningful +alternatives, or has consequences future contributors need to understand. Do not +create ADRs for routine implementation details or style choices already governed +by project conventions. + +## Open Design Decisions (for the maintainer) + +Each question has a recommendation. Nothing is implemented until the maintainer answers them. + +**Q1. Where does the realistic-id helper live?** + +- (a) In `primitives`, next to `PeerBuilder` in `peer::fixture` (behind `testing` if Q2 says so). + The fixture and its ids are in one place, and the six packages that use `PeerBuilder` can use + realistic ids too. +- (b) In `torrent-repository-benchmarking/tests/common/` (ADR rule E: one consuming package). No + public API, but the fixture keeps its own unrealistic ids, and other packages cannot reuse it. +- (c) In `torrust-tracker-test-helpers`. Ruled out by ADR rule B.1: that crate may not depend on + `primitives`. + +Recommendation: (a). + +**Q2. Does `peer::fixture` move behind a `testing` feature of `primitives`?** + +If yes: `#[cfg(feature = "testing")]` on the module, `testing` never in `default`, the path-only self +dev-dependency (`torrust-tracker-primitives = { path = ".", features = ["testing"] }`, ADR rule A.3), +and a `features = ["testing"]` `[dev-dependencies]` entry in each consumer (six packages, plus +`http-core` and the root crate if Q5 gates the `Default` impls). Most consumers list `primitives` +under `[dependencies]` today, so each needs a second entry under `[dev-dependencies]`. + +Recommendation: yes. ADR criterion 1: a normal build contains no test-only code unless the consumer +opts in. The compile proof shows production does not need it. + +**Q3. What happens to `Id::new`?** + +- (a) Remove it. Its only callers are in a `publish = false` package. Removing a public item of a + published crate is a breaking change, recorded for #2583. +- (b) Mark it `#[deprecated]` now, pointing at the new helper, and remove it in a later breaking + release. +- (c) Keep it, but behind `testing` with the fixture (Q2). + +Recommendation: (a). A `compile_fail` doctest can guard the removal, as F1's fix did for `Ord`. + +**Q4. What does the helper's API and id format look like?** + +The callers need distinct ids for distinct numbers, including zero and the negative sentinel `-1` +(see the caller inventory). The format: a known client prefix (for example qBittorrent `-qB4650-`, +used by #2824's tests) followed by the number written in the 12 remaining bytes, as zero-padded +decimal (readable in test failures) or as hex. A `u64` does not fit in either form (`u64::MAX` needs +20 decimal or 16 hex digits), so the choice is between two 32-bit inputs: + +- (a) Keep `i32`, the type the wrappers take today. The sign goes in the first of the 12 bytes (for + example `-` or `0`) and the absolute value in the other 11 as decimal digits (`i32::MIN` needs 10). + No call site changes its argument. +- (b) Take a `u32` (10 decimal digits, fits). The wrappers take a `u32` too, and the call sites + change: `-1` becomes a named constant outside the made range (for example + `const OTHER_PEER: u32 = 1000;`). The two `0..408` loops need a `u32` for the wrapper while `i` also + feeds `InfoHash::from(&i)` and `hash.write_i32(i)`: either keep `i` an `i32` and pass + `u32::try_from(i).expect(...)` (a `Result`, so it must be unwrapped), or iterate over `0..408_u32` + and convert only for those two uses. + +Recommendation: (b). The sentinel means "a peer not among the made ones", and a name says that +better than `-1`; the ids also stay a plain number after the prefix. Unit tests check that +`get_client_name()` is `Some("qBittorrent")`, that different numbers give different ids, and the +exact bytes of one example. + +**Q5. What happens to `impl Default for Peer` and `impl Default for Id`?** + +They sit inside `peer::fixture`, but trait impls apply everywhere, so they are part of the public API. +A "default peer" is test data. If Q2 gates the module they are gated too, which removes +`Peer: Default` and `Id: Default` from production builds. The alternative is to move them out of the +module and keep them unconditional. + +Recommendation: gate them with the module. The compile proof shows no library or binary needs them. + +**Q6. Do the fixture's own ids change to realistic ones?** + +`-qB00000000000000000`, `...01` and `...02` are not valid Azureus-style ids. Changing them may +break tests that compare against these bytes (for example JSON or hex in `axum-http-server` and +`axum-rest-api-server` tests). The implementation would first list those assertions. + +Recommendation: yes, the three fixture ids only (built with the Q4 helper). Literals in other +packages stay out of scope. + +**Q7. How is the decision recorded?** + +Recommendation: an amendment of the test-support ADR (the decision stands; `peer::fixture` gets a +row in the ownership map and rule D's reasoning covers shared fixtures, not only mocks). If the +maintainer prefers, a short note in this spec is enough. + +## Design and Ownership Review + +This is reusable test-fixture work, so ownership applies; the process, I/O and deadline items do not. + +- `primitives` owns `Peer`, `Id` and the shared fixture that builds them. With Q1 (a) it also owns + the realistic-id helper. +- Consumers own their own test data and reach the fixture only through `[dev-dependencies]` + (ADR rule A.4). No `[dependencies]` entry enables `testing`. +- Lifetime and deadline invariants: not applicable (pure, synchronous value builders). +- Design-review checkpoint: after the helper and its first unit test pass (T2), stop for maintainer + review of the helper's name, signature and format before migrating callers. + +## Bug-Fix Process + +F5 is a design problem, not a behavior defect: `Id::new` returns the bytes it promises, for every +input. So the `fix-bug` sequence +([fix-bug](../../../../.github/skills/dev/debugging/fix-bug/SKILL.md)) is adapted: + +- **Analysis.** Done in this spec: test-only data in a production API, with ids that no client + sends, and fixture code compiled into every build against ADR criterion 1. +- **Reproduction.** Instead of reproducing wrong behavior, reproduce the finding: re-run the caller + inventory and the compile proof (gate both items with `#[cfg(test)]`, run + `cargo check --workspace --lib --bins`, revert). Record commands and output in + `manual-verification-evidence.md`. Show that today's fixture ids give `get_client_name() == None`. +- **Regression boundary.** See below. +- **Red evidence.** The helper's unit tests are written first and fail (the helper does not exist, + or returns ids with no client name). +- **Change.** Helper, caller migration, `Id::new` removal and the fixture gate, each in its own + commit (see Commit Points). +- **Green evidence and recheck.** All tests pass, and the compile proof is repeated on the final + code without a throwaway change. + +## Regression Test Strategy + +Two things must not regress: the behavior the callers depend on, and the boundary between test +support and production code. + +- **Caller behavior.** The `torrent-repository-benchmarking` tests that use the helper must pass, + in particular the scrape-limit test that adds 75 peers and needs 75 distinct ids, and the test at + `tests/entry/mod.rs:427` that needs the sentinel peer to differ from the made peers. With Q4 (a) + only the helper call changes. With Q4 (b) the call sites that pass `-1` or the loop variable also + change their arguments (see the caller inventory), and each change must keep the ids distinct where + the test relies on it. +- **Helper behavior.** Unit tests in `primitives`, at the helper itself: recognized client name, + distinct ids for distinct inputs, exact bytes of one example. Follow the `write-unit-test` skill. +- **Test-support boundary.** If Q2 is yes: `cargo check -p torrust-tracker-primitives` (no + features) must compile without the fixture, and the repository's own check of shipped features, + `cargo run -p shipped-features-check -- --package torrust-tracker` (the `shipped-features` job in + `.github/workflows/testing.yaml`), must exit 0. It reads only normal and build edges. A plain + `cargo tree -e features` would not do: it keeps dev-dependency edges, so it would list the + `testing` feature that the self dev-dependency and the consumers' `[dev-dependencies]` enable. If Q3 is (a): a `compile_fail` doctest + shows that `Id::new` is gone. + +Red and green output and the final recheck go in issue-local `manual-verification-evidence.md`. + +## Implementation Plan + +Status values: `TODO`, `IN_PROGRESS`, `BLOCKED`, `DONE`. + +| ID | Status | Task | Notes / Expected Output | +| --- | ------ | ---- | ----------------------- | +| T0 | TODO | Get the maintainer's answers to Q1-Q7 | Answers recorded in this spec; later tasks adjusted. | +| T1 | TODO | Re-run the caller inventory and the compile proof | Tables above updated if `develop` moved; evidence in `manual-verification-evidence.md`. | +| T2 | TODO | Add the realistic-id helper with unit tests | In the Q1 location, with the Q4 format; design-review checkpoint after the first passing test. | +| T3 | TODO | Move the `torrent-repository-benchmarking` callers to the helper | Its tests pass; ids are distinct. | +| T4 | TODO | Remove or deprecate `Id::new` (Q3) | `compile_fail` doctest if removed. | +| T5 | TODO | Gate `peer::fixture` (and the `Default` impls, Q5) behind `testing` (Q2) | Feature in `primitives/Cargo.toml` with the semver comment of ADR rule A.6, self dev-dependency, consumer `[dev-dependencies]`; `cargo machete --with-metadata` clean. | +| T6 | TODO | Make the fixture's ids realistic (Q6) | Assertions on the old bytes listed first, then updated. | +| T7 | TODO | Tests or a no-test decision for every remaining fixture line | Issue-local `coverage-evidence.md` (see Coverage Evidence) shows no line owned by F5 left uncovered. | +| T8 | TODO | Record the decision (Q7) | ADR amendment, or a note in this spec. | +| T9 | TODO | Final verification and acceptance review | `linter all`, tests, manual scenarios, AC table filled in. | + +## Commit Points + +| Task | Coherent change set | Commit policy | +| ---- | ------------------- | ------------- | +| T0 | The maintainer's answers to Q1-Q7, recorded in this spec | Commit before T1 (`docs(issues):`). | +| T1 | Updated inventory tables, `manual-verification-evidence.md` (V1 baseline) and the coverage baseline | Commit after the inventory and the compile proof run. | +| T2 | The helper and its unit tests | Commit after focused validation and the design review. | +| T3 | Caller migration in `torrent-repository-benchmarking` | Commit after its tests pass. | +| T4 | `Id::new` removal or deprecation (+ `compile_fail` doctest) | Commit after `cargo test -p torrust-tracker-primitives`. | +| T5 | `testing` feature and consumer manifests | Commit after `cargo test --workspace` and `cargo machete`. | +| T6 | Fixture ids and the assertions on them | Commit after the affected packages' tests pass. | +| T7 | Fixture tests and coverage evidence | Commit after focused validation and the design review. | +| T8 | ADR amendment | Commit separately (`docs(adrs):`). | +| T9 | Final evidence, AC table and progress log | Commit after the final verification. | + +Record a justified no-change decision in the task's evidence without creating an empty commit. For +test-producing work, use the `write-unit-test` skill and complete an explicit design review after +each passing test increment, before maintainer review and commit. Confirm that the test exposes the +one causal initial-state difference; its fixture owns only incidental mechanics; and the production +Act plus independently specified expected result remain visible. The review must use the mandatory +prose-first Arrange-Act-Assert comparison: write temporary prose for each section, refactor until +the code expresses it, remove redundant prose, and retain only irreducible context. Record this +review in task evidence or a file-local test plan. Assess helper boundaries by meaningful named +actions and abstraction-level alignment, not caller count: a single-use helper is valid when it +keeps the test readable and hides only incidental mechanics. Commit each reviewed test-design +increment before starting the next planned file or behavior area. Use a Conventional Commit message +with the narrow affected scope, and sign every commit with GPG. + +## Progress Tracking + +### Workflow Checkpoints + +- [x] Folder-style spec drafted in `docs/issues/drafts/peer-id-test-helper/ISSUE.md` +- [ ] Spec reviewed and approved by user/maintainer (Q1-Q7 answered) +- [ ] GitHub issue created and issue number added to this spec +- [ ] (Optional, recommended for complex issues) Spec-only PR merged into `develop` before implementation +- [ ] Implementation completed +- [ ] Automatic verification completed (`linter all`, relevant tests, and any pre-push checks) +- [ ] Manual verification scenarios executed and recorded in issue-local `manual-verification-evidence.md` +- [ ] Acceptance criteria reviewed after implementation and updated with evidence +- [ ] Evidence-based implementation completion review recorded: issue-local retrospective created for material discoveries, or progress log states why none was needed +- [ ] Reviewer validated acceptance criteria and updated checkboxes +- [ ] Independent reviewer reports recorded in issue-local `agent-review-reports.md` when reviewers received this folder-style specification +- [ ] Committer verified spec progress is up to date before commit +- [ ] Issue closed and spec moved from `docs/issues/open/` to `docs/issues/closed/` + +### Progress Log + +- 2026-11-15 12:42 UTC - Claude Code (Opus 5.5) - Drafted from finding F5 of #2824 (maintainer + hand-off of 2026-11-11). Caller inventory re-run on `develop` at `abd7a10ff`; compile proof + (`cargo check --workspace --lib --bins` with `Id::new` and `peer::fixture` under `#[cfg(test)]`) + passed and was reverted. Found that both items are public in the published 3.0.0, and that the + `Default` impls of `Peer` and `Id` live in the fixture module (Q5). (Stamp corrected in review + round 1: it first said 12:45, after the commit.) +- 2026-11-15 20:32 UTC - Claude Code (Opus 5.5) - Review round 1 of PR #2865 (da2ce7 F1-F11, + Copilot two comments). The inventory now lists the wrapper call sites, which pass `0` and `-1`; + Q4 weighs `i32` against `u32` with a named sentinel; M2 and the regression strategy use + `shipped-features-check`, which exited 0 for `torrust-tracker` on `abd7a10ff`; a Coverage + Evidence section and commit points for T0, T1 and T9 were added; smaller wording fixes. +- 2026-11-15 21:27 UTC - Claude Code (Opus 5.5) - Review round 2 of PR #2865 (da2ce7, approved with + two Nit findings on this spec): Q4 (b) now names both ways to pass the loop variable as a `u32` + (`u32::try_from(i)` returns a `Result`), and the `swarm_metadata.rs` coverage note is dated and + updated with #2824's final measurement. +- 2026-11-16 05:57 UTC - Claude Code (Opus 5.5) - Review round 3 of PR #2865 (da2ce7, approved with + one Nit): the coverage note now cites #2824's final rows, 1,078 / 1,146, instead of the "After + `swarm_metadata.rs`" row. (Entry added in review round 4: round 3 changed the spec without one.) +- 2026-11-16 06:08 UTC - Claude Code (Opus 5.5) - Review round 4 of PR #2865 (da2ce7, approved with + one Nit on this spec): `last-updated-utc` bumped and the round-3 entry above added. +- 2026-11-16 07:54 UTC - Claude Code (Opus 5.5) - Rebased onto `develop` after #2871 moved the #2824 + spec to `docs/issues/closed/`; the `related-artifacts` entry and the References path now point there. + +## Acceptance Criteria + +- [ ] AC1: The caller inventory and the compile proof are re-run at implementation start and at the + end, and show that no library or binary target uses `Id::new` or the fixture. +- [ ] AC2: `Id::new` is no longer part of the unconditional public API of `primitives`, as decided + in Q3. +- [ ] AC3: A test helper builds peer ids that the client registry recognizes + (`get_client_name()` is `Some`), gives distinct ids for distinct inputs, and has unit tests. +- [ ] AC4: The `torrent-repository-benchmarking` tests use the helper and pass. +- [ ] AC5: The Q2 and Q5 decisions are applied: either `cargo check -p torrust-tracker-primitives` + without features compiles no fixture code and every consumer enables `testing` only from + `[dev-dependencies]`, or the spec records why the fixture stays unconditional. +- [ ] AC6: Every line of the helper and of the fixture that remains is covered by a unit test or has + a recorded no-test decision; issue-local `coverage-evidence.md` shows no uncovered line owned by + F5. +- [ ] AC7: The decision is recorded as Q7 says. +- [ ] `linter all` exits with code `0` +- [ ] Relevant tests pass +- [ ] Manual verification scenarios are executed and documented in issue-local `manual-verification-evidence.md` +- [ ] Acceptance criteria are re-reviewed after implementation and reflect actual behavior +- [ ] Documentation is updated when behavior/workflow changes + +## Verification Plan + +### Automatic Checks + +- `linter all` +- `cargo test -p torrust-tracker-primitives` and `cargo test -p torrust-tracker-torrent-repository-benchmarking` + (stable Rust toolchain) +- `cargo test --workspace` (stable), because the fixture has consumers in six packages +- `cargo machete --with-metadata` (pre-commit gate) +- `cargo package --workspace --no-verify` (stable; ADR criterion 5: the self dev-dependency has no + `version`) +- Pre-push checks + +### Manual Verification Scenarios + +Status values: `TODO`, `IN_PROGRESS`, `DONE`, `FAILED`, `BLOCKED`. + +| ID | Scenario | Human-oriented command/steps | Expected Result | Status | Evidence | +| --- | -------- | ---------------------------- | --------------- | ------ | -------- | +| M1 | Production builds need no test support | Before the change: the throwaway gate and `cargo check --workspace --lib --bins`. After: the same command on the final code, no throwaway change. | Exit code 0 both times | TODO | `manual-verification-evidence.md` section V1 | +| M2 | The release tracker carries no `testing` feature of `primitives` (if Q2 is yes) | `cargo run -p shipped-features-check -- --package torrust-tracker`, and as the readable view `cargo tree -p torrust-tracker -e normal,build,features -i torrust-tracker-primitives` | The check exits 0; the tree shows no `testing` feature of `primitives` | TODO | `manual-verification-evidence.md` section V2 | +| M3 | Realistic ids | Print a few helper ids and their `get_client_name()` in a scratch test; compare with the old fixture ids | New ids name a client; old ones give `None` | TODO | `manual-verification-evidence.md` section V3 | + +Notes: + +- Manual verification is mandatory even when automated tests pass. +- Record the toolchain for every command result (for example `stable Rust toolchain`, cargo 1.99.1). +- Create `manual-verification-evidence.md` from `docs/templates/MANUAL-VERIFICATION-EVIDENCE.md`. +- If a scenario fails, record the failure and diagnosis in the progress log before proceeding. + +### Coverage Evidence + +Coverage is measured for AC6, so the issue keeps an issue-local `coverage-evidence.md`: + +- The command, the same as #2824 uses (stable Rust toolchain, `cargo-llvm-cov`): + `cargo llvm-cov clean --workspace`, then + `cargo llvm-cov -p torrust-tracker-primitives --all-features --lib --json --output-path .json`. + It covers the `src/` code of `primitives`, run by the package's own unit tests only (`--lib`). + `--all-features` turns on `testing` if Q2 adds it, so the fixture is measured. +- Separate unit-only and aggregate tables (aggregate adds `cargo llvm-cov -p + torrust-tracker-primitives --all-features` without `--lib`), each with a baseline at T1 and a + final measurement at T9. +- Per-file rows for `peer.rs` (and the helper's file, if it is new), with the uncovered lines or + functions listed and an owner for each. +- Concise Markdown only; no raw JSON, LCOV or HTML reports are committed. + +### Disposable Verification Scripts + +None planned. The compile proof is a temporary source edit, reverted at once, and recorded as +commands and output. + +### Acceptance Verification + +| AC ID | Status (`TODO`/`DONE`) | Evidence | +| ----- | ---------------------- | -------- | +| AC1 | TODO | | +| AC2 | TODO | | +| AC3 | TODO | | +| AC4 | TODO | | +| AC5 | TODO | | +| AC6 | TODO | | +| AC7 | TODO | | + +## Risks and Trade-offs + +- Removing `Id::new`, the fixture or the `Default` impls breaks code outside the workspace that + uses the published 3.0.0. Mitigation: Q3 (b) deprecates first; #2583 owns the version bump. +- A `testing` feature turned on by `--all-features` or `--all-targets` reaches a shipped binary + (ADR rule A.5). Mitigation: M2, and the release build rules of #2482 already in place. +- Changing the fixture ids may change many test expectations. Mitigation: Q6 limits the change to + the three fixture ids, and T6 lists the assertions first. +- `develop` moves under the work. Mitigation: T1 re-runs the inventory at the start. + +## Implementation Completion Review + +After implementation, compare the result with this specification. Record +invalidated assumptions, material design changes, unexpected validation +findings, and reusable lessons. + +- Retrospective: `Not yet assessed` +- If needed, create `implementation-retrospective.md` from + `docs/templates/IMPLEMENTATION-RETROSPECTIVE.md` in this directory. +- If no retrospective is needed, add a concise progress-log entry explaining + why the work had no material discovery. +- When an independent reviewer receives this folder-style specification, it + records its result in `agent-review-reports.md` using + `docs/templates/AGENT-REVIEW-REPORTS.md`. + +## References + +- Origin: finding F5 of #2824 (Findings Register in + `docs/issues/closed/2824-1347-add-tests-primitives/ISSUE.md`), EPIC #1347 +- Test-support reorganization: EPIC #2482 (closed) and its + [inventory](../../closed/2482-1669-reorganize-shared-test-support/test-support-inventory.md) +- Version bumps: #2583 +- Related ADRs: + [test support through `testing` features](../../../adrs/20261021190318_share_workspace_test_support_through_testing_features.md), + [independent package versioning](../../../adrs/20260629000000_adopt_independent_package_versioning.md) diff --git a/docs/pr-reviews/pr-2865-review/PR-REVIEW.md b/docs/pr-reviews/pr-2865-review/PR-REVIEW.md new file mode 100644 index 0000000000..12bc98c4d1 --- /dev/null +++ b/docs/pr-reviews/pr-2865-review/PR-REVIEW.md @@ -0,0 +1,384 @@ +--- +semantic-links: + skill-links: + - process-pr-review + related-artifacts: + - .github/skills/dev/pr-reviews/process-pr-review/SKILL.md + - docs/issues/drafts/peer-id-test-helper/ISSUE.md +--- + + + +# PR #2865 Review Audit + +Source: pull-request reviews and inline review threads for . + +## 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 + +Findings from da2ce7's review 5912769583 (F1-F11, reviewer IDs kept) and Copilot's review 5912779850 (F12-F13, re-raises of F1 and F2), both on the first commit, `docs(issues): draft the peer-id-test-helper spec (finding F5 of #2824)`. Round 2: da2ce7's review 5913005734 (APPROVED) on the audit commit, `docs(pr-reviews): add the review audit of PR #2865, round 1`; its F12-F15 collide with existing audit IDs and are recorded as F14-F17. Round 3: da2ce7's review 5915609693 (APPROVED) on the round-2 audit commit, `docs(pr-reviews): record round 2 of the PR #2865 review audit`; its F16 collides and is recorded as F18. Round 4: da2ce7's review 5915707496 (APPROVED) on the round-3 audit commit, `docs(pr-reviews): record round 3 of the PR #2865 review audit`; its F18-F19 collide and are recorded as F19-F20. Round 6: da2ce7's review 5916743500 (APPROVED) on the rebased branch, after #2871 archived the #2824 spec; its F21 is kept (no collision). An approval without findings in between (review 5915854868) needed no row. + +| Finding ID | Review finding reference | Author class | Severity | Category | Relationship | Disposition | Thread state | +| ---------- | ------------------------ | ------------ | -------- | -------- | ------------ | ----------- | ------------ | +| F1 | review-finding:pr-2865-f1 | Human | Major | correctness | ORIGINAL | FIXED | RESOLVED | +| F2 | review-finding:pr-2865-f2 | Human | Major | correctness | ORIGINAL | FIXED | RESOLVED | +| F3 | review-finding:pr-2865-f3 | Human | Minor | correctness | ORIGINAL | FIXED | RESOLVED | +| F4 | review-finding:pr-2865-f4 | Human | Minor | correctness | ORIGINAL | FIXED | RESOLVED | +| F5 | review-finding:pr-2865-f5 | Human | Minor | documentation | ORIGINAL | FIXED | RESOLVED | +| F6 | review-finding:pr-2865-f6 | Human | Minor | testing | ORIGINAL | FIXED | RESOLVED | +| F7 | review-finding:pr-2865-f7 | Human | Nit | documentation | ORIGINAL | FIXED | RESOLVED | +| F8 | review-finding:pr-2865-f8 | Human | Nit | documentation | ORIGINAL | FIXED | RESOLVED | +| F9 | review-finding:pr-2865-f9 | Human | Nit | correctness | ORIGINAL | FIXED | RESOLVED | +| F10 | review-finding:pr-2865-f10 | Human | Nit | correctness | ORIGINAL | FIXED | RESOLVED | +| F11 | review-finding:pr-2865-f11 | Human | Nit | metadata | ORIGINAL | FIXED | RESOLVED | +| F12 | review-finding:pr-2865-f12 | Copilot | Minor (inferred) | correctness | RE_RAISE_OF:F1 | NO_ACTION | SUPERSEDED | +| F13 | review-finding:pr-2865-f13 | Copilot | Minor (inferred) | correctness | RE_RAISE_OF:F2 | NO_ACTION | SUPERSEDED | +| F14 | review-finding:pr-2865-f14 | Human | Minor | metadata | ORIGINAL | FIXED | RESOLVED | +| F15 | review-finding:pr-2865-f15 | Human | Minor | documentation | ORIGINAL | FIXED | RESOLVED | +| F16 | review-finding:pr-2865-f16 | Human | Nit | correctness | ORIGINAL | FIXED | RESOLVED | +| F17 | review-finding:pr-2865-f17 | Human | Nit | documentation | ORIGINAL | FIXED | RESOLVED | +| F18 | review-finding:pr-2865-f18 | Human | Nit | correctness | ORIGINAL | FIXED | RESOLVED | +| F19 | review-finding:pr-2865-f19 | Human | Minor | metadata | ORIGINAL | FIXED | RESOLVED | +| F20 | review-finding:pr-2865-f20 | Human | Nit | metadata | ORIGINAL | FIXED | RESOLVED | +| F21 | review-finding:pr-2865-f21 | Human | Minor | metadata | ORIGINAL | FIXED | RESOLVED | + +## Finding Details + +### F1 - Callers pass negative numbers and zero + +- PR number: 2865 +- Source review ID: 5912769583 +- Reviewer finding ID: F1 +- Source URL: +- Concern: The spec said the callers need only distinct ids for small positive numbers, but the `i32` wrappers are called with `-1` (`tests/entry/mod.rs:192,233,427`, `tests/repository/mod.rs:548`) and with a loop over `0..408`, and the test at `entry/mod.rs:427` depends on `-1` differing from the made peers. A `u32` helper (Q4) would change call sites, so the regression strategy's "unchanged apart from the helper call" did not hold. +- Solution: Added the wrapper call sites and their arguments to the caller inventory; removed the "small positive numbers" sentence; Q4 now weighs `i32` (sign in the first byte, no call-site changes) against `u32` with a named sentinel and `u32::try_from(i)` in the loops; the regression strategy says which call sites change under each option. +- Current-tree verification: `grep -rn -E 'a_(started|completed)_peer\(' packages/torrent-repository-benchmarking` lists the call sites recorded in the inventory table of `docs/issues/drafts/peer-id-test-helper/ISSUE.md`; `grep -n 'small positive' docs/issues/drafts/peer-id-test-helper/ISSUE.md` prints nothing. +- Resolution reference: docs(issues): correct the peer-id-test-helper inventory and checks after review +- Follow-up PR URL: N/A +- Reply URL: + +### F2 - M2 command keeps dev-dependency edges + +- PR number: 2865 +- Source review ID: 5912769583 +- Reviewer finding ID: F2 +- Source URL: +- Concern: M2 used `cargo tree -e features`, which keeps dev-dependency edges, so under Q2 the self dev-dependency and the consumers' `[dev-dependencies]` would show the `testing` feature and M2 could not pass. The repository already has `shipped-features-check`. +- Solution: M2 and the regression strategy now use `cargo run -p shipped-features-check -- --package torrust-tracker`, with `cargo tree -p torrust-tracker -e normal,build,features -i torrust-tracker-primitives` as the readable view, and explain why a plain `cargo tree -e features` does not work. +- Current-tree verification: On `develop` `abd7a10ff`, `cargo run -q -p shipped-features-check -- --package torrust-tracker` printed `"kind":"checked"` and exited 0; the `cargo tree` view lists only the `default` feature of `primitives`. `grep -n 'cargo tree -e features -i' docs/issues/drafts/peer-id-test-helper/ISSUE.md` prints nothing. +- Resolution reference: docs(issues): correct the peer-id-test-helper inventory and checks after review +- Follow-up PR URL: N/A +- Reply URL: + +### F3 - Uncovered lines are the last in peer.rs, not the package + +- PR number: 2865 +- Source review ID: 5912769583 +- Reviewer finding ID: F3 +- Source URL: +- Concern: The spec said the `Id::new` and fixture lines are the only uncovered lines left in the package; #2824's evidence says they are the only ones in `peer.rs`, and `swarm_metadata.rs` has 9 more. +- Solution: Reworded to "the only uncovered lines left in `peer.rs`" and added the 9 uncovered lines of `swarm_metadata.rs`, which F5 does not own. +- Current-tree verification: `docs/issues/open/2824-1347-add-tests-primitives/coverage-evidence.md` says `swarm_metadata.rs` is now 3 / 12 lines; the spec's Background bullet names `peer.rs`. +- Resolution reference: docs(issues): correct the peer-id-test-helper inventory and checks after review +- Follow-up PR URL: N/A +- Reply URL: + +### F4 - u64 fits in neither decimal nor hex + +- PR number: 2865 +- Source review ID: 5912769583 +- Reviewer finding ID: F4 +- Source URL: +- Concern: Q4 said a `u64` needs hex; after the 8-byte prefix only 12 bytes remain, and `u64::MAX` needs 20 decimal or 16 hex digits. +- Solution: Q4 now says a `u64` fits in neither form, so the choice is between two 32-bit inputs. +- Current-tree verification: `grep -n 'u64' docs/issues/drafts/peer-id-test-helper/ISSUE.md` shows only the corrected sentence in Q4. +- Resolution reference: docs(issues): correct the peer-id-test-helper inventory and checks after review +- Follow-up PR URL: N/A +- Reply URL: + +### F5 - ADR amendment precedent was wrong + +- PR number: 2865 +- Source review ID: 5912769583 +- Reviewer finding ID: F5 +- Source URL: +- Concern: The spec said the #2681 and #2699 amendments added ownership-map rows; they only added dated notes at the top of the ADR. +- Solution: The Architectural Decisions bullet now says a `peer::fixture` row would be the first row an amendment adds, and describes what the two amendments did. +- Current-tree verification: The ADR's two amendment notes (#2681, #2699) are at its top; its ownership map has no row added by either. +- Resolution reference: docs(issues): correct the peer-id-test-helper inventory and checks after review +- Follow-up PR URL: N/A +- Reply URL: + +### F6 - Coverage evidence parts missing + +- PR number: 2865 +- Source review ID: 5912769583 +- Reviewer finding ID: F6 +- Source URL: +- Concern: AC6 and T7 rest on coverage, but the spec lacked the parts `create-issue` requires when coverage is measured: an issue-local evidence file, the exact command and its scope, and separate unit-only and aggregate tables. +- Solution: Added a `Coverage Evidence` section (issue-local `coverage-evidence.md`, #2824's `cargo llvm-cov` command and its scope, unit-only and aggregate tables with baseline and final, per-file rows with owners, Markdown only); T7 and AC6 name the file. +- Current-tree verification: `grep -n '### Coverage Evidence' docs/issues/drafts/peer-id-test-helper/ISSUE.md` finds the section; T7 and AC6 cite `coverage-evidence.md`. +- Resolution reference: docs(issues): correct the peer-id-test-helper inventory and checks after review +- Follow-up PR URL: N/A +- Reply URL: + +### F7 - T0, T1 and T9 had no commit point + +- PR number: 2865 +- Source review ID: 5912769583 +- Reviewer finding ID: F7 +- Source URL: +- Concern: T0, T1 and T9 change documentation but had no commit point. +- Solution: Added commit-point rows for T0, T1 and T9. +- Current-tree verification: The Commit Points table of `docs/issues/drafts/peer-id-test-helper/ISSUE.md` has rows T0, T1 and T9. +- Resolution reference: docs(issues): correct the peer-id-test-helper inventory and checks after review +- Follow-up PR URL: N/A +- Reply URL: + +### F8 - Peer::default users wrongly said to be outside the packages above + +- PR number: 2865 +- Source review ID: 5912769583 +- Reviewer finding ID: F8 +- Source URL: +- Concern: `swarm-coordination-registry` is one of the packages listed above the `Peer::default()` paragraph. +- Solution: The paragraph now says "outside the files above" and notes that only `http-core` and the root crate are packages not listed above. +- Current-tree verification: The `Peer::default()` paragraph of `docs/issues/drafts/peer-id-test-helper/ISSUE.md` reads "outside the files above". +- Resolution reference: docs(issues): correct the peer-id-test-helper inventory and checks after review +- Follow-up PR URL: N/A +- Reply URL: + +### F9 - http-core bench uses a different literal + +- PR number: 2865 +- Source review ID: 5912769583 +- Reviewer finding ID: F9 +- Source URL: +- Concern: The `http-core` bench helper uses `-qB00000000000000000`, not `...01`. +- Solution: Out of Scope now names each literal with where it is used. +- Current-tree verification: `packages/http-core/benches/helpers/util.rs:159` has `-qB00000000000000000`; the Out of Scope bullet says so. +- Resolution reference: docs(issues): correct the peer-id-test-helper inventory and checks after review +- Follow-up PR URL: N/A +- Reply URL: + +### F10 - 3.1.0 is the version of primitives, not the workspace + +- PR number: 2865 +- Source review ID: 5912769583 +- Reviewer finding ID: F10 +- Source URL: +- Concern: "The workspace version is 3.1.0" is wrong: 3.1.0 is `primitives`' own version. +- Solution: Changed to "Its version in the workspace is 3.1.0". +- Current-tree verification: `packages/primitives/Cargo.toml:15` has `version = "3.1.0"`. +- Resolution reference: docs(issues): correct the peer-id-test-helper inventory and checks after review +- Follow-up PR URL: N/A +- Reply URL: + +### F11 - Timestamps later than the commit + +- PR number: 2865 +- Source review ID: 5912769583 +- Reviewer finding ID: F11 +- Source URL: +- Concern: `last-updated-utc` and the progress-log stamp said 12:45 UTC, after the 12:43:02 UTC commit. +- Solution: The first entry now says 12:42 UTC (the last edit before that commit) with a correction note; the round-1 entry and `last-updated-utc` say 20:32 UTC, before the fix commit at 20:32:36 UTC. +- Current-tree verification: `git log --format=%cI` gives 2026-11-15T12:43:02Z and 2026-11-15T20:32:36Z for the two commits. +- Resolution reference: docs(issues): correct the peer-id-test-helper inventory and checks after review +- Follow-up PR URL: N/A +- Reply URL: + +### F12 - Signed benchmark inputs (re-raise) + +- PR number: 2865 +- Source review ID: 5912779850 +- Reviewer finding ID: N/A +- Source URL: +- Concern: The inventory overlooks the signed `-1` inputs of the `i32` wrappers; Q4's `u32` helper needs more than a helper-call-only migration. +- Solution: Same concern as F1, fixed there. +- Current-tree verification: See F1. +- Resolution reference: +- Follow-up PR URL: N/A +- Reply URL: + +### F13 - Exclude dev-dependency edges in M2 (re-raise) + +- PR number: 2865 +- Source review ID: 5912779850 +- Reviewer finding ID: N/A +- Source URL: +- Concern: `cargo tree -e features` includes dev-dependencies, so M2 would report `primitives/testing` from test-only dependencies. +- Solution: Same concern as F2, fixed there. +- Current-tree verification: See F2. +- Resolution reference: +- Follow-up PR URL: N/A +- Reply URL: + +### F14 - Audit cited PR-branch commit ids + +- PR number: 2865 +- Source review ID: 5913005734 +- Reviewer finding ID: F12 +- Source URL: +- Concern: The audit cited PR-branch commits by id in the findings introduction and two processing-log entries; `open-pull-request` keeps such ids out of review audits because a rebase changes them. +- Solution: Replaced the ids with commit subjects (the first commit's subject in the introduction and the round-1 log entry; the push entry already named the fix commit by subject). +- Current-tree verification: The `open-pull-request` commit-id check, run from the repository root with `UPSTREAM_REMOTE=torrust`, prints nothing. +- Resolution reference: docs(pr-reviews): cite PR #2865 branch commits by subject in its audit +- Follow-up PR URL: N/A +- Reply URL: + +### F15 - PR description did not list the audit + +- PR number: 2865 +- Source review ID: 5913005734 +- Reviewer finding ID: F13 +- Source URL: +- Concern: The PR description still said the PR only adds the spec and listed one file, while the branch also adds this audit; the merge tool copies the description into the merge commit. +- Solution: Edited the PR description: it now says the PR adds the spec and its review audit, lists the audit under Files, describes the `Id::new` callers through the `i32` wrappers, and adds the audit validator under Validation. +- Current-tree verification: `gh pr view 2865 --json body` shows the audit under Files and no "only adds the spec" sentence. +- Resolution reference: +- Follow-up PR URL: N/A +- Reply URL: + +### F16 - u32::try_from returns a Result + +- PR number: 2865 +- Source review ID: 5913005734 +- Reviewer finding ID: F14 +- Source URL: +- Concern: Q4 (b) said the loops pass `u32::try_from(i)`, which is a `Result` and cannot be passed to a `u32` parameter as it is. +- Solution: Q4 (b) now names both routes: `u32::try_from(i).expect(...)`, or iterating over `0..408_u32` and converting only for `InfoHash::from` and `write_i32`. +- Current-tree verification: `grep -n 'try_from' docs/issues/drafts/peer-id-test-helper/ISSUE.md` shows the `.expect(...)` form and the second route. +- Resolution reference: docs(issues): clarify the loop conversion and coverage note of the peer-id-test-helper spec +- Follow-up PR URL: N/A +- Reply URL: + +### F17 - swarm_metadata.rs coverage note is stale + +- PR number: 2865 +- Source review ID: 5913005734 +- Reviewer finding ID: F15 +- Source URL: +- Concern: The note about 9 uncovered `swarm_metadata.rs` lines is stale on current `develop`: #2864 covered them, and #2824's final measurement puts all 68 uncovered lines in `peer.rs`. +- Solution: Dated the note to `develop` at `abd7a10ff` and added #2824's final measurement (31 / 31 for `swarm_metadata.rs`; 1,078 / 1,146 lines, all 68 uncovered in `peer.rs`; corrected by F18). +- Current-tree verification: On `develop` at `4c8c88c0b`, #2824's `coverage-evidence.md` gives `swarm_metadata.rs` 31 / 31 and 1,078 / 1,146 lines for the package in its final rows. +- Resolution reference: docs(issues): clarify the loop conversion and coverage note of the peer-id-test-helper spec +- Follow-up PR URL: N/A +- Reply URL: + +### F18 - Coverage note cites the wrong row of #2824's record + +- PR number: 2865 +- Source review ID: 5915609693 +- Reviewer finding ID: F16 +- Source URL: +- Concern: The note called 1,077 / 1,145 #2824's final measurement, but that is the "After `swarm_metadata.rs`" row; the final rows give 1,078 / 1,146. The audit's F17 solution and verification repeated the figure. +- Solution: The spec note and F17's solution and verification lines now give 1,078 / 1,146; the 68 uncovered lines in `peer.rs` are unchanged. +- Current-tree verification: On `develop` at `4c8c88c0b`, `docs/issues/open/2824-1347-add-tests-primitives/coverage-evidence.md` gives 1,077 / 1,145 on line 102 and 1,078 / 1,146 on lines 103 and 116; `grep -n '1,077' docs/issues/drafts/peer-id-test-helper/ISSUE.md` prints nothing. +- Resolution reference: docs(issues): cite the final #2824 coverage row in the peer-id-test-helper spec +- Follow-up PR URL: N/A +- Reply URL: + +### F19 - Round-3 Processing Log stamps contradict the forge and commit times + +- PR number: 2865 +- Source review ID: 5915707496 +- Reviewer finding ID: F18 +- Source URL: +- Concern: The round-3 entries said the review was received at 05:58 and the reply sent at 05:59 UTC, and stamped the validator run 06:00 UTC, but the review was submitted at 05:55:42, the reply posted at 05:57:50 and the audit commit made at 05:59:12 UTC. +- Solution: Appended a correction entry with the forge and commit times; the round-3 entries are left as written. +- Current-tree verification: The Processing Log's round-4 correction entry gives 05:55:42, 05:57:19, 05:57:50 and 05:59:12 UTC. +- Resolution reference: docs(pr-reviews): record round 4 of the PR #2865 review audit +- Follow-up PR URL: N/A +- Reply URL: + +### F20 - Spec last-updated stamp and Progress Log miss the round-3 edit + +- PR number: 2865 +- Source review ID: 5915707496 +- Reviewer finding ID: F19 +- Source URL: +- Concern: `last-updated-utc` still said 2026-11-15 21:27 after the round-3 spec change, and the Progress Log had no entry for it. +- Solution: Bumped `last-updated-utc` and added Progress Log entries for rounds 3 and 4. +- Current-tree verification: `grep -n 'last-updated-utc\|Review round 3' docs/issues/drafts/peer-id-test-helper/ISSUE.md` shows the 2026-11-16 stamp and the round-3 entry. +- Resolution reference: docs(issues): log review rounds 3 and 4 in the peer-id-test-helper spec +- Follow-up PR URL: N/A +- Reply URL: + +### F21 - New commit subject matches the closing-keyword scan + +- PR number: 2865 +- Source review ID: 5916743500 +- Reviewer finding ID: F21 +- Source URL: +- Concern: The subject of the commit that moved the #2824 references said "the closed" followed by the issue number, which the `open-pull-request` closing-keyword scan matches, while this PR is only related to #2824. +- Solution: Reworded the subject before the merge to say "archived" instead; the diff of the commit is unchanged. +- Current-tree verification: The skill's closing-keyword scan over the commit messages of the branch prints nothing. +- Resolution reference: docs(issues): point the peer-id-test-helper spec at the archived #2824 spec +- Follow-up PR URL: N/A +- Reply URL: + +## Processing Log + +- 2026-11-15 20:31 UTC - Review round 1: da2ce7 review 5912769583 (CHANGES_REQUESTED, F1-F11) and Copilot review 5912779850 (two comments) received on the first commit, `docs(issues): draft the peer-id-test-helper spec (finding F5 of #2824)`; every finding checked against the tree. +- 2026-11-15 20:32 UTC - Committed the fixes as `docs(issues): correct the peer-id-test-helper inventory and checks after review` and pushed it. +- 2026-11-15 20:44 UTC - Replied on all 13 threads (20:43:55 to 20:44:22 UTC). Late start: this audit record was created after the replies, not before the first reply as the workflow requires. +- 2026-11-15 20:45 UTC - Validator `validate-audit-record.py --pr-number 2865` exited 0 (13 rows, 0 failures); audit committed separately from the spec fix. +- 2026-11-15 21:26 UTC - Review round 2: da2ce7 review 5913005734 (APPROVED, four findings, recorded as F14-F17) received on the audit commit; every finding checked against the tree. +- 2026-11-15 21:28 UTC - Correction for F14: the findings introduction and the two round-1 entries above (20:31 and 20:32 UTC) were edited in place to replace PR-branch commit ids with commit subjects; they first named the reviewed head and the pushed head by id. Committed as `docs(pr-reviews): cite PR #2865 branch commits by subject in its audit`, with the spec fixes in `docs(issues): clarify the loop conversion and coverage note of the peer-id-test-helper spec`. +- 2026-11-15 21:29 UTC - Edited the PR description (F15) and recorded it in a PR comment; added rows F14-F17 before replying, then replied on the four threads (21:29 UTC). +- 2026-11-15 21:29 UTC - Validator `validate-audit-record.py --pr-number 2865` exited 0 for round 2. +- 2026-11-16 05:58 UTC - Review round 3: da2ce7 review 5915609693 (APPROVED, one finding, recorded as F18) received on the round-2 audit commit; the figure checked against #2824's `coverage-evidence.md` on `develop`. +- 2026-11-16 05:58 UTC - Correction for F18: F17's solution and current-tree verification lines were edited in place to replace 1,077 / 1,145 with 1,078 / 1,146. Added row F18 before replying, then replied on the thread (05:59 UTC). +- 2026-11-16 06:00 UTC - Validator `validate-audit-record.py --pr-number 2865` exited 0 for round 3 (18 rows, 0 failures). +- 2026-11-16 06:08 UTC - Review round 4: da2ce7 review 5915707496 (APPROVED, two findings, recorded as F19-F20) received on the round-3 audit commit at 06:07:50 UTC; both checked against the forge record and the commits. Added rows F19-F20 before replying. +- 2026-11-16 06:08 UTC - Correction for F19: the round-3 entries above carry wrong times. The review was submitted at 05:55:42 UTC, the spec fix committed at 05:57:19, the reply posted at 05:57:50, and the audit committed (with its validator run) at 05:59:12 UTC. +- 2026-11-16 06:09 UTC - Replied on the two round-4 threads (06:09 UTC); validator `validate-audit-record.py --pr-number 2865` exited 0 for round 4 (20 rows, 0 failures). +- 2026-11-16 06:27 UTC - da2ce7 review 5915854868 (APPROVED, no findings) and an ACK comment on the round-4 head; nothing to record as a row. +- 2026-11-16 07:54 UTC - Rebased onto `develop` after #2871 archived the #2824 spec, and moved the spec's two references to `docs/issues/closed/`. The two older `docs/issues/open/` paths in this audit are dated current-tree verifications and stay as written. +- 2026-11-16 08:08 UTC - Review round 6: da2ce7 review 5916743500 (APPROVED, one finding, F21) received at 08:06:57 UTC on the rebased head. Reworded the commit subject at 08:07 UTC and added row F21 before replying. +- 2026-11-16 08:08 UTC - Replied on the F21 thread (08:08 UTC); validator `validate-audit-record.py --pr-number 2865` exited 0 for round 6 (21 rows, 0 failures). + +## 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.