diff --git a/crates/update/src/lib.rs b/crates/update/src/lib.rs index d698dbe58..067653bbd 100644 --- a/crates/update/src/lib.rs +++ b/crates/update/src/lib.rs @@ -1248,10 +1248,11 @@ fn on_cloud() -> bool { on_cloud_platform(std::env::var("ZERON_DEVICE_PLATFORM").ok().as_deref()) } -/// Release files a Cloud machine never runs: the desktop app's background -/// engine (78 MB). A Cloud machine runs `zeron headless`, which links the -/// engine, and its disk is copied back in on every wake. -pub const CLOUD_UNUSED_FILES: &[&str] = &["zeron-engine"]; +/// Release files a Cloud machine never runs: none. (`zeron-engine` was here +/// until 2026-11-15, when `zeron headless` linked the engine. Since 0.3.0 the +/// release's `zeron` is the zgx app, whose `zeron headless` runs the +/// `zeron-engine` beside it: a machine without it never came online.) +pub const CLOUD_UNUSED_FILES: &[&str] = &[]; /// Remove [`CLOUD_UNUSED_FILES`] from the version folder `dir`. pub fn strip_cloud_unused(dir: &Path) { @@ -3692,9 +3693,11 @@ mod tests { assert_eq!(folders(&app_root), ["0.2.10", "0.2.11", "0.2.12", "current"]); } + /// `zeron headless` runs the `zeron-engine` beside it: a Cloud machine + /// keeps it in every version (it once left it out, and never came online). #[cfg(unix)] #[test] - fn a_cloud_machine_keeps_no_desktop_engine() { + fn a_cloud_machine_keeps_the_engine_its_headless_runs() { let tmp = tempfile::tempdir().unwrap(); let app_root = tmp.path().join("app"); versions_installed(&app_root, &["0.2.10", "0.2.11"]); @@ -3708,7 +3711,7 @@ mod tests { strip_unused_from_versions(&app_root); for ver in ["0.2.10", "0.2.11"] { - assert!(!app_root.join(ver).join("zeron-engine").exists(), "{ver}"); + assert!(app_root.join(ver).join("zeron-engine").exists(), "{ver}"); assert!(app_root.join(ver).join("zeron").exists(), "{ver}"); } assert!(app_root.join("notes").join("zeron-engine").exists()); @@ -4169,11 +4172,11 @@ mod tests { assert!(staged.join("zeron").is_file()); } - /// The release carries the desktop's background engine; a Cloud machine - /// stages the release without it, anywhere else keeps it. + /// The release carries `zeron-engine`, which `zeron headless` runs: a + /// Cloud machine stages it as anywhere else does. #[cfg(unix)] #[tokio::test] - async fn a_cloud_machine_stages_a_release_without_the_desktop_engine() { + async fn a_cloud_machine_stages_a_release_with_its_engine() { let tmp = tempfile::tempdir().unwrap(); let pkg = tmp.path().join("pkg"); std::fs::create_dir_all(pkg.join("zeron-pkg")).unwrap(); @@ -4190,7 +4193,7 @@ mod tests { .into(), ..Manifest::default() }; - for (cloud, kept) in [(true, false), (false, true)] { + for (cloud, kept) in [(true, true), (false, true)] { let app_root = tmp.path().join(format!("app-{cloud}")); std::fs::create_dir_all(&app_root).unwrap(); let (base, server) = serve_forever(bytes.clone()).await; diff --git a/crates/update/tests/update_transaction.rs b/crates/update/tests/update_transaction.rs index 3a50d6bb3..882ab5210 100644 --- a/crates/update/tests/update_transaction.rs +++ b/crates/update/tests/update_transaction.rs @@ -489,7 +489,7 @@ mod versioned { let mut rig = Rig::new("ok"); rig.platform = platform; rig.install_old(&["0.8.0", "0.9.0"]); - // The desktop's background engine, as the release ships it. + // The engine `zeron headless` runs, as the release ships it. for version in ["1.0.0", "2.0.0"] { std::fs::write(rig.app.join(version).join("zeron-engine"), "desktop").unwrap(); } @@ -497,12 +497,9 @@ mod versioned { rig.run_until_settled(); rig.assert_updated(&id); rig.app_settles_to(expected); - // A Cloud machine never runs it, and copies it back in on every wake. - assert_eq!( - rig.app.join("2.0.0/zeron-engine").exists(), - platform.is_none(), - "platform {platform:?}" - ); + // Kept everywhere, Cloud too: `zeron headless` runs it (a Cloud + // machine once left it out, and never came online). + assert!(rig.app.join("2.0.0/zeron-engine").exists(), "platform {platform:?}"); } } diff --git a/docs/design/cloud-device.md b/docs/design/cloud-device.md index df22d29af..994867f73 100644 --- a/docs/design/cloud-device.md +++ b/docs/design/cloud-device.md @@ -431,12 +431,12 @@ machine (`ZERON_DEVICE_PLATFORM=cloud`) keeps none of them: going back there is downloads anyway. Other Linux installs keep the newest older one, to go back to by hand. Never `current`, the running executable's folder, or a newer version (an update being staged). -A Cloud machine doesn't keep the release's `zeron-engine` either: it's the desktop app's background -engine (78 MB), and the unit runs `zeron headless`, which links the engine. The installer and the -updater leave it out, and the tidy and the pre-sleep cleanup remove it from versions installed before. -Measured on staging (send to first output, n=8 each), a machine on one version went from a median of -17.5 s to 14.2 s once neither it nor Codex's downloads came back with each wake; its wake downloaded -225 MB, 205 of them the engine it runs. +A Cloud machine keeps the release's `zeron-engine` (78 MB). From 2026-11-07 to 2026-11-15 the +installer, the updater and the tidy left it out, when the unit's `zeron headless` linked the engine; +since 0.3.0 the release's `zeron` is the zgx app, whose `zeron headless` runs that `zeron-engine`, so +a machine without it exited at once and never enrolled. The installer keeps it now, and a repair +(`~/.zeron/repair-engine`, the unit's `ExecStartPre=-`, set up by the installer and every wake) puts +it back before each start if an older updater left it out (edge/src/cloud/install-script.ts). A longer wake reads as updating: the engine says so (`POST /runner/wake-stage`), `CloudSession.stage` is `updating` while it lasts (a stage nobody clears stops showing after 10 minutes), the desktop's