[PR #1946] [MERGED] Launcher: keep prepared resources while the preparer's OUTPUT_VERSION is the same #3884

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

📋 Pull Request Information

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

Base: main ← Head: feat/prepare-output-version


📝 Commits (1)

  • acb68ed launcher: reuse prepared resources while the preparer's OUTPUT_VERSION is the same

📊 Changes

1 file changed (+205 additions, -11 deletions)

View changed files

📝 launcher/src/backend.rs (+205 -11)

📄 Description

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

What

The launcher copies a player's prepared resources to a newly installed release when both pin the same Minecraft jars and their preparers declare the same OUTPUT_VERSION (pub const OUTPUT_VERSION: u32 in the version folder's crates/horizon-prepare/src/lib.rs, which releases ship). Until now it required the preparer's sources and the exporters to be byte for byte the same, so any change to crates/horizon-prepare (#1869, for example) made every player prepare again even when the prepared files were identical.

  • output_version_at: the constant from the folder's sources; for preparers from before it, a fingerprint of their sources (horizon_prepare::sources_sha256) and of the 18 exporters they run, looked up in LEGACY_OUTPUT_VERSIONS.
  • Legacy fingerprints mapped to version 1: v0.2.52–v0.2.64 and v0.2.49–v0.2.51. I measured their output: the canonical digest (tools/prepare_output.py in the companion PR) of the CI runners' preparations for keys from v0.2.49/50, v0.2.53, v0.2.54–60, v0.2.61 and v0.2.62–64 is the same, 0a608bf4…. v0.2.47's preparation differs (1eb01fc9…), so it is not mapped.
  • Versions older than that (neither side has a number) are compared as before (same_preparer, unchanged).

The constant itself, the CI check that the number is bumped when the output changes, and the docs are in the companion PR (horizon-prepare side). Merge order: this one first, and let it ship in a launcher release before the preparer one ships in a game release. A launcher that hasn't updated yet still compares bytes, so the first game release that changes crates/horizon-prepare re-prepares for its players once.

Tests

  • cargo test (launcher): new prepared_resources_follow_the_preparers_output_version, which covers these cases:

    • same number with different code reuses;
    • a bumped number prepares again;
    • another jar prepares again;
    • a legacy fingerprint maps to its number, and CRLF doesn't change it;
    • a changed exporter or source drops the mapping.

    The existing a_new_version_reuses_resources_prepared_by_a_compatible_one still passes unchanged (the old path).

  • cargo clippy --all-targets -D warnings (launcher): clean.

  • End to end in a temp HORIZON_LAUNCHER_HOME (all data dirs mktemp, no self-update, no audio):

    • the real v0.2.64 macOS release, with resources prepared by its preparer (the CI runner's preparation for its key);
    • v0.2.65: the preparer files the package ships (research-lock.json, crates/horizon-prepare, mods/horizon/src/test/java) from the companion branch, OUTPUT_VERSION = 1;
    • v0.2.66: the same with the number bumped to 2.

    horizon-launcher versions --installed printed Prepared v0.2.65 with the resources of v0.2.64. and left v0.2.66 not prepared.

🤖 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/1946 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/25/2026 **Status:** ✅ Merged **Merged:** 10/26/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `feat/prepare-output-version` --- ### 📝 Commits (1) - [`acb68ed`](https://github.com/horizon-rust/horizon/commit/acb68ed163deb929e1e64b8abf6f39aa9caa99bf) launcher: reuse prepared resources while the preparer's OUTPUT_VERSION is the same ### 📊 Changes **1 file changed** (+205 additions, -11 deletions) <details> <summary>View changed files</summary> 📝 `launcher/src/backend.rs` (+205 -11) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. ## What The launcher copies a player's prepared resources to a newly installed release when both pin the same Minecraft jars and their preparers declare the same **`OUTPUT_VERSION`** (`pub const OUTPUT_VERSION: u32` in the version folder's `crates/horizon-prepare/src/lib.rs`, which releases ship). Until now it required the preparer's sources and the exporters to be byte for byte the same, so any change to `crates/horizon-prepare` (#1869, for example) made every player prepare again even when the prepared files were identical. - `output_version_at`: the constant from the folder's sources; for preparers from before it, a fingerprint of their sources (`horizon_prepare::sources_sha256`) and of the 18 exporters they run, looked up in `LEGACY_OUTPUT_VERSIONS`. - Legacy fingerprints mapped to version 1: v0.2.52–v0.2.64 and v0.2.49–v0.2.51. I measured their output: the canonical digest (`tools/prepare_output.py` in the companion PR) of the CI runners' preparations for keys from v0.2.49/50, v0.2.53, v0.2.54–60, v0.2.61 and v0.2.62–64 is the same, `0a608bf4…`. v0.2.47's preparation differs (`1eb01fc9…`), so it is not mapped. - Versions older than that (neither side has a number) are compared as before (`same_preparer`, unchanged). The constant itself, the CI check that the number is bumped when the output changes, and the docs are in the companion PR (horizon-prepare side). **Merge order:** this one first, and let it ship in a launcher release before the preparer one ships in a game release. A launcher that hasn't updated yet still compares bytes, so the first game release that changes `crates/horizon-prepare` re-prepares for its players once. ## Tests - `cargo test` (launcher): new `prepared_resources_follow_the_preparers_output_version`, which covers these cases: - same number with different code reuses; - a bumped number prepares again; - another jar prepares again; - a legacy fingerprint maps to its number, and CRLF doesn't change it; - a changed exporter or source drops the mapping. The existing `a_new_version_reuses_resources_prepared_by_a_compatible_one` still passes unchanged (the old path). - `cargo clippy --all-targets -D warnings` (launcher): clean. - End to end in a temp `HORIZON_LAUNCHER_HOME` (all data dirs `mktemp`, no self-update, no audio): - the real v0.2.64 macOS release, with resources prepared by its preparer (the CI runner's preparation for its key); - `v0.2.65`: the preparer files the package ships (`research-lock.json`, `crates/horizon-prepare`, `mods/horizon/src/test/java`) from the companion branch, `OUTPUT_VERSION = 1`; - `v0.2.66`: the same with the number bumped to 2. `horizon-launcher versions --installed` printed `Prepared v0.2.65 with the resources of v0.2.64.` and left v0.2.66 `not prepared`. 🤖 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 04:13:00 +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#3884
No description provided.