From 10d76ad89d96c0f66cda7a2a5e8e0b0ab54697be Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Mon, 19 Oct 2026 14:15:20 +0200 Subject: [PATCH] Launcher: stable builds by default, a "Beta builds" switch, and each version's channel Game releases now go out as betas and become stable 6 hours later (promote.yml). The launcher installs new versions from the stable channel unless "Beta builds" is on in Settings; turning it on checks again at once. The Versions page, `versions` and the MCP server show each build's channel. The website's patch notes list stable releases only. Co-Authored-By: Claude Opus 5.5 --- launcher/src/backend.rs | 67 +++++++++++++++++-- launcher/src/backend/release_loading_tests.rs | 4 ++ launcher/src/cli.rs | 5 +- launcher/src/main.rs | 35 +++++++--- launcher/src/mcp.rs | 2 +- website/build.mjs | 3 +- website/src/main.js | 2 +- 7 files changed, 101 insertions(+), 17 deletions(-) diff --git a/launcher/src/backend.rs b/launcher/src/backend.rs index 8d1036d22..c416e5777 100644 --- a/launcher/src/backend.rs +++ b/launcher/src/backend.rs @@ -31,6 +31,8 @@ pub struct Release { pub body: String, pub date: String, pub asset: Option<(String, u64)>, + /// A beta: a game release not promoted to stable yet (a GitHub pre-release, docs/release-flow.md). + pub beta: bool, } #[cfg(all(target_os = "linux", target_arch = "x86_64"))] @@ -169,6 +171,7 @@ fn parse_releases( .take(10) .collect(), asset: found, + beta: r["prerelease"].as_bool().unwrap_or(false), }); } out.sort_by(|a, b| compare_versions(&b.tag, &a.tag)); @@ -247,6 +250,16 @@ pub fn latest(releases: &[Release]) -> Option<&Release> { releases.iter().find(|r| r.asset.is_some()) } +/// The releases a launcher installs by itself: stable ones, and betas too when the player turned +/// "Beta builds" on in Settings. +pub fn channel(releases: &[Release], beta: bool) -> Vec { + releases + .iter() + .filter(|r| beta || !r.beta) + .cloned() + .collect() +} + /// The community, sponsor and website links, from `launcher/links.json` on main, so they can change /// without a launcher release. An empty address hides its button. #[derive(Clone, Debug, PartialEq, serde::Serialize)] @@ -1462,10 +1475,17 @@ pub fn launcher_update(releases: &[Release]) -> Option { pub fn releases_and_updates( on_releases: impl FnOnce(Result, String>), ) -> Result { - releases_and_updates_with(release_list, installed, launcher_releases_in, on_releases) + releases_and_updates_with( + Settings::load().beta_builds, + release_list, + installed, + launcher_releases_in, + on_releases, + ) } fn releases_and_updates_with( + beta: bool, load: impl FnOnce() -> Result, installed: impl FnOnce() -> Vec, launchers: impl FnOnce(&serde_json::Value) -> Vec, @@ -1479,7 +1499,7 @@ fn releases_and_updates_with( } }; let releases = parse_releases(&list, ASSET, is_game_tag); - let horizon = horizon_update(&releases, &installed()); + let horizon = horizon_update(&channel(&releases, beta), &installed()); on_releases(Ok(releases)); Ok(Updates { horizon, @@ -1501,12 +1521,16 @@ pub fn select_after_update(selected: Option<&str>, installed_before: &[String]) } } -/// Installs `tag` (or the newest release with "latest"), then updates the selection as +/// Installs `tag` (or with "latest" the newest release of the player's channel), then updates the selection as /// `select_after_update` says when `as_update`, or always selects it otherwise. pub fn install_tag(tag: &str, as_update: bool, progress: impl Fn(f32)) -> Result { let releases = releases()?; let release = if tag == "latest" { - latest(&releases).ok_or("No release has a build for this platform yet.")? + let beta = Settings::load().beta_builds; + releases + .iter() + .find(|r| r.asset.is_some() && (beta || !r.beta)) + .ok_or("No release has a build for this platform yet.")? } else { releases .iter() @@ -1926,6 +1950,9 @@ pub struct Settings { /// default. Appended after the launcher's own arguments, so they can add to or override them. #[serde(default, skip_serializing_if = "String::is_empty")] pub game_args: String, + /// Whether new versions include betas (releases not promoted to stable yet). Off by default. + #[serde(default)] + pub beta_builds: bool, } impl Settings { @@ -2117,6 +2144,36 @@ mod tests { assert_eq!(offered(&["v2026.10.15.1", "v2026.10.14"]), None); } + /// Betas (GitHub pre-releases) install by themselves only with "Beta builds" on; the stable + /// channel waits for promote.yml (docs/release-flow.md, "Channels"). + #[test] + fn updates_follow_the_stable_channel_unless_betas_are_on() { + let asset = ASSET.unwrap_or("horizon-linux-x86_64.tar.gz"); + let list = serde_json::json!([ + {"tag_name": "v2026.10.19.02", "prerelease": true, "assets": [{"name": asset, "browser_download_url": "b", "size": 1}]}, + {"tag_name": "v2026.10.19.01", "assets": [{"name": asset, "browser_download_url": "s", "size": 1}]}, + ]); + let releases = parse_releases(&list, Some(asset), is_game_tag); + assert_eq!( + releases.iter().map(|r| r.beta).collect::>(), + [true, false] + ); + let offered = |beta: bool, installed: &[&str]| { + let installed: Vec = installed.iter().map(|t| t.to_string()).collect(); + horizon_update(&channel(&releases, beta), &installed).map(|r| r.tag) + }; + assert_eq!(offered(false, &[]), Some("v2026.10.19.01".into())); + assert_eq!( + offered(true, &["v2026.10.19.01"]), + Some("v2026.10.19.02".into()) + ); + assert_eq!(offered(false, &["v2026.10.19.01"]), None); + // A beta installed earlier is never "updated" to an older stable build. + assert_eq!(offered(false, &["v2026.10.19.02"]), None); + assert!(!Settings::parse("{}").beta_builds); + assert!(Settings::parse(r#"{"beta_builds": true}"#).beta_builds); + } + #[test] fn the_version_is_the_one_the_release_workflow_injects() { assert_eq!(version_or(Some("0.4.2")), "0.4.2"); @@ -2135,6 +2192,7 @@ mod tests { body: String::new(), date: String::new(), asset: Some(("u".into(), 1)), + beta: false, }; assert!(launcher_update(&[r(format!("{LAUNCHER_TAG_PREFIX}{VERSION}"))]).is_none()); assert_eq!( @@ -2176,6 +2234,7 @@ mod tests { body: String::new(), date: String::new(), asset: Some(("u".into(), 1)), + beta: false, }; let releases = [r("v2026.10.13"), r("v2026.10.12")]; assert_eq!( diff --git a/launcher/src/backend/release_loading_tests.rs b/launcher/src/backend/release_loading_tests.rs index befef2279..ab01ab437 100644 --- a/launcher/src/backend/release_loading_tests.rs +++ b/launcher/src/backend/release_loading_tests.rs @@ -45,6 +45,7 @@ fn baseline(load: impl Fn() -> Result) -> (Vec Result) -> (Vec, Updates) { let mut releases = None; let updates = releases_and_updates_with( + false, load, installed_fixture, |list| parse_releases(list, LAUNCHER_ASSET, is_launcher_tag), @@ -81,6 +82,7 @@ fn errors_reach_releases_and_updates_without_fallback() { ] { let mut published = None; let result = releases_and_updates_with( + false, || Err(error.into()), || panic!("no installed scan after failure"), |_| panic!("no fallback after failure"), @@ -95,6 +97,7 @@ fn errors_reach_releases_and_updates_without_fallback() { fn publish_games_before_older_launcher_fallback() { let events = RefCell::new(Vec::new()); let result = releases_and_updates_with( + false, || Ok(serde_json::json!([{"tag_name": "v2026.10.14", "assets": []}])), Vec::new, |list| { @@ -129,6 +132,7 @@ fn failed_launcher_fallback_keeps_game_result_and_checks_stay_fresh() { for day in [14, 15] { let mut published = None; let updates = releases_and_updates_with( + false, || { requests.fetch_add(1, Ordering::Relaxed); Ok(serde_json::json!([{"tag_name": format!("v2026.10.{day}")}])) diff --git a/launcher/src/cli.rs b/launcher/src/cli.rs index d18a60dac..a691eb061 100644 --- a/launcher/src/cli.rs +++ b/launcher/src/cli.rs @@ -268,7 +268,7 @@ fn attached(mut cmd: Command) -> Result<(), String> { fn release_json(r: &Release) -> serde_json::Value { serde_json::json!({ - "tag": r.tag, "name": r.name, "date": r.date, + "tag": r.tag, "name": r.name, "date": r.date, "channel": if r.beta { "beta" } else { "stable" }, "available_here": r.asset.is_some(), "installed": backend::installed().contains(&r.tag), }) } @@ -317,7 +317,8 @@ fn execute(command: Cmd, as_json: bool) -> Result<(), String> { (false, true) => "", (false, false) => "no build for this platform", }; - println!("{:<14} {} {}", r.tag, r.date, state); + let channel = if r.beta { "beta" } else { "stable" }; + println!("{:<15} {} {:<6} {}", r.tag, r.date, channel, state); } } Cmd::Install { tag } => { diff --git a/launcher/src/main.rs b/launcher/src/main.rs index ca86b5b08..dec680025 100644 --- a/launcher/src/main.rs +++ b/launcher/src/main.rs @@ -1898,6 +1898,15 @@ impl Launcher { cx.notify(); }), ); + let betas = switch("beta-builds", self.settings.beta_builds, &t).on_click(cx.listener( + |this, _: &ClickEvent, _, cx| { + this.settings.beta_builds = !this.settings.beta_builds; + this.settings.save(); + // What counts as new changed: check again (and install it if that is on). + this.check_updates(); + cx.notify(); + }, + )); let opening = switch("opening", !self.settings.skip_opening, &t).on_click(cx.listener( |this, _: &ClickEvent, _, cx| { this.settings.skip_opening = !this.settings.skip_opening; @@ -2053,13 +2062,22 @@ impl Launcher { )) .child(index_row( n + 2, + "Beta builds", + Some(plain( + "New versions as soon as they are released, before they become stable 6 hours later. Off: only stable versions install by themselves.", + )), + Some(betas.into_any_element()), + &t, + )) + .child(index_row( + n + 3, "Show the opening", Some(plain("The wordmark, while the release list loads.")), Some(opening.into_any_element()), &t, )) .child(index_row( - n + 3, + n + 4, "Game menus", Some(plain( "Classic is vanilla's own screens, with no way back inside the game: switch back here. Applies the next time the game starts.", @@ -2067,24 +2085,24 @@ impl Launcher { Some(menus.into_any_element()), &t, )) - .child(self.game_args_row(n + 4, cx)) - .child(index_row(n + 5, "Horizon", Some(plain(&horizon)), horizon_action, &t)) + .child(self.game_args_row(n + 5, cx)) + .child(index_row(n + 6, "Horizon", Some(plain(&horizon)), horizon_action, &t)) .child(index_row( - n + 6, + n + 7, "Launcher", Some(plain(&launcher)), launcher_action, &t, )) .child(index_row( - n + 7, + n + 8, "Data folder", Some(mono(short(&backend::data_dir()))), None, &t, )) .child(index_row( - n + 8, + n + 9, "Logs", Some(mono(format!( "{} ยท crash reports beside it", @@ -2103,7 +2121,7 @@ impl Launcher { )) .when(cfg!(target_os = "linux"), |d| { d.child(index_row( - n + 9, + n + 10, "Applications menu", Some(plain(if self.settings.desktop_entry() { "Horizon and its icon are in your desktop's menu." @@ -2603,7 +2621,8 @@ impl Launcher { let tag = release.tag.clone(); let installed = self.installed.contains(&tag); let selected = self.selected() == Some(&tag); - let mut meta = vec![release.date.clone()]; + let channel = if release.beta { "Beta" } else { "Stable" }; + let mut meta = vec![channel.to_string(), release.date.clone()]; if let Some((_, size)) = release.asset { meta.push(megabytes(size)); } diff --git a/launcher/src/mcp.rs b/launcher/src/mcp.rs index 2dd2aa5cb..906cd089f 100644 --- a/launcher/src/mcp.rs +++ b/launcher/src/mcp.rs @@ -95,7 +95,7 @@ impl Session { { out["releases"] = backend::releases()? .iter() - .map(|r| json!({ "tag": r.tag, "name": r.name, "date": r.date, "available_here": r.asset.is_some() })) + .map(|r| json!({ "tag": r.tag, "name": r.name, "date": r.date, "channel": if r.beta { "beta" } else { "stable" }, "available_here": r.asset.is_some() })) .collect(); } Ok(serde_json::to_string_pretty(&out).unwrap()) diff --git a/website/build.mjs b/website/build.mjs index 0a921d9d1..99fafd73a 100644 --- a/website/build.mjs +++ b/website/build.mjs @@ -114,7 +114,8 @@ const parityHeadline = matching === body.length ? "Every subsystem matches vanil const isGame = (tag) => /^v\d{4}\.\d{1,2}\.\d{1,2}/.test(tag); const isLauncher = (tag) => tag.startsWith("launcher-v"); -const game = releases.filter((r) => isGame(r.tag_name)).slice(0, 3); +// Stable releases only: betas become stable 6 hours later (docs/release-flow.md, "Channels"). +const game = releases.filter((r) => isGame(r.tag_name) && !r.prerelease).slice(0, 3); const launcher = releases.find((r) => isLauncher(r.tag_name) && !r.prerelease); // --- The page -------------------------------------------------------------------------- diff --git a/website/src/main.js b/website/src/main.js index 5178d4207..e4523fd25 100644 --- a/website/src/main.js +++ b/website/src/main.js @@ -102,7 +102,7 @@ async function setUpDownload() { const isGame = (tag) => /^v\d{4}\.\d{1,2}\.\d{1,2}/.test(tag); async function setUpNotes() { - const list = (await releases).filter((r) => isGame(r.tag_name)); + const list = (await releases).filter((r) => isGame(r.tag_name) && !r.prerelease); if (list.length) document.getElementById("releases").innerHTML = releasesHtml(list.slice(0, 3)); }