[PR #7249] [MERGED] horizon-server: management protocol server/activity and status heartbeat notifications #7443

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/7249
Author: @Akirabane
Created: 11/2/2026
Status: ✅ Merged
Merged: 11/2/2026
Merged by: @ludovic111

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


📝 Commits (4)

  • 5f5806a game: the login gate records a login_activity event
  • df382b7 horizon-server: the management protocol's server/activity notification
  • 8d01223 horizon-server: the management protocol's status heartbeat
  • 35bdb3d docs: the management protocol's activity and heartbeat notifications

📊 Changes

5 files changed (+117 additions, -4 deletions)

View changed files

📝 crates/horizon-client/src/game/dedicated.rs (+3 -0)
📝 crates/horizon-server/src/management.rs (+100 -1)
📝 crates/horizon-server/src/management_methods.rs (+5 -0)
📝 docs/api/server.md (+2 -2)
📝 docs/server.md (+7 -1)

📄 Description

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

Refs #7118 (step 5 of 5, the last one in scope).

What was wrong

The management protocol's notification/server/activity and notification/server/status (the heartbeat) were never sent.

What changed

Four commits: the game's side, then each notification, then the docs.

  • dedicated.rs: the login gate (every login attempt of a dedicated server goes through it) records a typed login_activity event. Vanilla calls ServerActivityMonitor.reportLoginActivity when a login starts, from the constructor of ServerLoginPacketListenerImpl, however the login ends.
  • management.rs, server/activity: the supervisor applies ServerActivityMonitor.processWithRateLimit (checked with javap): an activity is told when thirty seconds have gone by since the last one told, and is lost otherwise, because the monitor clears its flag whatever it did (it is not told later). MinecraftServer builds it with SERVER_ACTIVITY_MONITOR_SECONDS_BETWEEN_NOTIFICATIONS = 30.
  • management.rs, server/status: ManagementServer.scheduleHeartbeat runs statusHeartbeat with scheduleAtFixedRate(interval, interval) in seconds, and nothing when status-heartbeat-interval is 0; the notification carries ServerStateService.status. The supervisor, which serves the protocol, runs the same timer from the property (already on main) and sends the status server/status answers (started: false before the game is up), and computes nothing when no client is connected.
  • Docs: docs/server.md section 8, docs/api/server.md.

Vanilla classes followed: ServerActivityMonitor, MinecraftServer (its monitor), ServerLoginPacketListenerImpl, ManagementServer.scheduleHeartbeat, NotificationManager, JsonRpcNotificationService.statusHeartbeat.

How it was checked

  • management.rs: the thirty-seconds rule with fake instants (an activity at 0, lost at 29, told at 30, lost at 59, told at 60); a client on a real socket gets one server/activity for two logins, and a heartbeat after a second with started: false and the version; rpc.discover lists both names.
  • cargo test -p horizon-server management (16 passed), cargo clippy -p horizon-server -p horizon-client --all-targets -- -D warnings, cargo fmt: clean.
  • The parity script (extended in the PR next to this one, and run before this branch existed) doesn't cover these two: an activity needs a login and the heartbeat a timer; neither was compared to a vanilla server.

Not tested: a real server with a real login (no client was joined), and the heartbeat's cadence against vanilla's. What is left of #7118 after this is world/upgrade_*, which waits for WorldUpgrader's server side.


🔄 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/7249 **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-5` --- ### 📝 Commits (4) - [`5f5806a`](https://github.com/horizon-rust/horizon/commit/5f5806a1e32482752a0e060b80429deef741e552) game: the login gate records a login_activity event - [`df382b7`](https://github.com/horizon-rust/horizon/commit/df382b701bc1cf0ac3b9dc0a5fa29ebfab0f62b5) horizon-server: the management protocol's server/activity notification - [`8d01223`](https://github.com/horizon-rust/horizon/commit/8d0122354f74a807e5775d989c50ec44378a920b) horizon-server: the management protocol's status heartbeat - [`35bdb3d`](https://github.com/horizon-rust/horizon/commit/35bdb3d07660343c1be5677f30ff9bf225566327) docs: the management protocol's activity and heartbeat notifications ### 📊 Changes **5 files changed** (+117 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/dedicated.rs` (+3 -0) 📝 `crates/horizon-server/src/management.rs` (+100 -1) 📝 `crates/horizon-server/src/management_methods.rs` (+5 -0) 📝 `docs/api/server.md` (+2 -2) 📝 `docs/server.md` (+7 -1) </details> ### 📄 Description > 🤖 Opened by both Akirabane's AI agent (Claude Code), and Akirabane Himself after his review. Refs #7118 (step 5 of 5, the last one in scope). ## What was wrong The management protocol's `notification/server/activity` and `notification/server/status` (the heartbeat) were never sent. ## What changed Four commits: the game's side, then each notification, then the docs. - `dedicated.rs`: the login gate (every login attempt of a dedicated server goes through it) records a typed `login_activity` event. Vanilla calls `ServerActivityMonitor.reportLoginActivity` when a login starts, from the constructor of `ServerLoginPacketListenerImpl`, however the login ends. - `management.rs`, `server/activity`: the supervisor applies `ServerActivityMonitor.processWithRateLimit` (checked with `javap`): an activity is told when thirty seconds have gone by since the last one told, and is **lost** otherwise, because the monitor clears its flag whatever it did (it is not told later). `MinecraftServer` builds it with `SERVER_ACTIVITY_MONITOR_SECONDS_BETWEEN_NOTIFICATIONS = 30`. - `management.rs`, `server/status`: `ManagementServer.scheduleHeartbeat` runs `statusHeartbeat` with `scheduleAtFixedRate(interval, interval)` in seconds, and nothing when `status-heartbeat-interval` is 0; the notification carries `ServerStateService.status`. The supervisor, which serves the protocol, runs the same timer from the property (already on main) and sends the status `server/status` answers (`started: false` before the game is up), and computes nothing when no client is connected. - Docs: `docs/server.md` section 8, `docs/api/server.md`. Vanilla classes followed: `ServerActivityMonitor`, `MinecraftServer` (its monitor), `ServerLoginPacketListenerImpl`, `ManagementServer.scheduleHeartbeat`, `NotificationManager`, `JsonRpcNotificationService.statusHeartbeat`. ## How it was checked - `management.rs`: the thirty-seconds rule with fake instants (an activity at 0, lost at 29, told at 30, lost at 59, told at 60); a client on a real socket gets one `server/activity` for two logins, and a heartbeat after a second with `started: false` and the version; `rpc.discover` lists both names. - `cargo test -p horizon-server management` (16 passed), `cargo clippy -p horizon-server -p horizon-client --all-targets -- -D warnings`, `cargo fmt`: clean. - The parity script (extended in the PR next to this one, and run before this branch existed) doesn't cover these two: an activity needs a login and the heartbeat a timer; neither was compared to a vanilla server. Not tested: a real server with a real login (no client was joined), and the heartbeat's cadence against vanilla's. What is left of #7118 after this is `world/upgrade_*`, which waits for `WorldUpgrader`'s server side. --- <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#7443
No description provided.