Move device discovery and the display helpers out of the CLI module #17

Merged
wokoman merged 1 commit from refactor/split-cli-helpers into main 2026-08-28 20:07:36 +02:00
Owner

Device discovery and the terminal-formatting helpers move out of the command-line module. No behaviour changes.

The seam pointed backwards. The browser imported fit, plural and duration from cli.rs, and fit's own documentation explains itself in terms of a browser pane being squeezed flat — a helper documented in terms of the caller that supposedly does not own it. Meanwhile device discovery, the one piece of real domain logic in that file, was private, so the browser could only reach it indirectly.

device.rs holds mountpoint resolution and the volume scan; display.rs holds the three formatters. Their tests move with them. cli.rs goes from 700 to 624 lines and keeps argument parsing and printing, which is what it is for.

This reopens a recorded decision, which is why the ticket asked for a call before an implementation. SPEC.md settled on "one file, not the module tree sketched above", on the stated premise of ~600 lines that only ever change together. That premise was about the browser module, which is now over 2,000 lines, so the finding stopped covering everything it was being cited for. It is updated rather than deleted: still one file for the browser, but a seam pointing the wrong way is not a module tree. The audio-file walker the browser also imports stays in cli.rs deliberately — #8 decides where the copy pre-flight lives, and moving it twice would be churn.

65 unit tests pass, cargo clippy --all-targets clean.

One thing to flag rather than fix: the relocated device-discovery test builds its scratch directory at a fixed path, ironpod-detect-test, with no PID suffix, unlike every other temp-using test in the repo. One run failed immediately after the move and three runs since have passed; I could not reproduce it and am not claiming the shared path was the cause, but it is the one real hazard in that test and it is worth hardening the next time someone is in there. Left alone here because this PR is meant to relocate code, not change it.

Closes #10.

Device discovery and the terminal-formatting helpers move out of the command-line module. No behaviour changes. The seam pointed backwards. The browser imported `fit`, `plural` and `duration` from `cli.rs`, and `fit`'s own documentation explains itself in terms of a browser pane being squeezed flat — a helper documented in terms of the caller that supposedly does not own it. Meanwhile device discovery, the one piece of real domain logic in that file, was private, so the browser could only reach it indirectly. `device.rs` holds mountpoint resolution and the volume scan; `display.rs` holds the three formatters. Their tests move with them. `cli.rs` goes from 700 to 624 lines and keeps argument parsing and printing, which is what it is for. **This reopens a recorded decision, which is why the ticket asked for a call before an implementation.** `SPEC.md` settled on "one file, not the module tree sketched above", on the stated premise of ~600 lines that only ever change together. That premise was about the browser module, which is now over 2,000 lines, so the finding stopped covering everything it was being cited for. It is updated rather than deleted: still one file for the browser, but a seam pointing the wrong way is not a module tree. The audio-file walker the browser also imports stays in `cli.rs` deliberately — #8 decides where the copy pre-flight lives, and moving it twice would be churn. 65 unit tests pass, `cargo clippy --all-targets` clean. One thing to flag rather than fix: the relocated device-discovery test builds its scratch directory at a fixed path, `ironpod-detect-test`, with no PID suffix, unlike every other temp-using test in the repo. One run failed immediately after the move and three runs since have passed; I could not reproduce it and am not claiming the shared path was the cause, but it is the one real hazard in that test and it is worth hardening the next time someone is in there. Left alone here because this PR is meant to relocate code, not change it. Closes #10.
The browser imported its formatting helpers from the command line, one of
which documented itself in terms of a browser pane, while device discovery
sat private in the same file and could only be reached indirectly.

Closes #10.
wokoman deleted branch refactor/split-cli-helpers 2026-08-28 20:07:36 +02:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
wokoman/ironpod!17
No description provided.