Repository navigation
feat(workspace-coupling): [#2645] label optional edges and skip self edges - #2648
Conversation
…p self edges Read the optional field of each dependency and the features table of each package. An optional normal dependency is labelled with the features that enable it, so one enabled only by the testing feature shows as optional (testing) instead of normal. A package's dependency on itself is skipped in the leaf detection, the dependency counts and the details. Co-authored-by: Copilot <[email protected]>
…ncy diagram Co-authored-by: Copilot <[email protected]>
…f an optional dependency Cargo adds the feature key = ["dep:key"] to the features table for an optional dependency, so a dependency enabled by testing = ["key"] was labelled optional (key, testing) instead of optional (testing). Co-authored-by: Copilot <[email protected]>
…ing optional edges Co-authored-by: Copilot <[email protected]>
…the spec Co-authored-by: Copilot <[email protected]>
There was a problem hiding this comment.
🟡 Changes recommended
Transitive feature activation is ignored, so a dependency enabled by default can be incorrectly labelled test-only.
1 open issue
What changed in this PR
Updates the workspace coupling tool for #2645, preparing it to distinguish optional test-support dependencies and omit self dependencies before the #2482 migrations.
Changes:
- Adds optional-edge labels based on package features and excludes self edges from counts, details, and leaf detection.
- Adds 15 tests covering edge labels and filtering.
- Updates the report legend, diagram guidance, and implementation evidence.
| File | Description |
|---|---|
| docs/media/packages/dependencies-workspace-packages.md | Explains omission of test-only and self edges. |
| docs/issues/open/2645-2482-label-optional-and-self-dependency-edges/manual-verification-evidence.md | Records scratch-workspace and repository verification. |
| docs/issues/open/2645-2482-label-optional-and-self-dependency-edges/ISSUE.md | Records completion and acceptance evidence. |
| docs/issues/open/2645-2482-label-optional-and-self-dependency-edges/implementation-retrospective.md | Documents the implicit-feature correction and lessons. |
| docs/issues/open/2482-1669-reorganize-shared-test-support/test-support-inventory.md | Marks the edge-reporting work resolved. |
| contrib/dev-tools/analysis/workspace-coupling/tests/edge_labels.rs | Adds classification and self-edge tests. |
| contrib/dev-tools/analysis/workspace-coupling/src/main.rs | Integrates edge classification and updates the legend. |
| contrib/dev-tools/analysis/workspace-coupling/src/lib.rs | Adds feature metadata, edge labels, and self-edge filtering. |
Review effort: Balanced
…n labelling an optional edge A dependency enabled through default = ["testing"] or another alias of the feature that enables it was labelled optional (testing), as if only the testing feature enabled it. Collect every feature that enables the dependency directly or through other features, with a stop on cycles. Co-authored-by: Copilot <[email protected]>
…t features enable through others Co-authored-by: Copilot <[email protected]>
…e PR 2648 review audit Co-authored-by: Copilot <[email protected]>
da2ce7
left a comment
There was a problem hiding this comment.
Reviewed at 04fb2e77ee447ad74fef07e1d98cc70eaf029cbf. Recomputed from the bytes at this head, against the merge base 5304d2379; git merge-tree against develop 5124c66e2 writes a clean tree (dcac7db2d), and develop changed only Markdown since the base.
Verdict: request changes, for F2 alone. At this head the label hides any feature that has the dependency's name, so an edge that such a feature enables at runtime reads optional (testing), the test-only label. The comment and the spec describe that removal as Cargo's implicit feature. Everything else here is non-blocking.
Against the spec. T1 to T5, AC1 to AC4 and the checkpoints are ticked with evidence. AC2's "not counted as a runtime edge" is read as "never labelled normal" in the spec's completion review and log, not only in the description. #2482 row 7 "regenerates the coupling report", as the description says.
The change of behaviour.
optionalandfeaturesare read fromcargo metadata.dep:KEYandKEY/fenable the dependency andKEY?/fdoes not, as in Cargo.- Feature chains are closed upward, and each round adds only new names, so a cycle terminates.
- Renames match by key, and labels are sorted.
- The self-edge skip compares package names, so the console client's renamed
client-libedge is kept. enabling.remove(key)is unconditional (F2). It replaced the exact["dep:key"]guard ofe437c13a7.
The tests.
- The 20 tests deserialize hand-written metadata. Each fails without its code: 14 would not compile without the first change, 2 fail before
e437c13a7and 4 of 5 before1e8fd2f9d, as V3 says. - Tests and code share each commit, so the commits cannot show test-first.
- Untested: an explicit same-name feature, optional build or target-specific dependencies, and a package that is both a normal and a dev dependency.
- Three tests model the pre-2024 implicit feature (F3).
The output. The legend matches the labels' spelling, parentheses and order. One phrase overstates (F4). The diagram note agrees. Against the base, the tool should print only the three legend lines, plus Generated: if the minute differs. The dated reports are snapshots, and row 7 regenerates them.
The records.
- The retrospective follows its template.
- The audit's one row matches its thread, severity, reply and subject, and the review bot's second review postdates it. One wording slip remains (F5).
- The evidence's environment line lags its own runs (F6).
- The inventory row is updated, and the 24 relative links resolve.
Hygiene.
- Eight Conventional subjects tagged
[#2645], and the bodies match their diffs. - Author equals committer.
- Each commit ends in an attribution footer naming the review bot's account, which no rule in the tree governs.
git diff --checkis clean, and the commit-id check prints nothing.- The description closes #2645 only, and the new words already occur in the tree.
The bot. I agree with its first review, which 1e8fd2f9d answers. Its open second review raises F2's case, and I agree with it.
Findings: F2 (Major, blocking), F3 (Minor), F4 to F6 (Nit), inline.
Checked, no finding:
- the AC2 reading;
- weak and renamed references;
- cycle termination;
- self edges in the workspace (none);
- the commit order of the second series.
Checks
On the loop's compute hub at this head, against the merge base 5304d2379, the #2646 merge (receipt server-gates-sojka-456; develop has since moved to 5124c66e2, the #2647 merge): pre-commit profile gate exit 0 (134 s); linter markdown, linter cspell, linter lychee exit 0; frontmatter-validator --all: 16 errors / 4 warnings at this head and 16 / 4 at the base re-measured, the same 20 diagnostics by path and category, none in the files this PR touches; the audit validator over docs/pr-reviews/pr-2648-review/PR-REVIEW.md with the review comments and the PR's commit list captured at gate time: ok, 1 row, 1 log entry, 0 failures. cargo test -p workspace-coupling: 40 passed, 0 failed in 6 suites at this head (the 20 edge_labels tests among them) against 20 in 5 suites at the base, measured in a separate target directory. cargo clippy -p workspace-coupling --all-targets --all-features -- -D warnings: exit 0. The tool itself, run at this head and at the base into scratch files: both exit 0, and the reports differ only in the generation stamp and the legend's lines for the new labels and the skipped self edge. On the merge of this head into develop 5124c66e2 (tree dcac7db2d), cargo test --locked -p workspace-coupling passes (40 tests). GitHub checks at this head at posting time: "Publish (Development): completed/skipped; Publish (Release): completed/skipped; Context: completed/success; Package Coverage Regression: completed/success; Docker E2E: completed/skipped; Unit (nightly): completed/success; Layer Boundary Bans: completed/success; Documented Clippy Allows: completed/success; Unit (stable): completed/success; Workspace Packaging: completed/success; Package Coverage (workspace-coupling): completed/success; Test (Docker) (release): completed/success; Generate Coverage Report: completed/success; Build on macos-latest (nightly): completed/success; Build on ubuntu-latest (nightly): completed/success; Docs Lint: completed/success; Build on windows-latest (nightly): completed/success; Build on macos-latest (stable): completed/success; Build on ubuntu-latest (stable): completed/success; Discover Package Coverage: completed/success; Build on windows-latest (stable): completed/success". At posting, develop is 5124c66e2.
…like the dependency in the label The label dropped every feature named like the dependency, so an explicit c = ["dep:c", "extras"] beside testing = ["dep:c"] read optional (testing), the test-only label. Drop only the shape Cargo adds on its own: the feature is exactly ["dep:key"], no other feature names dep:key, and it is not default. Co-authored-by: Copilot <[email protected]>
…el means in the report legend Co-authored-by: Copilot <[email protected]>
…mplicit feature Co-authored-by: Copilot <[email protected]>
…verification run Co-authored-by: Copilot <[email protected]>
…by its subject Co-authored-by: Copilot <[email protected]>
… 2648 Co-authored-by: Copilot <[email protected]>
da2ce7
left a comment
There was a problem hiding this comment.
Reviewed at 5d48a7d27b037a525b654bd4eb735d2dbc7dbe7f, round 2 after 04fb2e77e. Recomputed from the bytes at this head, against the merge base 5304d2379; git merge-tree against develop 4b81147e9 exits 0 with no conflicts.
APPROVE: no blocking finding remains.
F2 / audit F3: fixed by b7b1fd626; the exact singleton/no-other-direct-reference guard preserves explicit same-name features and always retains default.
F3 / audit F4: round 1's edition-2024 premise was wrong; that was this review loop's error. Credit to the maintainer for correcting it in 5e301d978: optional dependencies still get implicit features unless dep: suppresses them. No edition restriction belongs here.
F4 / audit F5: fixed by 6ae062c0d; the legend now accounts for the implicit feature.
F5 / audit F6: fixed by 2e98d2ed5; the first review's head subject matches its captured commit.
F6 / audit F7: addressed by 6b329f69a; run times and trees are named, with one new chronology nit (F9).
The three new tests deserialize metadata for an explicit same-name feature enabling more, a singleton beside another direct dependency reference, and a dependency renamed default. All three assertions fail under the old unconditional removal. Optional build edges, target-specific edges, and mixed normal/dev declarations still lack dedicated tests. A lone explicit singleton remains indistinguishable from an implicit one in this metadata.
Records: the seven rows' source/reply ids, severities and resolution subjects match the capture and history. Audit F3 correctly re-raises F2; both concern the same then-unfixed defect. All seven threads are resolved and outdated. V4's feature tables reproduce the stated labels by inspection; its dependent-package edition lines agree with the declared setup. Historical executions are not independently proved by the records. F8 concerns the audit's chronology.
Hygiene: six Conventional subjects with appropriate scopes and [#2645]; author and committer identities match. Bodies agree with the diffs. Each has an attribution footer, which no inspected tree rule forbids. Seven files changed, +276/-24. Whitespace check passes; the verbatim branch-id check prints nothing. The description's closing-keyword scan matches only issue #2645. New terminology introduces no identified dictionary gap.
The review bot's approval is supported. Its “1 resolved since last review” links its one prior outstanding thread; it is not a count of all seven threads.
Findings: F8 and F9 (Nit, non-blocking chronology corrections), inline.
Checked, no finding: transitive closure and cycle termination; strong versus weak dependency-feature references; rename-key matching; self-edge filtering in details, counts and leaves; default activation; clean integration. No compiler or network commands ran in this lane.
Checks
On the loop's compute hub at this head, against the merge base 5304d2379, the #2646 merge (receipt server-gates-sojka-465; develop has since moved to 4b81147e9, the #2649 merge): pre-commit profile gate exit 0 (94 s); linter markdown, linter cspell, linter lychee exit 0; frontmatter-validator --all: 16 errors / 4 warnings at this head and 16 / 4 at the base re-measured, the same 20 diagnostics by path and category, none in the files this PR touches; the audit validator over docs/pr-reviews/pr-2648-review/PR-REVIEW.md with the review comments and the PR's commit list captured at gate time: ok, 7 rows, 2 log entries, 0 failures. cargo test -p workspace-coupling: 43 passed, 0 failed in 6 suites at this head (the 23 edge_labels tests among them) against 20 in 5 suites at the base, measured in a separate target directory. cargo clippy -p workspace-coupling --all-targets --all-features -- -D warnings: exit 0. The tool itself, run at this head and at the base into scratch files: both exit 0, and the reports differ only in the generation stamp and the legend's lines for the new labels and the skipped self edge. On the merge of this head into develop 4b81147e9 (tree 30371b6a5), cargo test --locked -p workspace-coupling passes (43 tests). A scratch workspace at edition 2024 on the hub's cargo 1.101.0-nightly: with an optional path dependency y and testing = ["y"], cargo metadata accepts the manifest and lists y = ["dep:y"] beside testing; with testing = ["dep:y"] it lists no y feature. GitHub checks at this head at posting time: "Publish (Development): completed/skipped; Publish (Release): completed/skipped; Context: completed/success; Package Coverage Regression: completed/success; Package Coverage (workspace-coupling): completed/success; Docker E2E: completed/skipped; Unit (nightly): completed/success; Unit (stable): completed/success; Layer Boundary Bans: completed/success; Workspace Packaging: completed/success; Documented Clippy Allows: completed/success; Test (Docker) (release): completed/success; Discover Package Coverage: completed/success; Generate Coverage Report: completed/success; Build on macos-latest (nightly): completed/success; Build on macos-latest (stable): completed/success; Build on windows-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; Docs Lint: completed/success". At posting, develop is 4b81147e9.
|
ACK 5d48a7d — verified the optional-edge guard, regression assertions, review resolutions and clean merge at this head |
…ns that preceded their commits Co-authored-by: Copilot <[email protected]>
…tion claim in the audit log Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
|
ACK 1cab588 |
…ssues/closed 6b51773 docs(pr-reviews): [#2645] record the review of PR 2659 (Jose Celano) 2cc90ee docs(issues): [#2645] refresh the inventory update date after the archive repair (Jose Celano) 4b39703 chore(issues): archive closed issue #2645 spec to docs/issues/closed (Jose Celano) Pull request description: Archives the spec for issue #2645 (closed on GitHub by PR #2648) from `docs/issues/open/` to `docs/issues/closed/`. Row 8 of the #2482 EPIC. - Verified #2645 is `CLOSED` on GitHub - Updated frontmatter (`status: done`, `spec-path`, `last-updated-utc`) and the checkpoint for the archive - Repaired the live links: the #2482 EPIC row 8 (now DONE, with a Progress Log entry), the inventory row, the 2026-10-06 coupling report link and the `related-artifacts` of the PR 2648 audit and of the moved files - The #2482 Progress Log entry of 2026-10-25 06:55 and the spec checkpoint that names the drafted spec's `open/` path are historical and keep that path - Pre-commit hooks passed Related to #2645 (already closed). ACKs for top commit: josecelano: ACK 6b51773 Tree-SHA512: b54cdcf71e688a4bbd02c5257fa04541d3de925f15d967fe254efa367b92e64db6636035c20aee220661fbea077b3a656b5b0f55ff0b4f494b5ad921fffa4df1
da2ce7
left a comment
There was a problem hiding this comment.
Reviewed at 1cab588e60b8764e09268decafcad25cffc1d265 (post-merge). Recomputed from the bytes at the merged head, against the base 5304d2379; the PR merged on 2026-10-26 at 17:21:51Z as f4b221095.
Label: POST_MERGE_FINDINGS — Review requested at 2026-10-26T12:44:23Z; the PR merged before this round ran. The findings below stand at the merged head for a follow-up PR. No ACK follows a merged PR.
Change: the round-two-to-merged-head diff contains three documentation commits only: 76c00fb3b narrows the evidence note, eb113e6e5 appends the chronology correction, and 1cab588e6 adds F8/F9 and the approval-round log. The guard, labels, and tests are byte-identical to 5d48a7d27. Re-reading the full base diff exposed the explicit-singleton ambiguity below; the earlier approval is not treated as proof.
Tests: the 23 added cases exercise self-edge exclusion, direct/transitive/renamed activation, weak references, cycles, explicit same-name variants, defaults, legacy deserialization, and ordering. The feature search terminates because each nonfinal round enlarges a finite set. The explicit singleton reached through a feature alias is not covered. No build was attempted.
Records and bot: three bot reviews contain two actionable source comments and a later clean review. Agree with the transitive-activation and explicit-feature concerns; the former is repaired, and the latter has the residual case below. All nine audit source/reply pairs match captured threads, which are resolved. F9 now correctly distinguishes V1 at 08:10:01 from the implementation commit at 08:08:46. F8 preserves the original log and appends a correction without inventing a resolution timestamp, but the new 12:40 entry repeats prospective event narration. The edition-related execution claim cannot be rerun in this lane.
Hygiene and dependencies: 17 commits, 9 changed files; Conventional subjects carry issue 2645. Attribution footer lines are present and are not forbidden by the inspected convention. Relative Markdown file targets resolve. The description closes issue 2645. PR 2659 subsequently moves these records and updates live references; it does not change this code.
Findings: F10 Nit, F11 Minor.
Checked, no finding: no executable changes after round two, cycle termination, weak dependency references, self-edge filtering at both report call sites, and F9 resolution evidence.
Checks
On the loop's compute hub at the merged head, against the base 5304d2379 (receipt server-gates-sojka-488; the PR merged as f4b221095): pre-commit profile gate exit 0 (85 s); linter markdown, linter cspell, linter lychee exit 0; frontmatter-validator --all: 16 errors / 4 warnings at the merged head and 16 / 4 at the base re-measured, the same 20 diagnostics by path and category; the audit validator over docs/pr-reviews/pr-2648-review/PR-REVIEW.md with the review comments and commit list captured at gate time: ok, 9 rows, 4 log entries, 0 failures; cargo test at the merged head: workspace-coupling 43 passed, 0 failed (exit 0, 7 s; 20 at the base); cargo clippy over workspace-coupling with all targets and features and -D warnings: exit 0, 0 diagnostics. GitHub checks at this head at posting time: "Publish (Release): completed/skipped; Publish (Development): completed/skipped; Context: completed/success; Package Coverage Regression: completed/success; Package Coverage (workspace-coupling): completed/success; Docker E2E: completed/skipped; Layer Boundary Bans: completed/success; Documented Clippy Allows: completed/success; Unit (nightly): completed/success; Unit (stable): completed/success; Workspace Packaging: completed/success; Test (Docker) (release): completed/success; Discover Package Coverage: completed/success; Generate Coverage Report: completed/success; Build on windows-latest (stable): completed/success; Build on windows-latest (nightly): completed/success; Build on macos-latest (stable): completed/success; Docs Lint: completed/success; Build on ubuntu-latest (nightly): completed/success; Build on ubuntu-latest (stable): completed/success; Build on macos-latest (nightly): completed/success". At posting, develop is 968099d93.
| - 2026-10-26 12:40 UTC - The `ACK` of `da2ce7` on the head dated 07:23:00 UTC arrived with two non-blocking nit | ||
| threads, F8 and F9, and an approval review of Copilot with no finding. Both nits were checked against the tree | ||
| and `git log` and confirmed. The maintainer authorized pushing after the `ACK`. Fixed each in its own signed | ||
| commit and pushed; replied on both threads after the push. The threads are resolved after this record is |
There was a problem hiding this comment.
[Nit][F10] Append an observation after the approval-round events occur
The 12:40 entry says the threads are resolved after this record is committed and pushed, and that another review is requested. Its containing commit 1cab588e6 is at 12:41:34Z, and the captured review request is at 12:44:23Z. Thus the entry again narrates events beyond its own timestamp, the same class of error F8 just corrected. Preserve this entry and append an event-time correction, separating completed observations from planned actions; the captured final resolved states do not establish their event times.
|
|
||
| // Cargo adds the implicit feature `key = ["dep:key"]` for an optional dependency that no other | ||
| // feature names with `dep:`. It is the dependency itself, so it takes part in the search above | ||
| // but is not shown. A feature of that name that enables more, that exists beside another |
There was a problem hiding this comment.
[Minor][F11] Distinguish an explicit singleton feature from the generated shape
This re-raises the review bot's 4371273086 explicit-feature concern. With an optional dependency c and manifest features c = ["dep:c"], testing = ["c"], the search finds both c and testing, but this guard removes c: it is a singleton and no other feature directly contains dep:c. The resulting optional (testing) hides an explicitly declared production entry point. The new explicit-name tests cover extra items and a second direct dep:c reference, so both miss this alias case. Metadata alone does not encode whether this identical shape was generated; consult the manifest or conservatively retain ambiguous names and describe the limitation. Add the explicit-singleton/alias regression case. The spec's Known limits paragraph states the hiding rule for the generated shape but not this consequence, and this loop's own second round approved the guard without naming the case either; at the least, say in Known limits that an explicitly written c = ["dep:c"] is indistinguishable from the generated one and is hidden too.

Closes #2645
Row 8 of sub-EPIC #2482. After the ADR's
testingfeature, an edge that only a package'stestingfeature enables must not look like a runtime edge, and a package's path-only dev-dependency on itself must not look like coupling.Changes
workspace-couplingreads each dependency'soptionalfield and each package'sfeaturestable. An optional normal dependency is labelledoptional (<features>); one onlytestingenables isoptional (testing); one no feature enables isoptional. A required normal edge staysnormal. The label lists every feature that enables the dependency, directly or through other features (adefaultthat includestestinggivesoptional (default, testing), which is not test-only); the implicit feature Cargo adds for an optional dependency (exactly["dep:key"], no other feature namingdep:key) is not shown, an explicit feature of the same name is.docs/media/packages/dependencies-workspace-packages.mdexplain the labels.tests/edge_labels.rs, 23 tests), manual evidence, an implementation retrospective and the inventory row update.Notes for review
normal"; the completion review in the spec says so.Validation
cargo test -p workspace-coupling, the pre-commit gate on every commit andpre-push.shon the final code passed (seemanual-verification-evidence.md).