[PR #708] [MERGED] Decode the server's command tree and complete commands with it #2749

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

📋 Pull Request Information

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

Base: main ← Head: feat/server-command-tree


📝 Commits (4)

  • e4741b7 Decode the server's command tree and complete commands with it
  • 7c5bd06 lan_bot: the command tree arrives parsed (#708)
  • 1c79add Input capture test: on a server the chat is ChatScreen (#708)
  • bf1cd95 Merge main into feat/server-command-tree

📊 Changes

16 files changed (+703 additions, -166 deletions)

View changed files

📝 crates/horizon-client/src/command/mod.rs (+1 -0)
➕ crates/horizon-client/src/command/network.rs (+404 -0)
📝 crates/horizon-client/src/game.rs (+1 -8)
📝 crates/horizon-client/src/game/agent.rs (+3 -0)
📝 crates/horizon-client/src/game/chat.rs (+27 -6)
📝 crates/horizon-client/src/game/control.rs (+0 -12)
📝 crates/horizon-client/src/game/debug_keys.rs (+1 -2)
📝 crates/horizon-client/src/game/pad.rs (+0 -7)
📝 crates/horizon-client/src/game/pad_menu.rs (+7 -11)
📝 crates/horizon-client/src/game/remote.rs (+26 -105)
📝 crates/horizon-client/src/game/scoreboard.rs (+0 -2)
📝 crates/horizon-client/tests/lan_bot.rs (+1 -3)
📝 crates/horizon-protocol/src/buf.rs (+4 -0)
📝 crates/horizon-protocol/src/packets/play.rs (+178 -4)
📝 tests/test_world_input_capture.py (+7 -4)
📝 tools/lan_e2e.py (+43 -2)

📄 Description

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

Task 3 of the server-thread work. Independent of #695/#697/#700, so it is based on main.

Problem

The window dropped the server's ClientboundCommandsPacket: the decoder returned "argument nodes are not decoded". On any server, including single player's integrated server thread, the chat was then a bare input line, with:

  • no Tab completion;
  • no argument colouring;
  • no usage line and no parse errors.

Change

  • horizon-protocol now decodes argument nodes:

    • the 26.3 minecraft:command_argument_type ids (ARGUMENT_TYPES, from ArgumentTypeInfos.bootstrap);
    • each parser's network properties (ArgumentProperties, mirroring ArgumentTypeInfo.deserializeFromNetwork): integer/long/float/double bounds, string kind, entity and score holder flags, time minimum, and the resource arguments' registry;
    • the custom suggestion provider id.

    The raw property bytes stay in CommandNode.parser, so encoding is unchanged.

  • command::network::from_packet turns the tree into a Dispatcher. The packet's root becomes node 0, and redirects (execute … run) are mapped.

    • A node at a path the client's vanilla tree also has keeps that node's argument type and suggestion provider: the same parser code runs on both sides.
    • Any other node, from another server or a mod, gets the type its parser and properties describe.
    • Executable nodes run the server command id, so the chat only sends them.
  • The chat on a server is now ChatScreen over that tree, as in single player without the server thread:

    • Tab completion, the suggestion list, argument colours, usage and errors;
    • history;
    • Enter sends the command (ChatCommand) or the message.

    Player-name suggestions come from the server's player list. The old bare chat_input line is removed, along with its key, pad and HUD paths. The on-screen keyboard now goes through the chat screen.

  • The screen state reports chat_input while the chat is open, for harnesses.

Not in this PR: minecraft:ask_server nodes use the client's own suggestions for the matching vanilla node instead of a ServerboundCommandSuggestionPacket round trip. For Horizon servers the lists are the same. Server-only state (another server's functions or storages) is not completed.

Tests

  • command::network unit tests:
    • a round trip of argument nodes through the codec;
    • a server tree, with the root last, becoming a dispatcher: a server-only warp <count> gets its integer bounds, and vanilla's give <targets> keeps the client's type;
    • every one of the 62 argument types decoding its properties to the end.
  • tools/lan_e2e.py --check commands (new). The guest is a remote client like the server-thread window. It types /gamem + Tab and /gamemode cr + Tab, then Enter:
    • before (the #700 stack build, which lacks this commit): FAIL, type needs the chat screen (/ opened the bare input line);
    • after: PASS, {'literal': '/gamemode', 'argument': '/gamemode creative', 'mode': 'creative'}.
  • --check feedback still passes.
  • Smoke on the window with HORIZON_SERVER_THREAD=1: /gamem + Tab gives /gamemode, /gamemode surv + Tab gives /gamemode survival, and Enter puts the player in survival.
  • cargo fmt --all --check: ok.
  • cargo clippy --workspace --all-targets -- -D warnings: ok.
  • cargo test -p horizon-client --lib: 824 passed.
  • Local parity: results follow 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/708 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/17/2026 **Status:** ✅ Merged **Merged:** 10/17/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `feat/server-command-tree` --- ### 📝 Commits (4) - [`e4741b7`](https://github.com/horizon-rust/horizon/commit/e4741b7793211787741f520d9667cebfd9aaeca8) Decode the server's command tree and complete commands with it - [`7c5bd06`](https://github.com/horizon-rust/horizon/commit/7c5bd06dfe7018793e2db3260b5a887d910e6a27) lan_bot: the command tree arrives parsed (#708) - [`1c79add`](https://github.com/horizon-rust/horizon/commit/1c79addec1520d31da93589016f27a3e9596fe39) Input capture test: on a server the chat is ChatScreen (#708) - [`bf1cd95`](https://github.com/horizon-rust/horizon/commit/bf1cd958686ffc95a6ff30cdbedc9a8de59315ad) Merge main into feat/server-command-tree ### 📊 Changes **16 files changed** (+703 additions, -166 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/command/mod.rs` (+1 -0) ➕ `crates/horizon-client/src/command/network.rs` (+404 -0) 📝 `crates/horizon-client/src/game.rs` (+1 -8) 📝 `crates/horizon-client/src/game/agent.rs` (+3 -0) 📝 `crates/horizon-client/src/game/chat.rs` (+27 -6) 📝 `crates/horizon-client/src/game/control.rs` (+0 -12) 📝 `crates/horizon-client/src/game/debug_keys.rs` (+1 -2) 📝 `crates/horizon-client/src/game/pad.rs` (+0 -7) 📝 `crates/horizon-client/src/game/pad_menu.rs` (+7 -11) 📝 `crates/horizon-client/src/game/remote.rs` (+26 -105) 📝 `crates/horizon-client/src/game/scoreboard.rs` (+0 -2) 📝 `crates/horizon-client/tests/lan_bot.rs` (+1 -3) 📝 `crates/horizon-protocol/src/buf.rs` (+4 -0) 📝 `crates/horizon-protocol/src/packets/play.rs` (+178 -4) 📝 `tests/test_world_input_capture.py` (+7 -4) 📝 `tools/lan_e2e.py` (+43 -2) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. Task 3 of the server-thread work. Independent of #695/#697/#700, so it is based on `main`. ## Problem The window dropped the server's `ClientboundCommandsPacket`: the decoder returned "argument nodes are not decoded". On any server, including single player's integrated server thread, the chat was then a bare input line, with: - no Tab completion; - no argument colouring; - no usage line and no parse errors. ## Change - **horizon-protocol** now decodes argument nodes: - the 26.3 `minecraft:command_argument_type` ids (`ARGUMENT_TYPES`, from `ArgumentTypeInfos.bootstrap`); - each parser's network properties (`ArgumentProperties`, mirroring `ArgumentTypeInfo.deserializeFromNetwork`): integer/long/float/double bounds, string kind, entity and score holder flags, time minimum, and the resource arguments' registry; - the custom suggestion provider id. The raw property bytes stay in `CommandNode.parser`, so encoding is unchanged. - **`command::network::from_packet`** turns the tree into a `Dispatcher`. The packet's root becomes node 0, and redirects (`execute … run`) are mapped. - A node at a path the client's vanilla tree also has keeps that node's argument type and suggestion provider: the same parser code runs on both sides. - Any other node, from another server or a mod, gets the type its parser and properties describe. - Executable nodes run the `server` command id, so the chat only sends them. - **The chat on a server is now `ChatScreen`** over that tree, as in single player without the server thread: - Tab completion, the suggestion list, argument colours, usage and errors; - history; - Enter sends the command (`ChatCommand`) or the message. Player-name suggestions come from the server's player list. The old bare `chat_input` line is removed, along with its key, pad and HUD paths. The on-screen keyboard now goes through the chat screen. - The screen state reports `chat_input` while the chat is open, for harnesses. **Not in this PR:** `minecraft:ask_server` nodes use the client's own suggestions for the matching vanilla node instead of a `ServerboundCommandSuggestionPacket` round trip. For Horizon servers the lists are the same. Server-only state (another server's functions or storages) is not completed. ## Tests - `command::network` unit tests: - a round trip of argument nodes through the codec; - a server tree, with the root last, becoming a dispatcher: a server-only `warp <count>` gets its integer bounds, and vanilla's `give <targets>` keeps the client's type; - every one of the 62 argument types decoding its properties to the end. - `tools/lan_e2e.py --check commands` (new). The guest is a remote client like the server-thread window. It types `/gamem` + Tab and `/gamemode cr` + Tab, then Enter: - before (the #700 stack build, which lacks this commit): FAIL, `type needs the chat screen` (`/` opened the bare input line); - after: PASS, `{'literal': '/gamemode', 'argument': '/gamemode creative', 'mode': 'creative'}`. - `--check feedback` still passes. - Smoke on the window with `HORIZON_SERVER_THREAD=1`: `/gamem` + Tab gives `/gamemode`, `/gamemode surv` + Tab gives `/gamemode survival`, and Enter puts the player in survival. - `cargo fmt --all --check`: ok. - `cargo clippy --workspace --all-targets -- -D warnings`: ok. - `cargo test -p horizon-client --lib`: 824 passed. - Local parity: results follow 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-02 15:58:45 +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#2749
No description provided.