[PR #1522] [MERGED] Prepare: Netty's native transports are optional, as in the game (Prism Launcher on macOS) #3563

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

📋 Pull Request Information

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

Base: main ← Head: fix/prepare-netty-natives


📝 Commits (1)

  • e1fff77 Prepare: Netty's native transports are optional, as in the game

📊 Changes

1 file changed (+159 additions, -4 deletions)

View changed files

📝 crates/horizon-prepare/src/artifacts.rs (+159 -4)

📄 Description

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

Fixes #1487 (#1498 is a duplicate of it).

What

Prepare no longer requires Netty's native transport jars (io.netty:netty-transport-native-kqueue:…:osx-* and …-epoll:…:linux-*). If the player's launcher has one, it is imported and checked against the version JSON's sha1, as before. If it doesn't, preparing logs No <name> in <folder>: the game runs without it and goes on. Every other library is still required.

Why

  • Prism Launcher never downloads these jars. Its metadata lists them, but they are not anywhere under PrismLauncher/ and not on its launch classpath (#1487). Replaying 26.3's library selection over a Prism install finds 66 of 67 jars, and this is the one missing. So the error's advice ("play it once in your launcher") could never work.
  • Vanilla's launcher downloads the jar, because the manifest rule is allow os=osx. artifacts.rs follows those rules, so it asked for it.
  • Vanilla's game works without it. The bytecode (tools/rea_vanilla.py method net.minecraft.server.network.EventLoopGroupHolder remote):
    public static EventLoopGroupHolder remote(final boolean allowNativeTransport) {
        if (allowNativeTransport) {
            if (KQueue.isAvailable()) return KQUEUE;
            if (Epoll.isAvailable()) return EPOLL;
        }
        return NIO;
    }
    
    KQueue/Epoll live in the netty-transport-classes-* jars, which stay required. Without the native jar, isAvailable() is false and the game uses NIO.
  • Horizon only puts these jars on the exporters' compile/run classpath, and the exporters never open a network channel.

I chose this over downloading the missing library from the manifest's URL because it needs no network code in prepare: "Horizon does not download the game" stays true.

How

  • artifacts.rs: runs_without(name) is true only for io.netty:netty-transport-native-* with a classifier. -unix-common and -classes-* are still required. import skips such a jar only when neither the launcher nor an earlier import has it. client_libraries (verify/reuse) leaves out one that was never imported. A copy that is there but corrupt is still an error.
  • Tests:
    • a_prism_install_without_netty_natives_prepares: a Prism-like install with its renamed native path and no kqueue jar. Import succeeds, verify and reuse pass, and prepared.json lists 2 libraries. With the launcher's jar corrupt, prepare fails with "is not the pinned file". With the right jar, it is imported (3 libraries). A missing plain library still fails with "Missing …".
    • runs_without_only_netty_native_transports.
    • With the fix reverted, the Prism test fails with #1487's exact message: Missing …/libraries/io/netty/netty-transport-native-kqueue/1/netty-transport-native-kqueue-1-osx-aarch_64.jar. Horizon does not download the game: ….

Proof: a real 26.3 prepare from a Prism-like install (Mac mini, arm64)

I built a Prism-layout folder from the pinned 26.3 files: 66 libraries, natives at Prism's renamed paths (…/jtracy-natives-macos-arm64/…), and no netty-transport-native-kqueue. Then I ran horizon-prepare --prepare --minecraft-dir <it> --server-jar <26.3 server> in a fresh root, with no sibling imports to reuse:

  • origin/main (d6dc080):
    Imported client 26.3 from /tmp/ls1-prism.nIoO/PrismLauncher
    error: Missing /tmp/ls1-prism.nIoO/PrismLauncher/libraries/io/netty/netty-transport-native-kqueue/4.2.16.Final/netty-transport-native-kqueue-4.2.16.Final-osx-aarch_64.jar. Horizon does not download the game: …
    
  • This branch: exit 0 in 535 s. Every exporter ran, and prepared.json lists 66 client libraries.
    Imported client 26.3 from /tmp/ls1-prism.nIoO/PrismLauncher
    No io.netty:netty-transport-native-kqueue:4.2.16.Final:osx-aarch_64 in /tmp/ls1-prism.nIoO/PrismLauncher: the game runs without it
    client: 11383 classes, 98739 methods
    ...
    Prepared Horizon native-client resources: /tmp/ls1-after/root/.local/horizon-client/26.3
    

Self-check

  • cargo fmt, cargo clippy -p horizon-prepare --all-targets -- -D warnings: clean.
  • cargo test -p horizon-prepare: 28 passed.
  • tools/parity.py --changed origin/main: 0 harnesses depend on the change.
  • Launcher on Windows CI, on an integration branch of this PR and #1521 (main's Windows launcher build fails on the reference doc until #1521 merges): https://github.com/ludovic111/horizon/actions/runs/40036151676 (head e8ac3b6 = this PR merged with #1521; dry run, publishes nothing). decide, build linux, build macos, build windows and sign all passed. On Windows: launcher lib 109 passed, including sources::tests::prism_native_jars_are_found_through_the_linked_folder ... ok. Bin 25 passed, tests/ 1 passed.

Linux (epoll) uses the same code path. The unit test runs the rule for whichever OS it runs on, including Linux in checks. The Python preparer (tools/lab.py, dev-only) is unchanged: it doesn't know Prism's layout either.

Needs Ludovic

Merge after #1521 (they don't conflict). This changes crates/horizon-prepare, which ships in both the launcher and the game, so the next launcher@ release includes it.

🤖 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/1522 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/23/2026 **Status:** ✅ Merged **Merged:** 10/24/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/prepare-netty-natives` --- ### 📝 Commits (1) - [`e1fff77`](https://github.com/horizon-rust/horizon/commit/e1fff77a484a57e4d34947215768660a1f2dcb7b) Prepare: Netty's native transports are optional, as in the game ### 📊 Changes **1 file changed** (+159 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-prepare/src/artifacts.rs` (+159 -4) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. Fixes #1487 (#1498 is a duplicate of it). ## What Prepare no longer requires Netty's native transport jars (`io.netty:netty-transport-native-kqueue:…:osx-*` and `…-epoll:…:linux-*`). If the player's launcher has one, it is imported and checked against the version JSON's sha1, as before. If it doesn't, preparing logs `No <name> in <folder>: the game runs without it` and goes on. Every other library is still required. ## Why - **Prism Launcher never downloads these jars.** Its metadata lists them, but they are not anywhere under `PrismLauncher/` and not on its launch classpath (#1487). Replaying 26.3's library selection over a Prism install finds 66 of 67 jars, and this is the one missing. So the error's advice ("play it once in your launcher") could never work. - **Vanilla's launcher** downloads the jar, because the manifest rule is `allow os=osx`. `artifacts.rs` follows those rules, so it asked for it. - **Vanilla's game** works without it. The bytecode (`tools/rea_vanilla.py method net.minecraft.server.network.EventLoopGroupHolder remote`): ```java public static EventLoopGroupHolder remote(final boolean allowNativeTransport) { if (allowNativeTransport) { if (KQueue.isAvailable()) return KQUEUE; if (Epoll.isAvailable()) return EPOLL; } return NIO; } ``` `KQueue`/`Epoll` live in the `netty-transport-classes-*` jars, which stay required. Without the native jar, `isAvailable()` is false and the game uses NIO. - **Horizon** only puts these jars on the exporters' compile/run classpath, and the exporters never open a network channel. I chose this over downloading the missing library from the manifest's URL because it needs no network code in prepare: "Horizon does not download the game" stays true. ## How - `artifacts.rs`: `runs_without(name)` is true only for `io.netty:netty-transport-native-*` with a classifier. `-unix-common` and `-classes-*` are still required. `import` skips such a jar only when neither the launcher nor an earlier import has it. `client_libraries` (verify/reuse) leaves out one that was never imported. A copy that is there but corrupt is still an error. - Tests: - `a_prism_install_without_netty_natives_prepares`: a Prism-like install with its renamed native path and no kqueue jar. Import succeeds, verify and reuse pass, and `prepared.json` lists 2 libraries. With the launcher's jar corrupt, prepare fails with "is not the pinned file". With the right jar, it is imported (3 libraries). A missing plain library still fails with "Missing …". - `runs_without_only_netty_native_transports`. - With the fix reverted, the Prism test fails with #1487's exact message: `Missing …/libraries/io/netty/netty-transport-native-kqueue/1/netty-transport-native-kqueue-1-osx-aarch_64.jar. Horizon does not download the game: …`. ## Proof: a real 26.3 prepare from a Prism-like install (Mac mini, arm64) I built a Prism-layout folder from the pinned 26.3 files: 66 libraries, natives at Prism's renamed paths (`…/jtracy-natives-macos-arm64/…`), and no `netty-transport-native-kqueue`. Then I ran `horizon-prepare --prepare --minecraft-dir <it> --server-jar <26.3 server>` in a fresh root, with no sibling imports to reuse: - **origin/main** (d6dc080): ``` Imported client 26.3 from /tmp/ls1-prism.nIoO/PrismLauncher error: Missing /tmp/ls1-prism.nIoO/PrismLauncher/libraries/io/netty/netty-transport-native-kqueue/4.2.16.Final/netty-transport-native-kqueue-4.2.16.Final-osx-aarch_64.jar. Horizon does not download the game: … ``` - **This branch**: exit 0 in 535 s. Every exporter ran, and `prepared.json` lists 66 client libraries. ``` Imported client 26.3 from /tmp/ls1-prism.nIoO/PrismLauncher No io.netty:netty-transport-native-kqueue:4.2.16.Final:osx-aarch_64 in /tmp/ls1-prism.nIoO/PrismLauncher: the game runs without it client: 11383 classes, 98739 methods ... Prepared Horizon native-client resources: /tmp/ls1-after/root/.local/horizon-client/26.3 ``` ## Self-check - `cargo fmt`, `cargo clippy -p horizon-prepare --all-targets -- -D warnings`: clean. - `cargo test -p horizon-prepare`: 28 passed. - `tools/parity.py --changed origin/main`: 0 harnesses depend on the change. - Launcher on Windows CI, on an integration branch of this PR and #1521 (main's Windows launcher build fails on the reference doc until #1521 merges): https://github.com/ludovic111/horizon/actions/runs/40036151676 (head e8ac3b6 = this PR merged with #1521; dry run, publishes nothing). decide, build linux, build macos, **build windows** and sign all passed. On Windows: launcher lib `109 passed`, including `sources::tests::prism_native_jars_are_found_through_the_linked_folder ... ok`. Bin `25 passed`, `tests/` `1 passed`. Linux (epoll) uses the same code path. The unit test runs the rule for whichever OS it runs on, including Linux in `checks`. The Python preparer (`tools/lab.py`, dev-only) is unchanged: it doesn't know Prism's layout either. ## Needs Ludovic Merge after #1521 (they don't conflict). This changes `crates/horizon-prepare`, which ships in both the launcher and the game, so the next launcher@ release includes it. 🤖 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:10:27 +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#3563
No description provided.