[PR #178] [MERGED] Reuse verified Minecraft imports when preparing new versions #2380

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

📋 Pull Request Information

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

Base: main ← Head: fix/reuse-imported-minecraft


📝 Commits (2)

  • 20988e8 fix(prepare): reuse verified imports from installed versions
  • 8caee51 Regenerate preparation metadata when reusing imports

📊 Changes

5 files changed (+385 additions, -45 deletions)

View changed files

📝 crates/horizon-prepare/src/artifacts.rs (+356 -13)
📝 crates/horizon-prepare/src/lib.rs (+1 -1)
📝 launcher/README.md (+4 -1)
📝 launcher/src/backend.rs (+19 -26)
📝 launcher/src/main.rs (+5 -4)

📄 Description

Preparing a new Horizon version failed when the official Minecraft install had been moved or removed, even if an older installed Horizon version held the same pinned game files. The launcher and standalone horizon-prepare --prepare now reuse valid imports from the current version or an immediate sibling version before requiring that install.

Reuse checks the target version's lock, manifest, client/server jars, inner server jar, and required client/server libraries. It copies only those verified inputs through the existing atomic file-copy helper and verifies the destination again. A corrupt or incompatible candidate is skipped; the normal import path remains available when no valid copy exists.

Import and reuse share metadata generation: both inventories and prepared.json are generated from destination artifacts with paths relative to the current root. Existing valid imports missing those files are repaired too. Sibling discovery is intended for the launcher's versions/ folder.

The GUI, CLI and MCP all reach this lookup. In-process, external Rust and legacy Python preparers skip importing only after successful verification, without requiring or downloading another server jar. Optional sound assets still come from the Minecraft asset store as before.

Fixes #160.

Validation:

  • 16 preparer Rust tests, including real ZIP/checksum fixtures covering current/sibling reuse, corrupted manifests/jars/libraries, target pin mismatches, candidate fallback and repair of corrupt current imports. Metadata regressions verify both inventories, destination-relative jar/library paths, stale source metadata replacement, and repair without a valid sibling.
  • Launcher compilation, 12 library tests and its CLI logs integration test.
  • Rust workspace tests; warning-denied workspace and launcher all-target Clippy; 173 Python tests; both format checks; diff and public-tree history checks.
  • Independent review of checksum validation and all launcher preparation paths.

A fresh sibling checkout reused real pinned imports and regenerated metadata with --minecraft-dir /nonexistent-minecraft. That reproduction exposed a later relative-root data-generator bug, fixed separately in #185 after this PR merged. No app window was launched; GUI interaction and Windows/macOS execution remain unchecked.


🔄 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/178 **Author:** [@Online5277](https://github.com/Online5277) **Created:** 10/14/2026 **Status:** ✅ Merged **Merged:** 10/14/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/reuse-imported-minecraft` --- ### 📝 Commits (2) - [`20988e8`](https://github.com/horizon-rust/horizon/commit/20988e810e4aa17c4fe8f71040b782e3de2d0e3d) fix(prepare): reuse verified imports from installed versions - [`8caee51`](https://github.com/horizon-rust/horizon/commit/8caee518976214dfeb5cdda6495afd84d6dd6367) Regenerate preparation metadata when reusing imports ### 📊 Changes **5 files changed** (+385 additions, -45 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-prepare/src/artifacts.rs` (+356 -13) 📝 `crates/horizon-prepare/src/lib.rs` (+1 -1) 📝 `launcher/README.md` (+4 -1) 📝 `launcher/src/backend.rs` (+19 -26) 📝 `launcher/src/main.rs` (+5 -4) </details> ### 📄 Description Preparing a new Horizon version failed when the official Minecraft install had been moved or removed, even if an older installed Horizon version held the same pinned game files. The launcher and standalone `horizon-prepare --prepare` now reuse valid imports from the current version or an immediate sibling version before requiring that install. Reuse checks the target version's lock, manifest, client/server jars, inner server jar, and required client/server libraries. It copies only those verified inputs through the existing atomic file-copy helper and verifies the destination again. A corrupt or incompatible candidate is skipped; the normal import path remains available when no valid copy exists. Import and reuse share metadata generation: both inventories and `prepared.json` are generated from destination artifacts with paths relative to the current root. Existing valid imports missing those files are repaired too. Sibling discovery is intended for the launcher's `versions/` folder. The GUI, CLI and MCP all reach this lookup. In-process, external Rust and legacy Python preparers skip importing only after successful verification, without requiring or downloading another server jar. Optional sound assets still come from the Minecraft asset store as before. Fixes #160. Validation: - 16 preparer Rust tests, including real ZIP/checksum fixtures covering current/sibling reuse, corrupted manifests/jars/libraries, target pin mismatches, candidate fallback and repair of corrupt current imports. Metadata regressions verify both inventories, destination-relative jar/library paths, stale source metadata replacement, and repair without a valid sibling. - Launcher compilation, 12 library tests and its CLI logs integration test. - Rust workspace tests; warning-denied workspace and launcher all-target Clippy; 173 Python tests; both format checks; diff and public-tree history checks. - Independent review of checksum validation and all launcher preparation paths. A fresh sibling checkout reused real pinned imports and regenerated metadata with `--minecraft-dir /nonexistent-minecraft`. That reproduction exposed a later relative-root data-generator bug, fixed separately in #185 after this PR merged. No app window was launched; GUI interaction and Windows/macOS execution remain unchecked. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-02 15:55:28 +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#2380
No description provided.