From d7464f20edfef63deabe3cb272d9e92cf57f6c80 Mon Sep 17 00:00:00 2001 From: "autocraft-bot[bot]" <354215646+autocraft-bot[bot]@users.noreply.github.com> Date: Mon, 30 Nov 2026 17:13:35 -0500 Subject: [PATCH] Default branch is red: `test mapped_crates_have_no_findings` (#4479) * Default branch is red: `test mapped_crates_have_no_findings` * All three failures were mistakes in the tests, so only test code changed All three failures were mistakes in the tests, so only test code changed. On macOS, `a_row_announces_the_letter_it_has_among_all_its_siblings` used the host's OS, and Mac menus have no access letters by design; it now sets the fixture to Linux. On macOS, `a_guide_dragged_under_the_centre_readout_...` held Control before pressing, which is a secondary click there; Control now goes down after the press and still turns snapping off during the drag. On Windows, `allows_windows_single_instance_socket_...` bound a socket under a long, canonicalised temp path that exceeded the socket path limit; it now uses a short directory under the temp directory, without canonicalising it. No assertion changed. Both macOS failures reproduced here at the logged lines with the fixture forced to macOS. With the fix, all 14 guides tests passed under that forced setting. On Linux, the tests of craft-ui-widgets, craft-ui-canvas and craft-nightly passed, clippy with -D warnings passed on those three crates, and cargo fmt --check passed. `mapped_crates_have_no_findings` also passes on this tree. Nothing ran on real macOS or Windows. The Windows test and its new directory code were not compiled here, because no Windows target is installed. The logged run stopped at the socket bind, so the log does not show whether the later assertions pass on Windows, including the validator connecting through the `\\?\` form of the path. --------- Co-authored-by: autocraft-bot[bot] <354215646+autocraft-bot[bot]@users.noreply.github.com> --- crates/nightly/src/validate.rs | 10 +++++++--- crates/ui-canvas/tests/it/canvas_controls/guides.rs | 3 ++- crates/ui-widgets/tests/it/menu/steady_pass.rs | 4 +++- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/crates/nightly/src/validate.rs b/crates/nightly/src/validate.rs index 99e832942b..008e9a6520 100644 --- a/crates/nightly/src/validate.rs +++ b/crates/nightly/src/validate.rs @@ -591,10 +591,14 @@ mod tests { Self { path } } - #[cfg(unix)] + #[cfg(any(unix, windows))] fn new_short(label: &str) -> Self { - // macOS limits Unix socket sun_path to 104 bytes; /tmp stays well under that limit. + // A Unix socket's sun_path holds 104 bytes on macOS and 108 on Windows. /tmp stays well under that limit. + #[cfg(unix)] let base = fs::canonicalize(Path::new("/tmp")).unwrap_or_else(|_| PathBuf::from("/tmp")); + // Not canonicalised: that adds the `\\?\` prefix to the path the test binds. + #[cfg(windows)] + let base = std::env::temp_dir(); let id = TEST_DIR_COUNTER.fetch_add(1, Ordering::Relaxed); let path = base.join(format!("cn-{label}-{}-{id}", std::process::id())); fs::create_dir_all(&path).expect("create short temp test dir"); @@ -867,7 +871,7 @@ mod tests { #[cfg(windows)] #[test] fn allows_windows_single_instance_socket_live_and_stale_and_rejects_elsewhere() { - let tmp = TempDir::new("wsock"); + let tmp = TempDir::new_short("w"); let home = tmp.path().join("h"); let profile = tmp.path().join("p"); let single_instance = profile.join("single-instance"); diff --git a/crates/ui-canvas/tests/it/canvas_controls/guides.rs b/crates/ui-canvas/tests/it/canvas_controls/guides.rs index d010888bfa..83f7315460 100644 --- a/crates/ui-canvas/tests/it/canvas_controls/guides.rs +++ b/crates/ui-canvas/tests/it/canvas_controls/guides.rs @@ -193,7 +193,6 @@ fn a_guide_dragged_under_the_centre_readout_names_its_side_and_its_distance_from let initial = if along == Axis::Y { 200.0 } else { 180.0 }; let guides: Shared> = Rc::new(RefCell::new(if pending { Vec::new() } else { vec![guide(1, along, initial)] })); let (mut fixture, words) = ruled_with(1.0, &guides, mode, bounds, twice); - fixture.fixture().hold(Modifiers::CTRL); let before: Vec = fixture.fixture().texts().iter().map(|run| run.text.clone()).collect(); let from = if pending { let room = fixture.canvas().rect; @@ -206,6 +205,8 @@ fn a_guide_dragged_under_the_centre_readout_names_its_side_and_its_distance_from let to = if along == Axis::Y { pos2(position, 300.0) } else { pos2(450.0, position) }; fixture.fixture().frame(vec![pointer::moved(from)]); fixture.fixture().frame(vec![pointer::press(from)]); + // Control turns snapping off. It goes down after the press: on macOS a Control press is a secondary click. + fixture.fixture().hold(Modifiers::CTRL); fixture.fixture().frame(vec![pointer::moved(from.lerp(to, 0.5))]); fixture.fixture().frame(vec![pointer::moved(to)]); let painted: Vec = diff --git a/crates/ui-widgets/tests/it/menu/steady_pass.rs b/crates/ui-widgets/tests/it/menu/steady_pass.rs index f76801a013..6789e251f5 100644 --- a/crates/ui-widgets/tests/it/menu/steady_pass.rs +++ b/crates/ui-widgets/tests/it/menu/steady_pass.rs @@ -1,6 +1,7 @@ //! An open menu in a pass with no measuring run, where each row registers with its level as the row runs: the letter //! each row announces, and how often a row's shortcut is measured. +use craft_host::target::Os; use craft_ui::contract::{Bind, Props as _, Show as _, ShowContainer as _}; use craft_ui::menu::{Menu, MenuItem}; use craft_ui::testing::{Fixture, last_pass_measure_asks, last_pass_measuring_runs, trial}; @@ -16,7 +17,8 @@ fn a_row_announces_the_letter_it_has_among_all_its_siblings() { MenuItem::new("&Select All").show(ui); }); }); - fixture.settle(); + // A Mac menu has no access letters. + fixture.os(Os::Linux).settle(); for frame in 0..3 { let key = |fixture: &Fixture, label: &str| { let row = fixture.by_label(label).expect("the menu shows the row");