diff --git a/.github/workflows/promote.yml b/.github/workflows/promote.yml index b7ef0b38b..389d99712 100644 --- a/.github/workflows/promote.yml +++ b/.github/workflows/promote.yml @@ -1,17 +1,20 @@ name: promote -# Beta game releases become stable (docs/release-flow.md, "Channels"): every 30 minutes tools/release_channels.py -# promotes the newest beta that has been out 6 hours, passed its release smoke test and isn't covered by an issue -# labelled release-blocker. By hand, from GitHub's app too (Actions > promote > Run workflow): -# gh workflow run promote -f tag=v2026.10.19.03 # that beta now, without the wait -# gh workflow run promote -f tag=v2026.10.19.03 -f force=true # even blocked or without its smoke test -# gh workflow run promote -f dry_run=true # say what would be promoted +# Beta game releases become stable once a day (docs/release-flow.md, "Channels"): at 20:00 UTC (21:00 in Paris in +# winter time, 22:00 in summer) tools/release_channels.py promotes the newest beta that had been out 6 hours by then, +# passed its release smoke test and isn't covered by an issue labelled release-blocker. Launchers on the Nightly +# channel install every beta when it is published; Stable gets the day's promotion. The later runs of the evening are +# retries for a run GitHub starts late or skips: they promote the same beta, so stable still moves once. +# By hand, from GitHub's app too (Actions > promote > Run workflow): +# gh workflow run promote -f tag=v0.2.3 # that beta now, without waiting for 20:00 +# gh workflow run promote -f tag=v0.2.3 -f force=true # even blocked or without its smoke test +# gh workflow run promote -f dry_run=true # say what would be promoted # Holding betas back: label an issue release-blocker. While it is open it holds every beta; closed as completed it # still holds the betas published before it closed. The issue's text is never read (its author could edit it). -# When the oldest waiting beta is 24 hours old, an issue "Promotion to stable has stalled" says so; it closes itself -# after the next promotion. +# When the oldest waiting beta is 30 hours old (it missed a promotion it was due for), an issue "Promotion to stable +# has stalled" says so; it closes itself after the next promotion. on: schedule: - - cron: '13,43 * * * *' + - cron: '7,37 20-21 * * *' workflow_dispatch: inputs: tag: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index cd882a787..6c1ecf422 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,14 +1,14 @@ name: release # Automatic game releases (docs/release-flow.md). After every green `checks` run on main, every 10 minutes (so a # release waiting for merges to settle goes out without another merge) and by hand, tools/release_train.py decides: -# a release when pull requests merged since the last one changed what players run and the newest merged 15 minutes -# ago (the oldest an hour ago, if merges never pause), or at once for a pull request labelled release-now. +# a release when pull requests merged since the last one changed what players run and the newest merged 5 minutes +# ago (the oldest 20 minutes ago, if merges never pause), or at once for a pull request labelled release-now. # RELEASES_PAUSED=1 (repository variable) stops them. # Builds Linux (an older Ubuntu, so the binary runs on any recent distribution and on NixOS through nix-ld) and # Windows on GitHub, macOS on the Mac mini's runner (MAC_RUNNER=macos-latest sends it to GitHub), then # publishes vX.Y.Z on the release line in .github/release-line.txt (docs/versioning.md; without it, the dated # vYYYY.MM.DD[.N] from before 0.2) with notes from the merged pull requests, as a beta (a pre-release) that promote.yml makes -# stable after 6 hours. macOS: with the repository variable MACOS_SIGN_IDENTITY set, the programs are signed with +# stable in its daily promotion. macOS: with the repository variable MACOS_SIGN_IDENTITY set, the programs are signed with # Developer ID and the hardened runtime and the zip is notarized, from the runner's signing keychain # (packaging/macos/README.md); unset (forks), ad hoc. # gh workflow run release --ref # dry run: builds and notes, publishes nothing @@ -349,7 +349,8 @@ jobs: run: | signature=(); [[ -f dist/SHA256SUMS.sig ]] && signature=(dist/SHA256SUMS.sig) smoke=(); [[ -f dist/smoke-test.json ]] && smoke=(dist/smoke-test.json) - # A beta (pre-release): promote.yml makes it stable and latest after 6 hours (docs/release-flow.md). + # A beta (pre-release), the Nightly channel's: promote.yml makes it stable and latest in its daily promotion + # (docs/release-flow.md). gh release create "$TAG" --target "${{ needs.decide.outputs.head }}" --title "$(cat notes/title.txt)" \ --notes-file notes/body.md --prerelease --latest=false dist/horizon-linux-x86_64.tar.gz \ dist/horizon-windows-x64.zip dist/horizon-macos-arm64.zip dist/horizon-server-linux-x86_64.tar.gz \ diff --git a/docs/release-flow.md b/docs/release-flow.md index a6c47c8b0..52a9d5596 100644 --- a/docs/release-flow.md +++ b/docs/release-flow.md @@ -2,8 +2,9 @@ How a change gets from a pull request to players: the checks a pull request passes, how it merges, and the automatic releases that follow. Releases are automatic and frequent so the latest Horizon is always playable. -Each one goes out as a **beta** and becomes **stable** 6 hours later unless something holds it back -([Channels](#channels)): launchers and servers install stable builds unless their owner turns betas on. +Each one goes out as a **beta**, which launchers on the **Nightly** channel install at once, and becomes **stable** in +the next daily promotion unless something holds it back ([Channels](#channels)): launchers and servers install +stable builds unless their owner picks Nightly. ## Pull request checks @@ -93,7 +94,7 @@ flowchart LR main --> mainchecks{"checks on main"} mainchecks -- green --> decide{"decide
tools/release_train.py"} cron(["every hour :17"]) --> decide - decide -- "player-facing PRs settled 15 min
(or waiting 1 h), or release-now" --> build + decide -- "player-facing PRs settled 5 min
(or waiting 20 min), or release-now" --> build decide -- otherwise --> wait(["wait"]) subgraph build["build, in parallel"] linux["Linux x86_64
GitHub ubuntu-22.04"] @@ -101,8 +102,8 @@ flowchart LR mac["macOS arm64
Mac mini runner
+ offscreen game run"] end build --> publish["publish vX.Y.Z as a beta
notes from the merged PRs"] - publish --> beta(["launchers with Beta builds on install it"]) - publish --> promote{"promote.yml, every 30 min:
6 h old, smoke test, no release-blocker"} + publish --> beta(["launchers on Nightly install it"]) + publish --> promote{"promote.yml, daily at 20:00 UTC:
6 h old by then, smoke test, no release-blocker"} promote --> stable["stable and latest
notes since the last stable"] stable --> launcher(["every launcher and server installs it"]) stable --> kira(["Kira posts it;
pings only with ### New"]) @@ -117,9 +118,10 @@ commits) since the last **published** game release: `xtask/`, `packaging/`, `Cargo.toml`, `Cargo.lock`, `research-lock.json`, or an exporter `horizon-prepare` compiles (the `mods/horizon/src/test/java/dev/horizonlab/parity/*.java` files its sources name). Markdown never counts. -- It releases when at least one pull request counts and the newest of them merged at least 15 minutes ago, so a burst - of merges becomes one release; if merges never pause, it releases once the oldest has waited an hour. There is no - minimum time between releases: every settled player-facing change ships. +- It releases when at least one pull request counts and the newest of them merged at least 5 minutes ago, so a wave + of merges becomes one release; if merges never pause, it releases once the oldest has waited 20 minutes. There is + no minimum time between releases: every settled player-facing change ships, limited only by the release already + building. That is the Nightly channel, many releases a day. - A pull request labelled `release-now` (a crash or a blocker) releases at once. - A pull request labelled `skip-release` (work players don't see) doesn't count and isn't listed in the notes. - One release at a time (concurrency group `game-release`); a run that finds nothing new does nothing. @@ -184,15 +186,23 @@ Kira posts every published release in #releases and pings the releases role only ### Channels Every game release is published as a **beta**, a GitHub pre-release, so GitHub's *latest* release stays the last -**stable** one. Launchers and `horizon-server update` install stable builds by default (the launcher's Settings -has a "Beta builds" switch; `horizon-server update --version ` takes one by name), and Kira announces a release +**stable** one. The launcher's Settings has an **Updates** choice of two channels (`update_channel` in its +`settings.json`, `horizon-launcher update-channel`): + +- **Stable**, the default: a tested build about once a day, the betas promoted below. +- **Nightly**: every beta as soon as it is built, many times a day; it can break. "Nightly" is a name, not a + schedule. An open launcher looks for releases every 30 minutes on Nightly (4 hours on Stable). Launchers from before 0.2 had a "Beta builds" switch instead; on, it reads as Nightly. + +`horizon-server update` installs stable builds (`--version ` takes one by name), and Kira announces a release when it becomes stable: Discord's #releases only ever shows stable ones. -`.github/workflows/promote.yml` runs `tools/release_channels.py promote` every 30 minutes. It promotes the newest +`.github/workflows/promote.yml` runs `tools/release_channels.py promote` once a day at 20:00 UTC (21:00 in Paris in +winter time, 22:00 in summer), with retries until 21:37 for a run GitHub starts late or skips. It promotes the newest beta that - is newer than the stable release, -- has been out 6 hours, +- had been out 6 hours at 20:00 UTC (published by 14:00 UTC that day; one published later waits for the next day), + so every run of the evening picks the same beta and stable moves once a day, - passed its release smoke test: the macOS build attaches `smoke-test.json` (the offscreen game run's report) only when the game drew a world on the Mac mini, so a release built while `MAC_RUNNER` sends macOS to GitHub waits for a hand, @@ -204,7 +214,8 @@ beta that Nothing older than the stable release is ever promoted, not even with `force`: GitHub's latest release is what `horizon-server update` and `install.sh` download, so it only moves forward. -When the oldest beta newer than the stable release has waited 24 hours, promote.yml opens an issue titled +When the oldest beta newer than the stable release has waited 30 hours (it missed a daily promotion it was due for; +on a normal day a beta waits at most that long and is promoted), promote.yml opens an issue titled "Promotion to stable has stalled" with the reason from the last check (a blocker left open, smoke tests not running). It closes itself after the next promotion. @@ -213,12 +224,12 @@ release (`release_train.py notes --stable`), so players who skipped the betas se betas. By hand, from a phone too (GitHub app: Actions, promote, Run workflow): ```sh -gh workflow run promote -f tag=v2026.10.19.03 # that beta now: no 6-hour wait, still no blocker -gh workflow run promote -f tag=v2026.10.19.03 -f force=true # even blocked or without a smoke test -gh workflow run promote -f dry_run=true # what would be promoted now +gh workflow run promote -f tag=v0.2.3 # that beta now: no wait for 20:00, still no blocker +gh workflow run promote -f tag=v0.2.3 -f force=true # even blocked or without a smoke test +gh workflow run promote -f dry_run=true # what would be promoted now ``` -A beta's notes cover only what changed since the release before it (beta or stable), and say it is a beta. +A beta's notes cover only what changed since the release before it (beta or stable), and say it is a nightly build. `release_train.py decide` counts pull requests from the newest release of either channel, so betas don't release the same changes again. @@ -308,7 +319,7 @@ and by hand; pushes to `launcher` and `launcher-*` branches only build. - `tools/release_train.py decide --kind launcher` counts the pull requests merged since the last published launcher release that changed those paths (not `launcher/links.json`, which the launcher reads from main, nor - tests or Markdown), with the same settling rule (15 minutes, at most an hour), `release-now`, `skip-release` and `RELEASES_PAUSED`. + tests or Markdown), with the same settling rule (5 minutes, at most 20), `release-now`, `skip-release` and `RELEASES_PAUSED`. - The tag is `launcher@X.Y.Z` on the release line (`launcher@0.2.0` first; the game and the launcher count their patches separately). Without `.github/release-line.txt`, `launcher-vX.Y.Z`: the patch after the last launcher tag, or the next minor (`X.Y+1.0`) when one of those pull requests is labelled `feature`. `launcher-v0.2.0` was taken diff --git a/docs/security.md b/docs/security.md index 7dead0e83..d61198ec2 100644 --- a/docs/security.md +++ b/docs/security.md @@ -38,7 +38,7 @@ and some are waiting for Ludovic: | Private vulnerability reporting | **Live** (see the end of this page). | | Signed checksums on releases | **Live** for new releases (#1011): the `release` environment holds the key, and its public half is in `release-keys.txt` (#1023). Releases from before then are unsigned. | | Launchers and servers checking signatures | **Not yet**: #1014 waits as a draft until a signed stable game release and a signed launcher release exist. Until then they trust GitHub's checksum, as before. | -| Beta, then stable | **Not yet** (#1012): every release still goes straight to every player. The launcher's "Beta builds" switch is already there (#1013), and has no betas to offer yet. | +| Beta, then stable | **Live** (#1012): every release is first a beta. The launcher's Updates setting picks Stable (the default) or Nightly (the betas). | | Reports marked suspicious | **Partly**: the scan of Discord for agents does it. Kira's issues do it once its pull request merges. | | Code owners' review of the pipeline | **Not yet**: `.github/CODEOWNERS` and its protection (#1015) wait for the App, below. Until then pipeline changes merge like any other once `verify` passes. | | Agents on their own GitHub App | **Not yet**: prepared, waiting for Ludovic to create it. Agents still use his account. | @@ -54,10 +54,10 @@ and some are waiting for Ludovic: the only `verify` a change can have is one that ran. Main requires it, from GitHub Actions only, for everyone, admins included. - **Beta, then stable.** Every release is first a **beta**. It becomes **stable**, the version launchers and - servers install by themselves, only after it has been out 6 hours and passed its smoke test (the game started and - drew a world on the Mac mini), and only while no issue labelled `release-blocker` is open. If no beta has - become stable for a day, an issue says so. Players who want the - newest builds at once turn on "Beta builds" in the launcher's Settings. Discord announces stable releases only. + servers install by themselves, in the daily promotion (20:00 UTC), only after it has been out 6 hours and passed its + smoke test (the game started and drew a world on the Mac mini), and only while no issue labelled `release-blocker` + is open. If a beta misses a promotion it was due for, an issue says so. Players who want the newest builds at once + pick **Nightly** under Updates in the launcher's Settings. Discord announces stable releases only. - **Signed updates.** Each release carries a list of its files' checksums, signed with Horizon's release key. The launcher (for the game and for itself) and `horizon-server update` check that signature against the public key built into them, then check the download against the list. Anything unsigned, signed with another key, signed diff --git a/docs/versioning.md b/docs/versioning.md index f60073ac8..4481e72f6 100644 --- a/docs/versioning.md +++ b/docs/versioning.md @@ -22,9 +22,10 @@ game and the launcher of the 0.2 line. 0.2. A `feature` label no longer bumps anything: it only lists the change under **New**. - **Patch releases** are every release the train makes: the patch after the newest release tagged on the line, game and launcher counted separately (the game releases more often, so `v0.2.14` can go with `launcher@0.2.3`). -- **Betas** are not separate tags. As before, every game release is published as a GitHub pre-release (a beta) under - its final tag and promoted in place to stable after 6 hours ([Channels](release-flow.md#channels)). `v0.2.4` is - the same build whether it is still a beta or already stable. +- **Betas** are not separate tags. As before, every game release is published as a GitHub pre-release (a beta, what + the launcher's Nightly channel installs) under its final tag and promoted in place to stable in the daily + promotion at 20:00 UTC, once it has been out 6 hours ([Channels](release-flow.md#channels)). `v0.2.4` is the same + build whether it is still a beta or already stable. - **Pre-release tags** (`v0.3.0-rc.1`, `v0.3.0-beta.2`) are semver's and are reserved for a hand-made preview of a new line; the train never makes them. Every reader orders them before their release and after the release before (`v0.2.9` < `v0.3.0-beta.1` < `v0.3.0-rc.1` < `v0.3.0`). @@ -125,7 +126,8 @@ Run by the orchestrator, in this order. Until step 3, nothing is published. makes it *latest*. Do not force it (`promote` with `force=true`): it carries about 43 player-facing pull requests from the freeze and needs its beta like any release. Check it is *latest*: `gh api repos/ludovic111/horizon/releases/latest --jq .tag_name`. -5. Only then mark the switch pull request (#1132) ready and merge it (`.github/release-line.txt` = `0.2`, and the +5. Only then merge the update channels pull request (the launcher's Stable and Nightly, the daily promotion), then + mark the switch pull request (#1132) ready and merge it (`.github/release-line.txt` = `0.2`, and the docs that talk about 0.2). On the next run, about 10 minutes, the train publishes `v0.2.0` as a beta and `launcher@0.2.0`, both "the first release of 0.2", built from the same code as the bridges plus that pull request. 6. Check the way over from an old launcher, in a scratch folder: @@ -135,7 +137,8 @@ Run by the orchestrator, in this order. Until step 3, nothing is published. # with launcher-v0.17.0's binary: update --check --json -> "launcher": "0.2.0", "horizon": "v0.2.0" (with Beta builds on) ``` and `gh release view v0.2.0 --json assets`, `horizon-server --version` in the Linux server archive. -7. `v0.2.0` becomes stable after 6 hours (or `gh workflow run promote -f tag=v0.2.0`). While it is a beta, *latest* +7. `v0.2.0` becomes stable in the first daily promotion (20:00 UTC) it has been out 6 hours for (or + `gh workflow run promote -f tag=v0.2.0`). While it is a beta, *latest* stays the bridge, so keeping it in beta for longer catches more servers (Ludovic's call). From then on everything is automatic again: `v0.2.1`, `launcher@0.2.1`, …. 8. Point Kira, `release-kick` and the heartbeat prompts at the new tags (outside this repository). diff --git a/launcher/README.md b/launcher/README.md index 74054ea55..c1935c7cf 100644 --- a/launcher/README.md +++ b/launcher/README.md @@ -78,9 +78,17 @@ page `servers.json` (the list), `servers//` (the servers created there) an `server-runtime/` (the programs and game files they run). - **Settings**: install new Horizon versions automatically (on unless you turn it off; the - selected version only moves to the new one if you were on the newest), the opening animation, + selected version only moves to the new one if you were on the newest), which ones (Updates, + below), the opening animation, the game's menu style, the game's extra command-line arguments, and the launcher's own version and update state. +- **Updates**: **Stable** (the default) installs a tested build about once a day, the betas that + `promote.yml` makes stable; **Nightly** installs every release as soon as it is built, several + times a day, and can break (docs/release-flow.md, "Channels"). While it is open, the launcher + looks for new releases every 4 hours on Stable and every 30 minutes on Nightly. Kept as `update_channel` in + `settings.json`; a `beta_builds: true` from launchers before 0.2 reads as Nightly. + `horizon-launcher update-channel [stable|nightly]` shows or sets it. The **Versions** page + shows each release's channel. The launcher's own updates don't depend on it. - **Game arguments**: extra arguments added to the game's command line (for example `--server-thread`), one line where quotes group a word with spaces. They are appended after the launcher's own arguments, kept as `game_args` in `settings.json`, and apply the next time the @@ -132,6 +140,7 @@ The same binary is a command-line tool; without a subcommand it opens the window horizon-launcher notes [] patch notes as plain text horizon-launcher links the Discord, sponsor and website links horizon-launcher menu-style [horizon|classic] show or set the game's menu style + horizon-launcher update-channel [stable|nightly] show or set which releases install by themselves horizon-launcher game-args [] show or set the extra arguments the game starts with horizon-launcher update [--check] Horizon and the launcher horizon-launcher logs [--lines N] [--crash] the end of the game's log, or its newest crash report @@ -165,7 +174,7 @@ The same binary is a command-line tool; without a subcommand it opens the window horizon-launcher data benchmark upload a benchmark report, printed first `--json` prints JSON where there is something to report (`versions`, `install`, `notes`, -`next`, `links`, `menu-style`, `game-args`, `update --check`, `logs`, `account`, `benchmark`, `data`, `modpack`). Errors go to stderr with exit code 1. `server` runs in the terminal, +`next`, `links`, `menu-style`, `update-channel`, `game-args`, `update --check`, `logs`, `account`, `benchmark`, `data`, `modpack`). Errors go to stderr with exit code 1. `server` runs in the terminal, so lines you type reach its console. `HORIZON_LAUNCHER_HOME` replaces the data folder (for scripts and tests). @@ -177,7 +186,7 @@ scripts and tests). (with the full path to the binary if it is not on your `PATH`). Its tools: `list_versions`, `install_version`, `remove_version`, `prepare_resources`, `launch_client`, `start_server`, -`server_command`, `server_log`, `stop_server`, `patch_notes`, `links`, `menu_style`, `logs`, +`server_command`, `server_log`, `stop_server`, `patch_notes`, `links`, `menu_style`, `update_channel`, `logs`, `check_updates`, `accounts`, `sign_in` (returns the link and code for the player; the sign-in finishes in the background), `sign_out`, `select_account`, and for data collection `data_collection`, `set_data_collection`, `data_preview`, `delete_my_data` and `report_bug` diff --git a/launcher/docs/settings.png b/launcher/docs/settings.png index 3d4cecbb7..455f8bf27 100644 Binary files a/launcher/docs/settings.png and b/launcher/docs/settings.png differ diff --git a/launcher/src/backend.rs b/launcher/src/backend.rs index a4ff228d9..ba854730f 100644 --- a/launcher/src/backend.rs +++ b/launcher/src/backend.rs @@ -346,16 +346,74 @@ 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 { +/// The releases a launcher installs by itself: stable ones, and betas too on the Nightly channel. +pub fn channel(releases: &[Release], channel: UpdateChannel) -> Vec { releases .iter() - .filter(|r| beta || !r.beta) + .filter(|r| channel.takes(r)) .cloned() .collect() } +/// Which game releases install by themselves (Settings, "Updates"; docs/release-flow.md, "Channels"). +#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, serde::Serialize, serde::Deserialize)] +#[serde(rename_all = "lowercase")] +pub enum UpdateChannel { + /// A tested build about once a day: the betas promote.yml makes stable. + #[default] + Stable, + /// Every release as soon as it is built, betas included. + Nightly, +} + +impl UpdateChannel { + pub fn name(self) -> &'static str { + match self { + UpdateChannel::Stable => "stable", + UpdateChannel::Nightly => "nightly", + } + } + + /// Its name in Settings and on the Versions page. + pub fn label(self) -> &'static str { + match self { + UpdateChannel::Stable => "Stable", + UpdateChannel::Nightly => "Nightly", + } + } + + pub fn parse(name: &str) -> Option { + match name { + "stable" => Some(UpdateChannel::Stable), + "nightly" => Some(UpdateChannel::Nightly), + _ => None, + } + } + + /// Whether this channel installs `release`: betas only reach Nightly. + pub fn takes(self, release: &Release) -> bool { + self == UpdateChannel::Nightly || !release.beta + } + + /// How often a launcher left open looks for new releases: Nightly's come many times a day, + /// Stable's once. + pub fn check_every(self) -> std::time::Duration { + std::time::Duration::from_secs(match self { + UpdateChannel::Stable => 4 * 3600, + UpdateChannel::Nightly => 30 * 60, + }) + } + + /// The channel a release is on when it is listed: betas are Nightly's only. + pub fn of(release: &Release) -> Self { + if release.beta { + UpdateChannel::Nightly + } else { + UpdateChannel::Stable + } + } +} + /// 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)] @@ -1650,7 +1708,7 @@ pub fn releases_and_updates( on_releases: impl FnOnce(Result, String>), ) -> Result { releases_and_updates_with( - Settings::load().beta_builds, + Settings::load().update_channel, release_list, installed, launcher_releases_in, @@ -1659,7 +1717,7 @@ pub fn releases_and_updates( } fn releases_and_updates_with( - beta: bool, + update_channel: UpdateChannel, load: impl FnOnce() -> Result, installed: impl FnOnce() -> Vec, launchers: impl FnOnce(&serde_json::Value) -> Vec, @@ -1673,7 +1731,7 @@ fn releases_and_updates_with( } }; let releases = parse_releases(&list, ASSET, is_game_tag); - let horizon = horizon_update(&channel(&releases, beta), &installed()); + let horizon = horizon_update(&channel(&releases, update_channel), &installed()); on_releases(Ok(releases)); Ok(Updates { horizon, @@ -1700,10 +1758,10 @@ pub fn select_after_update(selected: Option<&str>, installed_before: &[String]) pub fn install_tag(tag: &str, as_update: bool, progress: impl Fn(f32)) -> Result { let releases = releases()?; let release = if tag == "latest" { - let beta = Settings::load().beta_builds; + let update_channel = Settings::load().update_channel; releases .iter() - .find(|r| r.asset.is_some() && (beta || !r.beta)) + .find(|r| r.asset.is_some() && update_channel.takes(r)) .ok_or("No release has a build for this platform yet.")? } else { releases @@ -2155,9 +2213,10 @@ 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. + /// Which releases install by themselves: Stable by default. Launchers before 0.2 had a "Beta + /// builds" switch instead; [`Settings::parse`] reads its `beta_builds: true` as Nightly. #[serde(default)] - pub beta_builds: bool, + pub update_channel: UpdateChannel, /// The player has read what the "I'm playing" ping holds (`telemetry::PING`): on the /// first-run question, or on the Play page once if they answered that before it existed. #[serde(default)] @@ -2169,7 +2228,25 @@ impl Settings { Self::parse(&fs::read_to_string(data_dir().join("settings.json")).unwrap_or_default()) } pub fn parse(text: &str) -> Self { - serde_json::from_str(text).unwrap_or_default() + let Ok(mut value) = serde_json::from_str::(text) else { + return Self::default(); + }; + if let Some(fields) = value.as_object_mut() { + // The switch from before 0.2: on meant every release at once, the Nightly channel. + if fields.remove("beta_builds") == Some(serde_json::Value::Bool(true)) { + fields + .entry("update_channel") + .or_insert_with(|| UpdateChannel::Nightly.name().into()); + } + // A channel this launcher doesn't know is Stable, not a reason to lose every setting. + if fields + .get("update_channel") + .is_some_and(|c| c.as_str().and_then(UpdateChannel::parse).is_none()) + { + fields.remove("update_channel"); + } + } + serde_json::from_value(value).unwrap_or_default() } /// Whether the launcher keeps its entry in the applications menu (Linux). pub fn desktop_entry(&self) -> bool { @@ -2381,10 +2458,10 @@ 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"). + /// Betas (GitHub pre-releases) install by themselves only on the Nightly channel; Stable waits + /// for promote.yml's daily promotion (docs/release-flow.md, "Channels"). #[test] - fn updates_follow_the_stable_channel_unless_betas_are_on() { + fn updates_follow_the_stable_channel_unless_nightly_is_picked() { 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}]}, @@ -2395,9 +2472,14 @@ mod tests { releases.iter().map(|r| r.beta).collect::>(), [true, false] ); - let offered = |beta: bool, installed: &[&str]| { + let offered = |nightly: bool, installed: &[&str]| { let installed: Vec = installed.iter().map(|t| t.to_string()).collect(); - horizon_update(&channel(&releases, beta), &installed).map(|r| r.tag) + let on = if nightly { + UpdateChannel::Nightly + } else { + UpdateChannel::Stable + }; + horizon_update(&channel(&releases, on), &installed).map(|r| r.tag) }; assert_eq!(offered(false, &[]), Some("v2026.10.19.01".into())); assert_eq!( @@ -2407,8 +2489,52 @@ mod tests { 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); + assert_eq!( + releases.iter().map(UpdateChannel::of).collect::>(), + [UpdateChannel::Nightly, UpdateChannel::Stable] + ); + } + + #[test] + fn the_update_channel_is_stored_by_name_and_the_old_beta_switch_reads_as_nightly() { + let read = |text: &str| Settings::parse(text).update_channel; + assert_eq!(read(""), UpdateChannel::Stable); + assert_eq!(read("{}"), UpdateChannel::Stable); + assert_eq!( + read(r#"{"update_channel": "stable"}"#), + UpdateChannel::Stable + ); + assert_eq!( + read(r#"{"update_channel": "nightly"}"#), + UpdateChannel::Nightly + ); + // Launchers before 0.2: "Beta builds" on is Nightly, off is Stable. + assert_eq!(read(r#"{"beta_builds": true}"#), UpdateChannel::Nightly); + assert_eq!(read(r#"{"beta_builds": false}"#), UpdateChannel::Stable); + // Once a channel is picked, it wins over a switch left behind. + let both = r#"{"beta_builds": true, "update_channel": "stable"}"#; + assert_eq!(read(both), UpdateChannel::Stable); + // An unknown channel is Stable, and the rest of the settings survive it. + let odd = + Settings::parse(r#"{"update_channel": "beta", "game_args": "--x", "beta_builds": 1}"#); + assert_eq!(odd.update_channel, UpdateChannel::Stable); + assert_eq!(odd.game_args, "--x"); + // Saved as a name, without the old switch. + let mut settings = Settings::parse(r#"{"selected": "v0.2.0", "beta_builds": true}"#); + let saved = serde_json::to_value(&settings).unwrap(); + assert_eq!(saved["update_channel"], "nightly"); + assert!(saved.get("beta_builds").is_none()); + assert_eq!(saved["selected"], "v0.2.0"); + settings.update_channel = UpdateChannel::Stable; + let text = serde_json::to_string(&settings).unwrap(); + assert_eq!(read(&text), UpdateChannel::Stable); + for c in [UpdateChannel::Stable, UpdateChannel::Nightly] { + assert_eq!(UpdateChannel::parse(c.name()), Some(c)); + } + // An open launcher looks again every 4 hours on Stable, every 30 minutes on Nightly. + let minutes = |c: UpdateChannel| c.check_every().as_secs() / 60; + assert_eq!(minutes(UpdateChannel::Stable), 240); + assert_eq!(minutes(UpdateChannel::Nightly), 30); } #[test] @@ -2538,10 +2664,10 @@ mod tests { ]); let releases = parse_releases(&list, Some(asset), is_game_tag); let installed = ["v2026.10.19.15".to_string(), "v2026.10.12".to_string()]; - let offered = |beta| horizon_update(&channel(&releases, beta), &installed).map(|r| r.tag); - // A beta 0.2.0 reaches launchers with Beta builds on; stable ones wait for its promotion. - assert_eq!(offered(true), Some("v0.2.0".into())); - assert_eq!(offered(false), None); + let offered = |on| horizon_update(&channel(&releases, on), &installed).map(|r| r.tag); + // A beta 0.2.0 reaches launchers on Nightly; Stable ones wait for its promotion. + assert_eq!(offered(UpdateChannel::Nightly), Some("v0.2.0".into())); + assert_eq!(offered(UpdateChannel::Stable), None); let mut sorted = vec![ "v2026.10.19.15".to_string(), "v0.2.1".into(), diff --git a/launcher/src/backend/release_loading_tests.rs b/launcher/src/backend/release_loading_tests.rs index b07b00495..4aaa616a2 100644 --- a/launcher/src/backend/release_loading_tests.rs +++ b/launcher/src/backend/release_loading_tests.rs @@ -45,7 +45,7 @@ fn baseline(load: impl Fn() -> Result) -> (Vec Result) -> (Vec, Updates) { let mut releases = None; let updates = releases_and_updates_with( - false, + UpdateChannel::Stable, load, installed_fixture, |list| parse_releases(list, LAUNCHER_ASSET, is_launcher_tag), @@ -82,7 +82,7 @@ fn errors_reach_releases_and_updates_without_fallback() { ] { let mut published = None; let result = releases_and_updates_with( - false, + UpdateChannel::Stable, || Err(error.into()), || panic!("no installed scan after failure"), |_| panic!("no fallback after failure"), @@ -97,7 +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, + UpdateChannel::Stable, || Ok(serde_json::json!([{"tag_name": "v2026.10.14", "assets": []}])), Vec::new, |list| { @@ -132,7 +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, + UpdateChannel::Stable, || { 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 1151ee476..a3903bf2f 100644 --- a/launcher/src/cli.rs +++ b/launcher/src/cli.rs @@ -277,6 +277,13 @@ enum Cmd { #[arg(value_parser = ["horizon", "classic"])] style: Option, }, + /// Show or set which Horizon releases install by themselves: stable (a tested build about once + /// a day) or nightly (every release as soon as it is built; can break) + UpdateChannel { + /// Omit to show the current channel + #[arg(value_parser = ["stable", "nightly"])] + channel: Option, + }, /// Show or set the extra arguments the game starts with (for example --server-thread); /// quotes group a word with spaces in it GameArgs { @@ -394,7 +401,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, "channel": if r.beta { "beta" } else { "stable" }, + "tag": r.tag, "name": r.name, "date": r.date, "channel": backend::UpdateChannel::of(r).name(), "available_here": r.asset.is_some(), "installed": backend::installed().contains(&r.tag), }) } @@ -445,8 +452,8 @@ fn execute(command: Cmd, as_json: bool) -> Result<(), String> { (false, true) => "", (false, false) => "no build for this platform", }; - let channel = if r.beta { "beta" } else { "stable" }; - println!("{:<15} {} {:<6} {}", r.tag, r.date, channel, state); + let channel = backend::UpdateChannel::of(r).name(); + println!("{:<15} {} {:<7} {}", r.tag, r.date, channel, state); } } Cmd::Install { tag } => { @@ -552,6 +559,19 @@ fn execute(command: Cmd, as_json: bool) -> Result<(), String> { println!("Menu style: {style}"); } } + Cmd::UpdateChannel { channel } => { + let mut settings = backend::Settings::load(); + if let Some(channel) = channel.as_deref().and_then(backend::UpdateChannel::parse) { + settings.update_channel = channel; + settings.save(); + } + let channel = settings.update_channel.name(); + if as_json { + json(serde_json::json!({ "update_channel": channel })); + } else { + println!("Update channel: {channel}"); + } + } Cmd::GameArgs { args } => { let mut settings = backend::Settings::load(); if let Some(line) = args { diff --git a/launcher/src/main.rs b/launcher/src/main.rs index 2fec8e50f..ec418a213 100644 --- a/launcher/src/main.rs +++ b/launcher/src/main.rs @@ -92,9 +92,6 @@ fn ease_out_cubic(x: f32) -> f32 { horizon_theme::ease_out_cubic(x) } -/// How often the launcher looks for new releases while it is open. -const CHECK_EVERY: Duration = Duration::from_secs(4 * 3600); - enum Load { Loading, Ready(T), @@ -618,7 +615,8 @@ impl Launcher { changed = true; } } - if self.checked.is_some_and(|at| at.elapsed() > CHECK_EVERY) { + let every = self.settings.update_channel.check_every(); + if self.checked.is_some_and(|at| at.elapsed() > every) { self.check_updates(); } if changed { @@ -1832,15 +1830,25 @@ 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(); + use backend::UpdateChannel::{Nightly, Stable}; + let this = cx.entity().downgrade(); + let update_channel = segments( + "update-channel", + &[(Stable, Stable.label()), (Nightly, Nightly.label())], + self.settings.update_channel, + &t, + move |picked, _, cx| { + let _ = this.update(cx, |this, cx| { + if this.settings.update_channel != picked { + this.settings.update_channel = picked; + 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; @@ -1996,11 +2004,18 @@ 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()), + "Updates", + Some( + div() + .flex() + .flex_col() + .child("Stable: a tested build about once a day.") + .child( + "Nightly: every change as soon as it is built, several times a day; can break.", + ) + .into_any_element(), + ), + Some(update_channel.into_any_element()), &t, )) .child(index_row( @@ -2439,7 +2454,7 @@ impl Launcher { let tag = release.tag.clone(); let installed = self.installed.contains(&tag); let selected = self.selected() == Some(&tag); - let channel = if release.beta { "Beta" } else { "Stable" }; + let channel = backend::UpdateChannel::of(&release).label(); 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 3103961c0..0d77c3545 100644 --- a/launcher/src/mcp.rs +++ b/launcher/src/mcp.rs @@ -51,6 +51,8 @@ fn tools() -> Value { { "name": "links", "description": "The Horizon links: the Discord invite, the GitHub Sponsors page and the website (an empty one is not offered).", "inputSchema": none }, { "name": "menu_style", "description": "Show or set the game's menu style. \"horizon\" is Horizon's own menus, \"classic\" is vanilla's screens, which have no way back inside the game. The game reads it when it starts.", "inputSchema": { "type": "object", "properties": { "style": { "type": "string", "enum": ["horizon", "classic"], "description": "Omit to show the current style." } } } }, + { "name": "update_channel", "description": "Show or set which Horizon releases install by themselves. \"stable\" (the default) is a tested build about once a day; \"nightly\" is every release as soon as it is built, several times a day, and can break. Only when the player asks to change it.", + "inputSchema": { "type": "object", "properties": { "channel": { "type": "string", "enum": ["stable", "nightly"], "description": "Omit to show the current channel." } } } }, { "name": "logs", "description": "Read the game's log: the last lines of logs/latest.log in the game folder, or with crash the newest crash report (what the game wrote when it last crashed). Read-only.", "inputSchema": { "type": "object", "properties": { "lines": { "type": "integer", "minimum": 1, "maximum": 5000, "description": "How many lines of latest.log (default 100)." }, "crash": { "type": "boolean", "description": "Return the newest crash report instead." } } } }, { "name": "accounts", "description": "The Microsoft accounts signed in to the launcher (names and UUIDs, never tokens), which one the game plays as (none = offline), and how a sign-in started with sign_in is going.", "inputSchema": none }, @@ -95,7 +97,7 @@ impl Session { { out["releases"] = backend::releases()? .iter() - .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() })) + .map(|r| json!({ "tag": r.tag, "name": r.name, "date": r.date, "channel": backend::UpdateChannel::of(r).name(), "available_here": r.asset.is_some() })) .collect(); } Ok(serde_json::to_string_pretty(&out).unwrap()) @@ -285,6 +287,18 @@ impl Session { } Ok(format!("Menu style: {}", backend::menu_style().name())) } + "update_channel" => { + let mut settings = backend::Settings::load(); + if let Some(name) = arg_str(args, "channel") { + settings.update_channel = backend::UpdateChannel::parse(name) + .ok_or("channel is \"stable\" or \"nightly\"")?; + settings.save(); + } + Ok(format!( + "Update channel: {}", + settings.update_channel.name() + )) + } "data_collection" => Ok(serde_json::to_string_pretty(&telemetry::status_json()) .map_err(|e| e.to_string())?), "set_data_collection" => { diff --git a/tests/test_release_channels.py b/tests/test_release_channels.py index 8a98c6470..ed183afed 100644 --- a/tests/test_release_channels.py +++ b/tests/test_release_channels.py @@ -4,7 +4,8 @@ import unittest from tools import release_channels as channels from tools import release_train as train -NOW = dt.datetime(2026, 10, 19, 18, 0, tzinfo=dt.timezone.utc) +# Just after the daily promotion (PROMOTE_AT, 20:00 UTC): a beta is due when it had been out 6 hours by 20:00. +NOW = dt.datetime(2026, 10, 19, 20, 30, tzinfo=dt.timezone.utc) def release(tag, hours_ago, prerelease=True, smoke=True, draft=False): @@ -29,9 +30,30 @@ class ReleaseChannelTests(unittest.TestCase): self.assertIn("6 h", why) def test_nothing_is_due_before_six_hours(self): - chosen, why = channels.choose([STABLE, release("v2026.10.19", 5.5)], [], NOW) - self.assertIsNone(chosen) - self.assertIn("0 h 30 min to go", why) + chosen, why = channels.choose([STABLE, release("v2026.10.19", 6)], [], NOW) + self.assertIsNone(chosen, "out 5 h 30 min at 20:00") + self.assertIn("the one at 2026-10-20 20:00 UTC takes it", why) + late = channels.choose([STABLE, release("v2026.10.19", 0.5)], [], NOW)[1] + self.assertIn("the one at 2026-10-20 20:00 UTC takes it", late, "out after 20:00: 6 h by the next one") + + def test_stable_moves_once_a_day_whenever_the_run_starts(self): + hour = dt.timedelta(hours=1) + releases = [STABLE, release("v2026.10.19", 9), release("v2026.10.19.01", 6)] + # Before 20:00 nothing new is due, even what has been out 6 hours by now. + before = channels.choose(releases, [], NOW - hour) + self.assertIsNone(before[0], before[1]) + # The 20:00 run and a late one or a retry pick the same beta; once it is stable, the evening's later runs + # promote nothing, though v2026.10.19.01 has been out 6 hours by then. + for late in (0, 1, 3): + self.assertEqual(channels.choose(releases, [], NOW + late * hour)[0]["tag_name"], "v2026.10.19") + promoted = [release("v2026.10.19", 9, prerelease=False), releases[2]] + self.assertIsNone(channels.choose(promoted, [], NOW + 3 * hour)[0]) + # A run GitHub skipped is caught up by the next one, at any hour before the next day's promotion. + self.assertEqual(channels.choose(releases, [], NOW + 20 * hour)[0]["tag_name"], "v2026.10.19") + # The next day's promotion takes the one that came out too late for today's. + self.assertEqual(channels.choose(promoted, [], NOW + 24 * hour)[0]["tag_name"], "v2026.10.19.01") + self.assertEqual(channels.promotion_time(NOW), dt.datetime(2026, 10, 19, 20, 0, tzinfo=dt.timezone.utc)) + self.assertEqual(channels.promotion_time(NOW - hour), dt.datetime(2026, 10, 18, 20, 0, tzinfo=dt.timezone.utc)) def test_a_beta_without_its_smoke_test_waits_for_a_hand(self): releases = [STABLE, release("v2026.10.19", 8, smoke=False)] @@ -97,13 +119,14 @@ class ReleaseChannelTests(unittest.TestCase): launcher = release("launcher@0.2.0", 7) self.assertIsNone(channels.choose([bridge, launcher], [], NOW)[0], "launcher releases are never game betas") - def test_a_stall_is_reported_once_the_oldest_waiting_beta_is_a_day_old(self): - self.assertIsNone(channels.stalled([STABLE, release("v2026.10.19", 23), release("v2026.10.19.01", 2)], NOW)) - releases = [STABLE, release("v2026.10.19", 25), release("v2026.10.19.01", 2)] + def test_a_stall_is_reported_once_the_oldest_waiting_beta_missed_a_daily_promotion(self): + # Out at 14:31 yesterday: just too late for yesterday's 20:00, so 29 h 59 min of waiting is a normal day. + self.assertIsNone(channels.stalled([STABLE, release("v2026.10.19", 29.99), release("v2026.10.19.01", 2)], NOW)) + releases = [STABLE, release("v2026.10.19", 31), release("v2026.10.19.01", 2)] oldest, age = channels.stalled(releases, NOW) self.assertEqual(oldest["tag_name"], "v2026.10.19") title, body = channels.stall_issue(releases, (oldest, age), "no beta is due (release-blocker #4)") - self.assertEqual(title, "Promotion to stable has stalled: v2026.10.19 has waited 25 h") + self.assertEqual(title, "Promotion to stable has stalled: v2026.10.19 has waited 31 h") self.assertIn("v2026.10.18.04", body) self.assertIn("release-blocker #4", body) # Betas older than the stable release are contained in it: they aren't waiting. @@ -114,10 +137,10 @@ class ReleaseChannelTests(unittest.TestCase): pr = {"number": 1, "title": "Fix a thing", "labels": [], "paths": ["crates/x.rs"], "issues": [], "author": "ludovic111"} _, beta = train.notes("game", "v2026.10.19", [pr], [], beta=True) _, stable = train.notes("game", "v2026.10.19", [pr], [], beta=False) - self.assertIn("beta build", beta) - self.assertNotIn("beta build", stable) + self.assertIn("This is a nightly build: launchers on the Nightly channel", beta) + self.assertNotIn("nightly", stable.lower()) _, launcher = train.notes("launcher", "launcher-v0.9.0", [pr], [], beta=True) - self.assertNotIn("beta build", launcher) + self.assertNotIn("nightly", launcher.lower()) if __name__ == "__main__": diff --git a/tests/test_release_train.py b/tests/test_release_train.py index 73b192c67..2a41ae810 100644 --- a/tests/test_release_train.py +++ b/tests/test_release_train.py @@ -120,15 +120,15 @@ class ReleaseTrainTests(unittest.TestCase): def test_decision(self): minute = dt.timedelta(minutes=1) decide = lambda prs, **kw: train.decision("game", prs, NOW, **kw)[0] - self.assertTrue(decide([pr(1, merged=16 * minute)]), "settled for the debounce") - self.assertFalse(decide([pr(1, merged=5 * minute)]), "merged moments ago") - self.assertFalse(decide([pr(1, merged=40 * minute), pr(2, merged=5 * minute)]), "a burst still merging") - self.assertTrue(decide([pr(1, merged=61 * minute), pr(2, merged=2 * minute)]), "merges that never pause still ship") + self.assertTrue(decide([pr(1, merged=6 * minute)]), "settled for the debounce") + self.assertFalse(decide([pr(1, merged=2 * minute)]), "merged moments ago") + self.assertFalse(decide([pr(1, merged=15 * minute), pr(2, merged=2 * minute)]), "a burst still merging") + self.assertTrue(decide([pr(1, merged=21 * minute), pr(2, merged=minute)]), "merges that never pause still ship") self.assertTrue(decide([pr(1, labels=["release-now"], merged=minute)])) self.assertFalse(decide([pr(1, paths=[])]), "nothing players run") self.assertFalse(decide([pr(1, labels=["skip-release"])])) self.assertFalse(decide([pr(1, labels=["release-now", "skip-release"])])) - self.assertFalse(decide([pr(1, merged=5 * minute), pr(2, labels=["skip-release"], merged=minute)]), "the settled one waits for nothing") + self.assertFalse(decide([pr(1, merged=3 * minute), pr(2, labels=["skip-release"], merged=minute)]), "the settled one waits for nothing") self.assertFalse(decide([pr(1)], paused=True)) self.assertTrue(decide([], paused=True, force=True)) diff --git a/tools/release_channels.py b/tools/release_channels.py index 592e083d8..be0f2ca73 100644 --- a/tools/release_channels.py +++ b/tools/release_channels.py @@ -1,14 +1,16 @@ #!/usr/bin/env python3 -"""Promotes Horizon's beta game releases to stable (.github/workflows/promote.yml, docs/release-flow.md). +"""Promotes Horizon's beta game releases to stable once a day (.github/workflows/promote.yml, docs/release-flow.md). python3 tools/release_channels.py promote # the newest beta that is due, if any python3 tools/release_channels.py promote --tag v2026.10.19.03 # that beta now (by hand) python3 tools/release_channels.py promote --tag v2026.10.19.03 --force # even if blocked or untested python3 tools/release_channels.py promote --dry-run # say what would happen, change nothing -Every game release goes out as a beta (a GitHub pre-release). A beta is due for stable when: +Every game release goes out as a beta (a GitHub pre-release): launchers on the Nightly channel install it at once. +Stable moves once a day, at PROMOTE_AT (20:00 UTC). A beta is due for stable when: - it is newer than the stable release (GitHub's "latest", which launchers and servers install by default), -- it has been out PROMOTE_AFTER (6 hours) without trouble; a promotion by hand (--tag) skips the wait, +- it had been out PROMOTE_AFTER (6 hours) at the day's promotion time, so every run until the next one picks the + same beta and a run GitHub starts late (or a second try) never promotes twice; by hand (--tag) skips the wait, - its release smoke test passed: release.yml attaches smoke-test.json only after the Mac mini ran the game, - and no issue labelled release-blocker covers it. An open blocker holds every beta; one closed as completed keeps holding the betas published before it closed (they still have the bug); one closed as not planned holds nothing. @@ -20,7 +22,8 @@ stable release (tools/release_train.py notes --stable). Older betas stay betas: Nothing older than the current stable release is ever promoted, even with --force: GitHub's "latest" is what horizon-server update and install.sh download, and it only moves forward. -When the oldest beta newer than the stable release has waited STALL_AFTER (24 hours), promotion has stalled +When the oldest beta newer than the stable release has waited STALL_AFTER (30 hours: past one daily promotion it +was due for, so a normal day never trips it), promotion has stalled (blocked, smoke tests not running, the schedule off): an issue says so, and is closed once a beta is promoted. """ @@ -39,10 +42,14 @@ from tools.release_train import is_game_tag, tag_key # noqa: E402 (vYYYY.MM.DD REPO = os.environ.get("GITHUB_REPOSITORY", "ludovic111/horizon") PROMOTE_AFTER = dt.timedelta(hours=6) +# The daily promotion (21:00 in Paris in winter time, 22:00 in summer); promote.yml's schedule runs just after it. +PROMOTE_AT = dt.time(20, 0) SMOKE_ASSET = "smoke-test.json" BLOCKER = "release-blocker" -STALL_AFTER = dt.timedelta(hours=24) +STALL_AFTER = dt.timedelta(hours=30) STALLED = "Promotion to stable has stalled" + + def parse_time(text): return dt.datetime.fromisoformat(text.replace("Z", "+00:00")) if text else None @@ -55,6 +62,13 @@ def covers(blocker, release): return blocker.get("state_reason") == "completed" and bool(closed) and parse_time(release["published_at"]) < closed +def promotion_time(now): + """The last daily promotion time (PROMOTE_AT, UTC) at or before now.""" + now = now.astimezone(dt.timezone.utc) + at = dt.datetime.combine(now.date(), PROMOTE_AT, dt.timezone.utc) + return at if at <= now else at - dt.timedelta(days=1) + + def stable(releases): """The newest stable (non pre-release) game release.""" stables = [r for r in releases if not r["prerelease"]] @@ -68,11 +82,12 @@ def reasons_against(release, current, blockers, now, by_hand=False): reasons.append("it is already stable") if current and tag_key(release["tag_name"]) <= tag_key(current["tag_name"]): reasons.append(f"it is not newer than the stable {current['tag_name']}") - age = now - parse_time(release["published_at"]) - if not by_hand and age < PROMOTE_AFTER: - left = PROMOTE_AFTER - age - reasons.append(f"it has been out {age.seconds // 3600} h {age.seconds % 3600 // 60} min, " - f"{left.seconds // 3600} h {left.seconds % 3600 // 60} min to go") + ready = parse_time(release["published_at"]) + PROMOTE_AFTER + if not by_hand and ready > promotion_time(now): + due = promotion_time(ready) + due += dt.timedelta(days=1 if due < ready else 0) + reasons.append(f"it had not been out {PROMOTE_AFTER.seconds // 3600} h at a daily promotion yet: " + f"the one at {due:%Y-%m-%d %H:%M} UTC takes it") if not any(asset["name"] == SMOKE_ASSET for asset in release.get("assets", [])): reasons.append(f"it has no {SMOKE_ASSET}: the release smoke test did not run") for blocker in blockers: @@ -101,8 +116,8 @@ def choose(releases, blockers, now, tag=None, force=False): for release in betas: reasons = reasons_against(release, current, blockers, now) if not reasons: - return release, f"{release['tag_name']} has been out {PROMOTE_AFTER.seconds // 3600} h, passed its smoke test " \ - "and no release-blocker covers it" + return release, f"{release['tag_name']} had been out {PROMOTE_AFTER.seconds // 3600} h at the daily promotion, " \ + "passed its smoke test and no release-blocker covers it" held.append(f"{release['tag_name']}: " + "; ".join(reasons)) return None, "no beta is due" + (" (" + " / ".join(held[:3]) + ")" if held else "") @@ -161,7 +176,7 @@ def promote(release): def main(): parser = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter) parser.add_argument("command", choices=["promote"]) - parser.add_argument("--tag", help="promote this beta now (by hand: no 6-hour wait)") + parser.add_argument("--tag", help="promote this beta now (by hand: no wait for the daily promotion)") parser.add_argument("--force", action="store_true", help="with --tag: even without a smoke test or with a blocker") parser.add_argument("--dry-run", action="store_true", help="say what would be promoted, change nothing") parser.add_argument("--now", help="the time to decide at (ISO 8601; default now)") @@ -169,6 +184,7 @@ def main(): if args.force and not args.tag: parser.error("--force needs --tag: only a named beta is forced") now = dt.datetime.fromisoformat(args.now) if args.now else dt.datetime.now(dt.timezone.utc) + now = now if now.tzinfo else now.replace(tzinfo=dt.timezone.utc) releases = gh_pages(f"repos/{REPO}/releases?per_page=100") blockers = [issue for issue in gh_pages(f"repos/{REPO}/issues?labels={BLOCKER}&state=all&per_page=100") if "pull_request" not in issue] diff --git a/tools/release_train.py b/tools/release_train.py index 7df349582..5f6239edc 100644 --- a/tools/release_train.py +++ b/tools/release_train.py @@ -37,8 +37,9 @@ import sys ROOT = Path(__file__).resolve().parents[1] REPO = os.environ.get("GITHUB_REPOSITORY", "ludovic111/horizon") -DEBOUNCE = dt.timedelta(minutes=15) -MAX_WAIT = dt.timedelta(hours=1) +# Nightly builds ship constantly: a merge starts a release within minutes, once its wave of merges has settled. +DEBOUNCE = dt.timedelta(minutes=5) +MAX_WAIT = dt.timedelta(minutes=20) # Kept as typed in release titles, where the clauses after the first are lowercased. PROPER = {"Horizon", "Horizon's", "Minecraft", "Mojang", "Microsoft", "Java", "Xbox", "PlayStation", "Steam", "Windows", "Linux", "LAN", "Kira", "Discord", "Wayland", "Hyprland", "F3", "GUI", "UI"} @@ -71,8 +72,8 @@ LAUNCHER_IGNORED = ["launcher/links.json", "launcher/docs/", "launcher/tests/"] FOOTER = { "game": "Install or update it from the Horizon launcher: it installs new versions by itself. " "New here? Get the launcher at https://playhorizon.dev. You need your own copy of Minecraft: Java Edition.", - "beta": "This is a beta build: launchers with Beta builds turned on in Settings install it now; everyone gets it " - "once it has been out 6 hours without a release-blocker.", + "beta": "This is a nightly build: launchers on the Nightly channel (Settings, Updates) install it now; Stable gets it " + "in the next daily update if it holds up.", "launcher": "Your launcher updates itself. New here? Download the archive for your system below, extract it, " "and run `horizon-launcher`. Website: https://playhorizon.dev", } diff --git a/website/docs/faq.md b/website/docs/faq.md index 8c7fd97ad..bb810a42f 100644 --- a/website/docs/faq.md +++ b/website/docs/faq.md @@ -60,7 +60,7 @@ Only if you say yes, and each kind has its own switch. Everything is off by defa ## How often does it update? -Often. Every change players can see is released automatically after it is merged, so new versions can come out several times a day. The launcher installs them for you, or only stable ones if you leave **Beta builds** off. See [Install](/docs/install#updating). +Often. Every change players can see is released automatically after it is merged, so new versions can come out several times a day. On the **Nightly** channel the launcher installs each one as soon as it is built; on **Stable**, the default, it installs a tested build about once a day. See [Install](/docs/install#updating). ## How do I report a bug? diff --git a/website/docs/install.md b/website/docs/install.md index 1ac3da95a..b898d79de 100644 --- a/website/docs/install.md +++ b/website/docs/install.md @@ -37,9 +37,14 @@ The game opens on Horizon's own title screen. Your worlds, options and logs live - **Horizon.** The launcher looks for a new release when it starts and every four hours while it is open. With **Install new versions automatically** on (the default), it installs one and moves you to it if you were on the newest. New releases come out many times a day, and old versions stay installed until you remove them on the **Versions** page. - **The launcher.** It updates itself from its own releases, then shows **Restart** in its footer. -## Stable and beta builds +## Stable and Nightly -The launcher installs **stable** builds by default. In **Settings**, **Beta builds** installs new builds the moment they are released, before they have had time to settle. The **Versions** page shows each version's channel. A new release starts as a beta and becomes stable by itself about six hours later, once its smoke test has passed. +In **Settings**, **Updates** picks which builds install by themselves: + +- **Stable** (the default): a tested build about once a day. +- **Nightly**: every change as soon as it is built, several times a day. It can break. A launcher left open looks for new builds every 30 minutes, instead of every four hours. + +Every new release is a Nightly build first. Once a day (20:00 UTC, 21:00 in Paris in winter), the newest one that has been out for six hours, passed its smoke test and has no known blocker becomes Stable. "Nightly" is just the name: it updates many times a day, not once a night. The **Versions** page shows each version's channel, and you can install any of them by hand. ## The Versions page