[PR #3653] [MERGED] world_spawn: reuse a seed's vanilla spawn under parity.py's oracle reuse #5125

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

📋 Pull Request Information

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

Base: main ← Head: ci/world-spawn-vanilla-reuse


📝 Commits (1)

  • 3b56436 world_spawn: reuse a seed's vanilla spawn under parity.py's oracle reuse

📊 Changes

2 files changed (+93 additions, -4 deletions)

View changed files

➕ tests/test_world_spawn_parity.py (+44 -0)
📝 tools/test_world_spawn_parity.py (+49 -4)

📄 Description

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

world_spawn is the costliest harness on the PR parity runners, and most of its time goes to vanilla's server, which gives the same answer every time. This change reuses that answer.

Measured (49 finished run-parity jobs, 2026-10-28 20:45Z to 2026-10-29 11:00Z): world_spawn (4 shards, 60 seeds) takes 25 % of all harness time on the Mac mini's runner (27 218 s across 28 runs) and 37 % on playhorizon's (30 512 s across 13 runs). Nearly every game-binary change selects it. Per seed, vanilla's server takes ~11 s and Horizon's ~2 s (log spans, Mac mini runner, 60 seeds). parity_shim.py never caches that vanilla run, because a server's console is a pipe.

Change. Under tools/parity.py's oracle reuse (when PARITY_SHIM_CACHE is set and PARITY_JAVA_CACHE isn't 0), each seed's vanilla spawn is kept in the oracle cache (.local/parity-runner/oracle-cache/world-spawn-<sha256>.json) and reused. The key holds everything vanilla's spawn depends on:

  • the server jar's SHA-1 from the lock (verify_artifacts has already checked the jar and every library against it);
  • java -version;
  • the server's command line, without the machine-specific classpath;
  • the seed's server.properties, without the port.

Horizon's side runs every time. Anything that doesn't reuse oracles creates every vanilla world, as before: --fresh, --all, a run by hand, and parity.py's automatic fresh retry after a failure. The cache sits under .local/, so it never enters a harness's dependency trace, and runner-gc.sh keeps .local/parity-runner.

Checked on the Mac mini, 3 seeds (4242, 777 and the report seed 1891623539983467248):

run per seed seeds' wall time result
1, empty cache 14 s, 12 s, 10 s 36 s 3/3 match, 3 entries written
2, reuse 5 s, 5 s, 4 s 14 s 3/3 match, vanilla reused for 3
PARITY_JAVA_CACHE=0 12 s 12 s 1/1 match, vanilla run again

The cached spawns ([0,64,0], [0,76,0], [144,71,144]) are the ones vanilla printed. tests/test_world_spawn_parity.py covers the key: off without oracle reuse; changes with the seed, jar, JDK or flags; the same when only the classpath moves.

Expected effect: each of the 4 shards drops from ~6 min to ~2.5 min on the Mac mini and from ~10 min to ~4 min on playhorizon. That is ~3–4 min less wall time per Mac mini run (~22 min today) and ~6 min less per playhorizon run (~40 min), with ~20 % (Mac) / ~30 % (playhorizon) of harness slot time freed for the other harnesses.

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

Check Result
Scope ✅ 2 files, +93 −4
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 411 passed (1 min 18 s)
rustfmt / clippy / tests ➖ no Rust change
Parity ➖ 2 affected, to run in CI (--quick): lan_integration, world_spawn (world_spawn run by hand above)
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/3653 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/29/2026 **Status:** ✅ Merged **Merged:** 10/29/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `ci/world-spawn-vanilla-reuse` --- ### 📝 Commits (1) - [`3b56436`](https://github.com/horizon-rust/horizon/commit/3b5643628a251fcaae87aa57eab5a5a98e501833) world_spawn: reuse a seed's vanilla spawn under parity.py's oracle reuse ### 📊 Changes **2 files changed** (+93 additions, -4 deletions) <details> <summary>View changed files</summary> ➕ `tests/test_world_spawn_parity.py` (+44 -0) 📝 `tools/test_world_spawn_parity.py` (+49 -4) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. `world_spawn` is the costliest harness on the PR parity runners, and most of its time goes to vanilla's server, which gives the same answer every time. This change reuses that answer. **Measured** (49 finished run-parity jobs, 2026-10-28 20:45Z to 2026-10-29 11:00Z): `world_spawn` (4 shards, 60 seeds) takes 25 % of all harness time on the Mac mini's runner (27 218 s across 28 runs) and 37 % on playhorizon's (30 512 s across 13 runs). Nearly every game-binary change selects it. Per seed, vanilla's server takes ~11 s and Horizon's ~2 s (log spans, Mac mini runner, 60 seeds). `parity_shim.py` never caches that vanilla run, because a server's console is a pipe. **Change.** Under `tools/parity.py`'s oracle reuse (when `PARITY_SHIM_CACHE` is set and `PARITY_JAVA_CACHE` isn't `0`), each seed's vanilla spawn is kept in the oracle cache (`.local/parity-runner/oracle-cache/world-spawn-<sha256>.json`) and reused. The key holds everything vanilla's spawn depends on: - the server jar's SHA-1 from the lock (`verify_artifacts` has already checked the jar and every library against it); - `java -version`; - the server's command line, without the machine-specific classpath; - the seed's `server.properties`, without the port. Horizon's side runs every time. Anything that doesn't reuse oracles creates every vanilla world, as before: `--fresh`, `--all`, a run by hand, and parity.py's automatic fresh retry after a failure. The cache sits under `.local/`, so it never enters a harness's dependency trace, and `runner-gc.sh` keeps `.local/parity-runner`. **Checked** on the Mac mini, 3 seeds (4242, 777 and the report seed 1891623539983467248): | run | per seed | seeds' wall time | result | | --- | --- | --- | --- | | 1, empty cache | 14 s, 12 s, 10 s | 36 s | 3/3 match, 3 entries written | | 2, reuse | 5 s, 5 s, 4 s | 14 s | 3/3 match, `vanilla reused for 3` | | `PARITY_JAVA_CACHE=0` | 12 s | 12 s | 1/1 match, vanilla run again | The cached spawns (`[0,64,0]`, `[0,76,0]`, `[144,71,144]`) are the ones vanilla printed. `tests/test_world_spawn_parity.py` covers the key: off without oracle reuse; changes with the seed, jar, JDK or flags; the same when only the classpath moves. **Expected effect:** each of the 4 shards drops from ~6 min to ~2.5 min on the Mac mini and from ~10 min to ~4 min on playhorizon. That is ~3–4 min less wall time per Mac mini run (~22 min today) and ~6 min less per playhorizon run (~40 min), with ~20 % (Mac) / ~30 % (playhorizon) of harness slot time freed for the other harnesses. **pr_ready** (`tools/pr_ready.py --quick` on ludovics-mac-mini, against origin/main at 4a9501d2d, 1 min 19 s) | Check | Result | | --- | --- | | Scope | ✅ 2 files, +93 −4 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 411 passed (1 min 18 s) | | rustfmt / clippy / tests | ➖ no Rust change | | Parity | ➖ 2 affected, to run in CI (--quick): lan_integration, world_spawn (world_spawn run by hand above) | | 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:10:25 +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#5125
No description provided.