diff --git a/.github/workflows/studio-tauri-smoke.yml b/.github/workflows/studio-tauri-smoke.yml index 8e26b9fd0c..c6dad07f37 100644 --- a/.github/workflows/studio-tauri-smoke.yml +++ b/.github/workflows/studio-tauri-smoke.yml @@ -91,6 +91,16 @@ jobs: npm run build test -f dist/index.html + # The crate carries ~100 unit tests (native_file_dialogs, preflight, + # install, desktop_auth, ...) that nothing ran until now: this workflow + # only ever built. Run them here, where the toolchain and the WebKit dev + # packages are already installed, so a broken assertion fails the PR + # instead of sitting unnoticed. `--no-fail-fast` reports every failing + # test in one run rather than stopping at the first. + - name: Rust unit tests (studio/src-tauri) + working-directory: studio/src-tauri + run: cargo test --no-fail-fast + - name: Tauri debug build (Linux, no bundle, no codesign) # `--debug` + `--no-bundle` keeps this lean: compiles the Rust crate, # confirms the frontend dist is wired into Tauri, but skips the AppImage diff --git a/studio/src-tauri/src/native_file_dialogs.rs b/studio/src-tauri/src/native_file_dialogs.rs index 0b46f81f49..4ad0e5023e 100644 --- a/studio/src-tauri/src/native_file_dialogs.rs +++ b/studio/src-tauri/src/native_file_dialogs.rs @@ -335,7 +335,13 @@ mod tests { let path = std::env::temp_dir().join(OsString::from_vec(vec![ b'u', b'n', b's', b'l', b'o', b't', b'h', 0xff, b'.', b'c', b's', b'v', ])); - fs::write(&path, "role,content\nuser,hello\n").unwrap(); + // Linux happily stores arbitrary bytes in a filename, but macOS enforces + // UTF-8 on APFS/HFS+ and rejects this name outright. The name-recovery + // path being asserted here is only reachable where such a file can + // exist, so skip rather than fail on filesystems that forbid it. + if fs::write(&path, "role,content\nuser,hello\n").is_err() { + return; + } let imported = read_selected_import(Some(path.clone())).unwrap().unwrap(); assert_eq!(imported.name, "chat-import.csv"); let _ = fs::remove_file(path); diff --git a/studio/src-tauri/src/preflight/managed.rs b/studio/src-tauri/src/preflight/managed.rs index 0d67a1c3e6..276ca05f5f 100644 --- a/studio/src-tauri/src/preflight/managed.rs +++ b/studio/src-tauri/src/preflight/managed.rs @@ -704,7 +704,15 @@ mod tests { fs::write(venv.join("pyvenv.cfg"), "home = /usr/bin\n").unwrap(); fs::write(venv.join("unsloth_install_manifest.json"), "{}").unwrap(); - let site_packages = venv.join("lib").join("python3.11").join("site-packages"); + // site_packages_dirs() only walks lib//site-packages on unix; on + // Windows it looks at Lib/site-packages. Building the posix layout + // everywhere left the dist-info invisible to the fingerprint on Windows, + // so removing it changed nothing and the assert_ne below could not hold. + let site_packages = if cfg!(windows) { + venv.join("Lib").join("site-packages") + } else { + venv.join("lib").join("python3.11").join("site-packages") + }; fs::create_dir_all(site_packages.join("unsloth_cli").join("commands")).unwrap(); fs::write( site_packages