[PR #1748] [MERGED] server_player_targets harness: end each step by the server's clock, not 2.5 s #3740

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

📋 Pull Request Information

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

Base: main ← Head: fix/server-player-targets-barrier


📝 Commits (1)

  • 6acf7fb server_player_targets harness: end each step by the server's clock

📊 Changes

3 files changed (+91 additions, -24 deletions)

View changed files

📝 mods/horizon/src/test/java/dev/horizonlab/parity/LocatorBarClient.java (+41 -1)
📝 tools/test_dedicated_server_parity.py (+16 -11)
📝 tools/test_server_player_targets_parity.py (+34 -12)

📄 Description

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

What

server_player_targets failed on #1571 and #1585, PRs that don't touch it. Each step used to last a fixed 2.5 s of wall time. Now a step ends when the server has done its work:

  1. The step's console commands run, then the console's own time query gametime comes back. The console runs its queue in order, so those commands have run.
  2. Each player runs sync, a new LocatorBarClient script line. It runs time query gametime as that player and waits for the reply, which is not recorded. After that, the player's commands have run and every packet sent before the reply is recorded.
  3. The harness waits for the server's game time to advance STEP_TICKS (40) ticks, measured from the console. Then each player sends its position reminder (still) and syncs once more.

game_time() moves out of settle() in test_dedicated_server_parity.py so both can use it. LocatorBarClient prints synced NAME to the real stdout, because Bootstrap sends System.out to the logger. The three other harnesses that use this client don't send sync, so they behave as before.

Why (cause)

It was timing, not a Horizon bug. In both CI failures (run 40112226585 on #1571, attempt 3 of run 40123358749 on #1585), the late side was vanilla. Its console tp Bob 4.5 -60 0.5 (step console-tp-home, right after Bob's first trip to the Nether) took effect more than 2.5 s late. Its packets landed under alice-nether and everything after slipped by one step. On #1571, the late console tp Bob Alice even ran before Alice's execute in the_nether run tp Bob, which explains the different rotation in the transcript. Horizon's transcript followed the script order, and both servers sent the same packets. Horizon sends nothing in a different order than vanilla.

How tested (Mac mini, CPU 80-95 % busy from other sessions)

  • Reproduction: tools/test_server_player_targets_parity.py from origin/main, with both servers frozen (SIGSTOP) for 3 s every 8 s to imitate a stalled server: 2/2 FAIL, the same kind of step-shifted diff as on CI.
  • Fix under the same freezes: 2/2 PASS. A third run failed before the script started: the world-generation server lost its port in a bind race (FAILED TO BIND TO PORT, already possible before this change).
  • Fix, no injection: 11/11 PASS (10 in a row plus a first run), 123 identical lines, 225–300 s per run including world generation. CI took 246 s before.
  • python3 tools/parity.py --changed origin/main: 17 harnesses (everything that imports test_dedicated_server_parity.py or uses LocatorBarClient), 17 passed, 0 failed in 38 min.
  • pr_ready --quick: the only ❌ is 2 Python test errors (OracleReuseTests.test_reuses_until_an_input_or_output_changes, ParityRunnerTests.test_report_rejects_sources_changed_during_a_run). They fail the same way on plain main on this Mac, from the /var vs /private/var temp paths and java exit 127 in the stub env, and are unrelated.

pr_ready (tools/pr_ready.py --quick on ludovics-mac-mini, against origin/main at 4a675206b, 1 min 44 s)

Check Result
Scope ✅ 3 files, +91 −24
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ❌ 257 run, FAILED (errors=2) (41 s)
rustfmt ➖ no Rust change
clippy ➖ no Rust change
tests ➖ no crate touched
doc tests ➖ no crate touched
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ 14 affected, to run in CI (--quick): dedicated_server, locator_bar, online_mode, secure_chat, server_dimension_players, server_dragon, server_entities, server_knockback, server_ops_feedback, server_player_targets, server_resource_pack, server_world_gen and 2 more
Label skip-release

Follow-up (not in this PR)

server_dimension_players has the same weakness (fixed 5 s steps, same client). It failed the same way in attempt 1 of the #1585 run: vanilla's add Alice missed step bob-back. The same sync + game-time barrier would fix it.

Needs Ludovic

Nothing.

🤖 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/1748 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/25/2026 **Status:** ✅ Merged **Merged:** 10/25/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/server-player-targets-barrier` --- ### 📝 Commits (1) - [`6acf7fb`](https://github.com/horizon-rust/horizon/commit/6acf7fb6ab0cb4c20d113944d46ea2dbe3b79bfe) server_player_targets harness: end each step by the server's clock ### 📊 Changes **3 files changed** (+91 additions, -24 deletions) <details> <summary>View changed files</summary> 📝 `mods/horizon/src/test/java/dev/horizonlab/parity/LocatorBarClient.java` (+41 -1) 📝 `tools/test_dedicated_server_parity.py` (+16 -11) 📝 `tools/test_server_player_targets_parity.py` (+34 -12) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. ## What `server_player_targets` failed on #1571 and #1585, PRs that don't touch it. Each step used to last a fixed 2.5 s of wall time. Now a step ends when the server has done its work: 1. The step's console commands run, then the console's own `time query gametime` comes back. The console runs its queue in order, so those commands have run. 2. Each player runs `sync`, a new `LocatorBarClient` script line. It runs `time query gametime` as that player and waits for the reply, which is not recorded. After that, the player's commands have run and every packet sent before the reply is recorded. 3. The harness waits for the server's game time to advance `STEP_TICKS` (40) ticks, measured from the console. Then each player sends its position reminder (`still`) and syncs once more. `game_time()` moves out of `settle()` in `test_dedicated_server_parity.py` so both can use it. `LocatorBarClient` prints `synced NAME` to the real stdout, because Bootstrap sends `System.out` to the logger. The three other harnesses that use this client don't send `sync`, so they behave as before. ## Why (cause) It was timing, not a Horizon bug. In both CI failures (run 40112226585 on #1571, attempt 3 of run 40123358749 on #1585), the late side was **vanilla**. Its console `tp Bob 4.5 -60 0.5` (step `console-tp-home`, right after Bob's first trip to the Nether) took effect more than 2.5 s late. Its packets landed under `alice-nether` and everything after slipped by one step. On #1571, the late console `tp Bob Alice` even ran before Alice's `execute in the_nether run tp Bob`, which explains the different rotation in the transcript. Horizon's transcript followed the script order, and both servers sent the same packets. Horizon sends nothing in a different order than vanilla. ## How tested (Mac mini, CPU 80-95 % busy from other sessions) - **Reproduction:** `tools/test_server_player_targets_parity.py` from origin/main, with both servers frozen (SIGSTOP) for 3 s every 8 s to imitate a stalled server: **2/2 FAIL**, the same kind of step-shifted diff as on CI. - **Fix under the same freezes:** 2/2 PASS. A third run failed before the script started: the world-generation server lost its port in a bind race (`FAILED TO BIND TO PORT`, already possible before this change). - **Fix, no injection:** **11/11 PASS** (10 in a row plus a first run), 123 identical lines, 225–300 s per run including world generation. CI took 246 s before. - `python3 tools/parity.py --changed origin/main`: 17 harnesses (everything that imports `test_dedicated_server_parity.py` or uses `LocatorBarClient`), **17 passed, 0 failed** in 38 min. - `pr_ready --quick`: the only ❌ is 2 Python test errors (`OracleReuseTests.test_reuses_until_an_input_or_output_changes`, `ParityRunnerTests.test_report_rejects_sources_changed_during_a_run`). They fail the same way on plain main on this Mac, from the /var vs /private/var temp paths and `java` exit 127 in the stub env, and are unrelated. **pr_ready** (`tools/pr_ready.py --quick` on ludovics-mac-mini, against origin/main at 4a675206b, 1 min 44 s) | Check | Result | | --- | --- | | Scope | ✅ 3 files, +91 −24 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ❌ 257 run, FAILED (errors=2) (41 s) | | rustfmt | ➖ no Rust change | | clippy | ➖ no Rust change | | tests | ➖ no crate touched | | doc tests | ➖ no crate touched | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ 14 affected, to run in CI (--quick): dedicated_server, locator_bar, online_mode, secure_chat, server_dimension_players, server_dragon, server_entities, server_knockback, server_ops_feedback, server_player_targets, server_resource_pack, server_world_gen and 2 more | | Label | `skip-release` | ## Follow-up (not in this PR) `server_dimension_players` has the same weakness (fixed 5 s steps, same client). It failed the same way in attempt 1 of the #1585 run: vanilla's `add Alice` missed step `bob-back`. The same `sync` + game-time barrier would fix it. ## Needs Ludovic Nothing. 🤖 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 04:11: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#3740
No description provided.