Skip to content

docs(issues): [#2798] spec for Peer Ord inconsistent with Eq - #2800

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

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

Conversation

@josecelano-bot

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

Copy link
Copy Markdown
Contributor

Summary

Adds the specification for issue 2798: Peer derives Eq and Hash over all fields but implements Ord by peer_id only, which violates the Ord/Eq contract. The spec contains the bug analysis, a usage audit, the options (A remove Ord, B id-only Eq, C order by all fields, D document only), the regression-test strategy, and the reproduction evidence. It also has a first task, T1, to investigate why the two comparisons differ and classify every call site before the fix is chosen.

Spec-only PR: no production code changes. The fix will follow in a separate PR once the maintainer picks an option.

Files touched

  • docs/issues/open/2798-peer-ord-inconsistent-with-eq/ISSUE.md (new): the issue specification.
  • docs/issues/open/2798-peer-ord-inconsistent-with-eq/manual-verification-evidence.md (new): the timestamped reproduction of the bug.
  • docs/pr-reviews/pr-2800-review/PR-REVIEW.md (new): the review audit record of this PR.

No package or Rust file is touched.

Validation performed

  • linter all exits 0 before every push of this PR. Its last run before this edit was on the commit "docs(pr-reviews): [Peer's Ord is inconsistent with its Eq #2798] append a log correction for the first round 1 entry".
  • python3 .github/skills/dev/pr-reviews/process-pr-review/scripts/validate-audit-record.py --pr-number 2800 printed "status": "ok" with 0 failures on that same commit.
  • The reproduction was run with a temporary test (not included in this PR; reverted before each commit): a == b is false while a.cmp(&b) is Equal.
  • git diff --check and the PR-branch commit-id check print nothing.

Related to #2798

🤖 Generated with Claude Code

@josecelano josecelano self-assigned this Nov 10, 2026
@josecelano
josecelano requested review from da2ce7 and a balanced review from Copilot November 10, 2026 12:52

@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 38af2bdca2c4966a3d5210c56563e1c178815734. Recomputed from the bytes at this head, against the merge base 1df1ecdf0; git merge-tree against develop 1df1ecdf0 merges cleanly to a tree identical to the head's own (ea0229140), because develop has not moved past the base.

Process: a spec-only bug PR, governed by .github/skills/dev/planning/create-issue/SKILL.md, .github/skills/dev/debugging/fix-bug/SKILL.md and .github/skills/dev/git-workflow/open-pull-request/SKILL.md. The folder layout, the -spec branch, the Related to link, the frontmatter, the bug-only sections and the classified reproduction are in place. The test-development loop, three checkpoint rows and the evidence template's structure are missing (F4 to F6).

The change against its claim: both files contain what the description says. Re-reading peer.rs, the workspace and the history disproves three factual statements: the T1 history line (F1), the "swarm" in the impact bullet and the audit (F2), and the claimed cost of the hand-written option C variant (F3). Each one points T1 or the choice between options the wrong way, so they block.

Consistency: no Markdown links. The frontmatter matches the validator's strict issue profile: bug, planned, p3, a quoted timestamp, spec-path at its own location, and artifacts and skills that exist. No reference to the draft path remains. No index needs a row, and project-words.txt is untouched.

Hygiene: three Conventional docs(issues) commits with author equal to committer and no bodies. Each carries one co-author attribution footer naming a model, and the description ends with a generated-with line. No rule in the tree forbids either. git diff --check is clean, the PR-branch commit-id check prints nothing, and the closing-keyword pattern matches nothing in the title, the description or the messages.

Findings: F1 to F3 Major, F4 to F8 Minor, F9 and F10 Nit.

Checked, no finding: Peer has seven public fields, derives PartialEq/Eq/Hash and implements Ord by peer_id by hand. NumberOfBytes and AnnounceEvent lack Ord. The crate is published. PeerList and Torrent derive Ord and nothing orders them, and no other Peer ordering exists. The reproduction compiles against the fixtures as written. eaae0e487 is on develop, and nothing between it and the base touches the audited code. The cited ADR exists. The title's [#2798] follows how spec PRs on develop are titled.

Checks

On the loop's compute node at this head, against the merge base 1df1ecdf0 (receipt server-gates-kranich-585): the repository's pre-commit gate exit 0 (91 s), 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: 15 errors / 4 warnings at this head and at the base re-measured, so none is new. The forge reports this head as mergeable. GitHub checks at this head at posting time: "Docs Lint: completed/success". At posting, develop is 1df1ecdf0.

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 issue specification contains inaccurate production-map and ordering guidance and omits required incremental test-review and evidence-based completion checkpoints.

4 open issues
What changed in this PR

Adds a specification for #2798 to address inconsistent equality and ordering in Peer. This is documentation-only; implementation awaits maintainer selection of a fix.

Changes:

  • Documents the defect, usage audit, and proposed fixes.
  • Plans investigation of comparison intent, regression tests, and verification.
  • Records the initial reproduction and reserves a final recheck.
File Description
docs/​issues/​open/​2798-peer-ord-inconsistent-with-eq/​manual-verification-evidence.md Records the reproduction environment, temporary test, and observed results.
docs/​issues/​open/​2798-peer-ord-inconsistent-with-eq/​ISSUE.md Defines the analysis, options, implementation plan, and acceptance criteria.

Review effort: Balanced

@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 bebc4b7cf4bc73049fc63c41e2206d660c9d5ead. Recomputed from the bytes at this head, against the previous round's head 38af2bdca and the merge base 1df1ecdf0; git merge-tree against develop 1df1ecdf0 writes e9196d541, the head's own tree, so the merge is clean.

What moved: one commit, bebc4b7cf, a fast-forward of 38af2bdca that changes only the two spec files (+152/-83). The other 2,447 paths are byte-identical to 38af2bdca, so the previous round's conclusions on them stand.

Previous findings:

  • F1 fixed: the three history commits and their derives match git show, and the pickaxe finds no earlier impl Ord for Peer.
  • F2 fixed: Coordinator derives only Clone, keys by SocketAddr and orders no Peer.
  • F3 fixed: the stated projection (.0, a private rank) needs no new impl.
  • F4 and F5 fixed: the test loop, the template rows and the completion conditions are in place.
  • F6 partly fixed: the skeleton and the named checks are in, but the step stamps still overlap (inline).
  • F7 to F10 fixed.

The new commit: every code and history claim it adds holds at this head. 47 filtered out matches the 47 unit tests in the crate's sources. The PR-branch commit-id check prints nothing.

Hygiene: Conventional subject, no body, author equals committer, and one co-author attribution footer, which no rule in the tree forbids. git diff --check is clean.

Findings: F6 re-raised (Minor), F11 Minor, F12 Nit. None blocks. The audit validator exits 2 at this head because the record F11 asks for is absent, so this round is a comment.

Checked, no finding: Coordinator keeps two entries that share a peer_id under two addresses, as the Intent section now says. The code-review: note sits above PeerList. NumberOfBytes.0 is public, and AnnounceEvent is a crate-local enum with four fieldless variants, so a match without a wildcard flags a new variant. The description's two check claims hold, and no closing keyword appears.

Checks

On the loop's compute node at this head, against the merge base 1df1ecdf0 (receipt server-gates-kranich-589): the repository's pre-commit gate exit 0 (39 s), 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. No review audit record exists at this head (docs/pr-reviews/pr-2800-review/PR-REVIEW.md), so the audit validator could not pass; this round is a COMMENT with no ACK until the record lands. The forge reports this head as mergeable. GitHub checks at this head at posting time: "Docs Lint: completed/success". At posting, develop is 1df1ecdf0.

@josecelano-bot

Copy link
Copy Markdown
Contributor Author

Response to finding F8 of review 5842317457 (from da2ce7, "The PR description has no Files/packages touched or Validation performed"), disposition FIXED: I edited the PR description. It now has a "Files touched" section listing the two spec files and a "Validation performed" section naming linter all (exit 0), the temporary reproduction test (not included in this PR), the PR-branch commit-id check and git diff --check. Verified by reading the description back with gh pr view 2800 --json body.

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 c32c000d67638760326f81e3fa7799bd75dbfcca. Recomputed from the bytes at this head, against the previous round's head bebc4b7cf and the merge base 1df1ecdf0; git merge-tree against develop af8d84d25 writes ec66a7994 with no conflict: develop's tree plus exactly this PR's three files.

What moved: three commits, bf88ee268, 7b8bfc15e and c32c000d6, a fast-forward of bebc4b7cf (3 files, +324/-8). The other 2,447 paths are byte-identical to bebc4b7cf, so the previous round's conclusions on them stand.

Previous findings:

  • F6 fixed: each of V1's three steps has a start and an end stamp, strictly ordered.
  • F11 fixed: the record exists; the second review's rows have new IDs and keep the reviewer's, its four repeats are re-raises with the exact Superseded by replies, and F8 cites the conversation response.
  • F12 fixed as asked: round 2 used one commit per fix. Its row is F13 below.

The new commits: every reply URL sits on its row's thread, every source review ID and severity matches the capture, every cited subject is a branch commit, and every time the log quotes matches its commit, review or reply. The validator's logic, run offline against the capture, reports 17 rows, 8 log entries and 0 failures. The cited code facts hold, and the PR-branch commit-id check prints nothing.

Hygiene: Conventional subjects, no bodies, author equals committer, one co-author attribution footer each, which no rule in the tree forbids. git diff --check is clean, and no closing keyword appears.

Findings: F13 and F14 Minor, F15 and F16 Nit. None blocks.

Checked, no finding: the copied template sections match it verbatim. The scope docs(pr-reviews) is the one develop uses, and no index needs a row. Keeping an unreassigned reviewer ID matches records on develop.

Checks

On the loop's compute node at this head, against the merge base 1df1ecdf0 (receipt server-gates-kranich-593): 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-2800-review exit 0. The forge reports this head as mergeable. GitHub checks at this head at posting time: "Docs Lint: completed/success". At posting, develop is af8d84d25.

@da2ce7

da2ce7 commented Nov 10, 2026

Copy link
Copy Markdown
Contributor

ACK c32c000 — the three new commits fix F6, F11 and F12, and the audit record's rows, replies and log match the review capture, with its validator logic passing offline

@josecelano-bot

Copy link
Copy Markdown
Contributor Author

Response to finding F14 of review 5843126907 (from da2ce7, "The PR description's Files touched lists two files; the head changes three"), disposition FIXED: I edited the PR description. "Files touched" now lists the audit record docs/pr-reviews/pr-2800-review/PR-REVIEW.md as a third file, and "Validation performed" now names the commit on which linter all and validate-audit-record.py --pr-number 2800 last ran (the commit "docs(pr-reviews): [#2798] append a log correction for the first round 1 entry"), plus git diff --check and the PR-branch commit-id check, which printed nothing on that head. Verified by reading the description back with gh pr view 2800 --json body.

@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 45235f6ba420de5747eeddf751f82e31b620a9b7. Recomputed from the bytes at this head, against the previous round's head c32c000d6 and the merge base 1df1ecdf0; git merge-tree against develop af8d84d25 writes 3b4d509bc with no conflict: develop's tree plus exactly this PR's three files, at the head's blobs.

What moved: four commits, edba243ab, 3e898ce64, acc79180f and 45235f6ba, a fast-forward of c32c000d6 that changes only the audit record (+66/-6). The other 2,449 paths are byte-identical to c32c000d6, so the previous round's conclusions on them stand.

Previous findings:

  • F13 fixed: the F17 row is FIXED/RESOLVED, its reply cites a round 2 subject, and the thread is resolved.
  • F14 fixed: the description lists three files and names the commit its checks last ran on.
  • F15 fixed: the appended correction quotes 13:12:14 and 13:10:38, both right, and the F16 thread now reports the validator output, which the offline run reproduces at 7b8bfc15e.
  • F16 fixed: the command is one span, and no line of the record has a doubled or unbalanced backtick.

The new commits: rows F18 to F21 carry the right review ID, severity, thread and reply; every cited subject is a branch commit; every quoted time matches its commit, review or reply; all 21 threads are resolved. The validator's logic, run offline against the capture, reports 21 rows, 12 log entries and 0 failures, and reproduces the counts the log and replies quote. The PR-branch commit-id check prints nothing.

Hygiene: Conventional subjects, no bodies, author equals committer, one co-author attribution footer each, which no rule in the tree forbids. git diff --check is clean, and no closing keyword appears.

Findings: F17 Nit. None blocks.

Checked, no finding: APPROVED is the review's state at submission; the forge dismissed it on the push of 3e898ce64. No link, anchor or path was added or renamed.

Checks

On the loop's compute node at this head, against the merge base 1df1ecdf0 (receipt server-gates-kranich-598): the repository's pre-commit gate exit 0 (39 s), 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-2800-review exit 0 (21 rows, 12 log entries, no failures). The forge reports this head as mergeable. GitHub checks at this head at posting time: "". At posting, develop is af8d84d25.

- Current-tree verification: Read the F17 row and entry; `isResolved` is true on the F17 thread.
- Resolution reference: docs(pr-reviews): [#2798] record the round 3 findings
- Follow-up PR URL: N/A
- Reply URL: https://github.com/torrust/torrust-tracker/pull/2800#discussion_r4525878680

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][F17] The F18 thread was resolved on a reply that names no commit, and the F20 reply reports a reply that did not exist yet

The only reply on the F18 thread (discussion_r4525878680, 14:12:53) says the F17 row "is changing" "in the next audit commit". The thread was resolved after that commit landed, but no reply names it; this row cites it. Step 7 of process-pr-review asks for a reply that carries the resolution reference before resolving. The F20 reply (line 328, discussion_r4525879771, 14:12:58) says the validator result "is posted" on the F16 thread; that reply was created at 14:13:01. This is the shape F15 raised, and the skill's sweep rule covers open replies.

Suggestion: reply on the F18 thread with the subject docs(pr-reviews): [#2798] record the round 3 findings.

@da2ce7

da2ce7 commented Nov 10, 2026

Copy link
Copy Markdown
Contributor

ACK 45235f6 — the four new commits fix F13 to F16, and the audit record's new rows, replies and log match the review capture, with its validator logic passing offline at this head

@josecelano

Copy link
Copy Markdown
Member

ACK 45235f6

@josecelano
josecelano merged commit c2b5d96 into torrust:develop Nov 10, 2026
1 check passed
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.

4 participants