[PR #2892] [MERGED] Launcher: Play needs a Microsoft account that owns Minecraft: Java Edition #4673

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/2892
Author: @ludovic111
Created: 10/27/2026
Status: ✅ Merged
Merged: 10/27/2026
Merged by: @ludovic111

Base: main ← Head: feat/launcher-owner-gate


📝 Commits (2)

  • ce64c61 launcher: Play needs a Microsoft account that owns Minecraft: Java Edition
  • 95bf281 Merge remote-tracking branch 'origin/main' into feat/launcher-owner-gate

📊 Changes

14 files changed (+686 additions, -212 deletions)

View changed files

📝 README.md (+3 -3)
📝 docs/launcher-commands.md (+3 -3)
📝 docs/microsoft-account.md (+33 -7)
📝 launcher/README.md (+12 -5)
📝 launcher/lang/fr.json (+6 -4)
📝 launcher/lang/ru.json (+6 -4)
📝 launcher/src/account.rs (+225 -83)
📝 launcher/src/account/tests.rs (+182 -37)
📝 launcher/src/backend.rs (+39 -26)
📝 launcher/src/cli.rs (+16 -7)
📝 launcher/src/main.rs (+67 -32)
📝 launcher/src/mcp.rs (+2 -0)
📝 launcher/src/switch_page.rs (+3 -1)
➕ launcher/tests/owner_gate.rs (+89 -0)

📄 Description

🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself.

What

The launcher starts the game only while a Microsoft account in it owns Minecraft: Java Edition, as other launchers do. Ludovic agreed to this on Discord with bunchy7s on 2026-10-27, for two reasons: Mojang sees it favourably, and it makes the download from Mojang's servers clean. Offline play stays possible. The launcher just doesn't offer it on its own any more.

  • The owner gate (account::launch): before every Play, the launcher asks the Minecraft services again (the token renewal if due, then entitlements/mcstore with game_minecraft/product_minecraft, then the profile). It asks each account, the selected one first, until one owns the game. Without an owner the game doesn't start.
  • The answer lives with the tokens. Each account's keychain item keeps the last answer (owns), so no plain file can say yes. Accounts saved before this PR passed the same check at sign-in, which refuses non-owners, so they read as owners.
    • No network (or a sign-in that can't be renewed): the last answer stands, and the game starts offline as before.
    • "Doesn't own" (or no profile): blocks at once, and the answer is saved.
  • Every Play goes through the gate:
    • the window: Home, instances, packs, joining a friend, quick play;
    • horizon-launcher play and modpack play (via backend::client, where the gate now runs first);
    • the MCP's play.
    • The refusal: "Sign in with a Microsoft account that owns Minecraft: Java Edition to play." Home shows it with a Sign in button, which starts the sign-in and opens Settings with its code. The CLI adds horizon-launcher account sign-in.
  • Offline names play behind an owner. They can be added (play_as) only while an owning account is signed in. Signing the last one out keeps them in accounts.json; they can't launch until an owner is back.
  • Strings:
    • Removed: "Microsoft sign-in is coming soon. Until then the game plays offline…", "Coming soon" and "Microsoft account (coming soon)".
    • A build without a client ID now says it can't start the game.
    • FR and RU updated.
    • account list (CLI and MCP) reports owner.
  • Not affected:
    • the game binary (horizon-client, horizon-ctl launch), the harnesses and CI;
    • the dedicated server and horizon-server;
    • the website.
    • There is no bypass flag. Unit tests keep their accounts in MemoryStore (store() never reaches the keychain under cfg(test)). The CLI and MCP tests use the existing HORIZON_NO_KEYCHAIN, which gives a store with no owner.
  • Docs: docs/microsoft-account.md ("The owner gate"), launcher/README.md, README.md ("You need", and the out-of-date "can't sign in yet" lines), docs/launcher-commands.md (regenerated).

The one-time screen for players who played offline until now comes in the next PR. That PR also shows the gate as a screen when Play is pressed, with the sign-in code on it. The download for owners follows after that (brief mc-download-1).

Size

About 740 lines of code, roughly 300 of them tests. The rule has to hold at every entry point at once, so it can't ship in parts.

Tests

Unit tests in launcher/src/account/tests.rs, against the local mock of the Microsoft, Xbox and Minecraft services:

  • an_owner_plays_with_a_session: entitlements say yes.
  • a_no_from_the_services_blocks_at_once: entitlements say no. The answer is kept, and it still blocks offline.
  • no_network_never_blocks_a_past_owner: a network error after a past yes. This includes a token to renew offline and a build without a client ID. An account that never passed doesn't pass offline.
  • accounts_from_before_the_gate_owned_the_game_at_sign_in.
  • any_owner_opens_the_gate_and_the_one_who_plays_brings_the_session: the selected account is gone from the keychain, an offline name plays, or there are no accounts.
  • offline_names_play_only_beside_an_owner: also covers removing the last owner.
  • refresh_only_when_the_token_runs_out: rewritten for check.

Integration tests in launcher/tests/owner_gate.rs run the real binary in fresh homes, with an offline-only player's accounts.json and an installed version:

  • horizon-launcher play exits with the refusal, and the offline name is kept.
  • The MCP's tools/call play returns isError with the refusal.

Still to do: one real run on the Mac mini (sign in, Play works, sign out, Play refused, keychain clean) and screenshots of the gate in dark and light. Ludovic has to enter the sign-in code himself, and the Mac mini's screen is locked right now (so screencapture sees only the lock screen). These come with the next PR.

pr_ready (tools/pr_ready.py --quick on ludovics-mac-mini, against origin/main at 7f760b8eb, 1 min 6 s)

Check Result
Scope ⚠️ 14 files, +686 −212; 740 lines of code: over 500, split it if it can ship in parts
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 365 passed (44 s)
rustfmt ➖ no Rust change
clippy ➖ no Rust change
tests ➖ no crate touched
doc tests ➖ no crate touched
content root tests ➖ content root untouched
tokens.css up to date ➖ theme untouched
launcher rustfmt ✅ (1 s)
launcher clippy ✅ (6 s)
launcher tests ✅ 202 passed (15 s)
Parity ➖ 1 affected, to run in CI (--quick): lan_integration
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/2892 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/27/2026 **Status:** ✅ Merged **Merged:** 10/27/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `feat/launcher-owner-gate` --- ### 📝 Commits (2) - [`ce64c61`](https://github.com/horizon-rust/horizon/commit/ce64c617e98bb8ceeab670f00b5ba29fbe0638ab) launcher: Play needs a Microsoft account that owns Minecraft: Java Edition - [`95bf281`](https://github.com/horizon-rust/horizon/commit/95bf2811fc25a5ec36b6b424d4e42419ec4c570c) Merge remote-tracking branch 'origin/main' into feat/launcher-owner-gate ### 📊 Changes **14 files changed** (+686 additions, -212 deletions) <details> <summary>View changed files</summary> 📝 `README.md` (+3 -3) 📝 `docs/launcher-commands.md` (+3 -3) 📝 `docs/microsoft-account.md` (+33 -7) 📝 `launcher/README.md` (+12 -5) 📝 `launcher/lang/fr.json` (+6 -4) 📝 `launcher/lang/ru.json` (+6 -4) 📝 `launcher/src/account.rs` (+225 -83) 📝 `launcher/src/account/tests.rs` (+182 -37) 📝 `launcher/src/backend.rs` (+39 -26) 📝 `launcher/src/cli.rs` (+16 -7) 📝 `launcher/src/main.rs` (+67 -32) 📝 `launcher/src/mcp.rs` (+2 -0) 📝 `launcher/src/switch_page.rs` (+3 -1) ➕ `launcher/tests/owner_gate.rs` (+89 -0) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. ## What The launcher starts the game only while a Microsoft account in it owns Minecraft: Java Edition, as other launchers do. Ludovic agreed to this on Discord with bunchy7s on 2026-10-27, for two reasons: Mojang sees it favourably, and it makes the download from Mojang's servers clean. Offline play stays possible. The launcher just doesn't offer it on its own any more. - **The owner gate** (`account::launch`): before every Play, the launcher asks the Minecraft services again (the token renewal if due, then `entitlements/mcstore` with `game_minecraft`/`product_minecraft`, then the profile). It asks each account, the selected one first, until one owns the game. Without an owner the game doesn't start. - **The answer lives with the tokens.** Each account's keychain item keeps the last answer (`owns`), so no plain file can say yes. Accounts saved before this PR passed the same check at sign-in, which refuses non-owners, so they read as owners. - No network (or a sign-in that can't be renewed): the last answer stands, and the game starts offline as before. - "Doesn't own" (or no profile): blocks at once, and the answer is saved. - **Every Play goes through the gate:** - the window: Home, instances, packs, joining a friend, quick play; - `horizon-launcher play` and `modpack play` (via `backend::client`, where the gate now runs first); - the MCP's `play`. - The refusal: "Sign in with a Microsoft account that owns Minecraft: Java Edition to play." Home shows it with a **Sign in** button, which starts the sign-in and opens Settings with its code. The CLI adds `horizon-launcher account sign-in`. - **Offline names play behind an owner.** They can be added (`play_as`) only while an owning account is signed in. Signing the last one out keeps them in `accounts.json`; they can't launch until an owner is back. - **Strings:** - Removed: "Microsoft sign-in is coming soon. Until then the game plays offline…", "Coming soon" and "Microsoft account (coming soon)". - A build without a client ID now says it can't start the game. - FR and RU updated. - `account list` (CLI and MCP) reports `owner`. - **Not affected:** - the game binary (`horizon-client`, `horizon-ctl launch`), the harnesses and CI; - the dedicated server and `horizon-server`; - the website. - There is no bypass flag. Unit tests keep their accounts in `MemoryStore` (`store()` never reaches the keychain under `cfg(test)`). The CLI and MCP tests use the existing `HORIZON_NO_KEYCHAIN`, which gives a store with no owner. - **Docs:** docs/microsoft-account.md ("The owner gate"), launcher/README.md, README.md ("You need", and the out-of-date "can't sign in yet" lines), docs/launcher-commands.md (regenerated). The one-time screen for players who played offline until now comes in the next PR. That PR also shows the gate as a screen when Play is pressed, with the sign-in code on it. The download for owners follows after that (brief mc-download-1). ## Size About 740 lines of code, roughly 300 of them tests. The rule has to hold at every entry point at once, so it can't ship in parts. ## Tests Unit tests in `launcher/src/account/tests.rs`, against the local mock of the Microsoft, Xbox and Minecraft services: - `an_owner_plays_with_a_session`: entitlements say yes. - `a_no_from_the_services_blocks_at_once`: entitlements say no. The answer is kept, and it still blocks offline. - `no_network_never_blocks_a_past_owner`: a network error after a past yes. This includes a token to renew offline and a build without a client ID. An account that never passed doesn't pass offline. - `accounts_from_before_the_gate_owned_the_game_at_sign_in`. - `any_owner_opens_the_gate_and_the_one_who_plays_brings_the_session`: the selected account is gone from the keychain, an offline name plays, or there are no accounts. - `offline_names_play_only_beside_an_owner`: also covers removing the last owner. - `refresh_only_when_the_token_runs_out`: rewritten for `check`. Integration tests in `launcher/tests/owner_gate.rs` run the real binary in fresh homes, with an offline-only player's `accounts.json` and an installed version: - `horizon-launcher play` exits with the refusal, and the offline name is kept. - The MCP's `tools/call play` returns `isError` with the refusal. Still to do: one real run on the Mac mini (sign in, Play works, sign out, Play refused, keychain clean) and screenshots of the gate in dark and light. Ludovic has to enter the sign-in code himself, and the Mac mini's screen is locked right now (so `screencapture` sees only the lock screen). These come with the next PR. **pr_ready** (`tools/pr_ready.py --quick` on ludovics-mac-mini, against origin/main at 7f760b8eb, 1 min 6 s) | Check | Result | | --- | --- | | Scope | ⚠️ 14 files, +686 −212; 740 lines of code: over 500, split it if it can ship in parts | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 365 passed (44 s) | | rustfmt | ➖ no Rust change | | clippy | ➖ no Rust change | | tests | ➖ no crate touched | | doc tests | ➖ no crate touched | | content root tests | ➖ content root untouched | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ✅ (1 s) | | launcher clippy | ✅ (6 s) | | launcher tests | ✅ 202 passed (15 s) | | Parity | ➖ 1 affected, to run in CI (--quick): lan_integration | | 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:07:06 +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#4673
No description provided.