Skip to content

fix(primitives): [#2798] remove the Ord impl of Peer that disagreed with Eq - #2811

Merged
josecelano merged 16 commits into
torrust:developfrom
josecelano-bot:2798-peer-ord-inconsistent-with-eq
Nov 11, 2026
Merged

josecelano merged 16 commits into
torrust:developfrom
josecelano-bot:2798-peer-ord-inconsistent-with-eq

Conversation

@josecelano-bot

@josecelano-bot josecelano-bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes #2798. Peer derived Eq over all seven fields but implemented Ord by peer_id only, so two distinct peers (for example a seeder and a copy with left = 5) compared Equal. That breaks the Ord/Eq contract.

Option A, chosen by the maintainer after the T1 investigation recorded in the spec: remove Ord and PartialOrd from Peer.

  • The id-only Ord came from the AnnounceEvent wrapper swap in dev: remove announce event wrapper (the replacement type has no Ord, so the earlier all-field derive stopped compiling).
  • No production code orders or hashes a Peer; whole-peer equality is used by tests and by test-only Event equality.
  • PeerList and Torrent in torrent-repository-benchmarking (publish = false) only inherited the derived Ord, so those derives are dropped too.

Changes

  • packages/primitives/src/peer.rs: remove impl Ord/impl PartialOrd; rustdoc states equality is over every field and there is no ordering; a compile_fail doctest guards the removal.
  • packages/torrent-repository-benchmarking/src/entry/{mod,peer_list}.rs: drop the derived PartialOrd, Ord.
  • Spec and evidence under docs/issues/open/2798-peer-ord-inconsistent-with-eq/: T1 findings, decision, red run, reproduction and final recheck.

Breaking change: Peer no longer implements Ord. torrust-tracker-primitives is publishable (3.1.0), so its next publish is a major version. Accepted by the maintainer because few external consumers of Peer: Ord are expected (not verified).

Validation

  • Red: the compile_fail doctest failed on the unfixed code ("compiled successfully, but it's marked compile_fail"); recorded in manual-verification-evidence.md.
  • Green: cargo test -p torrust-tracker-primitives passes; cargo test --workspace --no-run exits 0; linter all passes.
  • Recheck: the original throwaway reproduction no longer compiles because Peer has no cmp.

History note: after review round 1 the branch history was rewritten once (force-with-lease) to reword two commit messages, as a reviewer asked; the content of those commits is unchanged.

🤖 Generated with Claude Code

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The doctest checks only Ord, allowing an equality-inconsistent PartialOrd implementation to be restored undetected despite the requirement to remove both ordering traits.

1 open issue
What changed in this PR

Fixes #2798 by removing Peer ordering that disagreed with its whole-field equality. This intentionally breaks callers relying on Peer: Ord, while preserving equality and hashing.

Changes:

  • Removes Ord and PartialOrd from Peer, documents its comparison semantics, and adds a compile-fail doctest.
  • Removes dependent ordering derives from benchmarking types.
  • Records the investigation, maintainer decision, and red/green verification evidence.
File Description
packages/​torrent-repository-benchmarking/​src/​entry/​peer_list.rs Removes ordering derives from PeerList.
packages/​torrent-repository-benchmarking/​src/​entry/​mod.rs Removes ordering derives from Torrent.
packages/​primitives/​src/​peer.rs Removes ordering implementations and adds documentation and a regression doctest.
docs/​issues/​open/​2798-peer-ord-inconsistent-with-eq/​manual-verification-evidence.md Records the red run and final reproduction recheck.
docs/​issues/​open/​2798-peer-ord-inconsistent-with-eq/​ISSUE.md Documents the chosen fix, investigation, and completion evidence.

Review effort: Balanced

Comment thread packages/primitives/src/peer.rs Resolved
da2ce7
da2ce7 previously approved these changes Nov 10, 2026

@da2ce7 da2ce7 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed at 7c8bb1f3548bf9190967b0306d26b49351066dd3. Recomputed from the bytes at this head, against the merge base c2b5d96ef; git merge-tree against develop c2b5d96ef writes a conflict-free tree identical to the head's own tree (develop has not moved past the merge base).

Process: a bug fix, governed by fix-bug (.github/skills/dev/debugging/fix-bug/SKILL.md) with create-issue, write-unit-test, commit-changes, open-pull-request and the implementer agent's task-review step. The required sequence is present: reproduction (V1), a red compile_fail doctest, the fix, a green run and the V2 recheck.

The change against its claim: peer.rs drops the id-only Ord/PartialOrd impls and adds rustdoc plus a compile_fail doctest that compiles only while Peer: Ord, so it fails with the change reverted and passes with it; PeerList and Torrent drop the derives they only inherited. No ordering use of Peer, PeerList or Torrent remains in the workspace (derives, bounds, impls, sorts, sets and map keys scanned). The T1 history (00af70f25 swapped in an AnnounceEvent without Ord), the Coordinator key and filter, the three Event enums, the test-only placement of whole-peer asserts, the 47 unit tests and the doctest's line 117 all recompute.

Consistency: no link or anchor changes, no file moves, every cited commit id is on develop, and doctest, rustdoc, nocapture are already in the dictionary.

Hygiene: three Conventional subjects with [#2798]; author equals committer; each commit ends in one co-author attribution footer (no rule in the tree addresses it); git diff --check is clean; the PR-branch commit-id check prints nothing; the keyword scan matches only the description's Fixes #2798, which is intended (the skill's table names Closes, same effect). No review threads exist, so no audit record is due.

Findings: five Minor (F1 the deleted major-version note for a publishable crate; F2 V2 names no code state and a TODO V2 stub remains; F3 no green output and the old test boundary in the evidence; F4 pre-PR spec state not recorded; F5 the last subject claims work the fix commit carries), two Nit (F6, F7) and one Suggestion (F8). None blocks.

Checked, no finding: the rustdoc wording, the V2 errors (two cmp calls, two E0599), the red run's summary line (the edition-2024 standalone-block form), the markdownlint rules on the new sections, and the cspell words added.

Checks

On the loop's compute node at this head, against the merge base c2b5d96ef (receipt server-gates-kranich-617): the repository's pre-commit gate exit 0 (115 s; it builds the workspace and runs the doc tests, including the new compile_fail doctest), clippy-allow-reasons against the base exit 0, and the tree left clean; linter markdown, linter cspell, linter lychee (offline links) exit 0; frontmatter-validator --all showed no new error against the base. Package tests at this head: cargo test -p torrust-tracker-primitives -p torrust-tracker-torrent-repository-benchmarking exit 0 (91 s, 1535 passed, none failed). Confirmed at this head: packages/primitives/src/peer.rs has no impl Ord or impl PartialOrd for Peer. GitHub checks at this head at posting time: "Package Coverage Regression: completed/success; Package Coverage (torrust-tracker-torrent-repository-benchmarking): completed/success; Package Coverage (torrust-tracker-primitives): completed/success; Docs Lint: completed/success; Build on ubuntu-latest (nightly): completed/success; Build on macos-latest (stable): completed/success; Build on ubuntu-latest (stable): completed/success; Build on macos-latest (nightly): completed/success; Build on windows-latest (nightly): completed/success; Build on windows-latest (stable): completed/success; Docker E2E: completed/skipped; Documented Clippy Allows: completed/success; Workspace Packaging: completed/success; Layer Boundary Bans: completed/success; Unit (stable): in_progress/pending; Unit (nightly): in_progress/pending; Shipped Features: completed/success; Discover Package Coverage: completed/success; Generate Coverage Report: completed/success; Test (Docker) (release): in_progress/pending". At posting, develop is 4a46f98b2.

Comment thread packages/primitives/src/peer.rs Resolved
@da2ce7

da2ce7 commented Nov 10, 2026

Copy link
Copy Markdown
Contributor

ACK 7c8bb1f — removal of the id-only Ord/PartialOrd from Peer and of the two inherited derives verified at this head, with no ordering use of Peer, PeerList or Torrent left in the workspace and the compile_fail doctest red with the change reverted

josecelano-bot and others added 5 commits November 10, 2026 17:45
…greed with Eq

Peer derives Eq over every field but ordered by peer_id only, so two
distinct peers compared Equal. Nothing in production orders a Peer, so remove
Ord and PartialOrd (and the derives PeerList and Torrent inherited) instead of
keeping an arbitrary ordering. A compile_fail doctest guards the removal.

The same commit also carries the issue spec and evidence updates: the option A
decision, scope, regression strategy, acceptance criteria and risks, and the
red run of the doctest, which a pre-commit doctest step kept from being
committed alone.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
… Peer ordering

The doctest bound is now PartialOrd, which Ord requires, so it fails when
either ordering trait is restored.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…the evidence

Delete the stale V2 stub, name the code state of V2 and of the red run, paste
the green doctest output, and refresh the test boundary and the closing note.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…the decision

Restore the major-version consequence and the publishability reason, update
the frontmatter, checkpoints and completion review, fix the stale
cross-references after the decision, and drop an overstated claim.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@josecelano

Copy link
Copy Markdown
Member

ACK c1ef92b

@josecelano
josecelano requested a review from da2ce7 November 10, 2026 17:49
@josecelano-bot
josecelano-bot force-pushed the 2798-peer-ord-inconsistent-with-eq branch from c1ef92b to 2562846 Compare November 10, 2026 17:58
da2ce7
da2ce7 previously approved these changes Nov 10, 2026

@da2ce7 da2ce7 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed at 87e3261504dcd35180e2e1175fcff7a67a3376ee. Recomputed from the bytes at this head, against the previous round's head 7c8bb1f35 and the merge base c2b5d96ef; git merge-tree against develop 4a46f98b2 writes a conflict-free tree that differs from this head only in the eight documentation paths develop changed since c2b5d96ef.

What moved: the branch was rewritten once, so 7c8bb1f35 and c1ef92b5c are no longer ancestors. The four rewritten commits keep their trees, and only two messages changed. 9533f3b6c and 25628465e edit the spec files; 1ef0385dc and 87e326150 add the audit record. No path outside docs/ differs from c1ef92b5c.

Previous findings: F1 to F8 are fixed in the bytes (spec 97-100, 91, 161, 212 and 346-349; evidence 4, 21, 85, 108-117, 121 and 152; frontmatter, checkpoints, 298 and 356; the reworded messages; peer.rs:120-123). F10, raised in this round's draft when replies preceded the record, is fixed by the record.

The audit record: nine rows for the nine threads, each replied to and resolved; the re-raise row carries the prescribed Superseded by reply; severities match the source brackets; the validator's logic passes offline on the capture (9 rows, 4 log entries, 0 failures). The PR-branch commit-id check reports three ids in its log (F13), and the record lacks the template's closing section (F14).

Hygiene: Conventional subjects with [#2798]; bodies match their diffs; author equals committer; one co-author attribution footer per commit (no rule in the tree addresses it); git diff --check from 7c8bb1f35 is clean; the audit is committed apart from the fixes.

Findings: F9 and F13 Minor, F11, F12 and F14 Nit. None blocks.

Checked, no finding: the log stamps against the commit, force-push and reply times, the reply texts against the bytes, and the description's history note.

Checks

On the loop's compute node at this head, against the merge base c2b5d96ef (receipt server-gates-kranich-631): the repository's pre-commit gate exit 0, clippy-allow-reasons against the base exit 0, and the tree left clean; linter markdown, linter cspell, linter lychee (offline links) exit 0; frontmatter-validator --all showed no new error against the base; the repository's audit validator on pr-2811-review exit 0 (9 rows, 4 log entries, no failures). Package tests at c1ef92b5c, whose Rust code this head keeps (the later commits change documentation and the audit record): cargo test -p torrust-tracker-primitives -p torrust-tracker-torrent-repository-benchmarking exit 0 (1535 passed, none failed). GitHub checks at this head at posting time: "". At posting, develop is 4a46f98b2.

@da2ce7

da2ce7 commented Nov 10, 2026

Copy link
Copy Markdown
Contributor

ACK 87e3261 — the audit record's nine rows, replies and resolutions verified against the review capture with its validator logic passing offline, and no code or manifest changed since the reviewed fix

@josecelano

Copy link
Copy Markdown
Member

ACK 87e3261

josecelano-bot and others added 5 commits November 10, 2026 19:18
…r the doctest

Record the red run of the PartialOrd doctest against the reintroduced id-only
Ord and PartialOrd impls, say which bound each red run used, and describe the
doctest as guarding both traits.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…udit log

Name the pushed states by commit subject and append a correction entry.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
da2ce7
da2ce7 previously approved these changes Nov 10, 2026

@da2ce7 da2ce7 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed at a4e9ad0255a5bdc7bf48ea9316a2a24aae01bab0. Recomputed from the bytes at this head, against the previous round's head 87e326150 and the merge base c2b5d96ef; git merge-tree against develop 4a46f98b2 writes a conflict-free tree that differs from this head only in the eight documentation paths develop changed since c2b5d96ef.

What moved: seven commits fast-forward 87e326150; 2f149f9dc, d2de5ec6a and f965c49b4 edit the spec and evidence, 511b52424, ec6f3b4a4, 13e05aadf and a4e9ad025 the audit record. All other paths, code included, are byte-identical to 87e326150.

Previous findings: F9 fixed (spec 201, 241-242; evidence 149-159 re-adds the impls removed since c2b5d96ef and names the doctest at peer.rs:117). F11 fixed (211-212). F12 fixed (275, 298, 357). F13 fixed (248, 250, correction 252; the commit-id check prints nothing). F14 fixed (256-273 equal template 120-137). F1 to F8 and F10 stay fixed.

The record: 14 rows and details, one per thread in the capture, each citing its own reply, with matching severity and the template's fields; all 14 threads resolved; the validator's logic passes offline (14 rows, 8 log entries, 0 failures). The log stamps match the commit and reply times except 254 (F17), and 251 gives a state the forge no longer showed (F18).

Hygiene: Conventional subjects with [#2798]; bodies match their diffs; author equals committer; one attribution footer naming a model per commit (no rule in the tree addresses it); git diff --check is clean; the audit commits touch only the record.

Findings: F17 Minor; F16 and F18 Nit. None blocks. F15 (this round's draft at ec6f3b4a4: replies before their rows) is fixed by rows 55-59.

Checked, no finding: the reply texts and new details against the bytes. Entries 248 and 250 were rewritten in place, as the previous round suggested, against the append-only rule (template 115-116); restoring them would bring back the ids the commit-id rule keeps out.

Checks

On the loop's compute node at this head, against the merge base c2b5d96ef (receipt server-gates-kranich-646): the repository's pre-commit gate exit 0 (66 s), clippy-allow-reasons against the base exit 0, and the tree left clean; the repository's audit validator on pr-2811-review exit 0 (14 rows, 8 log entries, no failures). Code is byte-identical to the previous round's head. GitHub checks at this head at posting time: "". At posting, develop is 4a46f98b2.

- 2026-11-10 18:22 UTC - Review 5847136183 (`da2ce7`, `APPROVED`, submitted 18:22:17 UTC) raised F10 to F14 (its IDs F9, F11, F12, F13, F14; its F10 was fixed by the round 1 audit record).
- 2026-11-10 19:23 UTC - Correction: the entries of 17:59 UTC and 18:05 UTC quoted three PR-branch commit ids from the push output; they were rewritten in place to name the pushed states by commit subject instead (review round 2, F13). No other content of those entries changed.
- 2026-11-10 19:27 UTC - Committed the fixes as "docs(issues): [#2798] state only the red runs that happened for the doctest" (F10; commit time 19:18:51 UTC), "docs(issues): [#2798] list the versioning ADR under Related ADRs" (F11; 19:21:30 UTC), "docs(issues): [#2798] record the retrospective rationale and the T4/T5 merge" (F12; 19:22:20 UTC), "docs(pr-reviews): [#2798] remove commit ids from the PR 2811 audit log" (F13; 19:23:25 UTC) and "docs(pr-reviews): [#2798] add the Completion Rules section to the PR 2811 audit" (F14; 19:24:06 UTC), pushed them in one fast-forward push, and posted the replies on the five threads (`created_at` 19:27:10 to 19:27:22 UTC).
- 2026-11-10 19:33 UTC - Pushed this record (commit "docs(pr-reviews): [#2798] record the PR 2811 round 2 findings", commit time 19:28:32 UTC; `validate-audit-record.py --pr-number 2811` printed `"status": "ok"` with 14 rows and 0 failures), then resolved the five threads of F10 to F14, each returning `isResolved: true` (the command finished at 19:31:04 UTC). A refreshed GraphQL query showed 0 unresolved threads.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Minor][F17] This entry is stamped 19:33 UTC, later than the commit that carries it and than every event it records.

a4e9ad025 added the entry and was committed at 19:31:27Z. The last event the entry names is the resolution that finished at 19:31:04 UTC; the push of 13e05aadf came before that. A 19:33 stamp therefore dates the entry after it was written. The time fits the push of a4e9ad025 itself (the capture's pull-request updated_at is 19:33:50Z), which the entry does not describe. process-pr-review (SKILL.md:120-122) asks for a stamp taken after the event, from git log --format=%cI, the command's own output or the forge's time. Suggest appending a correction entry that gives 19:31, from the resolution command's output, rather than editing this line, so the log stays append-only (template lines 115-116).

- 2026-11-10 17:59 UTC - Committed the fixes as "test(primitives): [#2798] also guard against a PartialOrd-only Peer ordering" (F1), "docs(issues): [#2798] name the code state and green output in the evidence" (F3, F4; commit time 17:47:14 UTC) and "docs(issues): [#2798] bring the Peer Ord spec up to date with the decision" (F2, F5, F7, F8; 17:47:53 UTC), reworded two earlier commits for F6, and pushed all with one `--force-with-lease` update (the push printed a forced update of the branch to the head carrying "docs(issues): [#2798] bring the Peer Ord spec up to date with the decision"). Edited the PR description at 17:59:00 UTC to correct the publishability sentence and note the history rewrite.
- 2026-11-10 17:59 UTC - Posted the replies on the nine threads (`created_at` 17:59:27 to 17:59:49 UTC); F9 got the `Superseded by F1` reply.
- 2026-11-10 18:05 UTC - Pushed the audit record (commit "docs(pr-reviews): [#2798] record the PR 2811 review audit", commit time 18:01:54 UTC; the push printed a fast-forward update to the head carrying that audit commit; `validate-audit-record.py --pr-number 2811` printed `"status": "ok"` with 0 failures), then resolved all nine threads, each returning `isResolved: true` (the command finished at 18:04:48 UTC). A refreshed GraphQL query showed 0 unresolved threads.
- 2026-11-10 18:22 UTC - Review 5847136183 (`da2ce7`, `APPROVED`, submitted 18:22:17 UTC) raised F10 to F14 (its IDs F9, F11, F12, F13, F14; its F10 was fixed by the round 1 audit record).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Nit][F18] The review's state is given as APPROVED, but the forge showed DISMISSED when this entry was written.

The review was dismissed at 19:26:56Z (timeline review_dismissed), before 13e05aadf added this line at 19:28:32Z, and the capture lists it as DISMISSED. The 17:38 entry (line 247) words the same case as "shown ... as DISMISSED". Suggest the same wording, through a correction entry.

doc-type: manual-verification-evidence
issue-spec: docs/issues/open/2798-peer-ord-inconsistent-with-eq/ISSUE.md
last-updated-utc: 2026-11-10 13:34
last-updated-utc: 2026-11-10 17:46

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Nit][F16] The evidence's stamp and closing note predate the round-2 red run.

2f149f9dc added the red run at lines 149-159 (stamped 19:18 UTC), but last-updated-utc here still reads 17:46. Line 163 still places "The red run" in "Regression Test Red Run (T4)" alone, and the new run sits under "Regression Test Revision (PR 2811 review round 1)" (line 138). These are stale record lines of the kind F11 and F12 were, so this is a Nit. Suggest updating line 4, naming the later red runs at line 163, and giving the round-2 run its own heading or retitling line 138.

@da2ce7

da2ce7 commented Nov 10, 2026

Copy link
Copy Markdown
Contributor

ACK a4e9ad0 — the round-2 fixes, the audit record's 14 rows, replies and resolutions verified against the review capture with its validator logic passing offline, and no code changed since the reviewed fix

@da2ce7 da2ce7 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed at 4589a658f31130b49b80c7f021ff7be3b45a1cb6. Recomputed from the bytes at this head, against the previous round's head a4e9ad025 and the merge base c2b5d96ef; git merge-tree against develop 4a46f98b2 writes a conflict-free tree whose diff from this head equals develop's own diff since c2b5d96ef (eight documentation paths, none of them touched by this branch).

What moved: one commit, 4589a658f, fast-forwards a4e9ad025 and adds docs/pr-reviews/pr-2811-review/review-retrospective.md. The other 2,453 tree entries, code and audit included, are byte-identical to a4e9ad025.

Previous findings: none changed state. F1 to F15 stay fixed. F16, F17 and F18 stay open: evidence line 4 and audit lines 251 and 254 are unchanged, and their threads have no reply.

The new commit follows PR-REVIEW-RETROSPECTIVE.md section by section, and its frontmatter paths resolve. Recomputed: 15 commits before it, 6 of them touching only the audit; 14 rows, one re-raise, two findings about the audit; the first review comment at 17:38:21 UTC (the 19:31 end is the audit's own stamp); option C was the recommendation at c2b5d96ef; the pre-commit hook runs the doc tests; the validator checks neither Completion Rules nor commit ids. The commit-id check prints nothing, and the audit validator's logic passes offline (14 rows, 8 log entries, 0 failures).

Hygiene: Conventional subject with [#2798]; no body besides one attribution footer naming a model (no rule in the tree addresses it); author equals committer; git diff --check is clean.

Findings: F19 and F20 Minor, F21 and F22 Nit. None blocks.

Checked, no finding: the 13 table rows against the audit's concerns and rounds; the T1 claim (spec 184, 187); the T4/T5 note (evidence 121, spec 357); replies before resolutions in both rounds; the model row against the spec's progress log.

Checks

On the loop's compute node at this head, against the merge base c2b5d96ef (receipt server-gates-kranich-660): the repository's pre-commit gate exit 0 (85 s), clippy-allow-reasons against the base exit 0, and the tree left clean; the repository's audit validator on pr-2811-review exit 0 (14 rows, 8 log entries, no failures). F19 read at this head: against c2b5d96ef the Rust changes are peer.rs, entry/mod.rs and entry/peer_list.rs (14 insertions, 14 deletions). Code is byte-identical to the previous round's head. GitHub checks at this head at posting time: "". At posting, develop is 4a46f98b2.


## What Made the Review Costly

Twelve of the 14 findings were about documents (spec, evidence, audit record); the other two (F1 and its repeat F9) were about the doctest, the only code change.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Minor][F19] The doctest is not the only code change, and F6 is not about a document.

Against c2b5d96ef, peer.rs also removes impl Ord and impl PartialOrd for Peer, and entry/mod.rs and entry/peer_list.rs in torrent-repository-benchmarking drop the derived PartialOrd, Ord; the PR description lists all three. Audit F6 (line 66) is about commit messages and is typed "Tooling / process", yet this line and line 34 count it with the spec, evidence and audit findings. Suggest "were about the doctest; none was about the removal itself", and counting F6 on its own.

4. **A failed hook left state behind.** The pre-commit doctest step rejected a red-state commit
and the staged files joined the next commit (F6).
5. **The audit was generated from a model, not from the template** (F14), and no check covered the
rules the reviewer later enforced by hand (F13, F14).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Minor][F20] A check for the F13 rule exists; it was not run.

open-pull-request (SKILL.md:74-92) carries the commit-id check and asks for it before every push that changes a review audit, and the comment that raised audit F13 named it as printing all three ids. So "no check covered" F13 is not what the tree shows, and the F13 row's "A check for ids in the audit before commit" (line 72) already exists. Root cause 2 likewise restates process-pr-review's "State only what ran" (SKILL.md:123-125), unchanged on this branch. The template asks for "the process or tooling gaps that allowed each failure mode to recur" (template lines 56-57). Suggest naming these existing rules and why they were not applied, and saying that improvement 2 moves an existing check into the validator.

and that the Processing Log has no PR-branch commit id — `validate-audit-record.py` — PROPOSED
3. Say in the audit-creation step to start from `PR-REVIEW-TEMPLATE.md`, not a prior audit —
`process-pr-review` skill — PROPOSED
4. Note in the commit steps to inspect the index after a hook rejection — `open-pull-request`

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Nit][F21] Improvement 4 names an owner artifact that has no commit step.

open-pull-request has no git commit step and does not mention the hook. Committing, the pre-commit hook and the manual check "read through git diff --staged ... unintended changes" are in commit-changes (SKILL.md:16-24, 115-122, 169-170). Suggest commit-changes as the owner, and saying how the proposal differs from that existing check.


| Metric | Value |
| -------------------------------------- | --------------------------------------------------------------------- |
| Review rounds | 2 (round 1: da2ce7 and Copilot; round 2: da2ce7) |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Nit][F22] The summary does not mention the third review, which predates this file.

Review 5848292848 was submitted at 19:46:16 UTC, before this commit (21:33:33 UTC), and its three threads are open at this head. Line 16 scopes the file to the first two rounds, so the counts hold for that scope, but "Review rounds | 2" and a last resolution at 19:31 read as the whole review. Suggest one sentence naming the excluded round and its open threads. The template's form for this row is <COUNT> (<HUMAN> human, <BOT> bot) (template line 31).

@da2ce7

da2ce7 commented Nov 10, 2026

Copy link
Copy Markdown
Contributor

ACK 4589a65 — the review retrospective's counts, times and claims recomputed against the tree, with every other path byte-identical to the approved a4e9ad0

@josecelano

Copy link
Copy Markdown
Member

ACK 4589a65

@josecelano
josecelano merged commit ea25385 into torrust:develop Nov 11, 2026
20 checks passed
josecelano added a commit that referenced this pull request Nov 11, 2026
…ives package tests

8fd18e3 docs(pr-reviews): record round 4 of the PR 2828 review (josecelano-bot)
31aaf6f docs(pr-reviews): record that the round 3 log entry was moved (josecelano-bot)
b02b779 docs(pr-reviews): name no branch commit id in the F20 detail heading (josecelano-bot)
50d5600 docs(pr-reviews): record the arrival of review 5859484596 (josecelano-bot)
c73d1fb docs(pr-reviews): order the PR 2828 round 3 log entries chronologically (josecelano-bot)
c416814 docs(pr-reviews): record round 3 of the PR 2828 review (josecelano-bot)
956954f docs(pr-reviews): correct the log entry that stamps the push with the commit time (josecelano-bot)
e02de53 docs(pr-reviews): correct the log entry that cites a branch commit id (josecelano-bot)
2d29f4a docs(pr-reviews): record round 2 of the PR 2828 review (josecelano-bot)
ae88dac docs(pr-reviews): add the template frontmatter to the PR 2828 audit (josecelano-bot)
1859642 docs(pr-reviews): say the F1 fixture classification is planned, not done (josecelano-bot)
6387fc7 docs(issues): [#2824] stamp the spec last-updated-utc from its last change (josecelano-bot)
61a479d docs(issues): [#2824] say the fixture classification is planned for the S2 record (josecelano-bot)
71cb645 docs(issues): [#2824] keep AC1 TODO until the final acceptance review (josecelano-bot)
2a0b460 docs(issues): [#2824] say findings were confirmed by a test or by code reading (josecelano-bot)
64a5d26 docs(issues): [#2824] list the S1 fix as the one production change in scope (josecelano-bot)
29dc342 docs(pr-reviews): add the PR 2828 review audit (josecelano-bot)
2eb61d3 docs(issues): [#2824] require fix-bug verification evidence in slice S1 (josecelano-bot)
13d354e docs(issues): [#2824] write the first log entries in the template form (josecelano-bot)
9bb6925 docs(issues): [#2824] append the EPIC log entry in order and stamp it from the commit (josecelano-bot)
f283cd7 docs(issues): [#2824] align the coverage evidence frontmatter with its siblings (josecelano-bot)
a1d6c91 docs(issues): [#2824] count both peer.rs examples and the compile_fail doctest (josecelano-bot)
c932b85 docs(issues): [#2824] drop zeroed from the uncovered swarm_metadata lines (josecelano-bot)
9fb6022 docs(issues): [#2824] add the acceptance verification table and manual scenario status (josecelano-bot)
3f8943d docs(issues): [#2824] limit manual scenario M1 to the announce interval (josecelano-bot)
ea1a691 docs(issues): [#2824] point the design review questions at the findings (josecelano-bot)
1936c49 docs(issues): [#2824] record the S0 pull request number (josecelano-bot)
8afaeb6 docs(issues): [#2824] mark the slicing as approved (josecelano-bot)
acaf25a docs(issues): [#2824] number the slice table rows by the ledger (josecelano-bot)
c0604ba docs(issues): [#2824] name a live owner for the peer fixture lines (josecelano-bot)
ba04eb4 docs(issues): [#2824] record F4 as #2823 and the AddAssign deletion (josecelano-bot)
1b043a8 docs(issues): [#2824] add issue specification for primitives package tests (josecelano-bot)

Pull request description:

  Related to #2824

  Spec-only PR for the `torrust-tracker-primitives` package tests, a subissue of EPIC #1347. No code or tests change; implementation follows in slices S1-S4 after this merges.

  ## Summary

  - Adds the specification `docs/issues/open/2824-1347-add-tests-primitives/ISSUE.md`, based on the #1348, #1349 and #2637 templates, with the maintainer-approved slicing S0-S4: spec, the `PeerRole` JSON casing fix, `peer.rs`, configuration defaults and bounded values, then `swarm_metadata.rs`, the no-change files and the final tasks.
  - Adds `coverage-evidence.md` (T1) with the clean baseline, the 16-file module inventory, the uncovered-line groups and the test-technique assessment.
  - Registers the subissue and its baseline in EPIC #1347 (Subissues row 11, aggregate and unit-only coverage tables, progress log).
  - Adds two words (`addassign`, `encodability`) to `project-words.txt`.

  ## Baseline

  Measured at `develop` `eaae0e487` with `cargo-llvm-cov 0.6.16` on stable Rust 1.99.1, filtered to `packages/primitives/src/`: unit-only = aggregate (the package has no integration tests) lines 60.56% (453/748), regions 67.94% (712/1,048), functions 57.23% (91/159), 47 unit tests.

  ## Findings Register

  F1 was fixed upstream (#2798, PR #2811). F2 is fixed in this issue's slice S1. F3 is handed off to #2804. F4 (`AggregateActiveSwarmMetadata::add_assign`) and F5 (`peer::Id::new` as a test-only helper) are handed off; F4 is #2823 (the unused `AddAssign` impl is being deleted); F5 has no issue yet, so its number stays a placeholder.

  ## Notes

  - The GitHub sub-issue link of #2824 under #1347 could not be set by the contributor account (the sub-issues API returns 404 for it); the maintainer needs to link it.
  - The spec frontmatter `branch` is `2824-1347-add-tests-primitives-spec`.

  ## Validation

  `TORRUST_GIT_HOOKS_LOG_DIR=.tmp ./contrib/dev-tools/git/hooks/pre-commit.sh` passed on commit (including `linter all`), and `linter all` passed on its own before it.

  🤖 Generated with [Claude Code](https://claude.com/claude-code)

ACKs for top commit:
  josecelano:
    ACK 8fd18e3
  da2ce7:
    ACK 8fd18e3 — the record of review 5859484596 against the forge capture, the validator's logic and the commit-id check offline, and a clean merge into `839adf5a0`, recomputed at this head

Tree-SHA512: 07b7dd6ca0ea3d4d026a354aff05a74e04275aea0773cb3319b171033459f5e8882405d60ccb4570c90aa2fcc09f66f2b5c4e5c49c6148061efee5d26ddf5d65
josecelano added a commit that referenced this pull request Nov 11, 2026
7d97ede docs(pr-reviews): [#2824] record the review of PR 2834 round 2 (josecelano-bot)
2ea19f2 docs(pr-reviews): [#2824] name the PR 2834 heads by commit subject (josecelano-bot)
eabfece docs(pr-reviews): [#2824] record the review of PR 2834 round 1 (josecelano-bot)
eca4076 docs(issues): [#2824] record the prose-first AAA review of the PeerRole tests (josecelano-bot)
1336f57 docs(issues): [#2824] stamp the S1 records no later than their commits (josecelano-bot)
1fd6c86 docs(issues): [#2824] record the S1 coverage measurement and the EPIC update (josecelano-bot)
2830e77 docs(issues): [#2824] update the spec tracking state after S0 merged (josecelano-bot)
fa59efb docs(issues): [#2824] add the manual verification evidence for the S1 fix (josecelano-bot)
01eafe9 test(primitives): [#2824] compare the PeerRole JSON with its Display form (josecelano-bot)
0f785bb docs(issues): [#2824] record the S1 PeerRole fix in the spec (josecelano-bot)
fe6278f fix(primitives): [#2824] serialize PeerRole in lowercase (josecelano-bot)
17595ab test(primitives): [#2824] pin the lowercase JSON form of PeerRole (josecelano-bot)

Pull request description:

  ## Summary

  Slice S1 of #2824 (EPIC #1347): the one defect the maintainer decided to fix inside the `primitives` tests issue (finding F2).

  `PeerRole` derived `Serialize` with `#[serde(rename_all_fields = "lowercase")]`, an attribute that only applies to the fields of struct-like variants. The unit variants therefore serialized as `"Seeder"` and `"Leecher"`, while `Display` and the `peer_role` metric label use `seeder` and `leecher`. The attribute is now `rename_all = "lowercase"`.

  ## Commits

  Code and tests (`packages/primitives/src/peer.rs`):

  1. `test(primitives): [#2824] pin the lowercase JSON form of PeerRole` — two regression tests that fail on this commit (`"Seeder"` and `"Leecher"` instead of lowercase).
  2. `fix(primitives): [#2824] serialize PeerRole in lowercase` — the one-attribute fix; the tests pass.
  3. `test(primitives): [#2824] compare the PeerRole JSON with its Display form` — the tests also assert the JSON equals the `Display` string (review finding).

  Issue records (`docs/issues/open/2824-1347-add-tests-primitives/` and the EPIC):

  4. `docs(issues): [#2824] record the S1 PeerRole fix in the spec` — spec progress.
  5. `docs(issues): [#2824] add the manual verification evidence for the S1 fix` — `manual-verification-evidence.md` with the red, green and head runs.
  6. `docs(issues): [#2824] update the spec tracking state after S0 merged` — slice rows, F2 state, frontmatter.
  7. `docs(issues): [#2824] record the S1 coverage measurement and the EPIC update` — `coverage-evidence.md` and both EPIC "Latest" tables.
  8. `docs(issues): [#2824] stamp the S1 records no later than their commits` — restamp three records.
  9. `docs(issues): [#2824] record the prose-first AAA review of the PeerRole tests` — `test-refactor-plans/s1-peer-role-serialization.md`.

  Review audit (`docs/pr-reviews/pr-2834-review/PR-REVIEW.md`):

  10. `docs(pr-reviews): [#2824] record the review of PR 2834 round 1`
  11. `docs(pr-reviews): [#2824] name the PR 2834 heads by commit subject`
  12. `docs(pr-reviews): [#2824] record the review of PR 2834 round 2`

  ## Verification

  - `cargo test -p torrust-tracker-primitives`: 49 unit tests pass (47 before, plus the 2 new ones), 2 + 1 other tests pass; the red and green runs are in `manual-verification-evidence.md`.
  - Unit-only coverage of the package: lines 62.73%, regions 70.29%, functions 59.49% (`coverage-evidence.md`); part of the gain comes from #2811 and #2827 merging, not only this slice.
  - `validate-audit-record.py --pr-number 2834` reports 0 failures.
  - No other package serializes `PeerRole` to JSON (searched `packages` and `src`).

  ## Notes

  Related to #2824; this PR does not close it (only the last slice does).

  🤖 Generated with [Claude Code](https://claude.com/claude-code)

ACKs for top commit:
  da2ce7:
    ACK 7d97ede — the F9 and F10 fixes and the round 2 audit rows recomputed from the bytes at this head, over a tree otherwise byte-identical to the previously approved head.
  josecelano:
    ACK 7d97ede

Tree-SHA512: 8a1087db3d07ae26ce8b38ba89d9db53c97c705ced41cf4bb81eb46172a278b5d876056c81ef32b392c22e4927877d6559f6a21279314a055b7641de3050aa9e

This branch was previously deployed

1 inactive deployment
coverage — 4589a658 Deployed Nov 11, 2026 by josecelano-bot via Generate Coverage Report #3038
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Peer's Ord is inconsistent with its Eq

4 participants