Skip to content

Milestone 365: xtask in modules, taken while the board is thin - #1001

Merged
calef merged 8 commits into
mainfrom
milestone/365-xtask-in-modules
Sep 20, 2026
Merged

calef merged 8 commits into
mainfrom
milestone/365-xtask-in-modules

Conversation

@calef

@calef calef commented Sep 19, 2026

Copy link
Copy Markdown
Collaborator

Lane: milestone/365-xtask-in-modules, written by an agent; calef's account is the author GitHub shows.

Milestone 365. xtask/src/main.rs was 11,124 lines with no module structure, and one of the three merge hotspots every lane wires its test into. It is now 19 modules plus a 294-line dispatcher, split along the seams the file already had, which are the commands. Base 638b6bfee83b2f17e5cef97178332fa92537ef39.

The layout, and what lost

The largest file is now shell_check.rs at 1,866 lines; the smallest is host.rs at 130. The four places where something other than "one module per command" won:

  • Shared machinery got a module when it is a thing, not when it is leftovers. scanout.rs, inbound.rs and measure.rs are instruments several commands use, each named for what it does. A common.rs would have been a second hotspot wearing a new name.
  • host.rs is the residue, deliberately small: cargo, run, capture, llvm_tool, workspace_root, bin_elf, flag_value. Named for what it holds rather than for the fact of being shared, which is what keeps it from growing into a common.
  • The soak and the job mix left the board. They share a recogniser with board-console and run under QEMU, never touching a board, so they are soak.rs.
  • The tests went with the code they test, not into a tests.rs, which would have been a fourth hotspot.

initrd_aarch64 is the only thing that moved out of file order, to sit with the two packers it is a sibling of.

The evidence that behaviour did not change

  • The move is provably a move. Every non-blank line of the original, ignoring use lines and the pub(crate) prefixes the split forced, appears in the new files: zero missing, and the only additions are the module doc comments and the mod tests wrappers.
  • script/fastpath-footprint is byte-identical on all three ISAs, before and after, down to the per-symbol totals.
  • cargo xtask <unknown> prints the same usage text byte for byte, which is the one output naming every subcommand and flag.
  • The 21 host tests are the same 21 by name.

Milestone 130's refused kernel_main split is why that list exists rather than a claim it was unneeded. xtask is a host binary compiled in one configuration with no cfg-gated early park, so the compiler really does verify this split completely.

Three things it broke, all build errors

script/lint's host-pass check read xtask/src/main.rs by name for the bare-metal exclusion list (it reads every xtask/src/*.rs now); three intra-doc links stopped resolving across files; and a banner lifted from // to //! became documentation that clippy's doc_markdown then had an opinion about.

Eighteen citations in notes/ and script/ that direct a reader at a symbol were repointed at its module, one at a time against the symbol rather than by a sweep. Seven that describe the past were left alone.

Gates, all from this worktree

gate exit
script/lint 0
script/names (refusals unchanged) 0
cargo test -p xtask (21 passed) 0
script/test (aarch64, riscv64, x86_64/OVMF) 0
script/shell-check (all three architectures) 0
script/shell-check --graphical 0
script/shell-check --graphical-serial 0
script/boot-check 0
script/bench --check 0
script/icount 0
script/fastpath-footprint (byte-identical) 0

This lane took the machine-global nife-dev link, as every gating lane does.

Commits

The split is its own commit and does not build on its own, by construction: a reviewer can read it as "these lines went there" with no visibility change or import line in the way. The next commit is the fixups the compiler then demanded.

🤖 Generated with Claude Code

https://claude.ai/code/session_01STu3VeDYnEHem3iKCbzBF2

calef and others added 7 commits September 19, 2026 15:58
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01STu3VeDYnEHem3iKCbzBF2
`xtask/src/main.rs` was 11,124 lines with no module structure, one of the
three files every lane edits to wire a test, and past the size at which a
file gets read. Milestone 365.

This commit is the move and nothing else: every line leaves main.rs and
arrives verbatim in a module file, along the seams the file already had,
which are the commands. No line is rewritten, no function is renamed, and
nothing is reordered except `initrd_aarch64`, which joins the two archive
packers it is a sibling of instead of sitting between the UEFI image and
the disks.

