[PR #4940] [MERGED] tools: end-to-end check that spectators stay hidden on a dedicated server #5959

Closed
opened 2026-11-03 05:16:13 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

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

Base: main ← Head: server-asks/spectator-check


📝 Commits (1)

  • 048dafd tools: end-to-end check that spectators stay hidden on a dedicated server

📊 Changes

1 file changed (+163 additions, -0 deletions)

View changed files

➕ tools/server_spectator_e2e.py (+163 -0)

📄 Description

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

What and why

A server host reported that survival players who aren't ops sometimes see spectators' name tags. The cause was fixed in #4204 (merged 2026-10-30, in game builds from 0.2.29): before it, the hub's entity tracker sent a spectator to every player, with only the invisible flag. Vanilla's ServerPlayer.broadcastToPlayer never sends a spectator to a player who isn't one. #4204 has a unit test of the tracker. This PR adds the end-to-end check with real clients that was missing.

tools/server_spectator_e2e.py starts a dedicated server and two Horizon clients (horizon-ctl, offscreen, scratch folders). Pat stays in survival. Ops goes in and out of spectator mode from the console. Pat's client must not know Ops's entity at all (entities), and must show no name tag of Ops (status's name_tags). It checks this right after the switch, after a teleport onto Pat, after a death and respawn, after a trip to the Nether and back, after Pat joins again, and after Ops joins again as a spectator. Pat sees Ops again once Ops is back in survival. Ops, while spectating, still sees Pat.

Checked

  • On the commit before #4204 (3caf55ae8) it fails: Ops turned spectator: Pat's client was sent the spectator Ops. On name tags alone it would pass there, because Horizon's client hides an invisible player's name, so it checks for the entity too.
  • On main it passes, in all 10 situations.

Not covered: the deprecated --in-frame LAN host still draws spectator guests' names from its own guest models (game/names.rs other_players). That mode is going away, so I left it alone.

python3 tools/server_spectator_e2e.py --bin-dir target/fast

pr_ready (tools/pr_ready.py on ludovics-mac-mini, against origin/main at 8f91f896a, 1 min 22 s)

Check Result
Scope ✅ 1 files, +163 −0
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 486 passed (1 min 21 s)
rustfmt ➖ no Rust change
clippy ➖ no Rust change
tests ➖ no crate touched
doc tests ➖ no crate touched
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 ➖ 1 affected, to run in CI (no vanilla data here): lan_integration
Label skip-release

🤖 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/4940 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/31/2026 **Status:** ✅ Merged **Merged:** 10/31/2026 **Merged by:** [@rdbtCVS](https://github.com/rdbtCVS) **Base:** `main` ← **Head:** `server-asks/spectator-check` --- ### 📝 Commits (1) - [`048dafd`](https://github.com/horizon-rust/horizon/commit/048dafddad24cd102fb14c94744ad529c0ab9a6c) tools: end-to-end check that spectators stay hidden on a dedicated server ### 📊 Changes **1 file changed** (+163 additions, -0 deletions) <details> <summary>View changed files</summary> ➕ `tools/server_spectator_e2e.py` (+163 -0) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. ## What and why A server host reported that survival players who aren't ops sometimes see spectators' name tags. The cause was fixed in #4204 (merged 2026-10-30, in game builds from 0.2.29): before it, the hub's entity tracker sent a spectator to every player, with only the invisible flag. Vanilla's `ServerPlayer.broadcastToPlayer` never sends a spectator to a player who isn't one. #4204 has a unit test of the tracker. This PR adds the end-to-end check with real clients that was missing. `tools/server_spectator_e2e.py` starts a dedicated server and two Horizon clients (horizon-ctl, offscreen, scratch folders). Pat stays in survival. Ops goes in and out of spectator mode from the console. Pat's client must not know Ops's entity at all (`entities`), and must show no name tag of Ops (`status`'s `name_tags`). It checks this right after the switch, after a teleport onto Pat, after a death and respawn, after a trip to the Nether and back, after Pat joins again, and after Ops joins again as a spectator. Pat sees Ops again once Ops is back in survival. Ops, while spectating, still sees Pat. ## Checked - On the commit before #4204 (3caf55ae8) it **fails**: `Ops turned spectator: Pat's client was sent the spectator Ops`. On name tags alone it would pass there, because Horizon's client hides an invisible player's name, so it checks for the entity too. - On main it **passes**, in all 10 situations. Not covered: the deprecated `--in-frame` LAN host still draws spectator guests' names from its own guest models (`game/names.rs` `other_players`). That mode is going away, so I left it alone. ``` python3 tools/server_spectator_e2e.py --bin-dir target/fast ``` **pr_ready** (`tools/pr_ready.py` on ludovics-mac-mini, against origin/main at 8f91f896a, 1 min 22 s) | Check | Result | | --- | --- | | Scope | ✅ 1 files, +163 −0 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 486 passed (1 min 21 s) | | rustfmt | ➖ no Rust change | | clippy | ➖ no Rust change | | tests | ➖ no crate touched | | doc tests | ➖ no crate touched | | 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 | ➖ 1 affected, to run in CI (no vanilla data here): lan_integration | | Label | `skip-release` | 🤖 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-03 05:16:13 +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#5959
No description provided.