Repository navigation
test(primitives): [#2824] final slice: swarm metadata, no-change files, mutation and manual verification - #2864
Conversation
Add one test per accessor of `SwarmMetadata` (`downloads`, `seeders`, `leechers`) on a value with three different counts, so a swap of two counts or of two fields fails, and one test that `zeroed` has every count at zero. Record the decision, coverage and mutation sample in `test-refactor-plans/swarm_metadata.md` and mark ledger row 7 done. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…re instance id JSON by value Review the tests of the nine fully covered and wiring files (ledger rows 8-16) in one shared record, `test-refactor-plans/no-change-files.md`. Change the JSON test of `ConfigurationInstanceId` to compare `serde_json::Value`s, as S3 did, so a field reorder that a reader cannot see does not fail it. Explain the `readiness.rs` coverage variance (the loop body of the concurrent test) and answer its `lessons.md` row. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… no mutant returns The only test of `ConfigurationInstanceId::instance_index` used index 1, so replacing the accessor body with `1` survived the package mutation run. Use index 2, which kills the `0` and `1` replacements. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… final records Record the package mutation run (147 mutants; the one real survivor is killed by the previous commit), the manual checks M1 and M2 against a built tracker, the S4 and final coverage measurements, the implementation retrospective, and `lessons.md` rows for every finding and for the unpinned REST peer `event` text. Reconcile the tasks, slice table, checkpoints, acceptance rows and both EPIC "Latest" tables. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
c725439 to
4958efd
Compare
da2ce7
left a comment
There was a problem hiding this comment.
Reviewed at 4958efd00cc0859521491087ff856067f344c2f2. Recomputed from the bytes at this head, against the merge base 2e64dff3a; git merge-tree against develop 2e64dff3a writes the head's own tree, with no conflict.
Process: a test-coverage slice that closes its issue, read against write-unit-test, create-issue (evidence files, retrospective template), commit-changes, open-pull-request and cleanup-completed-issues.
The change against its claim: the four SwarmMetadata tests use three distinct counts, so a swap of two accessors or two fields fails one, and the zeroed test builds its expectation with new. Index 2 kills both default replacements of instance_index; the JSON test now compares Values. Recomputed and matching: every coverage percentage and pp delta, the per-file sum (1,078 / 1,146), the mutation tallies (94 + 3 + 2 + 48 = 147; unviable 30 + 17 + 1), every cited line number, the seven SwarmMetadata::new calls in three packages, the BTreeMap keys, the REST format!, the fixed UDP transaction id, the M2 timestamps and peer-id bytes, and the cited merges.
Consistency: every relative link and anchor in the changed Markdown resolves, nothing is moved, and the new frontmatter follows the earlier slices and the closed precedent.
Hygiene: five Conventional commits in the [#2824] form, author equals committer, git diff --check clean, the commit-id check prints nothing, and only the description's line for the implemented issue matches the closing-keyword pattern. Every commit carries an attribution footer and the description ends with an attribution line; no rule in the tree forbids either.
Findings: F1 Major (AC9 checked while F5 has no draft spec or issue), F2 Minor (Findings Register not reconciled), F3 Minor (six review rounds claimed, five recorded), F4 Nit (test targets in the description), F5 Nit (AAA comments).
Checked, no finding: the derived-Default equivalence of both equivalent survivors, the readiness.rs timeout lines and loop lines, the row 8-16 test counts, the defaults 120 / 120 / 74, the REST deprecated-field note, and the PR-branch commit ids (none cited).
Checks
On the loop's compute node at this head, against the merge base 2e64dff3a (receipt server-gates-kranich-895): the repository's pre-commit gate and lint roster exit 0 (60 s wall). This PR has no audit record of its own yet, so the gate ran no validator for it. Package tests at this head (cargo test -p torrust-tracker-primitives, receipt pkgtest-2864-r1): exit 0, 112 passed, 0 failed, 0 ignored across 3 test binaries (1.1 s wall). F1 checked against the bytes at posting: AC9 at ISSUE.md:351 is checked, its evidence row at line 398 says F5 "has no GitHub issue yet", and docs/issues/drafts/ holds no spec for the peer::Id::new / peer::fixture move. GitHub checks at this head at posting time: "Package Coverage Regression: completed/success; Package Coverage (torrust-tracker-primitives): completed/success; Generate Coverage Report: completed/success; Discover Package Coverage: completed/success; Docker E2E: completed/skipped; Test (Docker) (release): in_progress/pending; Docs Lint: completed/success; Workspace Packaging: completed/success; Documented Clippy Allows: completed/success; Unit (nightly): completed/success; Layer Boundary Bans: completed/success; Unit (stable): completed/success; Shipped Features: completed/success; Build on macos-latest (nightly): completed/success; Build on windows-latest (stable): completed/success; Build on macos-latest (stable): completed/success; Build on windows-latest (nightly): completed/success; Build on ubuntu-latest (stable): completed/success; Build on ubuntu-latest (nightly): completed/success". At posting, develop is abd7a10ff.
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the test and documentation updates.
No open issues 🎉
What changed in this PR
Completes the final testing slice for #2824 under the package-testing EPIC #1347. This PR strengthens primitives tests and records final verification evidence without changing production code.
Changes:
- Adds four swarm-metadata tests and improves configuration-instance JSON and accessor assertions.
- Records mutation testing and manual HTTP, UDP, and REST verification.
- Reconciles completion records and reported coverage: 109 unit tests and 94.07% line coverage.
| File | Description |
|---|---|
packages/primitives/src/swarm_metadata.rs |
Adds accessor and zeroed-value tests. |
packages/primitives/src/configuration_instance_id.rs |
Compares JSON values and strengthens the index test. |
docs/issues/open/2824-1347-add-tests-primitives/test-refactor-plans/swarm_metadata.md |
Records test decisions, coverage, and mutation checks. |
docs/issues/open/2824-1347-add-tests-primitives/test-refactor-plans/README.md |
Marks the plan complete and registers S4 records. |
docs/issues/open/2824-1347-add-tests-primitives/test-refactor-plans/no-change-files.md |
Documents remaining file decisions and test adjustments. |
docs/issues/open/2824-1347-add-tests-primitives/mutation-evidence.md |
Records mutation results and the survivor fix. |
docs/issues/open/2824-1347-add-tests-primitives/manual-verification-evidence.md |
Records default-interval and peer-count checks. |
docs/issues/open/2824-1347-add-tests-primitives/lessons.md |
Updates findings handoffs and follow-up candidates. |
docs/issues/open/2824-1347-add-tests-primitives/ISSUE.md |
Updates tasks, acceptance evidence, and archive timing. |
docs/issues/open/2824-1347-add-tests-primitives/implementation-retrospective.md |
Summarizes outcomes and process improvements. |
docs/issues/open/2824-1347-add-tests-primitives/coverage-evidence.md |
Records final package and per-file coverage. |
docs/issues/open/1347-overhaul-packages-testing/EPIC.md |
Updates S4 progress and both coverage tables. |
Review effort: Balanced
…swarm metadata tests The four SwarmMetadata tests separated their sections with blank lines only. They now carry the // Arrange, // Act and // Assert comments the write-unit-test checklist asks for, as the ConfigurationInstanceId tests do. No assertion changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rm metadata tests Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…gn impl in the F4 row The F4 row of the Findings Register still said the unused AddAssign impl of AggregateActiveSwarmMetadata was being deleted. PR torrust#2827 deleted it on 2026-11-11; the row now says so. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…request The audit record of torrust#2852 names rounds 1 to 5. The retrospective said six in two places; it now says five, and a progress-log entry corrects the 2026-11-14 12:09 entry without rewriting it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
AC9 asks for a draft spec for every finding that needs a production change. F5 had none; its draft spec is now PR torrust#2865 (docs/issues/drafts/peer-id-test-helper/ISSUE.md). The Findings Register row, the AC9 evidence row, the peer::fixture risk, the lessons row and the retrospective cite it, and a progress-log entry records it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Round 1 (da2ce7, review
The in-tree fixes are pushed; each thread has its own reply. The audit record is |
…for round 1 da2ce7's review 5910653714 (F1 to F5, all fixed, replied to and resolved) and Copilot's review 5910671180 (approval recommended, no findings). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
da2ce7
left a comment
There was a problem hiding this comment.
Reviewed at 2c9c69b82fc2e2ad0985324dc864e88e2d1e5221. Recomputed from the bytes at this head, against the merge base 2e64dff3a; git merge-tree against develop abd7a10ff writes a tree with no conflict: the 13 commits develop gained touch two files, neither of them in this PR.
Process: the six commits since the last review answer round 1 under process-pr-review; write-unit-test, create-issue and open-pull-request still govern the bytes.
The change against its claim: each new commit does what its subject says. F1 fixed: the F5 register row, the AC9 evidence row, the peer::fixture risk, lessons.md and the retrospective cite the F5 draft spec in its own pull request, which is the issue's findings procedure (ISSUE.md:186). F2 fixed: the F4 row records the merged removal, and no placeholder is left in the issue folder. F3 fixed: the retrospective says five, and an appended log entry corrects the earlier one without rewriting it. F4 fixed in the description. F5 fixed: the four tests carry the section comments and no assertion changed. 2c9c69b82 changes no code.
Audit record: docs/pr-reviews/pr-2864-review/PR-REVIEW.md has one row per round-1 finding (severities match the source brackets, every Source review ID matches its comment, every Reply URL is a reply on its own thread, every resolution reference is a subject in this PR or a durable URL, and the log is in order). The validator's logic, run offline on the captured comments with this PR's commit subjects, gives 5 rows, 3 log entries and 0 failures. All five threads have a reply, a row and a resolution.
Hygiene: Conventional commits in the [#2824] form, the audit in its own docs(pr-reviews) commit, author equals committer, git diff --check clean, the commit-id check prints nothing, and only the description's line for the implemented issue matches the closing-keyword pattern. Each new commit carries an attribution footer; no rule in the tree forbids it.
Findings: none.
Checked, no finding: the F4 merge date against develop, the placeholders the replies name, the record's sections against the template, the unchanged last-updated-utc stamps (no rule requires a refresh), and the appended progress-log entries.
Checks
On the loop's compute node at this head, against the merge base 2e64dff3a (receipt server-gates-kranich-900): the repository's pre-commit gate and lint roster exit 0 (81 s wall), and the repository's audit-record validator for this PR passes with 5 rows, 3 log entries and 0 failures. Package tests at 290802ac9 (cargo test -p torrust-tracker-primitives, receipt pkgtest-2864-r2): exit 0, 112 passed, 0 failed, 0 ignored across 3 test binaries; 2c9c69b82 changes no file under packages/. Checked against the bytes at posting: swarm_metadata.rs carries 11 // Arrange / // Act / // Assert section comments across its four new tests (F5 of round 1). GitHub checks at this head at posting time: "". At posting, develop is abd7a10ff.
|
ACK 2c9c69b — F1 to F5 fixed, the round-1 audit record validated offline (5 rows, 0 failures) with every thread replied to and resolved, and a clean trial merge against develop |
|
ACK 2c9c69b |
Issue #2824 closed when #2864 merged (2026-11-15 21:05 UTC). The spec folder moves to docs/issues/closed/ with status done, the new spec-path and artifact paths, AC10 and the close checkpoint ticked, and an archive entry in the progress log. EPIC #1347 row 11 is DONE and its table links point at the closed folder; the #2850 spec and the error-locations draft cite the new path. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ssues/closed 1f364b5 chore(issues): archive closed issue #2824 spec to docs/issues/closed (josecelano-bot) Pull request description: Related to #2824 (already closed by #2864) and EPIC #1347. Archives the spec for issue #2824 from `docs/issues/open/` to `docs/issues/closed/`, following the `cleanup-completed-issues` skill (precedent: #2781 for #2637). - Verified #2824 is `CLOSED` on GitHub (2026-11-15 21:05 UTC) and PR #2864 is merged. - Updated frontmatter: `status: done`, `spec-path`, `last-updated-utc`, the artifact paths in `ISSUE.md`, `implementation-retrospective.md`, `manual-verification-evidence.md` and `test-refactor-plans/s1-peer-role-serialization.md`. - Ticked AC10 and the "Issue closed" checkpoint, set the S4 slice row to `DONE`, and added the archive entry to the progress log. - EPIC #1347: row 11 is `DONE` with its new path, the two coverage tables link to the closed folder, and a log entry records the close. - Repaired the live references: the `lessons.md` link to the EPIC's subissue guidelines, the #2850 spec's related artifact, and the `error-locations-si-2-primitives` draft. The PR review audit records (`pr-2834-review`) keep the old path as history. - Pre-commit hooks passed, including the local link check. 🤖 Generated with [Claude Code](https://claude.com/claude-code) ACKs for top commit: josecelano: ACK 1f364b5 Tree-SHA512: 075370acbd55e2f39d42245f4641f54cb844f9c7be248545373fa26a240b82c45226053c5b77f48688aff0d15d181477232f9fa1ba5b690991c37378b8a677a4
Closes #2824 (sub-issue of EPIC #1347). This is slice S4, the last slice of the plan in
docs/issues/open/2824-1347-add-tests-primitives/ISSUE.md: the remaining ledger rows, then T4-T6.What changes
swarm_metadata.rsdownloads,seeders,leechers) onnew(3, 5, 7), andzeroedequalsnew(0, 0, 0)configuration_instance_id.rsserde_json::Values (as S3 does after review); the accessor test uses index2(see the mutation run)test-refactor-plans/no-change-files.mdPackage unit-only coverage (= aggregate; the package has no integration tests) goes from 1,049 / 1,126 lines (93.16%) to 1,078 / 1,146 (94.07%), regions from 94.69% to 95.30%, functions from 92.69% to 94.17%, and from 105 to 109 unit tests (
cargo-llvm-cov 0.6.16, stable Rust 1.99.1). Over the whole issue: lines 60.56% → 94.07%, regions 67.94% → 95.30%, functions 57.23% → 94.17%, 47 → 109 unit tests. The only uncovered lines left arepeer::fixtureandpeer::Id::new, owned by the F5 follow-up.No production code changes in this slice.
Final tasks
mutation-evidence.md): 147 mutants, 94 caught, 3 missed, 2 timeouts, 48 unviable. Two survivors are equivalent (zeroedandScrapeData::emptyreplaced byDefault::default(), which they already return). The third,instance_indexreplaced by1, was a real gap (the only test used index1); the test now uses2and a re-run kills it. The tworeadiness.rstimeouts are detected mutants: the concurrent test loops until "not ready".manual-verification-evidence.md): M1, a tracker with no announce policy answers announces with the 120 s default over HTTP and UDP; M2, one seeder and one leecher give 1 / 1 in the HTTP scrape, the UDP scrape and the REST API, with the announced peers.implementation-retrospective.mdrecords the deviations.Review notes
docs/issues/open/: thecleanup-completed-issuesskill archives it after the issue closes, in its own PR, as Overhaul Packages Testing: Add tests foraxum-rest-api-serverpackage #2637 did. The slice table now says so.lessons.mdgained a row per finding and one new follow-up candidate from M2: the REST peereventtext is the derivedDebugofAnnounceEvent(format!("{:?}", ...)inrest-api-runtime-adapter) and no test pins it.peer-id-test-helper), handed off on 2026-11-11, has its draft spec in docs(issues): draft the peer-id-test-helper issue spec #2865 (docs/issues/drafts/peer-id-test-helper/ISSUE.md); no GitHub issue yet.readiness.rs: the coverage variance seen once in S3 is most likely the loop body of the concurrent test (test code, not production); the test is kept as it is (maintainer decision).Validation
cargo test -p torrust-tracker-primitives(109 unit tests and the 3 doctests, 2 + 1),cargo +nightly fmt --all -- --check,cargo clippy -p torrust-tracker-primitives --all-targets,git diff --check,linter markdownandlinter cspell, and the repository pre-commit gate (includinglinter allandcargo machete --with-metadata) on every commit.🤖 Generated with Claude Code