[PR #7248] [MERGED] horizon-server: gamerules/update as vanilla's answers it, and the parity script for the game rules and list notifications #7444

Closed
opened 2026-11-03 06:39:37 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/7248
Author: @Akirabane
Created: 11/2/2026
Status: ✅ Merged
Merged: 11/2/2026
Merged by: @ludovic111

Base: main ← Head: feat/management-gamerules-parity


📝 Commits (4)

  • f6dbc7f game: gamerules/update tells and logs on every update, and answers vanilla's errors
  • 918febd tools: the management parity script covers the game rules and the notifications of the lists
  • 770ebea Merge remote-tracking branch 'origin/main' into feat/management-gamerules-parity
  • 5dedbb4 Merge remote-tracking branch 'origin/main' into feat/management-gamerules-parity

📊 Changes

3 files changed (+66 additions, -26 deletions)

View changed files

📝 crates/horizon-client/src/game/dedicated/management.rs (+37 -23)
📝 docs/server.md (+3 -3)
📝 tools/test_management_protocol_parity.py (+26 -0)

📄 Description

🤖 Opened by both Akirabane's AI agent (Claude Code), and Akirabane Himself after his review.

Refs #7118 (follow-up to step 4, #7220, which merged before this was pushed).

What was wrong

#7220 added the game rules to the management protocol without comparing them to a vanilla server: the parity script, which runs on the maintainers' machines, didn't cover them. I ran it here (below) after extending it, and it found two differences:

  • MinecraftGameRuleServiceImpl.updateGameRule sets, logs and tells the notification service on every update, also when the rule already has the value. Three updates (a rule to false, the same again, another rule) gave three notification/gamerules/updated on vanilla and two on Horizon, whose update set the rule only when its value changed.
  • Vanilla's codecs answer a bad request with their own texts, which the first version replaced with its own.

What changed

  • game/dedicated/management.rs: gamerules/update sets, logs and tells on every update. A value or a key that doesn't fit answers vanilla's texts, as the script saw them: Value -1 outside of range [0:2147483647], Not a boolean: "yes", Unknown registry key in ResourceKey[minecraft:root / minecraft:game_rule]: minecraft:nope, No key key in MapLike[{"value":true}]. A value that is not a number answers Not a number: … as DFU's number codec does; the script doesn't cover that one. docs/server.md says so.
  • tools/test_management_protocol_parity.py: it now sends gamerules and gamerules/update (a rule set twice to the same value, an integer rule, out of range, the wrong type, an unknown rule, a missing key) and compares the notifications both servers send for the same messages (the lists' and the rules'), name by name and count by count. Vanilla lists the rules in the order of a map keyed by identity, which changes from run to run, so the list is compared sorted by key.

Two commits: the fix, then the script.

How it was checked

python tools/test_management_protocol_parity.py against the pinned vanilla 26.3 server, on Windows: 110 exchanges over TLS answered as vanilla answers them; rpc.discover matches the report, with the notifications equal. The first run, before the fix, listed 7 differences (the game rules' list order, the four error texts, the missing gamerules/updated); the second, after it, none. Two things about how it ran here, so nobody is surprised: I ran the script through a small wrapper that skips its cargo build --profile fast and uses the debug binaries already built (the wrapper is not in this PR), and with a keystore path written with slashes, because on Windows the script writes backslashes into server.properties, where Java reads them as escapes (the script itself is unchanged for that; the wrapper patched it).

cargo test -p horizon-client --lib dedicated::management, cargo clippy -p horizon-client --all-targets -- -D warnings, cargo fmt: clean.

Not covered: server/saving, server/saved and the players' notifications (they depend on timing or need a player), server/activity and the heartbeat (the next step).


🔄 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/7248 **Author:** [@Akirabane](https://github.com/Akirabane) **Created:** 11/2/2026 **Status:** ✅ Merged **Merged:** 11/2/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `feat/management-gamerules-parity` --- ### 📝 Commits (4) - [`f6dbc7f`](https://github.com/horizon-rust/horizon/commit/f6dbc7fa785fe1371d7d05345386865aef29a5e1) game: gamerules/update tells and logs on every update, and answers vanilla's errors - [`918febd`](https://github.com/horizon-rust/horizon/commit/918febd6afe1d7cf0a4a355ae987a6b3c2eb4b44) tools: the management parity script covers the game rules and the notifications of the lists - [`770ebea`](https://github.com/horizon-rust/horizon/commit/770ebeab4d7945a096bd71bae3920e956b2edebf) Merge remote-tracking branch 'origin/main' into feat/management-gamerules-parity - [`5dedbb4`](https://github.com/horizon-rust/horizon/commit/5dedbb4ccb3730a41935a9e68403a22fa960cfed) Merge remote-tracking branch 'origin/main' into feat/management-gamerules-parity ### 📊 Changes **3 files changed** (+66 additions, -26 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/dedicated/management.rs` (+37 -23) 📝 `docs/server.md` (+3 -3) 📝 `tools/test_management_protocol_parity.py` (+26 -0) </details> ### 📄 Description > 🤖 Opened by both Akirabane's AI agent (Claude Code), and Akirabane Himself after his review. Refs #7118 (follow-up to step 4, #7220, which merged before this was pushed). ## What was wrong #7220 added the game rules to the management protocol without comparing them to a vanilla server: the parity script, which runs on the maintainers' machines, didn't cover them. I ran it here (below) after extending it, and it found two differences: - `MinecraftGameRuleServiceImpl.updateGameRule` sets, logs and tells the notification service on **every** update, also when the rule already has the value. Three updates (a rule to `false`, the same again, another rule) gave three `notification/gamerules/updated` on vanilla and two on Horizon, whose update set the rule only when its value changed. - Vanilla's codecs answer a bad request with their own texts, which the first version replaced with its own. ## What changed - `game/dedicated/management.rs`: `gamerules/update` sets, logs and tells on every update. A value or a key that doesn't fit answers vanilla's texts, as the script saw them: `Value -1 outside of range [0:2147483647]`, `Not a boolean: "yes"`, `Unknown registry key in ResourceKey[minecraft:root / minecraft:game_rule]: minecraft:nope`, `No key key in MapLike[{"value":true}]`. A value that is not a number answers `Not a number: …` as DFU's number codec does; the script doesn't cover that one. `docs/server.md` says so. - `tools/test_management_protocol_parity.py`: it now sends `gamerules` and `gamerules/update` (a rule set twice to the same value, an integer rule, out of range, the wrong type, an unknown rule, a missing key) and compares the notifications both servers send for the same messages (the lists' and the rules'), name by name and count by count. Vanilla lists the rules in the order of a map keyed by identity, which changes from run to run, so the list is compared sorted by key. Two commits: the fix, then the script. ## How it was checked `python tools/test_management_protocol_parity.py` against the pinned vanilla 26.3 server, on Windows: **110 exchanges over TLS answered as vanilla answers them; rpc.discover matches the report**, with the notifications equal. The first run, before the fix, listed 7 differences (the game rules' list order, the four error texts, the missing `gamerules/updated`); the second, after it, none. Two things about how it ran here, so nobody is surprised: I ran the script through a small wrapper that skips its `cargo build --profile fast` and uses the debug binaries already built (the wrapper is not in this PR), and with a keystore path written with slashes, because on Windows the script writes backslashes into `server.properties`, where Java reads them as escapes (the script itself is unchanged for that; the wrapper patched it). `cargo test -p horizon-client --lib dedicated::management`, `cargo clippy -p horizon-client --all-targets -- -D warnings`, `cargo fmt`: clean. Not covered: `server/saving`, `server/saved` and the players' notifications (they depend on timing or need a player), `server/activity` and the heartbeat (the next step). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 06:39:37 +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#7444
No description provided.