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
6 changes: 3 additions & 3 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-15 21:07"
last-updated-utc: "2026-11-16 09:55"
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: `docs/issues/drafts/peer-id-test-helper/ISSUE.md`, PR #2865 (opened 2026-11-15, after review finding F1 of #2864); no GitHub issue yet, because the maintainer first answers its open design questions. 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/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 |
Comment thread
josecelano-bot marked this conversation as resolved.
Resolved
| 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 Expand Up @@ -398,7 +398,7 @@ Reviewed against observed behavior after the last slice, before the issue is clo
| AC6 | DONE | A Prose-First AAA table in every record with an added or changed test. |
| AC7 | DONE | `mutation-evidence.md` (no score target, no CI gate). |
| AC8 | DONE | The T5 reconciliation (S4): ledger, plan index, slice table, acceptance rows, coverage evidence and both EPIC "Latest" tables carry the final figures; no record says `status: proposed` or `in-progress`. |
| AC9 | DONE | F1 #2798, F2 fixed in S1 (#2834), F3 #2804, F4 #2823, F6 #2838 and #2850, each with its owner in the Findings Register and a `lessons.md` row. F5 is handed off by decision (2026-11-11); its draft spec is PR #2865 (`docs/issues/drafts/peer-id-test-helper/ISSUE.md`), with no GitHub issue yet; its `lessons.md` row says so. |
| AC9 | DONE | F1 #2798, F2 fixed in S1 (#2834), F3 #2804, F4 #2823, F6 #2838 and #2850, each with its owner in the Findings Register and a `lessons.md` row. F5 is handed off by decision (2026-11-11); its draft spec is PR #2865 (`docs/issues/drafts/peer-id-test-helper/ISSUE.md`), with no GitHub issue yet at closure (filed later as #2876; see the Findings Register). |
| AC10 | DONE | S0-S3 merged (#2828, #2834, #2841, #2852) with `Related to #2824`; S4 merged through #2864 (2026-11-15 21:05 UTC), the only PR that uses `Closes #2824`, and the issue closed with it. |
| AC11 | DONE | `cargo +nightly fmt --all -- --check` (nightly Rust), `linter all` (the pre-commit gate of every S4 commit), `cargo test -p torrust-tracker-primitives` (stable Rust 1.99.1: 109 unit tests and 3 doctests pass). |
| AC12 | DONE | `manual-verification-evidence.md`: M1 and M2 passed on 2026-11-15. |
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 (`docs/issues/drafts/peer-id-test-helper/ISSUE.md`, opened 2026-11-15); no GitHub issue yet. 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/open/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
7 changes: 4 additions & 3 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-15 21:22"
last-updated-utc: "2026-11-16 09:38"
semantic-links:
skill-links:
- create-issue
Expand Down Expand Up @@ -96,9 +96,10 @@ Status values: `TODO`, `IN_PROGRESS`, `BLOCKED`, `DONE`.
| 8 | #2301 - Review package coverage rollout | `docs/issues/open/2301-1347-review-package-coverage-rollout/ISSUE.md` | TODO | After the EPIC completes, review real rollout evidence before retaining, revising, or proposing a required coverage check. |
| 9 | #2361 - Keep the report-only package coverage summary from failing on a discovery failure | `docs/issues/open/2361-1347-package-coverage-summary-discovery-failure/ISSUE.md` | TODO | Bug follow-up of #2347 (`review-finding:pr-2293-f1`): the #2222 summary check goes red with a JSON parse error when discovery fails. |
| 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 (draft spec PR #2865) have owners. |
| 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/open/2838-1347-udp-reject-negative-announce-bytes/ISSUE.md` | IN_PROGRESS | Bug found by the #2824 primitives tests work. Fixed by the standalone issue #2850 (`docs/issues/open/2850-non-negative-number-of-bytes/ISSUE.md`): its implementation PR #2872 (open) closes this issue on merge; until then the bug is present on `develop`. The patch of PR #2839 was not merged. |
| 13 | 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. |
| 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. |
Comment thread
josecelano-bot marked this conversation as resolved.
Resolved
| 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
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: draft
status: planned
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"
epic: 1347
github-issue: 2876
spec-path: docs/issues/open/2876-1347-peer-id-test-helper/ISSUE.md
Comment thread
josecelano-bot marked this conversation as resolved.
Resolved
branch: "2876-peer-id-test-helper-spec"
related-pr: null
last-updated-utc: "2026-11-16 07:54"
last-updated-utc: "2026-11-16 09:41"
semantic-links:
skill-links:
- create-issue
Expand All @@ -26,7 +26,9 @@ semantic-links:

<!-- skill-link: create-issue -->

# Issue #[To be assigned] - Move `peer::Id::new` to a realistic test helper and decide whether `peer::fixture` goes behind a `testing` feature
# Issue #2876 - Move `peer::Id::new` to a realistic test helper and decide whether `peer::fixture` goes behind a `testing` feature
Comment thread
josecelano-bot marked this conversation as resolved.
Resolved

Parent EPIC: #1347 - Overhaul: Packages Testing

## Goal

Expand Down Expand Up @@ -365,8 +367,9 @@ with the narrow affected scope, and sign every commit with GPG.
### 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
- [x] Draft spec reviewed and merged through #2865 (filing approved by the maintainer in chat, 2026-11-16)
- [ ] Open design questions Q1-Q7 answered by the maintainer (before T0)
- [x] GitHub issue created (#2876) and issue number added to this spec
Comment thread
josecelano-bot marked this conversation as resolved.
Resolved
- [ ] (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)
Expand Down Expand Up @@ -402,6 +405,14 @@ with the narrow affected scope, and sign every commit with GPG.
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.
- 2026-11-16 08:45 UTC - Claude Code (Sonnet 5.5) - Filed as #2876 under EPIC #1347 after #2865 merged
Comment thread
josecelano-bot marked this conversation as resolved.
Resolved
(`a25a27e23`). Moved from `docs/issues/drafts/peer-id-test-helper/` to
`docs/issues/open/2876-1347-peer-id-test-helper/`; `epic`, `github-issue`, `spec-path` and `branch`
set; status `planned`. Q1-Q7 are still unanswered; nothing is implemented.
- 2026-11-16 09:41 UTC - Claude Code (Opus 5.5) - Review round 1 of PR #2878 (da2ce7 F1-F5, Copilot
two re-raises): `branch` is now the `-spec` branch, the parent EPIC line is under the title, the
approval checkpoint is split from the Q1-Q7 answers, and the F5 owner cells of EPIC row 11 and the
closed #2824 spec point at #2876.

## Acceptance Criteria

Expand Down
Loading
Loading