The dock's provider row opens a list of providers, and the model picker opens on the provider in use, with tab to widen it; signing in opens it on the provider just signed in to. Models go by their id unless config names them, and the model row wears its maker's mark. The guided review's guide prompt is shorter, the pull request brief shows the start of the description with the rest behind p, its commits drop the Luxe-review and Luxe-revision lines, and the weakened-gates signal is gone. luxe update reruns the installer it was installed with, in place of luxe-cli-update. The preview's FILE tab reads files the session changed outside the project, and only those. Smaller fixes: bash headers are highlighted, the preview loses a blank row, the launcher divider sits inside its frame, and the phone app's top bar is clear of iOS's blur. rustls-webpki 0.103.16 and webpki-roots 1.0.10 fix RUSTSEC-2026-0381 and RUSTSEC-2026-0382, and vite 8.3.4 fixes GHSA-587h-7wmj-h5pm, GHSA-698v-4r3x-3vcv and GHSA-r825-w8mm-5pxw.
86 lines
3.9 KiB
Rust
86 lines
3.9 KiB
Rust
use super::*;
|
|
|
|
/// A folder holding a stand-in installer script with `body`, a scratch folder, and a log path.
|
|
#[cfg(unix)]
|
|
fn stand_in(body: &str) -> (tempfile::TempDir, PathBuf, PathBuf, PathBuf) {
|
|
let dir = tempfile::tempdir().expect("tempdir");
|
|
let script = dir.path().join("installer.sh");
|
|
std::fs::write(&script, body).expect("the script");
|
|
let scratch = dir.path().join("scratch");
|
|
std::fs::create_dir(&scratch).expect("scratch");
|
|
let log = dir.path().join("logs").join("update.log");
|
|
(dir, script, scratch, log)
|
|
}
|
|
|
|
/// The script is told where to install and that `PATH` is left alone, keeps its temporary files in
|
|
/// the scratch folder, and everything it prints, stderr too, lands in the log.
|
|
#[cfg(unix)]
|
|
#[tokio::test]
|
|
async fn the_script_is_pointed_at_the_target_and_logged() {
|
|
let (_dir, script, scratch, log) = stand_in(
|
|
"echo \"dir=$LUXE_CLI_INSTALL_DIR path=$LUXE_CLI_NO_MODIFY_PATH tmp=$TMPDIR\"\n\
|
|
echo 'a warning' >&2\n",
|
|
);
|
|
let target = InstallTarget { dir: "/home/dev/.local/bin".into(), modify_path: false };
|
|
run_script(&script, &target, &scratch, &log).await.expect("the script succeeds");
|
|
|
|
let written = std::fs::read_to_string(&log).expect("the log");
|
|
let expected = format!("dir=/home/dev/.local/bin path=1 tmp={}", scratch.display());
|
|
assert!(written.contains(&expected), "{written}");
|
|
assert!(written.contains("a warning"), "stderr is kept: {written}");
|
|
assert!(written.contains("install folder: /home/dev/.local/bin"), "{written}");
|
|
assert!(written.trim_end().ends_with("exit: exit status: 0"), "{written}");
|
|
}
|
|
|
|
/// A script that fails is an error that says luxe is unchanged and where its output went.
|
|
#[cfg(unix)]
|
|
#[tokio::test]
|
|
async fn a_failed_script_names_its_log() {
|
|
let (_dir, script, scratch, log) = stand_in("echo 'could not download' >&2\nexit 3\n");
|
|
let target = InstallTarget { dir: "/tmp/bin".into(), modify_path: true };
|
|
let error = run_script(&script, &target, &scratch, &log).await.expect_err("it failed");
|
|
let message = error.to_string();
|
|
assert!(
|
|
message.contains("unchanged") && message.contains(&log.display().to_string()),
|
|
"{message}"
|
|
);
|
|
assert!(std::fs::read_to_string(&log).expect("the log").contains("could not download"));
|
|
}
|
|
|
|
/// Every temp variable either script reads points at the scratch folder. Without `TMP` and
|
|
/// `TEMP`, PowerShell's `GetTempPath` would put its folder in `%TEMP%` again.
|
|
#[test]
|
|
fn every_temp_variable_points_at_the_scratch_folder() {
|
|
let scratch = Path::new("/scratch");
|
|
let names: Vec<&str> = scratch_variables(scratch).iter().map(|(name, _)| *name).collect();
|
|
assert_eq!(names, ["TMP", "TEMP", "TMPDIR"]);
|
|
assert!(scratch_variables(scratch).iter().all(|(_, value)| *value == scratch));
|
|
}
|
|
|
|
/// The scratch folder goes, the downloaded archive and what was unpacked from it included.
|
|
#[tokio::test]
|
|
async fn the_scratch_folder_is_removed_with_everything_in_it() {
|
|
let dir = tempfile::tempdir().expect("tempdir");
|
|
let scratch = dir.path().join("luxe-update-x");
|
|
let unpacked = scratch.join("6f1b2c");
|
|
std::fs::create_dir_all(&unpacked).expect("nested");
|
|
std::fs::write(unpacked.join("luxe-cli.zip"), b"zip").expect("the archive");
|
|
remove_scratch(scratch.clone()).await;
|
|
assert!(!scratch.exists());
|
|
}
|
|
|
|
/// After an update the legacy updater beside the binary is removed, and nothing else is.
|
|
#[test]
|
|
fn the_legacy_updater_is_removed_and_nothing_else() {
|
|
let dir = tempfile::tempdir().expect("tempdir");
|
|
let exe = dir.path().join(format!("luxe{}", std::env::consts::EXE_SUFFIX));
|
|
let updater = dir.path().join(format!("{LEGACY_UPDATER}{}", std::env::consts::EXE_SUFFIX));
|
|
for path in [&exe, &updater] {
|
|
std::fs::write(path, b"").expect("a stand-in");
|
|
}
|
|
remove_legacy_updater(&exe);
|
|
assert!(!updater.exists());
|
|
assert!(exe.exists());
|
|
remove_legacy_updater(&exe);
|
|
}
|