[PR #3551] [MERGED] Launch API: horizon-client's options for other launchers (#3545) #5043

Closed
opened 2026-11-03 05:09:50 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/3551
Author: @GIGABAIT93
Created: 10/29/2026
Status: ✅ Merged
Merged: 10/30/2026
Merged by: @ludovic111

Base: main ← Head: feat/launch-api-client


📝 Commits (7)

📊 Changes

12 files changed (+774 additions, -98 deletions)

View changed files

📝 crates/horizon-client-render/src/auth.rs (+6 -6)
📝 crates/horizon-client-render/src/crash.rs (+5 -1)
📝 crates/horizon-client-render/src/logging.rs (+13 -2)
📝 crates/horizon-client/src/game.rs (+164 -83)
➕ crates/horizon-client/src/game/launch_api.rs (+266 -0)
📝 crates/horizon-client/src/main.rs (+25 -5)
➕ crates/horizon-client/tests/launch_api.rs (+113 -0)
📝 docs/api/README.md (+3 -1)
➕ docs/api/launch-reference.md (+98 -0)
➕ docs/api/launch.md (+77 -0)
📝 docs/api/stability.md (+2 -0)
📝 docs/microsoft-account.md (+2 -0)

📄 Description

🤖 Opened by GIGABAIT93's AI agent (Claude Code, Claude Opus 5.5), not by GIGABAIT93 directly.

What and why

The first part of #3545: what another launcher (Prism, MultiMC, ATLauncher, Modrinth App, HMCL…) needs to start horizon-client, as a versioned contract. Launch API 0.1.0, experimental until preparing and the guide are covered too.

  • --game-dir DIR (vanilla's --gameDir is accepted too): the folder for saves, options.txt, packs, mods and screenshots, created when missing. Paths given on the command line (--resources, --smoke-report, --control-socket) stay relative to where the game was started.
  • --home DIR: the same as HORIZON_HOME (logs, crash reports), set before the log opens. logging::game_home honours it everywhere.
  • --fullscreen: the window opens fullscreen whatever options.txt says, without writing it there.
  • --session-stdin: the session file's JSON on standard input, so the token never touches the disk.
  • --launch-api: prints the API version, the build, the Minecraft version, the options a launcher may pass, the exit codes and the crash report line as JSON, then exits 0. Unknown options stay refused, so a launcher asks this first.
  • Exit codes: 0, 1 (error, crash report), 2 for a refused command line, without a crash report (it was 1 with a crash report: the one change in behaviour), 101 (panic, crash report). The crash report line's prefix is now a constant, crash::SAVED_LINE.
  • --quickPlaySingleplayer is checked once the game folder is known; Options::read is split into parse (the command line alone, testable) and read (the session, the game folder, quick play).
  • Docs: docs/api/launch.md (the surface page), docs/api/launch-reference.md generated from game/launch_api.rs with a test that fails when it is out of date (HORIZON_WRITE_DOCS=1 cargo test -p horizon-client --bin horizon-client launch_api), rows in docs/api/README.md and stability.md, and --session-stdin in microsoft-account.md.

Tested by hand on Windows: --launch-api exits 0; --bogus exits 2 without a crash report; a run with --home, --game-dir, --session-stdin and missing resources creates the game folder, signs in from stdin, writes its log and crash report under --home, prints the report's path as its last stderr line and exits 1. --fullscreen on a real window is not tested here (no prepared resources on this machine).

Suggested label: feature.

Vanilla reference

net.minecraft.client.main.Main: the option names gameDir, fullscreen, width, height, quickPlaySingleplayer, quickPlayMultiplayer, checked in the 26.3 jar; --fullscreen goes to DisplayData, which opens the window fullscreen without changing Options.fullscreen. Otherwise Horizon-only (the Launch API). No harness: none covers the command line.

Self-check

Run on Linux (WSL2). The one failed test is packs::cache::tests::normalized_and_external_overlay_roots_keep_merged_bytes_current, which fails at random on an unchanged main too (3 runs in 5 there) and doesn't touch this change; #3602 fixes it.

pr_ready (tools/pr_ready.py --quick --base upstream/main on GIGABAIT, against upstream/main at 8f0c17895, 7 min 32 s)

Check Result
Scope ✅ 10 files, +566 −38
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 408 passed (27 s)
rustfmt ✅ (6 s)
clippy ✅ (2 min 15 s)
tests: horizon-client, horizon-client-render ❌ 1299 passed, 1 failed (2 min 46 s)
doc tests ✅ 0 passed (1 min 58 s)
content root tests ➖ content root untouched
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ not run (--quick): CI's parity job picks the affected harnesses
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/3551 **Author:** [@GIGABAIT93](https://github.com/GIGABAIT93) **Created:** 10/29/2026 **Status:** ✅ Merged **Merged:** 10/30/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `feat/launch-api-client` --- ### 📝 Commits (7) - [`cbd1b1c`](https://github.com/horizon-rust/horizon/commit/cbd1b1c93e555084a95afd0f7ee3a4b4ceae1106) Launch API: horizon-client's options for other launchers (#3545) - [`8b65dc4`](https://github.com/horizon-rust/horizon/commit/8b65dc4516eb7cf297481fd63caeafadef0ac49a) Merge branch 'main' of https://github.com/horizon-rust/horizon into feat/launch-api-client - [`88e10db`](https://github.com/horizon-rust/horizon/commit/88e10db8e56028c6180280a96d54e107d6f85089) Merge branch 'main' of https://github.com/horizon-rust/horizon into feat/launch-api-client - [`7d22727`](https://github.com/horizon-rust/horizon/commit/7d227270a204e816f842d1e50c1ae1076aacfaae) Merge branch 'main' of https://github.com/horizon-rust/horizon into feat/launch-api-client - [`416678b`](https://github.com/horizon-rust/horizon/commit/416678ba17190b74a3348bc77b5d1276a11b31ec) Launch API: test the exit codes on the real program (#3545) - [`ca7e8be`](https://github.com/horizon-rust/horizon/commit/ca7e8bed1a3d040c4b482731e7a052099e1422b4) Launch API: rustfmt the exit code test - [`267e706`](https://github.com/horizon-rust/horizon/commit/267e7063d51a447772a8ac6cabb9fe17f0c1db6f) Launch API: promise play only for an owner, name the option in errors (#3545) ### 📊 Changes **12 files changed** (+774 additions, -98 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-render/src/auth.rs` (+6 -6) 📝 `crates/horizon-client-render/src/crash.rs` (+5 -1) 📝 `crates/horizon-client-render/src/logging.rs` (+13 -2) 📝 `crates/horizon-client/src/game.rs` (+164 -83) ➕ `crates/horizon-client/src/game/launch_api.rs` (+266 -0) 📝 `crates/horizon-client/src/main.rs` (+25 -5) ➕ `crates/horizon-client/tests/launch_api.rs` (+113 -0) 📝 `docs/api/README.md` (+3 -1) ➕ `docs/api/launch-reference.md` (+98 -0) ➕ `docs/api/launch.md` (+77 -0) 📝 `docs/api/stability.md` (+2 -0) 📝 `docs/microsoft-account.md` (+2 -0) </details> ### 📄 Description > 🤖 Opened by GIGABAIT93's AI agent (Claude Code, Claude Opus 5.5), not by GIGABAIT93 directly. ## What and why The first part of #3545: what another launcher (Prism, MultiMC, ATLauncher, Modrinth App, HMCL…) needs to start `horizon-client`, as a versioned contract. Launch API 0.1.0, experimental until preparing and the guide are covered too. - `--game-dir DIR` (vanilla's `--gameDir` is accepted too): the folder for saves, `options.txt`, packs, mods and screenshots, created when missing. Paths given on the command line (`--resources`, `--smoke-report`, `--control-socket`) stay relative to where the game was started. - `--home DIR`: the same as `HORIZON_HOME` (logs, crash reports), set before the log opens. `logging::game_home` honours it everywhere. - `--fullscreen`: the window opens fullscreen whatever `options.txt` says, without writing it there. - `--session-stdin`: the session file's JSON on standard input, so the token never touches the disk. - `--launch-api`: prints the API version, the build, the Minecraft version, the options a launcher may pass, the exit codes and the crash report line as JSON, then exits 0. Unknown options stay refused, so a launcher asks this first. - Exit codes: 0, 1 (error, crash report), **2 for a refused command line, without a crash report** (it was 1 with a crash report: the one change in behaviour), 101 (panic, crash report). The crash report line's prefix is now a constant, `crash::SAVED_LINE`. - `--quickPlaySingleplayer` is checked once the game folder is known; `Options::read` is split into `parse` (the command line alone, testable) and `read` (the session, the game folder, quick play). - Docs: `docs/api/launch.md` (the surface page), `docs/api/launch-reference.md` generated from `game/launch_api.rs` with a test that fails when it is out of date (`HORIZON_WRITE_DOCS=1 cargo test -p horizon-client --bin horizon-client launch_api`), rows in `docs/api/README.md` and `stability.md`, and `--session-stdin` in `microsoft-account.md`. Tested by hand on Windows: `--launch-api` exits 0; `--bogus` exits 2 without a crash report; a run with `--home`, `--game-dir`, `--session-stdin` and missing resources creates the game folder, signs in from stdin, writes its log and crash report under `--home`, prints the report's path as its last stderr line and exits 1. `--fullscreen` on a real window is not tested here (no prepared resources on this machine). Suggested label: `feature`. ## Vanilla reference `net.minecraft.client.main.Main`: the option names `gameDir`, `fullscreen`, `width`, `height`, `quickPlaySingleplayer`, `quickPlayMultiplayer`, checked in the 26.3 jar; `--fullscreen` goes to `DisplayData`, which opens the window fullscreen without changing `Options.fullscreen`. Otherwise Horizon-only (the Launch API). No harness: none covers the command line. ## Self-check Run on Linux (WSL2). The one failed test is `packs::cache::tests::normalized_and_external_overlay_roots_keep_merged_bytes_current`, which fails at random on an unchanged main too (3 runs in 5 there) and doesn't touch this change; #3602 fixes it. **pr_ready** (`tools/pr_ready.py --quick --base upstream/main` on GIGABAIT, against upstream/main at 8f0c17895, 7 min 32 s) | Check | Result | | --- | --- | | Scope | ✅ 10 files, +566 −38 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 408 passed (27 s) | | rustfmt | ✅ (6 s) | | clippy | ✅ (2 min 15 s) | | tests: horizon-client, horizon-client-render | ❌ 1299 passed, 1 failed (2 min 46 s) | | doc tests | ✅ 0 passed (1 min 58 s) | | content root tests | ➖ content root untouched | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ not run (--quick): CI's parity job picks the affected harnesses | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 05:09:50 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon#5043
No description provided.