Skip to content

test(primitives): [#2824] test the peer module - #2841

Merged
josecelano merged 21 commits into
torrust:developfrom
josecelano-bot:2824-1347-add-tests-primitives-peer
Nov 12, 2026
Merged

josecelano merged 21 commits into
torrust:developfrom
josecelano-bot:2824-1347-add-tests-primitives-peer

Conversation

@josecelano-bot

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

Copy link
Copy Markdown
Contributor

Slice S2 of #2824 (sub-issue of EPIC #1347): tests for packages/primitives/src/peer.rs.

Related to #2824

History: the branch was rewritten twice in review (force-push with lease): first to split a docs commit from the test commit, then, at the reviewer's request, rebuilt from the pre-split commits. The TOML re-spacing step of the first version is not a separate commit, because the pre-commit gate rejects the unformatted array.

Commits:

  • docs(issues): [#2824] add the shared test plan guidance for the file test plans
  • test(primitives): [#2824] test the peer module
  • docs(issues): [#2824] record the S2 coverage and the F6 finding
  • test(primitives): [#2824] cover the ReadInfo role predicates for every state
  • docs(issues): [#2824] fix the S2 records after review round 1
  • docs(issues): [#2824] re-check the mutation attributions of the peer.rs record
  • docs(pr-reviews): [#2824] record the review of PR 2841 round 1
  • docs(pr-reviews): [#2824] correct a log stamp of the PR 2841 audit
  • docs(issues): [#2824] correct the S2 record statuses, mutation cells and timing
  • docs(pr-reviews): [#2824] correct the PR 2841 audit facts after round 2
  • test(primitives): [#2824] use nonzero transfer totals in the peer mutator fixture
  • docs(pr-reviews): [#2824] record round 2 of the PR 2841 review
  • docs(issues): [#2824] point the F6 records at #2850 and fix the S2 stamps
  • test(primitives): [#2824] point the negative-left test comment at #2850
  • docs(pr-reviews): [#2824] record round 3 of the PR 2841 review
  • test(primitives): [#2824] assert that Stopped and None peers are not completed
  • docs(pr-reviews): [#2824] record Copilot's round 3 review of PR 2841
  • docs(issues): [#2824] re-measure the S2 coverage and fix the peer.md round note
  • docs(pr-reviews): [#2824] record round 4 of the PR 2841 review
  • docs(pr-reviews): [#2824] fix two severities of the PR 2841 audit
  • docs(pr-reviews): [#2824] record round 5 of the PR 2841 review

Result: 32 tests added (81 unit tests). Package unit-only coverage: lines 62.73% to 85.23%, regions 70.29% to 89.31%, functions 59.49% to 82.99%. Id::new and peer::fixture stay untested by decision (the F5 follow-up). F6 (negative left): #2838 stays open; its fix PR #2839 was closed unmerged and #2850 makes a negative count unrepresentable, which will remove the pinned test.

Validation performed:

  • cargo test -p torrust-tracker-primitives --lib (81 passed), stable Rust 1.99.1.
  • cargo +nightly fmt --all -- --check, clippy pedantic on the package, cargo machete --with-metadata.
  • 18 sampled mutants of peer.rs, each applied alone: all killed (table in test-refactor-plans/peer.md).
  • Unit-only coverage with cargo-llvm-cov 0.6.16 (figures in coverage-evidence.md).
  • The pre-commit gate passed on every commit.
  • The review audit validator (validate-audit-record.py) passes against docs/pr-reviews/pr-2841-review/PR-REVIEW.md.

🤖 Generated with Claude Code

@josecelano-bot
josecelano-bot requested a review from a team as a code owner November 12, 2026 13:37
@josecelano-bot
josecelano-bot changed the base branch from main to develop November 12, 2026 13:53
@josecelano josecelano self-assigned this Nov 12, 2026
@josecelano
josecelano requested review from da2ce7 and a balanced review from Copilot November 12, 2026 13:54

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 ReadInfo tests lack sufficient left boundary and stopped-peer coverage across Peer and Arc<Peer> to catch constant predicate results or removal of the stopped-event check.

1 open issue
What changed in this PR

This PR delivers slice S2 of #2824, expanding peer-module tests as part of the package-testing overhaul in #1347. Production behavior is unchanged; negative-byte validation remains separate in #2838/#2839.

Changes:

  • Adds 31 tests covering peer roles, state changes, serialization, IDs, encoding properties and collection order.
  • Adds QuickCheck development dependencies and corrects the hex-output documentation.
  • Records test decisions, coverage gains and eight sampled mutants killed, including deferred testing scope.
File Description
packages/​primitives/​src/​peer.rs Adds peer tests and corrects the documented 0x prefix.
packages/​primitives/​Cargo.toml Adds QuickCheck dependencies and a cargo-machete exception.
docs/​issues/​open/​2824-1347-add-tests-primitives/​test-refactor-plans/​README.md Defines shared test-plan guidance.
docs/​issues/​open/​2824-1347-add-tests-primitives/​test-refactor-plans/​peer.md Records peer test decisions, results and mutation evidence.
docs/​issues/​open/​2824-1347-add-tests-primitives/​ISSUE.md Updates S2 progress and records the negative-byte follow-up.
docs/​issues/​open/​2824-1347-add-tests-primitives/​coverage-evidence.md Records S2 coverage and remaining exclusions.
docs/​issues/​open/​1347-overhaul-packages-testing/​EPIC.md Updates primitives coverage in both tracking tables.
Cargo.lock Registers QuickCheck dependencies for primitives.

Review effort: Balanced

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

@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 5c1242332ddbafa764a66c9e090be1fdeec95f1b. Recomputed from the bytes at this head, against the merge base fcd6a7268; git merge-tree against develop 388faf59a writes a clean tree (no conflicted path; develop touched none of the eight files).

Process: a test-coverage slice (S2) of the primitives sub-issue, governed by write-unit-test, add-rust-dependency, commit-changes and open-pull-request, and by the spec's own per-file workflow, commit points and slice rules.

The change against its claim: the 31 tests assert what their names say, and the counts recompute (49 to 80 in the package, 10 to 41 in peer.rs), as do the hex literals, the 1669397478934 ms value and every coverage percentage and pp delta. The to_hex_string doc comment now matches its 0x output. The commit messages do not match the commits: 32d8f0ae8, a docs commit, carries all the tests, the dependency and the lock change, and 905d75fb2, the test commit, only re-spaces one TOML array (F1). The two read-info tests pin each trait copy of the seeder rule on one side only (F2).

Consistency: links and anchors resolve. The F6 claim holds: HTTP parses left as u64, while UDP passes the i64 through. The slice table and EPIC row, the EPIC log placement and stamp, the fixture owner and the record states are not reconciled (F3 to F8).

Hygiene: subjects are Conventional with [#2824]; author equals committer; each commit ends with a co-authorship footer naming a model, which no rule in the tree forbids. git diff --check is clean, the commit-id check prints nothing, and the title, body and messages carry no closing keyword.

Findings: F1 Major (blocking: merged history cannot be reworded), F2 to F7 Minor, F8 Nit.

Checked, no finding: quickcheck 1.1.0 and quickcheck_macros 1.2.0 were already locked, with the same requirements as udp-core; the machete ignore is needed (the crate has no quickcheck:: path); AddAssign and the Peer ordering are gone; the peer.md line ranges point at the cited code; the frontmatter matches the earlier plans; the dictionary is unchanged.

Checks

On the loop's compute node at this head, against the merge base fcd6a7268 (receipt server-gates-kranich-767): the repository's pre-commit gate and lint roster exit 0 and the tree left clean; there is no audit record, and the one review thread has no reply yet, so none is due. Package tests at this head: cargo test -p torrust-tracker-primitives exit 0 (80, 2 and 1 passed, none failed). F1 read at this head: git show --stat 32d8f0ae8 (subject docs(issues): ...) lists packages/primitives/src/peer.rs +405, Cargo.toml and Cargo.lock, while 905d75fb2 (subject test(primitives): ...) changes only one line of packages/primitives/Cargo.toml. GitHub checks at this head at posting time: "". At posting, develop is 388faf59a.

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

@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 8032f49f828d3ed6d8e5286e3c99d97c1d1c4aa2. Recomputed from the bytes at this head, against the previous round's head 5c1242332 and the merge base fcd6a7268; git merge-tree against develop 388faf59a writes a clean tree (no conflicted path; the 45 newer develop commits touch none of the eight PR files).

What moved: one commit, 8032f49f8, added on top of 5c1242332 (a fast-forward; 4 files, +44/-10). The other 2,519 paths are byte-identical, so the previous conclusions about them still hold.

Previous findings: F2 is fixed. The case table at peer.rs 828-855 asserts both outcomes of is_seeder and is_leecher through each ReadInfo impl, which kills the constant-return, <=, && and != mutants of both copies. F1 and F3 to F8 are still open: their bytes are unchanged. The new EPIC entry (line 393) repeats the F4 placement, though its 14:10 stamp is no later than its commit, and the re-measured Results still sit under the 2026-11-11 heading that F8 flagged.

The new commit: the figures recompute (81 tests = 79 #[test] + 2 quickcheck; 846 / 993 = 85.20%, 1,341 / 1,502 = 89.28%, 161 / 194 = 82.99%; every pp delta; 68 uncovered peer.rs lines). The old figures remain only in the earlier log entry. The log's summary of the automated review matches that thread. The mutation table is stale (F9), the answered thread has no audit record (F10), the description is stale (F11) and the subject overclaims (F12).

Hygiene: Conventional subject with [#2824], no body; author equals committer; a co-authorship footer naming a model, which no rule in the tree forbids. git diff --check and the commit-id check print nothing.

Findings: F1 Major (still open, blocking); F3 to F7 and F9 to F11 Minor; F8 and F12 Nit.

Checked, no finding: the test layout fits rustfmt at max_width = 130; AnnounceEvent is Copy and Debug; the test's cases match the new AAA row; the touched EPIC links resolve; no line range that peer.md cites moved.

Checks

On the loop's compute node at this head, against the merge base fcd6a7268 (receipt server-gates-kranich-770): the repository's pre-commit gate and lint roster exit 0 and the tree left clean. Package tests at this head: cargo test -p torrust-tracker-primitives exit 0 (81, 2 and 1 passed, none failed). F10 read at this head: no path under docs/pr-reviews/ names PR 2841, while the automated review thread on peer.rs line 803 has a reply. Read on the forge: 9 review threads, one answered, none resolved. GitHub checks at this head at posting time: "". At posting, develop is 388faf59a.

Comment thread packages/primitives/src/peer.rs Resolved
@josecelano-bot

Copy link
Copy Markdown
Contributor Author

Review round 1 follow-up: the PR description was edited to give the post-review figures (32 tests added, 81 unit tests, lines 85.20%, regions 89.28%, functions 82.99%), the rewritten commit list and a "Validation performed" part. The branch history was rewritten (docs, test and record commits now match their messages).

@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 8edf5df46734687779016e40992e2618d0610933. Recomputed from the bytes at this head, against the previous round's head 8032f49f8 and the merge base fcd6a7268; git merge-tree against develop 388faf59a writes a clean tree (no conflicted path; the 45 newer develop commits touch none of the nine PR files).

What moved: the branch was rewritten onto fcd6a7268 (9b31dd556, 34be75469, 2761a2494), then fast-forwarded by 0aa7bf863, e3b241df6 and 8edf5df46. Against 8032f49f8 only six docs files differ; peer.rs, the manifests and the lock are byte-identical.

Previous findings:

  • F1 partly fixed: commits match their messages, but the re-spacing step was dropped (F14).
  • F3 to F7 fixed; F7's second-gate approval is not visible on the PR.
  • F8 fixed, then reopened by the new run dates (F19).
  • F9 partly fixed: peer.md lines 94 and 96 match; 95, 104 and 107 do not (F18).
  • F10 fixed: the record exists and the validator's checks pass offline (13 rows, 5 log entries); F20 covers two of its facts.
  • F11 fixed; F12 no longer applies (its commit was folded).

The new commits: 8edf5df46 corrects the late 16:24 stamp by appending an entry, as the skill asks. Every Source review ID, Reply URL, severity and resolution subject in the audit matches the capture.

Hygiene: Conventional subjects with [#2824], no bodies, author identity equals committer, one attribution footer line each (no rule in the tree on it). git diff --check from 8032f49f8 and per commit, and the commit-id check, print nothing.

Findings: F14 Major (blocking); F15, F16, F18, F20 Minor; F17, F19 Nit.

Checked, no finding: 13 resolved threads match 13 RESOLVED rows; each reply sits on its own thread; the log is in order; the hex, client-name, opposite, port and parse rows match their tests.

Checks

On the loop's compute node at this head, against the merge base fcd6a7268 (receipt server-gates-kranich-783): the repository's pre-commit gate and lint roster exit 0 and the tree left clean; the repository's audit validator on pr-2841-review exit 0 (13 rows, 5 log entries, no failures). cargo test -p torrust-tracker-primitives at this head: 81 + 2 + 1 passed, 0 failed (receipt pkgtest-2841-r3). F14 read at this head: the rewritten history from fcd6a7268 has no counterpart of test(primitives): [#2824] cover the ReadInfo role predicates for every state, which open-pull-request lines 118-131 require a rewrite to keep. GitHub checks at this head at posting time: "". At posting, develop is 388faf59a.

Comment thread packages/primitives/src/peer.rs Resolved
…e file test plans

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

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 mutator fixture initializes both transfer counters to zero, leaving the new preservation tests unable to detect accidental resets of uploaded or downloaded totals.

1 open issue
1 resolved since last review

Review effort: Balanced

Comment thread packages/primitives/src/peer.rs Resolved
josecelano-bot and others added 9 commits November 12, 2026 16:44
Adds the peer.rs tests (PeerRole, the Peer predicates and mutators,
ReadInfo, serialization, Id encoding with quickcheck properties, peer
collections) with their decision record peer.md. Corrects the to_hex_string
doc comment (the output has the 0x prefix). Adds quickcheck and
quickcheck_macros as dev-dependencies, with a cargo-machete ignore for
quickcheck (taplo-formatted, because the pre-commit gate rejects the
compact array).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…or every state

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…e peer.rs record

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…udit

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
… cells and timing

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…r round 2

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
josecelano-bot and others added 2 commits November 12, 2026 17:53
… fix the S2 stamps

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
… at torrust#2850

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

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 completion-predicate tests omit negative assertions for Stopped and None, leaving a download-count regression unguarded, while review documentation still contains stale commit references and an inconsistent resolution.

3 open issues
1 resolved since last review

Review effort: Balanced

Comment thread packages/primitives/src/peer.rs Resolved
josecelano-bot and others added 2 commits November 12, 2026 18:04
…re not completed

The is_completed test rejected only Started, so a predicate that accepted
every event but Started still passed. It decides the download count in the
swarm coordinator. One more mutant of that kind is killed.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…R 2841

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
da2ce7
da2ce7 previously approved these changes Nov 12, 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 40631b1f326c1be8f035dc30fcfbb8f0c677f4e2. Recomputed from the bytes at this head, against the previous round's head 70f1f05b3 and the merge base fcd6a7268; git merge-tree against develop 388faf59a writes a clean tree (exit 0; the 45 newer develop commits touch none of the nine PR files).

What moved: a fast-forward of 70f1f05b3 by 2b8dc59d2, fc5458dbc, 855b234fc, d15490744 and 40631b1f3, which change four files. Every other path is byte-identical, so the previous round's conclusions on those paths stand.

Previous findings:

  • F12 declined with a reason. I accept that for a Nit; its audit row is F32.
  • F22 fixed: every field it named is corrected, and a new log entry records it. The correction adds two new slips (F31).
  • F23 fixed.
  • F24 partly fixed: the stamp moved, but the note still puts the six round-1 mutants in later rounds (F28).

The new commits: the #2850 pointers agree across the decision record, the spec and the test comment. d15490744 kills event != Started. No other test in the package calls is_completed, so the new cell and the count of 18 are right. The audit records all 27 threads, with replies, in the template's field order. The description lists all 17 commits in order.

Hygiene: Conventional subjects with [#2824], and the one body (d15490744) matches its diff. Author identity equals committer identity, with one attribution footer line each (no rule in the tree covers it). git diff --check and the commit-id check print nothing.

Findings: F28, F29, F31 and F32 are Minor, and F30 and F33 are Nits. None of them blocks. They start at F28 because the audit now uses F25 to F27.

Checked, no finding: the validator's logic passes offline (27 rows, 8 log entries). The facts about #2838, #2839, #2850 and #2851 have no trace at 388faf59a, so they are unconfirmed here.

Checks

On the loop's compute node at this head, against the merge base fcd6a7268 (receipt server-gates-kranich-794): the repository's pre-commit gate and lint roster exit 0 and the tree left clean; the repository's audit validator on pr-2841-review exit 0 (27 rows, 8 log entries, no failures). cargo test -p torrust-tracker-primitives at this head: 84 passed, 0 failed (receipt pkgtest-2841-r5c). F29 read at this head: ISSUE.md line 12 is last-updated-utc: "2026-11-11 14:31", while the last Progress Log entry (line 331) is stamped 2026-11-12 17:53 UTC. Read on the forge: all 27 review threads are answered and resolved. GitHub checks at this head at posting time: "". At posting, develop is 388faf59a.

@da2ce7

da2ce7 commented Nov 12, 2026

Copy link
Copy Markdown
Contributor

ACK 40631b1 — the round 3 fixes, the new is_completed assertions and the audit's 27 rows were recomputed at this head against 70f1f05b3, the merge base and develop, and no blocking finding stands

…eer.md round note

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
josecelano-bot and others added 2 commits November 12, 2026 18:29
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
da2ce7
da2ce7 previously approved these changes Nov 12, 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 ade394de45c97f4a458c576883c621cfda75e231. Recomputed from the bytes at this head, against the previous round's head 40631b1f3 and the merge base fcd6a7268; git merge-tree against develop 388faf59a writes a clean tree (exit 0; the 45 newer develop commits touch none of the nine PR files).

What moved: a fast-forward of 40631b1f3 by fc15a1c65, cc2f2e2d7 and ade394de4, which change five records (+102/-16). Every other path is byte-identical.

Previous findings:

  • F28, F29 and F33 fixed: the round note, the spec stamp (18:24) and the re-measured totals. Every percentage and delta recomputes.
  • F30 is recorded NO_ACTION/SUPERSEDED, which fits a finding that asked for no change.
  • F31 partly fixed: line 42 now puts 5878380545 on the same head as 5878329038, and a new entry corrects the 17:58 entry. That correction repeats a gap that was in my F31 (F35).
  • F32 fixed in the record: the F12 row is SUPERSEDED, and its reply and resolution reference point at the prescribed reply. The reply on the F32 thread itself is wrong (F34).

The new commits: rows F28 to F33 match their source comments, replies, review 5879809319 and the bracket severities, once ade394de4 sets F30 and F33 to Nit. All 33 threads have a row and a reply, and the capture shows them all resolved. The log gains one entry, stamped at its commit minute, and no earlier entry is rewritten. The description lists all 20 commits and the new figures.

Hygiene: each subject matches its diff, and none has a body. Author identity equals committer identity, with one attribution footer line each (no rule in the tree covers it). git diff --check and the commit-id check print nothing.

Findings: F34 and F35 are Minor, and neither blocks.

Checked, no finding: the validator's logic passes offline (33 rows, 9 log entries). The re-measured counts cannot be reproduced offline.

Checks

On the loop's compute node at this head, against the merge base fcd6a7268 (receipt server-gates-kranich-796): the repository's pre-commit gate and lint roster exit 0 and the tree left clean; the repository's audit validator on pr-2841-review exit 0 (33 rows, 9 log entries, no failures). The new commits change documentation only; cargo test -p torrust-tracker-primitives passed at 40631b1f3 (84 passed), whose peer.rs this head keeps byte-identical. F34 read on the forge: reply 4554623061 on the F32 thread (18:28:46 UTC) begins "Superseded by F14", while the F32 row records FIXED. Read on the forge: all 33 review threads are answered and resolved. GitHub checks at this head at posting time: "". At posting, develop is 388faf59a.

@da2ce7

da2ce7 commented Nov 12, 2026

Copy link
Copy Markdown
Contributor

ACK ade394d — the re-measured S2 coverage, the round 4 audit rows F28 to F33 and their two severity fixes were recomputed at this head against 40631b1f3 and the capture, with the validator's logic passing offline

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

@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 436187be7ccece7209738f759e80026d6c3db3fd. Recomputed from the bytes at this head, against the previous round's head ade394de4 and the merge base fcd6a7268; git merge-tree against develop 388faf59a writes a clean tree (exit 0; the 45 newer develop commits touch none of the nine PR files).

What moved: a fast-forward of ade394de4 by 436187be7, which changes only the review audit (+31/-2). Every other path is byte-identical.

Previous findings:

  • F34 fixed: reply 4554846413 on the F32 thread gives the disposition and the round 4 audit subject, and the F32 Reply URL points at it (line 498).
  • F35 fixed: the 18:48 entry (line 550) names the F1 to F8, F10 and F11 replies, which the capture confirms are the only round 1 replies without a subject, and it logs the line 42 change. The 18:29 entry is unchanged.
  • F31 and F32 are now fully fixed, since their remainders were F35 and F34.

The new commits: line 42 names review 5880156295 as round 5. Rows F34 and F35 match their source comments, replies, review and bracket severities, and both threads are resolved in the capture. The 18:48 stamp is the commit minute, after the three replies (18:48:10 to 18:48:15). The review heads behind line 42 and the round 4 audit commit recompute from the history. The description lists all 21 commits.

Hygiene: the subject matches the diff, and there is no body. Author identity equals committer identity, with one attribution footer line (no rule in the tree covers it). git diff --check and the commit-id check print nothing.

Findings: none.

Checked, no finding: the validator's logic passes offline (35 rows, 10 log entries, 0 failures), and all 35 threads have a row and a reply. The F35 reply cites "the same commit" instead of the subject, as the F27 and F29 replies do.

Checks

On the loop's compute node at this head, against the merge base fcd6a7268 (receipt server-gates-kranich-797): the repository's pre-commit gate and lint roster exit 0 and the tree left clean; the repository's audit validator on pr-2841-review exit 0 (35 rows, 10 log entries, no failures). The new commit changes the audit record only; cargo test -p torrust-tracker-primitives passed at 40631b1f3 (84 passed), whose packages/ this head keeps byte-identical. F34's fix read on the forge: reply 4554846413 on the F32 thread begins "Fixed in the commit", and the F32 row's Reply URL (line 498) points at it. Read on the forge: all 35 review threads are answered and resolved. GitHub checks at this head at posting time: "". At posting, develop is 388faf59a.

@da2ce7

da2ce7 commented Nov 12, 2026

Copy link
Copy Markdown
Contributor

ACK 436187b — the round 5 audit rows F34 and F35, the corrected F32 reply and the 18:48 log entry were recomputed at this head against ade394de4 and the capture, with the validator's logic passing offline

@josecelano

Copy link
Copy Markdown
Member

ACK 436187b

@josecelano
josecelano merged commit ec1f58e into torrust:develop Nov 12, 2026
19 of 20 checks passed
josecelano-bot added a commit to josecelano-bot/torrust-tracker that referenced this pull request Nov 12, 2026
…ust#2824 are merged

PR torrust#2841 merged the tests that pin a negative left as a seeder. The coordination note names them and no longer describes that pull request as open.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
josecelano added a commit that referenced this pull request Nov 13, 2026
…foreground

38d7631 docs(pr-reviews): [#2855] create the PR 2857 review audit record (josecelano-bot)
a186f9e fix(container): [#2855] address PR #2857 review findings F2-F4,F7 (josecelano-bot)
08e4d2b fix(container): [#2855] stop the tracker with timeout --foreground (josecelano-bot)

Pull request description:

  Closes #2855. Intended merge order: #2856 (spec-only, folder-style issue specification and evidence for #2855) first, then this PR.

  Fixes the Container workflow's "Run Persistence Transition Regression" step, which has been failing on `develop` and on unrelated PRs since 2026-11-12 (first bad run 43184363486, last good run 43059027926).

  ## Root cause

  `run_tracker` in `test-mounted-no-persistence-configuration.sh` runs `timeout --signal=INT --kill-after=3s 10s docker run ...` and only accepts exit status 0 or 124. On the self-hosted CI runner (`torrust-runner-01`, Ubuntu 26.04.1), `timeout` is provided by `rust-coreutils` (the uutils implementation), which was upgraded 0.8.0 -> 0.10.0 on 2026-11-12 06:36 UTC. Without `--foreground`, that `timeout` does not forward SIGINT to the `docker run` client; the tracker never receives the signal, and `--kill-after=3s` SIGKILLs the client instead, giving exit status 137. The tracker itself shuts down correctly on SIGINT and SIGTERM in every case tested (`docker kill --signal=INT/TERM`, GNU `timeout` with or without `--foreground`, uutils `timeout --foreground`).

  ## Fix

  Add `--foreground` to the `timeout` invocation, and report the unexpected exit status on failure so a future regression is diagnosable from the CI log alone.

  ## Verification

  Ran the script locally against a release image built from `develop` at the merge of #2841, with both `timeout` implementations:

  - uutils `timeout` 0.10.0 (as on the runner): before the fix, exit 137 and no shutdown log line (reproducing the CI failure); after the fix, exit 0 and both regression markers printed.
  - GNU `timeout` 9.7: exit 0 and both markers printed, before and after.

  `linter all` passes.

  ## Files touched

  - `contrib/dev-tools/containers/tests/test-mounted-no-persistence-configuration.sh`: adds `--foreground` to the `timeout` invocation and reports the unexpected exit status on failure.
  - `project-words.txt`: adds `uutils`.

  Full root-cause analysis and evidence: #2855 and the spec in #2856.

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

ACKs for top commit:
  da2ce7:
    ACK 38d7631 — the `timeout --foreground` fix and its single exit-status `case` behave correctly for every status class, F1 to F5 are resolved, the audit record passes the validator's logic offline with a reply, row and resolution for all seven threads, and the branch merges cleanly onto `ec1f58ec9`
  josecelano:
    ACK 38d7631

Tree-SHA512: 39dc70d0836f81e6f56c69f80204ffcf1e2509390b05c6e63dc2d0fc6ed6a97072e5577a8ad85723d076219464199e8f14a7faddf032c4a44c7f297a863b4e69
josecelano-bot added a commit to josecelano-bot/torrust-tracker that referenced this pull request Nov 14, 2026
…ust#2824 are merged

PR torrust#2841 merged the tests that pin a negative left as a seeder. The coordination note names them and no longer describes that pull request as open.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
josecelano added a commit that referenced this pull request Nov 14, 2026
…lues, with the spec of its first application

5af3b9f docs(pr-reviews): record round 14 in the review audit of PR #2851 (josecelano-bot)
f8580ac docs(pr-reviews): record the second rebase in the review audit of PR #2851 (josecelano-bot)
4b2a10b docs(pr-reviews): record round 13 in the review audit of PR #2851 (josecelano-bot)
e3fc25c docs(pr-reviews): keep the reviewer-provided IDs of round 12 in the audit of PR #2851 (josecelano-bot)
2b7e9db docs(pr-reviews): record round 12 in the review audit of PR #2851 (josecelano-bot)
9ee0657 docs(issues): [#2850] name the UDP rejection as a client-visible change (josecelano-bot)
51f4729 docs(pr-reviews): record round 11 in the review audit of PR #2851 (josecelano-bot)
d0044e1 docs(pr-reviews): give one account of the round-7 audit commit in the audit of PR #2851 (josecelano-bot)
7713ef4 docs(pr-reviews): record round 10 in the review audit of PR #2851 (josecelano-bot)
23a3e8a docs(pr-reviews): correct rows and log entries of the review audit of PR #2851 (josecelano-bot)
612dfcc docs(issues): [#2838] check the length of each UDP response in the probe (josecelano-bot)
0aa5c5a docs(issues): [#1347] describe issue #2850 as the planned fix in the sub-issue table (josecelano-bot)
098124c docs(pr-reviews): record round 9 in the review audit of PR #2851 (josecelano-bot)
c1b44b3 docs(issues): [#2838] correct the probe evidence timestamp to its commit time (josecelano-bot)
44d07c8 docs(pr-reviews): record round 8 in the review audit of PR #2851 (josecelano-bot)
8e782aa docs(issues): [#2838] document the probe's new error-response exit path (josecelano-bot)
927aa9b docs(pr-reviews): record round 7 in the review audit of PR #2851 (josecelano-bot)
4094f4a docs(issues): [#2838] parse the connect response defensively in the UDP probe (josecelano-bot)
8117f94 docs(pr-reviews): record round 6 in the review audit of PR #2851 (josecelano-bot)
3076c37 docs(issues): [#2850] correct benchmark wording, add a Commit Points row, and record the tolerance write-back (josecelano-bot)
5a63ca6 docs(pr-reviews): record round 5 in the review audit of PR #2851 (josecelano-bot)
cbfd4d4 docs(issues): [#2850] plan the performance baseline and the missing UDP announce benchmark (josecelano-bot)
da7fc1f docs(issues): [#2838] remove the unused second UDP listener from the replay configuration (josecelano-bot)
454077a docs(pr-reviews): record round 4 in the review audit of PR #2851 (josecelano-bot)
28d1389 docs(issues): [#2850] carry the time of the last content edit in last-updated-utc of two files (josecelano-bot)
eb99272 docs(pr-reviews): record round 3 in the review audit of PR #2851 (josecelano-bot)
f279b3e docs(issues): [#2850] read the REST output after each accepted announce in scenario M7 (josecelano-bot)
5d1e55f docs(issues): [#2838] add the database directory as a replay prerequisite of the evidence (josecelano-bot)
8f346b3 test(udp-probe): [#2838] reject a response with the wrong transaction id in the UDP probe (josecelano-bot)
f5dda4e docs(issues): [#2850] record that the primitives tests of #2824 are merged (josecelano-bot)
338646c docs(pr-reviews): record round 2 in the review audit of PR #2851 (josecelano-bot)
fb7ce4f docs(pr-reviews): correct the time and actor of the force push in the audit of PR #2851 (josecelano-bot)
6347bf1 docs(pr-reviews): drop the commit ids of the rewritten branch from the audit of PR #2851 (josecelano-bot)
6500843 docs(issues): [#2850] set last-updated-utc to the time of the last content edits (josecelano-bot)
8cc2e6e docs(issues): [#2838] mark scenario M2 of the unmerged patch as superseded (josecelano-bot)
c69c061 docs(pr-reviews): record the review audit of PR #2851, round 1 (josecelano-bot)
4e22891 docs(adrs): [#2842] record that HTTP rejects an announce ip that is not an IP address (josecelano-bot)
d1300a7 docs(adrs): [#2842] describe how num_want is handled on each protocol in the inventory (josecelano-bot)
79f6b20 docs(adrs): [#2842] require verdict parity at the acceptance boundary, not at the parser (josecelano-bot)
3220fb6 docs(adrs): [#2842] name the seeder count as the statistic a negative left inflates (josecelano-bot)
4fde2fd docs(issues): [#2838] point the field decision at the progress log (josecelano-bot)
f1d4455 docs(issues): [#2850] correct a section reference and a leftover mention of the EPIC (josecelano-bot)
1255e0f docs(issues): [#2838] mark the checkpoints, criteria and recheck of the unmerged patch as superseded (josecelano-bot)
0eb9f64 docs(adrs): [#2842] stop attributing the sign of left to BEP 15 in the description (josecelano-bot)
00f6ec6 docs(adrs): [#2842] describe the udp-core conversion as planned, not as existing (josecelano-bot)
a776f2c docs(adrs): [#2842] state in the inventory that UDP still accepts a negative byte count (josecelano-bot)
018624c docs(issues): [#2850] cite the commits of PR #2839 by subject (josecelano-bot)
a7c6515 docs(adrs): [#2842] point the inbound tolerance ADR at issue #2850 (josecelano-bot)
6059d94 docs(issues): [#2850] add issue specification (josecelano-bot)
e2ee111 docs(issues): [#2838] carry over the spec and evidence from PR #2839 (josecelano-bot)
925a34a docs(adrs): [#2842] cite the client evidence for the byte counts (josecelano-bot)
20e231e docs(adrs): [#2842] add the layering rule and the byte-count first application (josecelano-bot)
9ab2d9b docs(adrs): [#2842] align the inbound tolerance ADR with the byte-count decisions (josecelano-bot)
30af1a1 docs(adrs): [#2842] reject malformed inbound protocol values unless real clients need the tolerance (josecelano-bot)

Pull request description:

  Closes #2842

  Related to #2850
  Related to #2838

  Docs only: no production code changes. The only script touched is the disposable UDP probe in the evidence folder of #2838. This is the spec-only pull request of #2850. It replaces #2843 (the ADR) and the documents of #2839 (the tactical patch), which are closed without merging.

  ## What

  - **The ADR of #2842**: "Reject malformed inbound protocol values unless real clients need the tolerance" (`docs/adrs/`), its index entry and its issue specification. The four commits of #2843 are carried over unchanged, with one more commit that points the ADR at #2850 as its first application, and the fix commits of the review rounds.
  - **The specification of #2850**: "Make the number of bytes non-negative by construction" (`docs/issues/open/2850-non-negative-number-of-bytes/ISSUE.md`). It addresses the bug of #2838 at its root.
  - **The specification and evidence of #2838**, carried over from the branch of #2839: the field audit, the evidence on real clients and other trackers, the reproduction evidence and the UDP probe. The patch plan in it is marked as superseded.
  - One row for #2838 in the sub-issue table of EPIC #1347, and three words in `project-words.txt`.
  - The review audit record, `docs/pr-reviews/pr-2851-review/PR-REVIEW.md`.

  ## Why one pull request

  The patch, the ADR and the design were three views of one decision, worked on in three sessions. The maintainer decided on 2026-11-12 to review the decision documents together and to address the bug of #2838 at its root instead of merging a patch that the next change would delete.

  ## The decisions recorded (maintainer, 2026-11-12)

  1. The domain `NumberOfBytes` holds a private `u64`, with no upper bound.
  2. Implementing a public protocol specification strictly has priority over failing fast. The UDP wire type and `Request::parse_bytes` are not changed; a negative counter is refused at the first conversion into a type the project owns (`peer_builder::from_request` in `udp-core`).
  3. The conversion owns its error and `UdpAnnounceError` wraps it. No standalone validation function.
  4. The HTTP protocol type holds a private `u64` and its `i64::MAX` limit is removed; the REST fields become `u64`. Wire ranges may differ per protocol; the domain is the same for both.
  5. The general rules live in the ADR of #2842 (its points 6 to 9).
  6. One standalone issue, not an EPIC.

  The specification of #2850 has a section "Sources for the Decisions" that maps each question of the review to the ADR or document that answers it.

  ## Files

  - `docs/adrs/20261111170611_reject_malformed_inbound_protocol_values_unless_clients_need_tolerance.md`, `docs/adrs/index.md`
  - `docs/issues/open/2842-inbound-tolerance-adr/ISSUE.md`
  - `docs/issues/open/2850-non-negative-number-of-bytes/ISSUE.md`
  - `docs/issues/open/2838-1347-udp-reject-negative-announce-bytes/` (specification, evidence, probe)
  - `docs/issues/open/1347-overhaul-packages-testing/EPIC.md`
  - `project-words.txt`

  ## Validation

  - `linter markdown`, `linter cspell` and `linter lychee` pass.
  - The frontmatter validator and the other pre-commit checks pass on every commit.
  - The check for commit ids that are not on `develop` reports nothing.
  - The closing-keyword scan of the title, this description and the commit messages matches only the intended close of #2842.

  ## History

  The history of this branch was rewritten once, during the first review round, to reword two commit messages that paired a closing keyword with #2838: "docs(issues): [#2838] carry over the spec and evidence from PR #2839" and "docs(adrs): [#2842] point the inbound tolerance ADR at issue #2850". No commit was dropped, squashed or reordered, and the tree at the rewritten head was identical to the tree before. The review audit names the commits the first review cites by their subjects.

  The branch was then rebased onto `develop` twice. The first rebase was needed because #2841 changed the row next to the one this pull request adds to the sub-issue table of EPIC #1347. The conflict was resolved by keeping the row of `develop` and adding the #2838 row after it; every commit was replayed in the same order.

  The second rebase, after the approval of round 13, was needed for the same reason: #2852 changed that row again and the pull request conflicted with `develop`. The conflict was resolved the same way, and all commits were replayed in the same order with the same changes. The commit ids that the review comments cite no longer name commits on the branch; [this comment](#2851 (comment)) maps each one to its commit subject.

  ## Not in this pull request

  - The implementation of #2850, which follows after this merges. Issues #2850 and #2838 stay open until that implementation merges. It takes the tests from the branch `2838-udp-reject-negative-announce-bytes`.
  - The register of tolerances and the rejection metric of the ADR.

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

ACKs for top commit:
  josecelano:
    ACK 5af3b9f
  da2ce7:
    ACK 5af3b9f — all 63 review threads answered, resolved and recorded with the validator's checks passing offline, the second rebase recorded with every cited commit id mapped to its subject, and the head merging into develop ef759e3 without conflict

Tree-SHA512: bb0ed8b32a33e28e6e7f702180be5d8251501fbca97d1b89084ec618767f983bc3d123152452fe6544de87587c34f977ba978a04ec433ef2c9ddc0b7d9c89ae0

This branch was previously deployed

1 inactive deployment
coverage — 436187be Deployed Nov 12, 2026 by josecelano-bot via Generate Coverage Report #3117
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