Skip to content

Commit 7bb3166

Browse files
fix: close the two formatter blind spots that hid 34 files from cargo fmt (#10565)
* fix(cli): declare ops command modules literally so rustfmt can see them `macro_rules! register_ops_command_modules` expanded the fifteen ops-family `pub mod` declarations out of the `ops_command_descriptors!` table. rustfmt resolves the module tree by parsing and does not expand macros, so those fifteen modules -- and everything reachable only through them -- were modules `cargo fmt --all` never learned existed. Probe: append `fn __fmt_probe(){let x=1;}` to every .rs file in the repo and run `cargo fmt --all`. 1775 of 1819 files get reformatted; the probe survives verbatim in 44. Thirty-three of those 44 are these fifteen subtrees plus the four tests/commands/*.rs files `#[path]`-mounted only from inside them. Replacing the macro consumer with literal `pub mod` lines makes all 33 visible. It weakens nothing: each descriptor row's `$handler` names `crate::commands::<module>::run`, so a row whose module is undeclared is a compile error, not a silent skip. Formatting drift the macro was hiding is swept in the next commit, kept separate so this structural change stays reviewable. Refs #10298 * style(cli): sweep formatting drift the ops-module macro was hiding Pure `cargo fmt --all` output, no hand edits. These ten files were unreachable from rustfmt's module tree until the previous commit, so `cargo fmt --all --check` passed on main while 36 diff blocks of drift sat in them. Per file (rustfmt diff blocks): daemon.rs 11, deploy.rs 9, ssh.rs 3, status/mod.rs 3, triage.rs 3, logs.rs 2, schedule.rs 2, status/git_cache.rs 1, status/types.rs 1, upgrade.rs 1. Every hunk is line wrapping, block re-indentation, or `use` sorting. Refs #10298 * fix(paths): pin formatter reachability, and close the two blind spots that hid modules rustfmt resolves the module tree by parsing and never expands macros. Two mechanisms in this workspace therefore produced modules that compiled, ran their tests, and were never formatted: 1. `macro_rules!` module declaration -- fixed in the previous commits. 2. `include!("runtime_helper/tests.rs")` in homeboy-extension, hiding a 1,073-line test file with five diff blocks of drift. Replaced with `#[path]`, which produces the identical module (`runtime_helper::tests`, same `super`) and which rustfmt does follow. `formatter_visibility` in homeboy-paths fails closed on both, plus the weaker property they are instances of: every checked-in source file must be reachable from a cargo target root through declarations rustfmt can follow. Modelled on `workspace_membership_is_complete`, added for the analogous `--workspace` blind spot in #10550. The walk reproduces rustc's module resolution -- mod-rs vs non-mod-rs directory ownership, inline `mod x { .. }` nesting, and the rule that a `#[path]`-loaded file resolves its own children in its own directory. It was validated against ground truth from the probe: run against origin/main it reports exactly the 37 non-fixture files `cargo fmt --all` skips, and against this branch exactly the two remaining orphans. It fails open on ambiguity -- a `mod` whose target file does not exist is ignored -- so it cannot go spuriously red. Also removed here: - `commands/agent_task/args/{fanout,lifecycle}.rs`: stale duplicates left behind when these types moved to `args/definitions/`. In no module tree, so rustc never compiled them and the divergence from the live copies was invisible. Absent from the audit baseline, so deleting them is inert. - The redundant `#[path]` on `defaults::builtins` and `engine::temp::implementation::storage`. Both named the exact file a plain `mod` already resolves to. Two orphans are listed in KNOWN_ORPHANS rather than fixed: `homeboy-code-audit/src/structural_tests.rs` (that crate is being restructured under #10557/#10558) and `tests/core/refactor/decompose_test.rs` (carried in the homeboy.json audit baseline as a VacuousTest finding -- the audit corpus walks the filesystem, so it reports on a file rustc never compiles; removing it needs a baseline edit). Refs #10298 * style(extension): sweep formatting drift the include! was hiding Pure `cargo fmt --all` output. Five rustfmt diff blocks in the 1,073-line runtime_helper test file, which only became reachable from the module tree when its `include!` became a `#[path]` in the previous commit. Refs #10298 --------- Co-authored-by: chubes-bot <266378653+homeboy-ci[bot]@users.noreply.github.com>
1 parent 493a98c commit 7bb3166

19 files changed

Lines changed: 885 additions & 395 deletions

File tree

crates/homeboy-cli/src/command_contract/descriptors.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,16 @@
33
/// Expands the Ops command descriptors into a consumer macro.
44
///
55
/// Each row binds a command module to its parsed Clap variant and JSON handler.
6-
/// That is the whole descriptor: module registration and JSON dispatch are the
7-
/// only two things a `Commands` variant needs from this table.
6+
///
7+
/// This table does **not** declare the command modules. It used to: a
8+
/// `register_ops_command_modules!` consumer expanded `$(pub mod $module;)*`.
9+
/// rustfmt resolves the module tree by parsing and does not expand
10+
/// `macro_rules!`, so every module declared that way was invisible to
11+
/// `cargo fmt --all` -- fifteen subtrees, 33 files, drifting unformatted. The
12+
/// declarations now live as literal `pub mod` lines in `commands/mod.rs`.
13+
/// Removing them from here cost no safety: `$handler` names
14+
/// `crate::commands::<module>::run`, so a row without a declared module does
15+
/// not compile.
816
///
917
/// Contract metadata (a `CommandSpec`) is deliberately **not** a column here. It
1018
/// lives once, in [`ops_command_spec`], because `spec.rs` splices the ops rows

crates/homeboy-cli/src/commands/agent_task/args/fanout.rs

Lines changed: 0 additions & 166 deletions
This file was deleted.

crates/homeboy-cli/src/commands/agent_task/args/lifecycle.rs

Lines changed: 0 additions & 106 deletions
This file was deleted.

0 commit comments

Comments
 (0)