[PR #2160] [MERGED] Split horizon-command and horizon-client-core out of horizon-client #4062

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

📋 Pull Request Information

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

Base: main ← Head: refactor/horizon-command


📝 Commits (6)

  • ebf3c15 parity: follow code into new crates when choosing harnesses
  • 0a116d9 Split horizon-command and horizon-client-core out of horizon-client
  • a4764f5 Merge origin/main into refactor/horizon-command
  • edc4a58 Merge origin/main into refactor/horizon-command
  • d3a662b Merge origin/main into refactor/horizon-command
  • 17f8419 Merge origin/main into refactor/horizon-command

📊 Changes

57 files changed (+739 additions, -568 deletions)

View changed files

📝 AGENTS.md (+6 -4)
📝 Cargo.lock (+19 -0)
📝 Cargo.toml (+1 -1)
➕ crates/horizon-client-core/Cargo.toml (+14 -0)
📝 crates/horizon-client-core/src/block_entity_nbt.rs (+1 -1)
📝 crates/horizon-client-core/src/bossbar.rs (+0 -0)
📝 crates/horizon-client-core/src/component.rs (+1 -1)
📝 crates/horizon-client-core/src/fastutil_order.rs (+0 -0)
📝 crates/horizon-client-core/src/gamerules.rs (+0 -23)
➕ crates/horizon-client-core/src/identifier.rs (+18 -0)
➕ crates/horizon-client-core/src/key_display.rs (+38 -0)
📝 crates/horizon-client-core/src/lang.rs (+6 -2)
➕ crates/horizon-client-core/src/lib.rs (+23 -0)
📝 crates/horizon-client-core/src/nbt_path.rs (+0 -0)
➕ crates/horizon-client-core/src/particle_type.rs (+209 -0)
➕ crates/horizon-client-core/src/registries.rs (+188 -0)
📝 crates/horizon-client-core/src/scoreboard.rs (+2 -2)
📝 crates/horizon-client-core/src/snbt.rs (+0 -0)
➕ crates/horizon-client-core/src/sound_source.rs (+7 -0)
📝 crates/horizon-client-core/src/text.rs (+1 -1)

...and 37 more files

📄 Description

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

First slice of splitting horizon-client into crates (Ludovic's priority 1: faster builds and tests). A pure move: renames plus mechanical path fixes, no logic change. It goes over the usual 500 lines because of the moved files; git shows them as renames.

What moves

  • horizon-command: command/, as is (the Brigadier port, the vanilla tree, argument types, selectors).
  • horizon-client-core: everything command/ needs from the lib, with no path back into the lib: text, lang, snbt, nbt_path, component, scoreboard, bossbar, gamerules, block_entity_nbt, fastutil_order. A few items move out of lib modules that sit in the big cycle, unchanged: ParticleType (particles.rs), the key display name (keybinds.rs), SOUND_SOURCES (settings.rs), uuid_text/uuid_from_text (save.rs), and Registries/RegistryIds/parse_identifier (command/args.rs).
  • horizon-client re-exports each module and item under its old path (horizon_client::text, crate::command::Registries, particles::ParticleType...), so no caller changes and open PRs keep compiling.
  • Inside the moved files only paths change. Also sign_side became pub; lang.rs includes the lang files from horizon-client's assets; gamerules' test that saves a Level moved to save.rs, since it needs the client's save.
  • Docs: AGENTS.md's crate table and docs/architecture.md. Tools: the paths in generate_command_order, port_regen/port_report and two harness source lists.

Harness selection (separate commit, tools/parity*.py)

  • Records made before the move name the old paths, so a change under crates/horizon-command/ matched no record: 0 of 348 harnesses. Fix: a changed file of a crate the recorded crates now link (path dependencies) counts, and the reach search decides.
  • A library's root is now open only once reached code names the crate. Before, every crate root was open, so any item of a new crate whose name matched a name used anywhere counted (args.rs would have selected 117 harnesses instead of 80). On main the new rule gives the same selection for 15 of 16 sampled files across 4 crates. For horizon-world/src/nbt.rs, world_border_render drops out: it reached that file only through a name match.
  • --changed-files after the split: args.rs 80 → 74 harnesses (the 6 dropped reached it only for parse_identifier, now in core). text.rs 80 → 82-83. Unit tests cover both changes.

Numbers (ThinkPad, idle, -j3, --no-default-features; base = main 4fbb0cde7)

base split
edit a command file, then run its unit tests 9.0 s (-p horizon-client --lib command::) 1.0 s (-p horizon-command)
edit text.rs, then run its unit tests ~8-9 s (client lib tests) 0.8 s (-p horizon-client-core)
cold cargo build --profile fast -p horizon-client 608 s 609 s
one-line edit, fast build: command/args.rs, text.rs, mobs/ai.rs 10.2, 10.7, 10.2 s 10.8, 10.9, 9.7 s
cargo test -p horizon-client --lib --bins --tests, built 19.7 s 18.8 s

The cold build doesn't change, and wasn't expected to. With 3 jobs it is CPU-bound, and about 80% of each big crate is codegen. The two new crates (22 s + 17 s) compile just before the lib, which drops from 154 s to 145 s. Crates only shorten a cold build where cores sit idle. One-line edits stay ~10 s: on a lib edit, 6.6 s is the lib re-checking itself (5.1 s frontend) and 5 s is the bin. The gains here are the per-crate test loops. Lib edits get cheaper only as the lib itself shrinks (mobs/ next). Mac mini numbers were too noisy to use (load 54-80); they are in horizon-parity's ci-speed/LOG.md.

Checks

pr_ready (tools/pr_ready.py --quick on ludovics-mac-mini, against origin/main at 4fbb0cde7, 16 min 43 s)

Check Result
Scope ⚠️ 57 files, +737 −567; 1258 lines of code: over 500, split it if it can ship in parts
Cargo.lock ✅ changes with a Cargo.toml
Public tree ✅
Python tests ❌ 311 run, FAILED (errors=2) (55 s)
rustfmt ✅ (8 s)
clippy ✅ (2 min 6 s)
tests: workspace ✅ 2190 passed (11 min 31 s)
doc tests ✅ 2 passed (2 min 2 s)
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ 340 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 328 more
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

Python tests: the same 2 errors as on main, environment-only (java not on the test's PATH: test_reuses_until_an_input_or_output_changes, test_report_rejects_sources_changed_during_a_run). Parity: parity.py --changed origin/main selects all 348 because Cargo.lock changes. Local run in progress on the Mac mini; result in a comment.

🤖 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/2160 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/26/2026 **Status:** ✅ Merged **Merged:** 10/27/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `refactor/horizon-command` --- ### 📝 Commits (6) - [`ebf3c15`](https://github.com/horizon-rust/horizon/commit/ebf3c1567cf408783e6adc08d76106b30fb82f20) parity: follow code into new crates when choosing harnesses - [`0a116d9`](https://github.com/horizon-rust/horizon/commit/0a116d95234f09d1cd5867a0ee371e097e37ed5a) Split horizon-command and horizon-client-core out of horizon-client - [`a4764f5`](https://github.com/horizon-rust/horizon/commit/a4764f5b0d3974b73d18652f688ceb431e13f667) Merge origin/main into refactor/horizon-command - [`edc4a58`](https://github.com/horizon-rust/horizon/commit/edc4a5839758f84803ab82174cee6750eca87775) Merge origin/main into refactor/horizon-command - [`d3a662b`](https://github.com/horizon-rust/horizon/commit/d3a662b76070bb2c1e3a64c3ee5f93be072de77f) Merge origin/main into refactor/horizon-command - [`17f8419`](https://github.com/horizon-rust/horizon/commit/17f8419acd9c5221247c2dfd5b72efa1e210c648) Merge origin/main into refactor/horizon-command ### 📊 Changes **57 files changed** (+739 additions, -568 deletions) <details> <summary>View changed files</summary> 📝 `AGENTS.md` (+6 -4) 📝 `Cargo.lock` (+19 -0) 📝 `Cargo.toml` (+1 -1) ➕ `crates/horizon-client-core/Cargo.toml` (+14 -0) 📝 `crates/horizon-client-core/src/block_entity_nbt.rs` (+1 -1) 📝 `crates/horizon-client-core/src/bossbar.rs` (+0 -0) 📝 `crates/horizon-client-core/src/component.rs` (+1 -1) 📝 `crates/horizon-client-core/src/fastutil_order.rs` (+0 -0) 📝 `crates/horizon-client-core/src/gamerules.rs` (+0 -23) ➕ `crates/horizon-client-core/src/identifier.rs` (+18 -0) ➕ `crates/horizon-client-core/src/key_display.rs` (+38 -0) 📝 `crates/horizon-client-core/src/lang.rs` (+6 -2) ➕ `crates/horizon-client-core/src/lib.rs` (+23 -0) 📝 `crates/horizon-client-core/src/nbt_path.rs` (+0 -0) ➕ `crates/horizon-client-core/src/particle_type.rs` (+209 -0) ➕ `crates/horizon-client-core/src/registries.rs` (+188 -0) 📝 `crates/horizon-client-core/src/scoreboard.rs` (+2 -2) 📝 `crates/horizon-client-core/src/snbt.rs` (+0 -0) ➕ `crates/horizon-client-core/src/sound_source.rs` (+7 -0) 📝 `crates/horizon-client-core/src/text.rs` (+1 -1) _...and 37 more files_ </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. First slice of splitting `horizon-client` into crates (Ludovic's priority 1: faster builds and tests). A **pure move**: renames plus mechanical path fixes, no logic change. It goes over the usual 500 lines because of the moved files; git shows them as renames. ## What moves - **`horizon-command`**: `command/`, as is (the Brigadier port, the vanilla tree, argument types, selectors). - **`horizon-client-core`**: everything `command/` needs from the lib, with no path back into the lib: `text`, `lang`, `snbt`, `nbt_path`, `component`, `scoreboard`, `bossbar`, `gamerules`, `block_entity_nbt`, `fastutil_order`. A few items move out of lib modules that sit in the big cycle, unchanged: `ParticleType` (particles.rs), the key display name (keybinds.rs), `SOUND_SOURCES` (settings.rs), `uuid_text`/`uuid_from_text` (save.rs), and `Registries`/`RegistryIds`/`parse_identifier` (command/args.rs). - `horizon-client` re-exports each module and item under its old path (`horizon_client::text`, `crate::command::Registries`, `particles::ParticleType`...), so no caller changes and open PRs keep compiling. - Inside the moved files only paths change. Also `sign_side` became `pub`; lang.rs includes the lang files from horizon-client's assets; gamerules' test that saves a `Level` moved to save.rs, since it needs the client's save. - Docs: AGENTS.md's crate table and docs/architecture.md. Tools: the paths in generate_command_order, port_regen/port_report and two harness source lists. ## Harness selection (separate commit, `tools/parity*.py`) - Records made before the move name the old paths, so a change under `crates/horizon-command/` matched no record: **0 of 348 harnesses**. Fix: a changed file of a crate the recorded crates now link (path dependencies) counts, and the reach search decides. - A library's root is now open only once reached code names the crate. Before, every crate root was open, so any item of a new crate whose name matched a name used anywhere counted (`args.rs` would have selected 117 harnesses instead of 80). On main the new rule gives the same selection for 15 of 16 sampled files across 4 crates. For `horizon-world/src/nbt.rs`, `world_border_render` drops out: it reached that file only through a name match. - `--changed-files` after the split: `args.rs` 80 → 74 harnesses (the 6 dropped reached it only for `parse_identifier`, now in core). `text.rs` 80 → 82-83. Unit tests cover both changes. ## Numbers (ThinkPad, idle, `-j3`, `--no-default-features`; base = main 4fbb0cde7) | | base | split | |---|---|---| | edit a command file, then run its unit tests | 9.0 s (`-p horizon-client --lib command::`) | **1.0 s** (`-p horizon-command`) | | edit text.rs, then run its unit tests | ~8-9 s (client lib tests) | **0.8 s** (`-p horizon-client-core`) | | cold `cargo build --profile fast -p horizon-client` | 608 s | 609 s | | one-line edit, fast build: command/args.rs, text.rs, mobs/ai.rs | 10.2, 10.7, 10.2 s | 10.8, 10.9, 9.7 s | | `cargo test -p horizon-client --lib --bins --tests`, built | 19.7 s | 18.8 s | The cold build doesn't change, and wasn't expected to. With 3 jobs it is CPU-bound, and about 80% of each big crate is codegen. The two new crates (22 s + 17 s) compile just before the lib, which drops from 154 s to 145 s. Crates only shorten a cold build where cores sit idle. One-line edits stay ~10 s: on a lib edit, 6.6 s is the lib re-checking itself (5.1 s frontend) and 5 s is the bin. The gains here are the per-crate test loops. Lib edits get cheaper only as the lib itself shrinks (mobs/ next). Mac mini numbers were too noisy to use (load 54-80); they are in horizon-parity's ci-speed/LOG.md. ## Checks **pr_ready** (`tools/pr_ready.py --quick` on ludovics-mac-mini, against origin/main at 4fbb0cde7, 16 min 43 s) | Check | Result | | --- | --- | | Scope | ⚠️ 57 files, +737 −567; 1258 lines of code: over 500, split it if it can ship in parts | | Cargo.lock | ✅ changes with a Cargo.toml | | Public tree | ✅ | | Python tests | ❌ 311 run, FAILED (errors=2) (55 s) | | rustfmt | ✅ (8 s) | | clippy | ✅ (2 min 6 s) | | tests: workspace | ✅ 2190 passed (11 min 31 s) | | doc tests | ✅ 2 passed (2 min 2 s) | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ 340 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 328 more | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | Python tests: the same 2 errors as on main, environment-only (`java` not on the test's PATH: `test_reuses_until_an_input_or_output_changes`, `test_report_rejects_sources_changed_during_a_run`). Parity: `parity.py --changed origin/main` selects all 348 because Cargo.lock changes. Local run in progress on the Mac mini; result in a comment. 🤖 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:14:24 +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#4062
No description provided.