[PR #4956] [MERGED] horizon-server: check the prepared game files before starting the engine (#4417) #5970

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/4956
Author: @Detimes
Created: 10/31/2026
Status: ✅ Merged
Merged: 10/31/2026
Merged by: @rdbtCVS

Base: main ← Head: fix-4417-resource-preflight


📝 Commits (1)

  • fdd6f50 horizon-server: check the prepared game files before starting the engine (#4417)

📊 Changes

3 files changed (+163 additions, -1 deletions)

View changed files

📝 crates/horizon-server/src/engine.rs (+155 -0)
📝 crates/horizon-server/src/init.rs (+6 -1)
📝 crates/horizon-server/src/supervisor.rs (+2 -0)

📄 Description

🤖 Opened by Detimes's AI agent (Claude Code, Claude Sonnet 5.5), not by Detimes personally.

What and why

Fixes #4417 (the fail-fast resource validator, point 3 of the proposal; the bundle/import commands, server.jar auto-fetch and the setup script are not part of this).

A prepared folder that was only copied in part makes the dedicated engine crash with os error 2 at every restart, and the supervisor restarts it again. This checks the folder before the engine starts and names what is wrong, in one message:

the prepared game files in /srv/horizon/resources are incomplete or damaged:
  registries.json is missing
  assets/minecraft/font is missing or empty
Prepare them again with `horizon-prepare --prepare --server-jar PATH` (or the launcher), or copy the whole prepared folder to the server again.
  • engine::check_prepared(resources): the four files horizon-prepare derives and the engine reads (facts.json, block-tags.json, registries.json, commands.json) exist; facts.json and block-tags.json match the facts_sha256 / block_tags_sha256 in horizon-resources.json; the folders assets/minecraft/font and assets/minecraft/textures aren't empty; the manifest is valid JSON.
  • horizon-server run stops with that message before locking or starting anything. horizon-server init prints it as a warning, like the other pre-flight notes there.
  • engine::resources (where the folder is looked for) is unchanged.

The check only looks at what the manifest and the engine's start already depend on, so it doesn't count files or walk the whole tree.

Kind

  • bug: a crash or a breakage

Vanilla reference

Horizon-only (the supervisor, crates/horizon-server). It follows horizon-prepare's manifest (crates/horizon-prepare/src/lib.rs, facts_sha256, block_tags_sha256, hex SHA-256 as digest writes it).

Self-check

Checked against a real prepared folder. I prepared 26.3 from my own copy (horizon-prepare --prepare, the game files from Mojang's servers, checked against their SHA-1s) and ran the built horizon-server on it, with a stand-in for the engine program:

  • the intact folder (copied to resources/): no warning, Game files: ./resources;
  • the same folder with registries.json deleted, assets/minecraft/font removed and block-tags.json replaced by {}: horizon-server run stops with the three lines of the message above, naming each problem.

pr_ready (tools/pr_ready.py --quick --base upstream/main on a Linux host, against upstream/main at 0d327cc09, 2 min 13 s)

Check Result
Scope ✅ 3 files, +163 −1
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 486 passed
rustfmt ✅
clippy ✅
tests: horizon-server ✅ 60 passed (5 new in engine::tests)
Parity ➖ not run (--quick): CI's parity job picks the affected harnesses

🔄 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/4956 **Author:** [@Detimes](https://github.com/Detimes) **Created:** 10/31/2026 **Status:** ✅ Merged **Merged:** 10/31/2026 **Merged by:** [@rdbtCVS](https://github.com/rdbtCVS) **Base:** `main` ← **Head:** `fix-4417-resource-preflight` --- ### 📝 Commits (1) - [`fdd6f50`](https://github.com/horizon-rust/horizon/commit/fdd6f507ec9adc75b5f82cd4d7fa1f7632d66a13) horizon-server: check the prepared game files before starting the engine (#4417) ### 📊 Changes **3 files changed** (+163 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-server/src/engine.rs` (+155 -0) 📝 `crates/horizon-server/src/init.rs` (+6 -1) 📝 `crates/horizon-server/src/supervisor.rs` (+2 -0) </details> ### 📄 Description > 🤖 Opened by Detimes's AI agent (Claude Code, Claude Sonnet 5.5), not by Detimes personally. ## What and why Fixes #4417 (the fail-fast resource validator, point 3 of the proposal; the bundle/import commands, `server.jar` auto-fetch and the setup script are not part of this). A prepared folder that was only copied in part makes the dedicated engine crash with `os error 2` at every restart, and the supervisor restarts it again. This checks the folder before the engine starts and names what is wrong, in one message: ``` the prepared game files in /srv/horizon/resources are incomplete or damaged: registries.json is missing assets/minecraft/font is missing or empty Prepare them again with `horizon-prepare --prepare --server-jar PATH` (or the launcher), or copy the whole prepared folder to the server again. ``` - `engine::check_prepared(resources)`: the four files `horizon-prepare` derives and the engine reads (`facts.json`, `block-tags.json`, `registries.json`, `commands.json`) exist; `facts.json` and `block-tags.json` match the `facts_sha256` / `block_tags_sha256` in `horizon-resources.json`; the folders `assets/minecraft/font` and `assets/minecraft/textures` aren't empty; the manifest is valid JSON. - `horizon-server run` stops with that message before locking or starting anything. `horizon-server init` prints it as a warning, like the other pre-flight notes there. - `engine::resources` (where the folder is looked for) is unchanged. The check only looks at what the manifest and the engine's start already depend on, so it doesn't count files or walk the whole tree. ## Kind - [x] bug: a crash or a breakage ## Vanilla reference Horizon-only (the supervisor, `crates/horizon-server`). It follows `horizon-prepare`'s manifest (`crates/horizon-prepare/src/lib.rs`, `facts_sha256`, `block_tags_sha256`, hex SHA-256 as `digest` writes it). ## Self-check **Checked against a real prepared folder.** I prepared 26.3 from my own copy (`horizon-prepare --prepare`, the game files from Mojang's servers, checked against their SHA-1s) and ran the built `horizon-server` on it, with a stand-in for the engine program: - the intact folder (copied to `resources/`): no warning, `Game files: ./resources`; - the same folder with `registries.json` deleted, `assets/minecraft/font` removed and `block-tags.json` replaced by `{}`: `horizon-server run` stops with the three lines of the message above, naming each problem. **pr_ready** (`tools/pr_ready.py --quick --base upstream/main` on a Linux host, against upstream/main at 0d327cc09, 2 min 13 s) | Check | Result | | --- | --- | | Scope | ✅ 3 files, +163 −1 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 486 passed | | rustfmt | ✅ | | clippy | ✅ | | tests: horizon-server | ✅ 60 passed (5 new in `engine::tests`) | | Parity | ➖ not run (--quick): CI's parity job picks the affected harnesses | --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 05:16:18 +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#5970
No description provided.