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
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).
Goal
Replace the regex-based import scanner in the
workspace-couplinganalysis tool with asyn-based Rust AST parser to correctly extract imported items from allusestatementforms, 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-texteprintln!calls with structured JSON NDJSON records on stderr.
Background
The
workspace-couplingtool uses a regex to extract imports:This regex misses at minimum two legitimate patterns:
use torrust_tracker_contrib_bencode::{BMutAccess, ben_int, ben_map}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
synAST parsing handles allvalid
useforms by construction.Additionally, the tool's
eprintln!calls violate ADR20260519000000_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_sourcefunction) and integration tests (viastd::process::Commandagainsta fixture workspace) will be added, following TDD order.
Spec
Full specification:
docs/issues/open/(see spec file for this issue number).Related
cargo machete --with-metadataand unused dev dep removal