Skip to main content

max / alloy

Point the tree-level checks at the files the split moved things to Three profile_split tests read image.rs as text to assert the builder's language, db and default choices agree with the Containerfile and with build/preflight.py; those live in image/choices.rs now. And sbin_path's guard that nothing follows a file's first `#[cfg(test)]` was right about the display and net facades, whose fixtures declaration sat above the re-exports.
Co-Authored-By
Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session
https://claude.ai/code/session_01WFBzMprSmNCfvdj2cGZyka
Author: Max Johnson <me@maxj.phd> · 2026-09-08 17:27 UTC
Signed with PGP, not checked
Commit: 961f4ad082c8f028954f7a1507de2538ebf36adc
Parent: 88fb193
4 files changed, +25 insertions, -22 deletions
@@ -141,9 +141,6 @@
141 141 mod reconcile;
142 142 mod view;
143 143
144 - #[cfg(test)]
145 - mod fixtures;
146 -
147 144 // What crosses the boundary keeps the path it had before the split. The
148 145 // installer names FILE, detect_outputs, Output, Rectangle and config_file;
149 146 // main.rs names reconcile and the screen.
@@ -158,3 +155,6 @@
158 155 // unused on the bin target alone.
159 156 #[allow(unused_imports)]
160 157 pub(crate) use model::Rectangle;
158 +
159 + #[cfg(test)]
160 + mod fixtures;
@@ -14,9 +14,9 @@
14 14 mod parse;
15 15 mod view;
16 16
17 - #[cfg(test)]
18 - mod fixtures;
19 -
20 17 pub(crate) use backend::{Backend, detect};
21 18 pub(crate) use model::{Interface, Kind, State};
22 19 pub(crate) use view::NetView;
20 +
21 + #[cfg(test)]
22 + mod fixtures;
@@ -702,7 +702,7 @@
702 702 // re-exports: the three are leaves that reference nothing above them.
703 703
704 704 #[cfg(test)]
705 - mod fixtures;
705 + mod tests;
706 706
707 707 #[cfg(test)]
708 - mod tests;
708 + mod fixtures;
@@ -246,7 +246,7 @@
246 246 /// one decision, and drift between them is a real defect, because a build that
247 247 /// bypasses the TUI has to get the stack the TUI would have asked for.
248 248 ///
249 - /// Asserted against `image.rs` as text rather than by importing it: the crate is
249 + /// Asserted against `image/choices.rs` as text rather than by importing it: the crate is
250 250 /// a binary, the test is a text check over the Containerfile in the spirit of
251 251 /// the rest of this file, and the point is that the two spellings agree.
252 252 ///
@@ -262,9 +262,10 @@
262 262 .find_map(|line| line.strip_prefix("ARG LANGS="))
263 263 .expect("no ARG LANGS in the Containerfile");
264 264
265 - let source =
266 - std::fs::read_to_string(PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("src/image.rs"))
267 - .expect("cannot read image.rs");
265 + let source = std::fs::read_to_string(
266 + PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("src/image/choices.rs"),
267 + )
268 + .expect("cannot read image/choices.rs");
268 269 // The derive is the default while there is no hand-written one, and a
269 270 // derived `BTreeSet` is empty. Scoped to `impl Default for Choices` rather
270 271 // than any `langs: BTreeSet::` line, because the tests below `Choices`
@@ -300,7 +301,7 @@
300 301
301 302 assert_eq!(
302 303 from_arg, from_builder,
303 - "ARG LANGS={arg:?} and image.rs's default disagree; they are one decision",
304 + "ARG LANGS={arg:?} and the builder's default disagree; they are one decision",
304 305 );
305 306 }
306 307
@@ -335,9 +336,10 @@
335 336 .expect("no ARG DB in the Containerfile")
336 337 .trim();
337 338
338 - let source =
339 - std::fs::read_to_string(PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("src/image.rs"))
340 - .expect("cannot read image.rs");
339 + let source = std::fs::read_to_string(
340 + PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("src/image/choices.rs"),
341 + )
342 + .expect("cannot read image/choices.rs");
341 343 assert!(
342 344 source.contains("db: Db::default()") || derives_default(&source),
343 345 "the builder does not default its db field"
@@ -350,7 +352,7 @@
350 352 .split_once("pub(crate) enum Db {")
351 353 .and_then(|(_, rest)| rest.split_once('}'))
352 354 .map(|(body, _)| body)
353 - .expect("no Db enum in image.rs");
355 + .expect("no Db enum in image/choices.rs");
354 356 let variant = body
355 357 .split_once("#[default]")
356 358 .and_then(|(_, rest)| rest.split(',').next())
@@ -391,7 +393,7 @@
391 393 /// The language whitelist lives in three files, and nothing bound them.
392 394 ///
393 395 /// The Containerfile validates `LANGS` against a `case` arm, `Lang::ALL` in
394 - /// image.rs is what the builder TUI offers, and build/preflight.py refuses a
396 + /// `image/choices.rs` is what the builder TUI offers, and build/preflight.py refuses a
395 397 /// recipe naming anything else. Adding `c` on 2026-09-07 touched the first two
396 398 /// and missed the third, and the gate caught it at mint time, after the recipe
397 399 /// was already written and a build had been asked for.
@@ -416,9 +418,10 @@
416 418 })
417 419 .expect("no LANGS case arm in the Containerfile");
418 420
419 - let image =
420 - std::fs::read_to_string(PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("src/image.rs"))
421 - .expect("cannot read image.rs");
421 + let image = std::fs::read_to_string(
422 + PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("src/image/choices.rs"),
423 + )
424 + .expect("cannot read image/choices.rs");
422 425 let from_enum: Vec<String> = image
423 426 .split_once("const ALL: [Lang;")
424 427 .and_then(|(_, rest)| rest.split_once('['))
@@ -428,7 +431,7 @@
428 431 .filter_map(|e| e.trim().strip_prefix("Lang::").map(str::to_lowercase))
429 432 .collect()
430 433 })
431 - .expect("no Lang::ALL in image.rs");
434 + .expect("no Lang::ALL in image/choices.rs");
432 435
433 436 let preflight = std::fs::read_to_string(
434 437 PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("../../build/preflight.py"),