[PR #356] [MERGED] Version ports: the version facts in one generated file (horizon_core::version) #2518

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

📋 Pull Request Information

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

Base: main ← Head: feat/version-consts


📝 Commits (4)

  • 9f38528 Version facts in one generated file: crates/horizon-core/src/version.rs
  • 326f69d lan_bot: the status's protocol is the generated constant
  • 605b9f8 datafix: the version name through horizon_core::version, in the harness's Rust scope
  • ef8b045 Tests main added since: prepared resources under the generated version

📊 Changes

46 files changed (+335 additions, -86 deletions)

View changed files

📝 .github/workflows/parity.yml (+2 -0)
📝 Cargo.lock (+1 -0)
📝 crates/horizon-client/examples/particle_providers_probe.rs (+1 -1)
📝 crates/horizon-client/src/bin/horizon-ctl/launch.rs (+1 -1)
📝 crates/horizon-client/src/crash.rs (+8 -2)
📝 crates/horizon-client/src/entities.rs (+2 -1)
📝 crates/horizon-client/src/entity_nbt.rs (+2 -1)
📝 crates/horizon-client/src/front.rs (+16 -3)
📝 crates/horizon-client/src/game.rs (+3 -2)
📝 crates/horizon-client/src/game/commands/extra.rs (+5 -7)
📝 crates/horizon-client/src/game/dedicated.rs (+7 -1)
📝 crates/horizon-client/src/game/tnt.rs (+2 -1)
📝 crates/horizon-client/src/gfx.rs (+2 -1)
📝 crates/horizon-client/src/lan/conn.rs (+4 -1)
📝 crates/horizon-client/src/menu.rs (+2 -1)
📝 crates/horizon-client/src/motion.rs (+39 -13)
📝 crates/horizon-client/src/packs.rs (+1 -1)
📝 crates/horizon-client/src/random_tick_sections.rs (+6 -2)
📝 crates/horizon-client/src/save.rs (+1 -1)
📝 crates/horizon-client/src/sprites.rs (+3 -1)

...and 26 more files

📄 Description

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

Version ports, port-2 slice 1a (docs/version-ports.md, "Regenerate": version_consts).

What

tools/gen_version_consts.py writes what the pinned client jar's version.json states into one generated file, crates/horizon-core/src/version.rs: VERSION_ID, VANILLA_VERSION (name), PROTOCOL_VERSION, DATA_VERSION, RESOURCE_PACK_FORMAT, DATA_PACK_FORMAT, JAVA_VERSION, STABLE, BUILD_TIME (as Date.toString() prints it for /version).

Every Rust site that stated a version fact by hand now reads it from there:

  • horizon_protocol::PROTOCOL_VERSION / GAME_VERSION, horizon_world::DATA_VERSION, save::VERSION_NAME, datafix::files::VERSION_NAME (now aliases)
  • /version (id, name, data version, stable, build time), packs::RESOURCE_FORMAT
  • the crash report, the legacy server-list ping, the dedicated server's start line, the title/front screens and F3's first line, --help texts
  • the default resource folder (.local/horizon-client/<version>), horizon-ctl's and the launcher's fallback, the launcher's .desktop entry; tests that read prepared resources
  • port_report.py lists version.rs as a generated table that facts changes make stale

datafix::files::VERSION_NAME names horizon_core::version::VANILLA_VERSION (not the crate root's re-export) and version.rs is in the datafix harness's PARITY_RUST_SCOPE, so that scope stays closed: with the re-export, its six shards reran on any Rust change (found in the integration audit: "PARITY_RUST_SCOPE not applied").

Test fixtures that state a version (a level.dat to parse, a relay message, launcher release fixtures) keep their literals: they test parsing, not the pin.

CI's parity job checks the file against the pinned jar (gen_version_consts.py --check); a unit test checks it agrees with research-lock.json.

Why

So the pin bump touches one generated file instead of ~40 sites. version_port.py regen (next PR) runs this generator in the candidate worktree.

How tested

The generated values are byte-identical to the hand-written ones (incl. BUILD_TIME Tue Sep 15 11:20:48 UTC 2026), so nothing a player sees changes. gen_version_consts.py --check passes against the 26.3 jar.

pr_ready (tools/pr_ready.py --quick on ludovics-mac-mini, against origin/main at 457a5d7ce, 33 min 39 s)

Check Result
Scope ⚠️ 46 files, +325 −82; mixes CI, game, launcher
Cargo.lock ✅ changes with a Cargo.toml
Public tree ✅
Python tests ❌ 236 run, FAILED (errors=2) (1 min 51 s)
rustfmt ✅ (23 s)
clippy ✅ (5 min 28 s)
tests: workspace ✅ 1217 passed (25 min 39 s)
tokens.css up to date ➖ theme untouched
launcher rustfmt ✅ (1 s)
launcher clippy ✅ (6 s)
launcher tests ✅ 50 passed (10 s)
Parity ➖ 301 affected, to run in CI (--quick): active_effect_tick, active_effects, ambient_sound, anchor, arrow, attribute_health, attribute_map_queries, attribute, attribute_updates, audio_attributes, auto_jump, bamboo and 289 more
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

The 2 Python test errors (test_parity_runner OracleReuse, test_rust_parity source hashes) fail the same way on plain origin/main on macOS (/private/var tmp paths, no java stub on PATH). Parity: every harness is affected (horizon-core); they run once on the integration commit of this PR and the tools sweep that follows. Draft until that run is in.

Rebased on main (457a5d7c): main's --dev-mod help line and launcher folder list kept, with the version from the generated constant; tests main added since read the resources under horizon_core::VANILLA_VERSION. CI's earlier parity failure was world_spawn alone hitting the job's 1500 s --timeout on the loaded runner (305 passed); it passes locally (1809 s, no timeout) and in the integration audit below.

Integration audit (Mac mini)

One integration commit for the stack, as the rules ask:

  • #356 + #357 merged on main (68cbad54): tools/parity.py --all, 306 of 306 harnesses pass. mob_ai passes too, so #290's drowned cases didn't show here. The run was resumed after interruptions, reusing passes. No harness failed at any point.
  • Stack tip (adds #359's command-tree split, the datafix scope fix, and the Python-only #388–#390): every horizon-client probe depends on vanilla.rs, so --changed lists 290 harnesses. I reran the ones the changes reach: command_exec, command_parse, lan, datafix (6 shards), options, world. 11 of 11 runs pass. The "PARITY_RUST_SCOPE not applied" note is gone from datafix.
  • The 26.3 candidate (#359's regen output) passed the 17 port harnesses in #388's forward replay.

Needs Ludovic

Nothing.

🤖 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/356 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/15/2026 **Status:** ✅ Merged **Merged:** 10/21/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `feat/version-consts` --- ### 📝 Commits (4) - [`9f38528`](https://github.com/horizon-rust/horizon/commit/9f385280ef9c4c7493061be990e40bc19c9104aa) Version facts in one generated file: crates/horizon-core/src/version.rs - [`326f69d`](https://github.com/horizon-rust/horizon/commit/326f69d326677980d166f020827da9b182541a2b) lan_bot: the status's protocol is the generated constant - [`605b9f8`](https://github.com/horizon-rust/horizon/commit/605b9f8511afa372e93e5a5c85266663361047bd) datafix: the version name through horizon_core::version, in the harness's Rust scope - [`ef8b045`](https://github.com/horizon-rust/horizon/commit/ef8b045d799c41a2913938061fec1368f115cc83) Tests main added since: prepared resources under the generated version ### 📊 Changes **46 files changed** (+335 additions, -86 deletions) <details> <summary>View changed files</summary> 📝 `.github/workflows/parity.yml` (+2 -0) 📝 `Cargo.lock` (+1 -0) 📝 `crates/horizon-client/examples/particle_providers_probe.rs` (+1 -1) 📝 `crates/horizon-client/src/bin/horizon-ctl/launch.rs` (+1 -1) 📝 `crates/horizon-client/src/crash.rs` (+8 -2) 📝 `crates/horizon-client/src/entities.rs` (+2 -1) 📝 `crates/horizon-client/src/entity_nbt.rs` (+2 -1) 📝 `crates/horizon-client/src/front.rs` (+16 -3) 📝 `crates/horizon-client/src/game.rs` (+3 -2) 📝 `crates/horizon-client/src/game/commands/extra.rs` (+5 -7) 📝 `crates/horizon-client/src/game/dedicated.rs` (+7 -1) 📝 `crates/horizon-client/src/game/tnt.rs` (+2 -1) 📝 `crates/horizon-client/src/gfx.rs` (+2 -1) 📝 `crates/horizon-client/src/lan/conn.rs` (+4 -1) 📝 `crates/horizon-client/src/menu.rs` (+2 -1) 📝 `crates/horizon-client/src/motion.rs` (+39 -13) 📝 `crates/horizon-client/src/packs.rs` (+1 -1) 📝 `crates/horizon-client/src/random_tick_sections.rs` (+6 -2) 📝 `crates/horizon-client/src/save.rs` (+1 -1) 📝 `crates/horizon-client/src/sprites.rs` (+3 -1) _...and 26 more files_ </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. Version ports, port-2 slice 1a (docs/version-ports.md, "Regenerate": `version_consts`). ## What `tools/gen_version_consts.py` writes what the pinned client jar's `version.json` states into one generated file, **`crates/horizon-core/src/version.rs`**: `VERSION_ID`, `VANILLA_VERSION` (name), `PROTOCOL_VERSION`, `DATA_VERSION`, `RESOURCE_PACK_FORMAT`, `DATA_PACK_FORMAT`, `JAVA_VERSION`, `STABLE`, `BUILD_TIME` (as `Date.toString()` prints it for `/version`). Every Rust site that stated a version fact by hand now reads it from there: - `horizon_protocol::PROTOCOL_VERSION` / `GAME_VERSION`, `horizon_world::DATA_VERSION`, `save::VERSION_NAME`, `datafix::files::VERSION_NAME` (now aliases) - `/version` (id, name, data version, stable, build time), `packs::RESOURCE_FORMAT` - the crash report, the legacy server-list ping, the dedicated server's start line, the title/front screens and F3's first line, `--help` texts - the default resource folder (`.local/horizon-client/<version>`), horizon-ctl's and the launcher's fallback, the launcher's `.desktop` entry; tests that read prepared resources - `port_report.py` lists `version.rs` as a generated table that facts changes make stale `datafix::files::VERSION_NAME` names `horizon_core::version::VANILLA_VERSION` (not the crate root's re-export) and `version.rs` is in the datafix harness's `PARITY_RUST_SCOPE`, so that scope stays closed: with the re-export, its six shards reran on any Rust change (found in the integration audit: "PARITY_RUST_SCOPE not applied"). Test fixtures that state a version (a level.dat to parse, a relay message, launcher release fixtures) keep their literals: they test parsing, not the pin. CI's parity job checks the file against the pinned jar (`gen_version_consts.py --check`); a unit test checks it agrees with `research-lock.json`. ## Why So the pin bump touches one generated file instead of ~40 sites. `version_port.py regen` (next PR) runs this generator in the candidate worktree. ## How tested The generated values are byte-identical to the hand-written ones (incl. `BUILD_TIME` `Tue Sep 15 11:20:48 UTC 2026`), so nothing a player sees changes. `gen_version_consts.py --check` passes against the 26.3 jar. **pr_ready** (`tools/pr_ready.py --quick` on ludovics-mac-mini, against origin/main at 457a5d7ce, 33 min 39 s) | Check | Result | | --- | --- | | Scope | ⚠️ 46 files, +325 −82; mixes CI, game, launcher | | Cargo.lock | ✅ changes with a Cargo.toml | | Public tree | ✅ | | Python tests | ❌ 236 run, FAILED (errors=2) (1 min 51 s) | | rustfmt | ✅ (23 s) | | clippy | ✅ (5 min 28 s) | | tests: workspace | ✅ 1217 passed (25 min 39 s) | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ✅ (1 s) | | launcher clippy | ✅ (6 s) | | launcher tests | ✅ 50 passed (10 s) | | Parity | ➖ 301 affected, to run in CI (--quick): active_effect_tick, active_effects, ambient_sound, anchor, arrow, attribute_health, attribute_map_queries, attribute, attribute_updates, audio_attributes, auto_jump, bamboo and 289 more | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | The 2 Python test errors (`test_parity_runner` OracleReuse, `test_rust_parity` source hashes) fail the same way on plain origin/main on macOS (`/private/var` tmp paths, no `java` stub on PATH). Parity: every harness is affected (horizon-core); they run once on the integration commit of this PR and the tools sweep that follows. Draft until that run is in. Rebased on main (457a5d7c): main's `--dev-mod` help line and launcher folder list kept, with the version from the generated constant; tests main added since read the resources under `horizon_core::VANILLA_VERSION`. CI's earlier `parity` failure was `world_spawn` alone hitting the job's 1500 s `--timeout` on the loaded runner (305 passed); it passes locally (1809 s, no timeout) and in the integration audit below. ## Integration audit (Mac mini) One integration commit for the stack, as the rules ask: - **#356 + #357 merged on `main` (68cbad54):** `tools/parity.py --all`, **306 of 306 harnesses pass**. `mob_ai` passes too, so #290's drowned cases didn't show here. The run was resumed after interruptions, reusing passes. No harness failed at any point. - **Stack tip (adds #359's command-tree split, the datafix scope fix, and the Python-only #388–#390):** every horizon-client probe depends on `vanilla.rs`, so `--changed` lists 290 harnesses. I reran the ones the changes reach: `command_exec`, `command_parse`, `lan`, `datafix` (6 shards), `options`, `world`. **11 of 11 runs pass.** The "PARITY_RUST_SCOPE not applied" note is gone from datafix. - The 26.3 candidate (#359's regen output) passed the 17 port harnesses in #388's forward replay. ## Needs Ludovic Nothing. 🤖 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:56:52 +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#2518
No description provided.