Repository navigation
docs(packages): add epic spec and subissue drafts for packages overhaul #1669 - #1789
Conversation
…ne artifacts Add a Rust binary at contrib/dev-tools/analysis/workspace-coupling/ that analyses inter-package coupling in the Cargo workspace. The tool produces: - A dependency graph (Graphviz DOT) - A coupling hotspots report (JSON / text) Also add the SI-01 output artifacts: - docs/issues/open/1669-overhaul-packages/readme-audit.md - docs/issues/open/1669-overhaul-packages/workspace-coupling-report.md And the SI-01 subissue spec: - docs/issues/drafts/1669-01-establish-baseline-analysis.md Add new technical words to project-words.txt (argjson, Graphviz, hotspots, organisation, prioritise, rustdoc, walkdir).
…sues to sequential order Add three new subissue specs identified from coupling analysis findings: - SI-04: Move AnnouncePolicy from torrust-tracker-configuration to torrust-tracker-primitives (F-03) - SI-05: Create torrust-net-primitives and move ServiceBinding (F-04) - SI-06: Resolve bittorrent-tracker-core stale dev dep on torrust-rest-tracker-api-client (F-05 — audit found dep unused, fix is a one-line Cargo.toml deletion) Also add SI-11: Update all package READMEs (docs gate before extraction). Renumber SI-04–SI-15 to follow declared priority rules (M → U → P → E) with no gaps: - SI-04–SI-06: move subissues (new, from F-03/F-04/F-05) - SI-07–SI-10: rename subissues (align prefix, metrics, clock, located-error) - SI-11: README update - SI-12–SI-15: extraction subissues (bencode, clock, metrics, tracker-client) Extend SI-02 and SI-03 scope with findings from coupling report (F-01/F-02). Update EPIC.md quick list, details table, notes, and Desired Package State. Update workspace-coupling-report.md findings resolution table (F-03→SI-04, F-04→SI-05, F-05→SI-06).
Replaced by the Rust binary at contrib/dev-tools/analysis/workspace-coupling/.
There was a problem hiding this comment.
Pull request overview
Adds the EPIC spec for issue #1669 (packages overhaul), 11 draft subissue specs covering the planned moves/renames/extractions, supporting analysis artifacts (workspace coupling report and README audit), and a new workspace-coupling Rust binary that generates the coupling report from cargo metadata + a src/ import scan. Also adds related spell-check words and registers the new tool as a workspace member.
Changes:
- New EPIC and 11 draft subissue specs documenting the overhaul plan (moves, renames, extractions, README updates).
- New
contrib/dev-tools/analysis/workspace-coupling/Rust binary plus the generated coupling report and a manually authored README audit. - Project word list and workspace
members/Cargo.lockupdates for the new tool.
Reviewed changes
Copilot reviewed 22 out of 23 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| project-words.txt | Adds spell-check entries for new terms used in specs/tool |
| docs/issues/open/1669-overhaul-packages/EPIC.md | New EPIC spec with inventory, desired state, subissues, strategy |
| docs/issues/open/1669-overhaul-packages/workspace-coupling-report.md | Generated coupling report artifact |
| docs/issues/open/1669-overhaul-packages/readme-audit.md | Manual README quality audit |
| docs/issues/drafts/1669-01-…through 1669-15-… | 11 draft subissue specs for baseline analysis, moves, renames, extractions, README updates |
| contrib/dev-tools/analysis/workspace-coupling/Cargo.toml | Manifest for new analysis binary |
| contrib/dev-tools/analysis/workspace-coupling/src/main.rs | Report generator implementation |
| Cargo.toml | Adds analysis tool to workspace members |
| Cargo.lock | Lockfile entry for workspace-coupling |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @@ -0,0 +1,1123 @@ | |||
| contrib/dev-tools/analysis/workspace-coupling.sh# Workspace Coupling Report | |||
| - Add `torrust-tracker-configuration` as a dependency of `torrust-tracker-primitives` | ||
| is removed; `torrust-tracker-primitives` must not depend on `torrust-tracker-configuration`. |
Move publish responsibility from SI-08 into SI-14 itself (new task T1b). SI-08 stays rename-only. SI-14 prerequisite now requires only SI-08 rename completion, per the policy of deferring publish and extract as late as possible (Refactor -> Publish -> Extract). Also mark F1 done in the review plan.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #1789 +/- ##
===========================================
- Coverage 78.38% 77.67% -0.72%
===========================================
Files 377 378 +1
Lines 28365 28599 +234
Branches 28365 28599 +234
===========================================
- Hits 22235 22214 -21
- Misses 5819 6074 +255
Partials 311 311 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Rename 'Extracted from workspace' to 'Planned for extraction from workspace' and add a clarifying note. Both packages are still in the workspace; the table describes the target end state for SI-12 and SI-15.
|
ACK 890d769 |
|
I think that we should remove "torrust-tracker-located-error" entirely. This crate is not so interesting. |
@da2ce7 I will update the draft subissue to remove it. |
da2ce7
left a comment
There was a problem hiding this comment.
This is a post-merge review of the change from #1789 as it stands at e170b9620 on the default branch.
Most of #1789 is planning Markdown. What still runs is the workspace-coupling workspace member it added: contrib/dev-tools/analysis/workspace-coupling/Cargo.toml, the member line at Cargo.toml:157, and src/main.rs. src/main.rs still has the merged layout: the cargo metadata call, the argument handling, the default output path, the date timestamp and the Markdown writers. Later commits replaced the scanner with an AST parse in src/lib.rs (8dc2dd3). They also added tests/ and benches/ to the scan (59192b9), resolved renamed dependencies and library target names (2358421), turned panics into NDJSON errors with exit codes (8dc2dd3) and labelled optional edges (20fdd59). Two defects of the merged version are therefore history, already fixed by those commits: its regex scan had no leading word boundary, and it panicked when cargo metadata failed or the report could not be written.
[Minor] contrib/dev-tools/analysis/workspace-coupling/src/main.rs:132 decides has_any_reference with a plain text search (contains_identifier, lines 141-148) that also matches comments and string literals. When no path was extracted, line 290 then reports the dependency as "used without a direct use path (macro, re-export, or glob import)". The AST scan now records re-exports (pub use dep::X), globs (as dep::*) and macro paths, so those three causes no longer reach this branch. What does reach it is mostly a mention in a comment or an intra-doc link, plus extern crate dep; and a bare use dep;. Example: a package declares foo = { path = "../foo" } and names foo only in a doc comment such as /// see [`foo::Bar`]. The report then calls the edge used, instead of printing the "No foo:: references found" line that marks an edge worth removing. The latest committed report (workspace-coupling-report-2026-11-09.md) has no edge in this branch. Smallest fix: reword the message to say that the name occurs but no path was extracted (comment, string or extern crate), or set the flag from parsed identifiers instead of raw text.
[Minor] contrib/dev-tools/analysis/workspace-coupling/src/main.rs:324-327 builds one src/, tests/ and benches/ list per package, and line 347 scans it for every edge whatever its kind. A [normal] edge, which the legend at line 184 calls "required for compilation of the library/binary", therefore gets credit for paths found only in integration tests or benches. Example: b is in [dependencies], src/ never names it, and tests/it.rs has use b::Thing;. The report lists - b::Thing under #### b [normal] and hides that the edge could be a dev-dependency. In the other direction, build.rs is never scanned, so every [build] edge prints "No references found". Neither case occurs at e170b9620. Each of the 89 normal workspace edges is named in its package's src/, and no member declares build-dependencies. Smallest fix: choose the directories by EdgeKind: src/ for normal and optional edges, all three for dev edges, and build.rs for build edges.
[Minor] contrib/dev-tools/analysis/workspace-coupling/src/main.rs:411 runs cargo metadata --format-version 1 without --no-deps. That resolves the whole dependency graph and fetches every crate in it. Without a full local cache the run needs network access, fails offline with "cargo metadata failed", and may rewrite Cargo.lock. The report reads only the workspace members' dependencies, targets and features, which --no-deps also returns. Smallest fix: add --no-deps. Taking the program from std::env::var_os("CARGO"), with cargo as the fallback, would also keep the toolchain of the cargo run that started it.
[Minor] contrib/dev-tools/analysis/workspace-coupling/src/main.rs:435 takes the first argument as the output path without looking at it. workspace-coupling --help, or cargo run -p workspace-coupling -- --help, writes the report to a file named --help in the current directory and exits 0. Line 397 collects the arguments with std::env::args(), which panics on a non-UTF-8 argument, before the structured usage error at line 399 can be reached. Smallest fix: read the arguments with std::env::args_os(), and treat an argument that starts with - as a usage error with exit code 2.
[Nit] contrib/dev-tools/analysis/workspace-coupling/src/main.rs:121 drops walk errors with .filter_map(Result::ok), while lines 125-128 turn read and parse errors into a reported failure. An unreadable subdirectory therefore disappears from the scan without any message, and a dependency used only there comes out as "No references found". Line 122 filters on the extension alone, so a directory named x.rs aborts the whole report with a read error. Smallest fix: map walk errors into the same Err(String) path, and add e.file_type().is_file() to the filter.
[Nit] contrib/dev-tools/analysis/workspace-coupling/src/main.rs:434, like the module documentation at lines 15-17, defaults the output to docs/issues/open/1669-overhaul-packages/workspace-coupling-report.md. That file does not exist at e170b9620, because the reports are kept as dated files with front matter, for example workspace-coupling-report-2026-11-09.md. A run without an argument therefore creates an untracked, undated report without front matter. Once the epic's directory moves under docs/issues/closed/, line 447 will recreate the open directory. Lines 363-365 also write a fixed "None — previously known thin dependencies have been resolved" into every report, whatever the scan above it found, and that text names torrust-clock, which is no longer a workspace member. Smallest fix: make the output path a required argument, and leave the observations section as an empty placeholder.
[Nit] contrib/dev-tools/analysis/workspace-coupling/src/main.rs:154-160 gets the Generated: stamp by running date from PATH. Where date is missing the report says "(timestamp unavailable)". The stamp also changes on every run, so a regenerated report never matches a committed one byte for byte. Smallest fix: use SOURCE_DATE_EPOCH when it is set, or compute the stamp from std::time::SystemTime.
[Nit] The description of #1789 says the binary "produces a dependency graph (Graphviz DOT) and a coupling hotspots report" and "replaces the old workspace-coupling.sh shell script". Neither the merged binary nor the one at e170b9620 (generate_report, contrib/dev-tools/analysis/workspace-coupling/src/main.rs:377-394) writes anything but the Markdown report. The change's own baseline specification lists DOT/SVG graphs as out of scope (docs/issues/drafts/1669-01-establish-baseline-analysis.md:104 at 890d76915). The shell script was added and deleted inside the change itself (ab4d8285c, 83d2c827d), so nothing on the base branch was replaced. The description's "26 packages" predates 313e0d46c, which corrected the documents to 27. These statements are in the description only and need no code fix, but the description does not record what the binary does.
Checked and found sound: the member line at Cargo.toml:157 leaves the crate out of default-members, so a bare cargo build does not build it and the container test archives do not include it; .dockerignore admits it only so that cargo metadata can resolve the workspace; .github/workflows/testing.yaml:111 runs its tests with the rest of the workspace; its manifest sets publish = false, the workspace lints and the license, its dependencies (serde, serde_json, syn 3.0.10, walkdir) are locked and the merged regex dependency is gone; the binary starts cargo and date without a shell, reads only the workspace tree, writes only the chosen output path, holds no secrets and is not shipped in the image; the string slicing in contains_identifier stays on character boundaries; and the self-edge filter and module-name resolution in src/lib.rs handle renamed dependencies and library target names.
Related to #1669
Adds the EPIC spec, subissue draft specs, and workspace-coupling analysis tool for the packages overhaul tracked in issue #1669.
What's included
Analysis tool
contrib/dev-tools/analysis/workspace-coupling/— Rust binary that analyses inter-package coupling in the Cargo workspace (replaces the oldworkspace-coupling.shshell script). Produces a dependency graph (Graphviz DOT) and a coupling hotspots report.EPIC spec
docs/issues/open/1669-overhaul-packages/EPIC.md— master EPIC spec with:SI-01 baseline artifacts
docs/issues/open/1669-overhaul-packages/readme-audit.md— per-package README quality auditdocs/issues/open/1669-overhaul-packages/workspace-coupling-report.md— coupling hotspots report (output of the analysis tool)15 subissue draft specs (
docs/issues/drafts/1669-NN-*.md)Numbered in implementation priority order (M=move first, then U=rename-unpublished, P=rename-published, E=extract last):
DurationSinceUnixEpochfrom primitives to clockDEFAULT_TIMEOUTfrom configuration to clockAnnouncePolicyfromtorrust-tracker-configurationtotorrust-tracker-primitives(F-03)torrust-net-primitivesand moveServiceBinding(F-04)torrust-rest-tracker-api-clientfrombittorrent-tracker-core(F-05)torrust-prefix: rename 7 tracker-specific packages totorrust-tracker-torrust-tracker-metrics→torrust-metricstorrust-tracker-clock→torrust-clocktorrust-tracker-located-error→torrust-located-errortorrust-tracker-contrib-bencode→torrust-bencodestandalone repotorrust-clockto standalone repositorytorrust-metricsto standalone repositorytorrust-tracker-clientto standalone repository