You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Overhaul workspace-coupling report tool: replace regex scanner with syn and adopt CLI output contract #1805
Replace the regex-based import scanner in the workspace-coupling analysis tool with a syn-based Rust AST parser to correctly extract imported items from all use statement
forms, and bring the tool's CLI output into compliance with the global CLI output contract
(ADR 20260519000000_define_global_cli_output_contract) by replacing plain-text eprintln!
calls with structured JSON NDJSON records on stderr.
Background
The workspace-coupling tool uses a regex to extract imports:
This regex misses at minimum two legitimate patterns:
Brace-import groups: use torrust_tracker_contrib_bencode::{BMutAccess, ben_int, ben_map}
Re-export statements: pub use bittorrent_peer_id::{PeerClient, PeerId}
This causes six confirmed false-negative "Items not extracted" entries in the coupling report.
Patching the regex would leave the tool fragile; replacing it with syn AST parsing handles all
valid use forms by construction.
Additionally, the tool's eprintln! calls violate ADR 20260519000000_define_global_cli_output_contract
(section 1: all stderr records must be JSON NDJSON). The migration policy (section 10) requires
migration when the file is substantially touched — this rewrite qualifies.
The tool also has no tests. As part of this overhaul, unit tests (for a pure parse_imports_from_source function) and integration tests (via std::process::Command against
a fixture workspace) will be added, following TDD order.
Spec
Full specification: docs/issues/open/ (see spec file for this issue number).
Implemented in #1948 - replaces the regex import scan with a syn AST parse moved into a unit-testable lib.rs, adds NDJSON output, and keeps coverage for root aliases and macro-embedded dependency paths that a naive visitor would miss.
Implemented in #1948 - replaces the regex import scan with a syn AST parse moved into a unit-testable lib.rs, adds NDJSON output, and keeps coverage for root aliases and macro-embedded dependency paths that a naive visitor would miss.
Activity
docs(issues): add issue specifications for torrust#1804 and torrust#1805
Merge #1806: docs(issues): add issue specifications for #1804 and #1805
mvanhorn commentedon Jun 26, 2026
Implemented in #1948 - replaces the regex import scan with a
synAST parse moved into a unit-testablelib.rs, adds NDJSON output, and keeps coverage for root aliases and macro-embedded dependency paths that a naive visitor would miss.josecelano commentedon Jun 26, 2026
Thanks @mvanhorn! I will review the PR soon.
Merge torrust#1948: refactor(workspace-coupling): parse imports with …
chore(issues): archive closed issue torrust#1805 spec to docs/issues/…
Merge #1952: chore(issues): archive closed issue #1805 spec to docs/i…