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
[bug] master red: tri mods orphan reads a one-line #[path] .. mod x; as a path for the NEXT mod (renum.rs reported orphaned since #10819) #10936
The check "Every source file is reachable from its crate root" (tri mods orphan --gate) is red on master since #10819 (mine, lane B1 of #10522): it reports cli/tri/src/renum.rs orphaned ("26 #[test] that cargo cannot see"), although mod renum; is declared in cli/tri/src/main.rs.
Cause
edges_from in cli/tri/src/modreach.rs reads cli/tri/src/main.rs line by line: a line that starts with #[path = "..."] stores the path and skips the REST OF THE LINE. #10819 wrote the SPICE and Zig mounts in the valid one-line form #[path = ".."] #[allow(..)] mod spice; // .. (to keep the hand-line budget at zero), so mod spice; and mod zig; are never seen, and the stored path is applied to the next line's mod renum; -- renum is "reached" as zig_convert.rs and renum.rs counts as orphaned.
Fix
After a #[path] attribute, read a mod declaration in the rest of the same line (after the last ], before a // comment). The existing test a_path_attribute_does_not_carry_to_a_later_unrelated_mod gets the one-line form in its fixture and an assert on the same-line mod; it fails on the old parser. Hand lines net <= 0 (the include! branch is written as one statement).
Given a source file contains a one-line #[path = ".."] mod zig; declaration followed by mod renum; on the next line, When tri mods orphan --gate runs, Then renum.rs is recognized as reachable and not reported as orphaned.
Given the existing test a_path_attribute_does_not_carry_to_a_later_unrelated_mod is updated with a one-line #[path] fixture, When the test suite executes, Then the test passes confirming the same-line mod is parsed and the path does not leak to the next declaration.
Requirements
FR-001: The parser in cli/tri/src/modreach.rs MUST detect a mod declaration on the same line after a #[path = "..."] attribute (after the last ] and before any // comment) and apply the path to that module.
FR-002: The stored path from a #[path] attribute MUST NOT be applied to a subsequent line's mod declaration when the attribute line already contains its own mod.
FR-003: The fix MUST keep the hand-line budget at zero (the include! branch written as one statement) and MUST NOT modify any file other than cli/tri/src/modreach.rs.
Success Criteria
cargo test -p tri a_path_attribute_does_not_carry_to_a_later_unrelated_mod exits 0
cargo run -p tri -- mods orphan --gate exits 0 and reports 0 orphaned files (previously reported cli/tri/src/renum.rs)
Closed by the issue-shape gate (specs/policy/issue_shape.t27, #7498): an issue must have the template's sections. Edit the body; an edit that passes reopens it.
missing: ## User Scenarios -- at least one Given/When/Then scenario
missing: ## Requirements -- numbered obligations, FR-001: ... MUST ...
missing: ## Success Criteria -- an outcome a machine can settle: a number with a unit, a backticked file, exit 0, or a backticked command
Activity
github-actions commentedon Oct 19, 2026
Closed by the issue-shape gate (specs/policy/issue_shape.t27, #7498): an issue must have the template's sections. Edit the body; an edit that passes reopens it.
FR-001: ... MUST ...exit 0, or a backticked commandtri mods orphan: a one-line #[path = ..] .. mod x; binds its own mod,…