[PR #5332] [MERGED] Dedicated server: complete /op, /deop, /pardon, /pardon-ip and /whitelist from the server's own lists #6212

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

📋 Pull Request Information

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

Base: main ← Head: fix-op-suggestions


📝 Commits (2)

  • 8a43975 Dedicated server: complete /op, /deop, /pardon, /pardon-ip and /whitelist from the server's own lists (#5316)
  • 5066c63 Merge main into #5332 (main's perf_bench, triage-list and launcher-string failures, fixed by #5369 and #5397)

📊 Changes

5 files changed (+132 additions, -5 deletions)

View changed files

📝 crates/horizon-client-core/src/registries.rs (+6 -0)
📝 crates/horizon-client/src/game/lan_actions.rs (+47 -2)
📝 crates/horizon-command/src/lib.rs (+31 -0)
📝 crates/horizon-command/src/tests.rs (+35 -0)
📝 crates/horizon-command/src/tree_extra.rs (+13 -3)

📄 Description

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

What and why

Fixes #5316. On a dedicated server, a guest's tab completion of /op, /deop, /pardon, /pardon-ip and /whitelist add|remove offered only the selectors and Player. The command tree sent to the client already marks these nodes ask_server (as vanilla does), but the server answered over the host process's registries, whose player list on a dedicated server is the one local player. Testers on a Horizon server found it.

  • The server's answer now uses the real online players (the guests; on a LAN world also the host, who was in the list but not the guests).
  • The six nodes get vanilla's providers: /op the online players who are not operators, /deop the operators, /pardon the banned names, /pardon-ip the banned addresses, /whitelist add the online players who are not whitelisted, /whitelist remove the whitelist. The lists come from the dedicated server's ops.json, banned-players.json, banned-ips.json and whitelist.json as it holds them.
  • /ban has no provider in vanilla and is unchanged.

Kind

  • parity: Horizon now does what vanilla 26.3 does

Vanilla reference

net.minecraft.server.commands.OpCommand (suggests: PlayerList.getPlayers() filtered by isOp), DeOpCommands (PlayerList.getOpNames), PardonCommand (UserBanList.getUserList), PardonIpCommand (IpBanList.getUserList), WhitelistCommand (getPlayers() filtered by UserWhiteList.isWhiteListed, getWhiteListNames), all with SharedSuggestionProvider.suggest (case-insensitive sub-string match). Read with javap -c on the pinned 26.3 jar, since the REA tool needs a download I did not make. Check: the_dedicated_commands_complete_from_the_servers_lists in crates/horizon-command/src/tests.rs, plus a real-server run below. No parity harness covers dedicated-only command completion; the new unit test is the regression check.

Other projects' code

none

Proof on a real dedicated server

A small protocol client (not in this PR) joins an offline-mode dedicated server as Opper (operator), Plain and Zed (both online), with Griefer banned, 203.0.113.9 IP-banned and Old and Zed whitelisted, and asks for completions as Opper.

Before (main at b8cf85f8c):

'op '                  -> ['@a', '@e', '@n', '@p', '@r', '@s', 'Player']
'deop '                -> ['@a', '@e', '@n', '@p', '@r', '@s', 'Player']
'pardon '              -> ['@a', '@e', '@n', '@p', '@r', '@s', 'Player']
'pardon-ip '           -> []
'whitelist add '       -> ['@a', '@e', '@n', '@p', '@r', '@s', 'Player']
'whitelist remove '    -> ['@a', '@e', '@n', '@p', '@r', '@s', 'Player']
'op z'                 -> []

After:

'op '                  -> ['Plain', 'Zed']
'deop '                -> ['Opper']
'pardon '              -> ['Griefer']
'pardon-ip '           -> ['203.0.113.9']
'whitelist add '       -> ['Opper', 'Plain']
'whitelist remove '    -> ['Old', 'Zed']
'ban '                 -> ['@a', '@e', '@n', '@p', '@r', '@s', 'Opper', 'Plain', 'Zed']
'op z'                 -> ['Zed']

Self-check

pr_ready (tools/pr_ready.py --quick --base upstream/main on leoserver, against upstream/main at b8cf85f8c, 7 min 55 s)

Check Result
Scope ✅ 5 files, +132 −5
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ❌ 500 run, FAILED (errors=1, skipped=1) (43 s)
rustfmt ✅ (10 s)
clippy ✅ (1 min 53 s)
tests: horizon-client, horizon-client-core, horizon-command ❌ 1411 passed, 8 failed (5 min 7 s)
doc tests ✅ 0 passed (2 s)
content root tests ➖ content root untouched
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ not run (--quick): CI's parity job picks the affected harnesses
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

The two red rows are not from this change. cargo test -p horizon-client --test lan_bot fails the same 8 tests (status_and_join, sprint_commands_survive_keyboard_input_changes, ...) on unchanged upstream/main (b8cf85f8c) on this machine; I ran that to check. The one Python error is test_perf_bench (cannot compare RD 8: scenario missing), in a file this PR does not touch; I did not run it on main. Everything else, including the new test and all 1411 other tests of the three crates, passes; the lines above are --quick, so CI's parity job will pick the 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/5332 **Author:** [@Detimes](https://github.com/Detimes) **Created:** 10/31/2026 **Status:** ✅ Merged **Merged:** 10/31/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix-op-suggestions` --- ### 📝 Commits (2) - [`8a43975`](https://github.com/horizon-rust/horizon/commit/8a4397551e517d4d5086480d12ada7b2ec3a5d8f) Dedicated server: complete /op, /deop, /pardon, /pardon-ip and /whitelist from the server's own lists (#5316) - [`5066c63`](https://github.com/horizon-rust/horizon/commit/5066c631924567f2c4f6eb6168d2390ae474785a) Merge main into #5332 (main's perf_bench, triage-list and launcher-string failures, fixed by #5369 and #5397) ### 📊 Changes **5 files changed** (+132 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-core/src/registries.rs` (+6 -0) 📝 `crates/horizon-client/src/game/lan_actions.rs` (+47 -2) 📝 `crates/horizon-command/src/lib.rs` (+31 -0) 📝 `crates/horizon-command/src/tests.rs` (+35 -0) 📝 `crates/horizon-command/src/tree_extra.rs` (+13 -3) </details> ### 📄 Description > 🤖 Opened by Detimes' AI agent (Claude Code, Claude Sonnet 5.5), not by Detimes personally. ## What and why Fixes #5316. On a dedicated server, a guest's tab completion of `/op`, `/deop`, `/pardon`, `/pardon-ip` and `/whitelist add|remove` offered only the selectors and `Player`. The command tree sent to the client already marks these nodes `ask_server` (as vanilla does), but the server answered over the host process's registries, whose player list on a dedicated server is the one local player. Testers on a Horizon server found it. - The server's answer now uses the real online players (the guests; on a LAN world also the host, who was in the list but not the guests). - The six nodes get vanilla's providers: `/op` the online players who are not operators, `/deop` the operators, `/pardon` the banned names, `/pardon-ip` the banned addresses, `/whitelist add` the online players who are not whitelisted, `/whitelist remove` the whitelist. The lists come from the dedicated server's `ops.json`, `banned-players.json`, `banned-ips.json` and `whitelist.json` as it holds them. - `/ban` has no provider in vanilla and is unchanged. ## Kind - [x] parity: Horizon now does what vanilla 26.3 does ## Vanilla reference `net.minecraft.server.commands.OpCommand` (suggests: `PlayerList.getPlayers()` filtered by `isOp`), `DeOpCommands` (`PlayerList.getOpNames`), `PardonCommand` (`UserBanList.getUserList`), `PardonIpCommand` (`IpBanList.getUserList`), `WhitelistCommand` (`getPlayers()` filtered by `UserWhiteList.isWhiteListed`, `getWhiteListNames`), all with `SharedSuggestionProvider.suggest` (case-insensitive sub-string match). Read with `javap -c` on the pinned 26.3 jar, since the REA tool needs a download I did not make. Check: `the_dedicated_commands_complete_from_the_servers_lists` in `crates/horizon-command/src/tests.rs`, plus a real-server run below. No parity harness covers dedicated-only command completion; the new unit test is the regression check. ## Other projects' code none ## Proof on a real dedicated server A small protocol client (not in this PR) joins an offline-mode dedicated server as `Opper` (operator), `Plain` and `Zed` (both online), with `Griefer` banned, `203.0.113.9` IP-banned and `Old` and `Zed` whitelisted, and asks for completions as `Opper`. Before (main at b8cf85f8c): ``` 'op ' -> ['@a', '@e', '@n', '@p', '@r', '@s', 'Player'] 'deop ' -> ['@a', '@e', '@n', '@p', '@r', '@s', 'Player'] 'pardon ' -> ['@a', '@e', '@n', '@p', '@r', '@s', 'Player'] 'pardon-ip ' -> [] 'whitelist add ' -> ['@a', '@e', '@n', '@p', '@r', '@s', 'Player'] 'whitelist remove ' -> ['@a', '@e', '@n', '@p', '@r', '@s', 'Player'] 'op z' -> [] ``` After: ``` 'op ' -> ['Plain', 'Zed'] 'deop ' -> ['Opper'] 'pardon ' -> ['Griefer'] 'pardon-ip ' -> ['203.0.113.9'] 'whitelist add ' -> ['Opper', 'Plain'] 'whitelist remove ' -> ['Old', 'Zed'] 'ban ' -> ['@a', '@e', '@n', '@p', '@r', '@s', 'Opper', 'Plain', 'Zed'] 'op z' -> ['Zed'] ``` ## Self-check **pr_ready** (`tools/pr_ready.py --quick --base upstream/main` on leoserver, against upstream/main at b8cf85f8c, 7 min 55 s) | Check | Result | | --- | --- | | Scope | ✅ 5 files, +132 −5 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ❌ 500 run, FAILED (errors=1, skipped=1) (43 s) | | rustfmt | ✅ (10 s) | | clippy | ✅ (1 min 53 s) | | tests: horizon-client, horizon-client-core, horizon-command | ❌ 1411 passed, 8 failed (5 min 7 s) | | doc tests | ✅ 0 passed (2 s) | | content root tests | ➖ content root untouched | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ not run (--quick): CI's parity job picks the affected harnesses | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | The two red rows are not from this change. `cargo test -p horizon-client --test lan_bot` fails the same 8 tests (`status_and_join`, `sprint_commands_survive_keyboard_input_changes`, ...) on unchanged `upstream/main` (b8cf85f8c) on this machine; I ran that to check. The one Python error is `test_perf_bench` (`cannot compare RD 8: scenario missing`), in a file this PR does not touch; I did not run it on main. Everything else, including the new test and all 1411 other tests of the three crates, passes; the lines above are `--quick`, so CI's parity job will pick the harnesses. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 06:15:57 +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#6212
No description provided.