Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ semantic-links:
- "issue #2582"
- "issue #2618"
- "issue #2876"
- docs/issues/open/2876-1347-peer-id-test-helper/ISSUE.md
- docs/issues/closed/2876-1347-peer-id-test-helper/ISSUE.md
---

<!-- skill-link: create-adr -->
Expand Down Expand Up @@ -69,7 +69,7 @@ semantic-links:
> plural module names such as `fixtures`. Trait impls inside such a module (here `Default`) are gated with it,
> so they leave production builds too. The ownership map has a row for it. The maintainer decided this on
> 2026-11-16 (the answers to Q2, Q5 and Q7 in the
> [#2876 spec](../issues/open/2876-1347-peer-id-test-helper/ISSUE.md)).
> [#2876 spec](../issues/closed/2876-1347-peer-id-test-helper/ISSUE.md)).

## Scope

Expand Down Expand Up @@ -359,5 +359,5 @@ so it is not an example of public test infrastructure. DEC-18 in the
- #2582, the packaging failure caused by a self dev-dependency with a `version`
- [Independent package versioning](20260629000000_adopt_independent_package_versioning.md)
- [`deny.toml`](../../deny.toml), the layer boundary rules referenced by rule B
- [#2876 spec](../issues/open/2876-1347-peer-id-test-helper/ISSUE.md), which moved `peer::fixture`
- [#2876 spec](../issues/closed/2876-1347-peer-id-test-helper/ISSUE.md), which moved `peer::fixture`
behind the `testing` feature of `primitives` (amendment of 2026-11-16)
4 changes: 2 additions & 2 deletions docs/issues/closed/2824-1347-add-tests-primitives/ISSUE.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ github-issue: 2824
spec-path: docs/issues/closed/2824-1347-add-tests-primitives/ISSUE.md
branch: "2824-1347-add-tests-primitives-final"
related-pr: 2864
last-updated-utc: "2026-11-16 09:55"
last-updated-utc: "2026-11-17 07:45"
semantic-links:
skill-links:
- create-issue
Expand Down Expand Up @@ -200,7 +200,7 @@ maintainer decides to fix in this issue are not handed off: they go to the T2a s
| F1 | `peer::Peer` derives `Eq`/`Hash` over all fields but implements `Ord` by `peer_id` only, so two unequal peers compare `Ordering::Equal` (violates the `Ord`/`Eq` contract). No production collection orders peers today (the swarm keys by `PeerId`), so the impact is latent. | Throwaway test, 2026-11-10: a seeder and a copy with `left = 5` give `a == b` false and `a.cmp(&b) == Equal`. | Handled by a separate bug issue and session, not fixed here (maintainer decision, 2026-11-10). Bug issue: #2798, spec PR #2800. Fixed by PR #2811 (merged 2026-11-11): `Ord` and `PartialOrd` removed from `Peer` (option A, maintainer's choice), guarded by a `compile_fail` doctest in `peer.rs`. | FIXED (upstream) |
| F3 | `ParsePeerRoleError::InvalidPeerRole` records `Location::caller()` inside `PeerRole::from_str`, which has no `#[track_caller]`, so every error reports the same line inside `peer.rs` (`peer.rs:73:27`) instead of the caller's. Adding `#[track_caller]` fixes only a direct `from_str` call: through `str::parse` the location is a line in Rust's standard library. The pattern is wider than this type: `Location::caller()` appears 65 times across the packages and `#[track_caller]` 3 times, and the located error may reach production output. | Throwaway test, 2026-11-10: `"x".parse::<PeerRole>()` reports `peer.rs:73:27`; with `#[track_caller]`, `parse` reports `core/src/str/mod.rs:2783:9` and a direct `from_str` call reports the caller's line. | Handed off to a follow-up issue that audits every use of `Location::caller()` (maintainer decision, 2026-11-10). Follow-up issue: #2804 (spec PR #2805). Nothing is fixed in this issue. | HANDED OFF |
| F4 | `AggregateActiveSwarmMetadata::add_assign` uses plain `+=` on four `u64` fields (panic in debug, wrap in release on overflow; practically unreachable). The registry and `torrent-repository-benchmarking` sum the fields by hand, so the impl may be dead code. | Code reading, 2026-11-11. | Handed off to a follow-up issue/session `aggregate-addassign` (maintainer decision, 2026-11-11): check whether the impl is used (remove it and run all tests, check git history); delete it if unused, otherwise make overflow explicit (`checked_add` + panic, test, comment). Follow-up issue: #2823. Outcome (maintainer approved, 2026-11-11): the unused `AddAssign` impl was deleted by PR #2827 (merged 2026-11-11), so `swarm_metadata.rs` has no `AddAssign` lines to test. Nothing is fixed in this issue. | HANDED OFF |
| F5 | `peer::Id::new` (public, in a production crate) builds a 20-byte id from a little-endian `i128` (4 zero bytes + 16 bytes). Behavior is correct and lossless, including negatives (two's complement). But it is a test-only helper: the only callers found are `torrent-repository-benchmarking` tests, and its ids look like no real client (`get_client_name()` is `None`). It has no doc comment and no tests. | Code reading and caller search, 2026-11-11 (not a behavior defect; a design problem). | Handed off to a follow-up issue/session `peer-id-test-helper` (maintainer decision, 2026-11-11): prove it is unused in production, move it to a testing helper that generates realistic ids, decide with it whether `peer::fixture` (and `Id::new`) move behind a `testing` feature, as the ADR on shared test support asks (EPIC #2482 is closed and did not reorganize `peer::fixture`). Draft spec merged through PR #2865 (opened 2026-11-15, after review finding F1 of #2864); filed on 2026-11-16 as #2876, spec `docs/issues/open/2876-1347-peer-id-test-helper/ISSUE.md`; the maintainer answers its open design questions before implementation. The `Id::new` tests in `peer.rs` wait on its outcome. | HANDED OFF |
| F5 | `peer::Id::new` (public, in a production crate) builds a 20-byte id from a little-endian `i128` (4 zero bytes + 16 bytes). Behavior is correct and lossless, including negatives (two's complement). But it is a test-only helper: the only callers found are `torrent-repository-benchmarking` tests, and its ids look like no real client (`get_client_name()` is `None`). It has no doc comment and no tests. | Code reading and caller search, 2026-11-11 (not a behavior defect; a design problem). | Handed off to a follow-up issue/session `peer-id-test-helper` (maintainer decision, 2026-11-11): prove it is unused in production, move it to a testing helper that generates realistic ids, decide with it whether `peer::fixture` (and `Id::new`) move behind a `testing` feature, as the ADR on shared test support asks (EPIC #2482 is closed and did not reorganize `peer::fixture`). Draft spec merged through PR #2865 (opened 2026-11-15, after review finding F1 of #2864); filed on 2026-11-16 as #2876, spec `docs/issues/closed/2876-1347-peer-id-test-helper/ISSUE.md`; the maintainer answered its design questions on 2026-11-16, and #2888 implemented the outcome (`Id::new` removed, its replacement tested in `peer.rs`). | HANDED OFF |
| F2 | `PeerRole` derives `Serialize` with `#[serde(rename_all_fields = "lowercase")]`, which does not apply to unit variants, so it serializes as `"Seeder"` and `"Leecher"` while `Display` and the `peer_role` metric label use `seeder` and `leecher`. No production code serializes `PeerRole` today. | Throwaway test, 2026-11-10: `serde_json::to_string(&PeerRole::Seeder)` gives `"Seeder"`. | Fixed in this issue, in slice S1 (maintainer decision, 2026-11-10): `rename_all = "lowercase"` plus a regression test, in its own `fix` commit. | FIXED through #2834 |
| F6 | `Peer::is_seeder` classifies a negative `left` as a seeder because `NumberOfBytes` is signed; the UDP announce accepts a negative `left` while HTTP rejects it. | Found writing the `peer.rs` tests (S2), 2026-11-12. | Handed off to issue #2838; its fix PR #2839 was closed unmerged, and #2850 (non-negative number of bytes by construction, spec PR #2851) will remove the case. The S2 test pins the classification of the signed domain value and is removed by the #2850 implementation. | HANDED OFF |

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Candidate lessons collected while working on Issue #2824. Promoting any of them
| [Findings register](ISSUE.md#findings-register) (F1) | None left: `Peer` lost `Ord` and `PartialOrd`. | Bug #2798, fixed by #2811 (merged 2026-11-11). |
| [Findings register](ISSUE.md#findings-register) (F3) | Audit every `Location::caller()` in the packages (65 uses, 3 `#[track_caller]`). | Follow-up issue #2804 (spec PR #2805). |
| [Findings register](ISSUE.md#findings-register) (F4) | None left: the unused `AddAssign` of `AggregateActiveSwarmMetadata` was deleted. | Follow-up issue #2823. |
| [Findings register](ISSUE.md#findings-register) (F5) | Move `peer::Id::new` and `peer::fixture` to test support behind a `testing` feature, with realistic ids. | Handed off by the maintainer's decision (2026-11-11) as `peer-id-test-helper`; draft spec PR #2865 (opened 2026-11-15); filed on 2026-11-16 as #2876 (`docs/issues/open/2876-1347-peer-id-test-helper/ISSUE.md`). The only uncovered lines of the package are its. |
| [Findings register](ISSUE.md#findings-register) (F5) | Move `peer::Id::new` and `peer::fixture` to test support behind a `testing` feature, with realistic ids. | Handed off by the maintainer's decision (2026-11-11) as `peer-id-test-helper`; draft spec PR #2865 (opened 2026-11-15); filed on 2026-11-16 as #2876 (`docs/issues/closed/2876-1347-peer-id-test-helper/ISSUE.md`). The only uncovered lines of the package are its. |
| [Findings register](ISSUE.md#findings-register) (F6) | Make the number of bytes non-negative by construction, so a negative `left` cannot reach `is_seeder`. | #2838 (fix PR #2839 closed unmerged), superseded by #2850 (spec PR #2851). |
| [Issue spec](ISSUE.md#out-of-scope) (Out of Scope) | Audit the implicit lowercase and snake_case convention of enum serialization (the F2 `PeerRole` defect came from a `rename_all_fields` that does not apply to unit variants) in a separate issue, under `create-adr`. | `PeerRole` serialized as `"Seeder"` while `Display` and the metric label use `seeder`; fixed in S1 (#2834). |

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
schema-version: 1
doc-type: issue
issue-type: task
status: in-progress
status: done
priority: p2
epic: 1347
github-issue: 2876
spec-path: docs/issues/open/2876-1347-peer-id-test-helper/ISSUE.md
spec-path: docs/issues/closed/2876-1347-peer-id-test-helper/ISSUE.md
Comment thread
josecelano-bot marked this conversation as resolved.
Resolved
branch: "2876-peer-id-test-helper"
related-pr: null
last-updated-utc: "2026-11-16 17:55"
related-pr: 2888
last-updated-utc: "2026-11-16 21:52"
semantic-links:
skill-links:
- create-issue
Expand Down Expand Up @@ -393,7 +393,7 @@ with the narrow affected scope, and sign every commit with GPG.
- [ ] 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
- [x] Committer verified spec progress is up to date before commit
- [ ] Issue closed and spec moved from `docs/issues/open/` to `docs/issues/closed/`
- [x] Issue closed and spec moved from `docs/issues/open/` to `docs/issues/closed/`

### Progress Log

Expand Down Expand Up @@ -475,6 +475,9 @@ with the narrow affected scope, and sign every commit with GPG.
- 2026-11-16 17:55 UTC - Claude Code (Opus 5.5) - Review round 3 of PR #2888 (da2ce7, approved, F5
Minor): the audit's round-1 log entry is restored and the F4 time correction is appended as a new
entry, because the log is append-only.
- 2026-11-16 21:52 UTC - Claude Code (Opus 5.5) - PR #2888 merged (2026-11-16 21:49 UTC, after
Comment thread
josecelano-bot marked this conversation as resolved.
Resolved
the maintainer's and da2ce7's ACK of `c4def2469`); #2876 closed. Spec archived to
`docs/issues/closed/`; the parent EPIC row and the ADR links point to the new path.
Comment thread
josecelano-bot marked this conversation as resolved.
Resolved

## Acceptance Criteria

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ semantic-links:
skill-links:
- write-markdown-docs
related-artifacts:
- docs/issues/open/2876-1347-peer-id-test-helper/ISSUE.md
- docs/issues/closed/2876-1347-peer-id-test-helper/ISSUE.md
- docs/adrs/20261021190318_share_workspace_test_support_through_testing_features.md
---

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
doc-type: manual-verification-evidence
issue-spec: docs/issues/open/2876-1347-peer-id-test-helper/ISSUE.md
last-updated-utc: 2026-11-16 16:29
issue-spec: docs/issues/closed/2876-1347-peer-id-test-helper/ISSUE.md
last-updated-utc: 2026-11-16 21:52
---

# Manual Verification Evidence
Expand Down
5 changes: 3 additions & 2 deletions docs/issues/open/1347-overhaul-packages-testing/EPIC.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ epic: null
github-issue: 1347
spec-path: docs/issues/open/1347-overhaul-packages-testing/EPIC.md
epic-owner: josecelano
last-updated-utc: "2026-11-16 14:07"
last-updated-utc: "2026-11-17 07:45"
semantic-links:
skill-links:
- create-issue
Expand Down Expand Up @@ -98,7 +98,7 @@ Status values: `TODO`, `IN_PROGRESS`, `BLOCKED`, `DONE`.
| 10 | #2637 - Add tests to the axum-rest-api-server package | `docs/issues/closed/2637-1347-add-tests-axum-rest-api-server/ISSUE.md` | DONE | S0 (spec and T1 baseline) merged through #2638; S1 (authentication and shared responses) merged through #2667; S2 (routes) merged through #2687; S3 (auth-key and whitelist contexts) merged through #2702; S4 (torrent and stats contexts) merged through #2718; S5 (server lifecycle) merged through #2744; S6 (crate root, wiring and final tasks) merged through #2772; the issue is closed. Replaces the former draft that was misfiled under #1349. |
| 11 | #2824 - Add tests to the primitives package | `docs/issues/closed/2824-1347-add-tests-primitives/ISSUE.md` | DONE | S0 (the spec, #2828), S1 (the `PeerRole` JSON casing fix, #2834), S2 (the `peer.rs` tests, #2841), S3 (the configuration defaults and bounded values, #2852) and S4 (`swarm_metadata.rs`, the no-change files, the mutation run, the manual checks, #2864) are merged; the issue is closed. Unit-only lines 60.56% → 94.07%. Findings F1 (fixed through #2811), F2 (fixed in S1), F3 (#2804), F4 (#2823), F6 (#2838, #2850) and F5 (#2876, drafted through #2865) have owners. |
| 12 | #2838 - UDP tracker accepts announces with a negative left, uploaded or downloaded | `docs/issues/closed/2838-1347-udp-reject-negative-announce-bytes/ISSUE.md` | DONE | Bug found by the #2824 primitives tests work. Fixed by the standalone issue #2850 (`docs/issues/closed/2850-non-negative-number-of-bytes/ISSUE.md`): its implementation PR #2872 merged on 2026-11-16 and closed this issue. The patch of PR #2839 was not merged; its tests were taken over by PR #2872. |
| 13 | #2876 - Move `peer::Id::new` to a realistic test helper and decide whether `peer::fixture` goes behind a `testing` feature | `docs/issues/open/2876-1347-peer-id-test-helper/ISSUE.md` | TODO | Finding F5 of #2824. Spec-only PR first; the maintainer answers the design questions Q1-Q7 before implementation. |
| 13 | #2876 - Move `peer::Id::new` to a realistic test helper and decide whether `peer::fixture` goes behind a `testing` feature | `docs/issues/closed/2876-1347-peer-id-test-helper/ISSUE.md` | DONE | Finding F5 of #2824. Spec through #2878, implementation through #2888: `Id::new` removed, `qbittorrent_peer_id` helper, `peer::fixture` behind the new `testing` feature of `primitives`, test-support ADR amended. Breaking for the published `primitives` 3.0.0; adds to the 4.0.0 it owes (#2583). |
| 14 | Additional package-testing subissues | Create a folder-style spec when a concrete package need is identified | TODO | Permitted but not required upfront; retain scope in this EPIC. |

## Package Coverage Tracking
Expand Down Expand Up @@ -354,6 +354,7 @@ For each subissue implementation, the completion policy is:
- 2026-11-15 21:07 UTC - Claude Code - #2824 closed by #2864 (merged 2026-11-15 21:05 UTC); row 11 set to `DONE` and the spec archived to `docs/issues/closed/2824-1347-add-tests-primitives/`.
- 2026-11-15 21:22 UTC - Claude Code (Opus 5.5) - Row 12 (#2838): the fix is the implementation of the standalone issue #2850, PR #2872 (open), which closes #2838 on merge. It removes the `primitives` test that pinned a negative `left` as a seeder (finding F6 of #2824) and the `-1` rows of the role table.
- 2026-11-16 14:07 UTC - Claude Code (Opus 5.5) - #2838 closed by PR #2872 (merged 2026-11-16 14:05 UTC); row 12 set to `DONE` and the specifications of #2838 and #2850 archived to `docs/issues/closed/`.
- 2026-11-16 21:52 UTC - Claude Code (Opus 5.5) - #2876 closed by PR #2888 (merged 2026-11-16 21:49 UTC); row 13 set to `DONE` and the spec archived to `docs/issues/closed/2876-1347-peer-id-test-helper/`.

## Acceptance Criteria

Expand Down
Loading
Loading