**It does not build on its own, by construction**, and that is the point
of keeping it separate: a reviewer can read this diff as "these lines went
there" without a visibility change or an import line in the way. The next
commit is the fixups the compiler then demands, and nothing else.

The module doc comments are the section banners the file already carried,
lifted from `//` to `//!` where there was one, and written where there was
not.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01STu3VeDYnEHem3iKCbzBF2
What the compiler asked for after the move, and nothing more: a `use`
line per name a module now reaches across a boundary for, `pub(crate)` on
exactly the items reached (the set is computed from those `use` lines, so
an item used only inside its own module stayed private), `stick.rs`'s
`use super::{..}` repointed at the modules its imports moved to, and the
`std::path` import the archive tests need in their own scope.

Nothing else changed. Every subcommand keeps its name, flags, environment
variables, output text and exit code; `cargo xtask` with an unknown
command prints the same usage byte for byte, and the 21 host tests are the
same 21, moved to the module each one tests.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01STu3VeDYnEHem3iKCbzBF2
`script/lint`'s host-pass check read `xtask/src/main.rs` by name for the
bare-metal exclusion list, which now lives in the module that runs the
host pass. It reads every `xtask/src/*.rs` instead, which is what the
check always meant: the list exists somewhere in xtask.

Three intra-doc links and one `NIFE_GPU_MON` in a doc comment broke the
same way, because a `[`run`]` that resolved inside one file does not
resolve across two, and a section banner lifted to `//!` is documentation
where `//` was not. Qualified, and backticked.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01STu3VeDYnEHem3iKCbzBF2
The module layout, the four places where something other than "one module
per command" won, the evidence that behaviour did not change, and the
three things the split broke (all of them build errors, which is the
failure mode milestone 130's refused `kernel_main` split is the precedent
for). BUGS records that the nineteen module names are provisional and that
`shell_check.rs` is still 1,866 lines.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01STu3VeDYnEHem3iKCbzBF2
Eighteen places name a function in `xtask/src/main.rs` as the place to go
read something: `boot_claim`, `SHELL_CHECK_SCRIPT`, `ABORTS_ACCEPTED`,
`DOC_BUNDLES`, `bench_x86`, the scanout decoders, the host-load sampler,
the excluded-crate list. Each now names the module that holds it. Done one
at a time against the symbol, not by a sweep: this tree has a scar from a
blind `sed` that rewrote the record of a name's refusal.

Seven references are deliberately left alone, because they describe the
past rather than direct a reader: a captured tool transcript in
notes/documentation-audit.md, a struck-through closed row, the SMB prober
that no longer exists in xtask, and two observations about which file the
commit ranking used to put on top.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01STu3VeDYnEHem3iKCbzBF2
What `script/lint`'s roadmap check asks of a BUILT block: the date the
index's Built column is generated from, a Follow-on saying what happened
to the work this named, and no gate line, since nothing gates work that is
finished.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01STu3VeDYnEHem3iKCbzBF2
@calef
calef marked this pull request as ready for review September 19, 2026 23:34
@calef

calef commented Sep 19, 2026

Copy link
Copy Markdown
Collaborator Author

merge-drain: STALLED. #1001 has conflicts a person must resolve (Milestone 365: xtask in modules, taken while the board is thin)

…part

The conflict this milestone's block predicted, resolved the way it says
to: not line by line, but by moving each upstream hunk into the module the
code now lives in. `--board` and the deferred `--until` went to
`board.rs`, `stage_words` beside `parse_stage` there, the sweep's watch
policy and `XENON` profile to `soak.rs`, and `boot_check_leg`'s empty
prologue to `boot_check.rs`.

Checked the same way the split was: every non-blank line of `main.rs` as
`origin/main` has it appears in the merged modules, bar the five this
branch deliberately edited (three intra-doc links and one backticked
`NIFE_GPU_MON`).

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01STu3VeDYnEHem3iKCbzBF2
@calef
calef enabled auto-merge September 19, 2026 23:40
@calef
calef added this pull request to the merge queue Sep 19, 2026
Merged via the queue into main with commit daa6f4b Sep 20, 2026
20 checks passed
@calef
calef deleted the milestone/365-xtask-in-modules branch September 20, 2026 00:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant