[PR #7198] [MERGED] horizon-server: management protocol notifications for the operators, allowlist, bans and IP bans #7402

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

📋 Pull Request Information

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

Base: main ← Head: feat/management-notifications-3


📝 Commits (2)

  • f6a932c horizon-server: the management protocol notifies changes of the operators, the allowlist and the bans
  • 80f5c34 docs: the management protocol's list notifications

📊 Changes

8 files changed (+259 additions, -19 deletions)

View changed files

📝 crates/horizon-client/src/game.rs (+2 -2)
📝 crates/horizon-client/src/game/dedicated.rs (+39 -2)
📝 crates/horizon-client/src/game/dedicated/events.rs (+5 -4)
📝 crates/horizon-server-files/src/user_lists.rs (+75 -3)
📝 crates/horizon-server/src/management.rs (+28 -3)
📝 crates/horizon-server/src/management_methods.rs (+102 -0)
📝 docs/api/server.md (+3 -4)
📝 docs/server.md (+5 -1)

📄 Description

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

Refs #7118 (step 3 of 4; steps 1 and 2 are #7121 and #7155).

What was wrong

After #7155 the management protocol sends the server and player notifications, but a client still learns nothing when an operator, an allowlisted player, a ban or an IP ban is added or removed. Vanilla's JsonRpcNotificationService sends eight notifications for that (operators/added|removed, allowlist/added|removed, bans/added|removed, ip_bans/added|removed).

What changed

In vanilla each StoredUserList holds the NotificationService and calls it itself, so a change is told whoever makes it (the console, a command in the game, the protocol's own methods). Checked with javap: ServerOpList.add/remove/clear call playerOped/playerDeoped, UserWhiteList playerAddedToAllowlist/playerRemovedFromAllowlist, UserBanList playerBanned/playerUnbanned, IpBanList ipBanned/ipUnbanned; a successful add and remove tell once, a clear tells once for each entry and then empties the list; the entries get drops when they have expired tell nothing.

  • horizon-server-files/user_lists.rs: UserList::watch takes a watcher that hears Change::Added(entry) and Change::Removed(entry) on add, remove and clear, not on load. An add of an entry equal to the stored one (a ban) returns false and says nothing, as vanilla's does.
  • dedicated.rs: each of the game's four lists gets a watcher that records a typed event (operators_added, allowlist_removed, bans_added, ip_bans_removed...), with the player, and the level for an operator, the reason, source and end for a ban. The event stream carries them too.
  • management_methods.rs (list_notification) and management.rs (game_event): the supervisor, which already fetches the game's events, turns them into the notifications, with the DTOs the lists already write for the operators, bans and ip_bans methods (an OperatorDto, a PlayerDto, a UserBanDto, an IpBanDto, and the bare address for an IP unban).
  • Docs: docs/server.md section 8, docs/api/server.md.

How it was checked

  • user_lists.rs: a watcher hears the adds, a removal that finds nothing says nothing, a clear says each entry that is left, and an equal ban says nothing.
  • management_methods.rs: every kind of event becomes the exact method and parameter (the operator with its level, a ban with and without a reason or an end, the IP ban, the bare address).
  • management.rs: a client on a real socket gets an allowlist removal with its one parameter; rpc.discover lists all eight names.
  • cargo test for horizon-server (14 management tests), horizon-server-files (3) and the game's event test; cargo clippy -p horizon-server -p horizon-server-files -p horizon-client --all-targets -- -D warnings and cargo fmt are clean. Rebased on main (2f35078b3) and rechecked.

Not tested: no run against a real vanilla server (the parity script runs on the maintainers' machines and doesn't compare notifications yet), no real server with a client connected, and tools/pr_ready.py was not run. A list change made while the supervisor isn't fetching the game's events (the game starting or stopping) is not told.

Next

Step 4 of #7118: gamerules and gamerules/update with gamerules/updated, then the activity, status heartbeat and world upgrade notifications.


🔄 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/7198 **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-notifications-3` --- ### 📝 Commits (2) - [`f6a932c`](https://github.com/horizon-rust/horizon/commit/f6a932c274bb8cb834f895e9dd496fab364257e0) horizon-server: the management protocol notifies changes of the operators, the allowlist and the bans - [`80f5c34`](https://github.com/horizon-rust/horizon/commit/80f5c342063d17b14edc2724a54a2a52268462fe) docs: the management protocol's list notifications ### 📊 Changes **8 files changed** (+259 additions, -19 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+2 -2) 📝 `crates/horizon-client/src/game/dedicated.rs` (+39 -2) 📝 `crates/horizon-client/src/game/dedicated/events.rs` (+5 -4) 📝 `crates/horizon-server-files/src/user_lists.rs` (+75 -3) 📝 `crates/horizon-server/src/management.rs` (+28 -3) 📝 `crates/horizon-server/src/management_methods.rs` (+102 -0) 📝 `docs/api/server.md` (+3 -4) 📝 `docs/server.md` (+5 -1) </details> ### 📄 Description > 🤖 Opened by both Akirabane's AI agent (Claude Code), and Akirabane Himself after his review. Refs #7118 (step 3 of 4; steps 1 and 2 are #7121 and #7155). ## What was wrong After #7155 the management protocol sends the server and player notifications, but a client still learns nothing when an operator, an allowlisted player, a ban or an IP ban is added or removed. Vanilla's `JsonRpcNotificationService` sends eight notifications for that (`operators/added|removed`, `allowlist/added|removed`, `bans/added|removed`, `ip_bans/added|removed`). ## What changed In vanilla each `StoredUserList` holds the `NotificationService` and calls it itself, so a change is told whoever makes it (the console, a command in the game, the protocol's own methods). Checked with `javap`: `ServerOpList.add`/`remove`/`clear` call `playerOped`/`playerDeoped`, `UserWhiteList` `playerAddedToAllowlist`/`playerRemovedFromAllowlist`, `UserBanList` `playerBanned`/`playerUnbanned`, `IpBanList` `ipBanned`/`ipUnbanned`; a successful `add` and `remove` tell once, a `clear` tells once for each entry and then empties the list; the entries `get` drops when they have expired tell nothing. - `horizon-server-files/user_lists.rs`: `UserList::watch` takes a watcher that hears `Change::Added(entry)` and `Change::Removed(entry)` on `add`, `remove` and `clear`, not on `load`. An `add` of an entry equal to the stored one (a ban) returns false and says nothing, as vanilla's does. - `dedicated.rs`: each of the game's four lists gets a watcher that records a typed event (`operators_added`, `allowlist_removed`, `bans_added`, `ip_bans_removed`...), with the player, and the level for an operator, the reason, source and end for a ban. The event stream carries them too. - `management_methods.rs` (`list_notification`) and `management.rs` (`game_event`): the supervisor, which already fetches the game's events, turns them into the notifications, with the DTOs the lists already write for the `operators`, `bans` and `ip_bans` methods (an `OperatorDto`, a `PlayerDto`, a `UserBanDto`, an `IpBanDto`, and the bare address for an IP unban). - Docs: `docs/server.md` section 8, `docs/api/server.md`. ## How it was checked - `user_lists.rs`: a watcher hears the adds, a removal that finds nothing says nothing, a clear says each entry that is left, and an equal ban says nothing. - `management_methods.rs`: every kind of event becomes the exact method and parameter (the operator with its level, a ban with and without a reason or an end, the IP ban, the bare address). - `management.rs`: a client on a real socket gets an allowlist removal with its one parameter; `rpc.discover` lists all eight names. - `cargo test` for `horizon-server` (14 management tests), `horizon-server-files` (3) and the game's event test; `cargo clippy -p horizon-server -p horizon-server-files -p horizon-client --all-targets -- -D warnings` and `cargo fmt` are clean. Rebased on main (2f35078b3) and rechecked. Not tested: no run against a real vanilla server (the parity script runs on the maintainers' machines and doesn't compare notifications yet), no real server with a client connected, and `tools/pr_ready.py` was not run. A list change made while the supervisor isn't fetching the game's events (the game starting or stopping) is not told. ## Next Step 4 of #7118: `gamerules` and `gamerules/update` with `gamerules/updated`, then the activity, status heartbeat and world upgrade notifications. --- <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:02 +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#7402
No description provided.