[PR #46] [MERGED] Launcher 0.1.4: reuse prepared resources across versions; clippy and fmt #2294

Closed
opened 2026-11-02 15:54:41 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

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

Base: main ← Head: launcher-014


📝 Commits (4)

  • c989692 Launcher: cargo fmt (formatting only)
  • 3a522af Launcher: fix clippy's 7 warnings (unused re-exports, complex markdown types, large Err in send closures)
  • 8fa3eef Launcher 0.1.4: a new version reuses resources another installed version prepared
  • 1404dd5 Launcher: catch up versions an older launcher installed without preparing them

📊 Changes

8 files changed (+1525 additions, -444 deletions)

View changed files

📝 launcher/Cargo.lock (+1 -1)
📝 launcher/Cargo.toml (+1 -1)
📝 launcher/src/backend.rs (+529 -82)
📝 launcher/src/cli.rs (+63 -13)
📝 launcher/src/main.rs (+736 -292)
📝 launcher/src/markdown.rs (+96 -30)
📝 launcher/src/mcp.rs (+97 -23)
📝 launcher/src/theme.rs (+2 -2)

📄 Description

After launcher 0.1.3 auto-installed v2026.10.13.1, players had to prepare again (same Minecraft 26.3 as v2026.10.13), and could not play it at all if their official Minecraft folder was gone.

What changes

  • Reuse of prepared resources (backend::install, so CLI install/update, the window's auto-install and MCP all get it): when the new version is not prepared and another installed version with the same game_version() is, its .local/horizon-client/<game_version>/ is copied over. Copied into .<version>.partial and renamed when complete, so an interrupted copy never counts as prepared. Real copies, not hard links: prepare_native_client.py rewrites files in place (write_text/write_bytes), so a hard link would let re-preparing one version change the other's files.
  • install (text and --json) and the MCP install_version tool say when the version is already prepared.
  • cargo clippy warnings fixed (7; clean with -D warnings), cargo fmt run. No behaviour change. The fmt pass reformats the whole crate (no rustfmt.toml), so it is its own commit.
  • Version 0.1.4.

Does the prepared output depend on the Horizon version? Yes

horizon-resources.json holds schema: 7 (written by prepare_native_client.py), the pinned jar hashes, and per exporter group the sha256 of each vanilla exporter source it was made with (*_exporters_sha256: path → hash, plus exporter_sha256 for VanillaHeightmapOracle.java). The client itself checks only data_version. So reuse happens only when:

  • both research-lock.json pin the same minecraft.version, client_sha1 and server_sha1;
  • tools/prepare_native_client.py is byte-identical (it writes every file and the schema);
  • every exporter source the manifest lists is byte-identical in both version folders.

The helper modules it imports (lab.py, test_rust_parity.py, test_model_baking_parity.py) are not compared. Between v2026.10.13 and v2026.10.13.1 they changed only in how they find and check the player's files (accepted manifest sha1s, library selection), not in what is written. Requiring them identical would have blocked exactly the release this fixes. For the real pair: pins equal, the prepare script and all 18 recorded exporter sources identical. VanillaCameraOracle.java changed, but it is not a prepare exporter.

Verified (Linux, ludodesktop)

  • cargo test --release --locked --lib: 9 passed, including the new a_new_version_reuses_resources_prepared_by_a_compatible_one (reuse, already prepared, other Minecraft version, changed exporter, changed prepare script).
  • cargo build --release --locked, cargo clippy --release --locked --all-targets -- -D warnings, cargo fmt --check.
  • End to end with temp HORIZON_LAUNCHER_HOME/HORIZON_HOME and HORIZON_LAUNCHER_NO_SELF_UPDATE=1, with a fake installed and prepared v2026.10.13 (its real sources and manifest, plus a dummy resource file):
    • install latest installs v2026.10.13.1 and shows it as prepared, with the resources copied.
    • update (the update path) does the same.
    • With one exporter source tampered in the old version, update leaves v2026.10.13.1 not prepared.

Not tested: macOS and Windows (the code is std::fs only), and the GUI window's install (it uses the same backend::install).

🤖 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/46 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/13/2026 **Status:** ✅ Merged **Merged:** 10/13/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `launcher-014` --- ### 📝 Commits (4) - [`c989692`](https://github.com/horizon-rust/horizon/commit/c989692bd9126a56194309bdffb67d1be5b4cb99) Launcher: cargo fmt (formatting only) - [`3a522af`](https://github.com/horizon-rust/horizon/commit/3a522af0670286cd8a3427fe10d6349417b81391) Launcher: fix clippy's 7 warnings (unused re-exports, complex markdown types, large Err in send closures) - [`8fa3eef`](https://github.com/horizon-rust/horizon/commit/8fa3eef8093681873c6ae09d2fb6584ce9c187a7) Launcher 0.1.4: a new version reuses resources another installed version prepared - [`1404dd5`](https://github.com/horizon-rust/horizon/commit/1404dd5a0a2fcd142ea96a9adbf40d40adaf64ae) Launcher: catch up versions an older launcher installed without preparing them ### 📊 Changes **8 files changed** (+1525 additions, -444 deletions) <details> <summary>View changed files</summary> 📝 `launcher/Cargo.lock` (+1 -1) 📝 `launcher/Cargo.toml` (+1 -1) 📝 `launcher/src/backend.rs` (+529 -82) 📝 `launcher/src/cli.rs` (+63 -13) 📝 `launcher/src/main.rs` (+736 -292) 📝 `launcher/src/markdown.rs` (+96 -30) 📝 `launcher/src/mcp.rs` (+97 -23) 📝 `launcher/src/theme.rs` (+2 -2) </details> ### 📄 Description After launcher 0.1.3 auto-installed v2026.10.13.1, players had to prepare again (same Minecraft 26.3 as v2026.10.13), and could not play it at all if their official Minecraft folder was gone. ## What changes - **Reuse of prepared resources** (`backend::install`, so CLI `install`/`update`, the window's auto-install and MCP all get it): when the new version is not prepared and another installed version with the same `game_version()` is, its `.local/horizon-client/<game_version>/` is copied over. Copied into `.<version>.partial` and renamed when complete, so an interrupted copy never counts as prepared. Real copies, not hard links: `prepare_native_client.py` rewrites files in place (`write_text`/`write_bytes`), so a hard link would let re-preparing one version change the other's files. - `install` (text and `--json`) and the MCP `install_version` tool say when the version is already prepared. - `cargo clippy` warnings fixed (7; clean with `-D warnings`), `cargo fmt` run. No behaviour change. The fmt pass reformats the whole crate (no rustfmt.toml), so it is its own commit. - Version 0.1.4. ## Does the prepared output depend on the Horizon version? Yes `horizon-resources.json` holds `schema: 7` (written by `prepare_native_client.py`), the pinned jar hashes, and per exporter group the sha256 of each vanilla exporter source it was made with (`*_exporters_sha256`: path → hash, plus `exporter_sha256` for `VanillaHeightmapOracle.java`). The client itself checks only `data_version`. So reuse happens only when: - both `research-lock.json` pin the same `minecraft.version`, `client_sha1` and `server_sha1`; - `tools/prepare_native_client.py` is byte-identical (it writes every file and the schema); - every exporter source the manifest lists is byte-identical in both version folders. The helper modules it imports (`lab.py`, `test_rust_parity.py`, `test_model_baking_parity.py`) are not compared. Between v2026.10.13 and v2026.10.13.1 they changed only in how they find and check the player's files (accepted manifest sha1s, library selection), not in what is written. Requiring them identical would have blocked exactly the release this fixes. For the real pair: pins equal, the prepare script and all 18 recorded exporter sources identical. `VanillaCameraOracle.java` changed, but it is not a prepare exporter. ## Verified (Linux, ludodesktop) - `cargo test --release --locked --lib`: 9 passed, including the new `a_new_version_reuses_resources_prepared_by_a_compatible_one` (reuse, already prepared, other Minecraft version, changed exporter, changed prepare script). - `cargo build --release --locked`, `cargo clippy --release --locked --all-targets -- -D warnings`, `cargo fmt --check`. - End to end with temp `HORIZON_LAUNCHER_HOME`/`HORIZON_HOME` and `HORIZON_LAUNCHER_NO_SELF_UPDATE=1`, with a fake installed and prepared v2026.10.13 (its real sources and manifest, plus a dummy resource file): - `install latest` installs v2026.10.13.1 and shows it as **prepared**, with the resources copied. - `update` (the update path) does the same. - With one exporter source tampered in the old version, `update` leaves v2026.10.13.1 **not prepared**. Not tested: macOS and Windows (the code is `std::fs` only), and the GUI window's install (it uses the same `backend::install`). 🤖 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-02 15:54:41 +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#2294
No description provided.