[PR #1571] [MERGED] Tools and harnesses start the game in scratch folders, not a player's #3598

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

📋 Pull Request Information

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

Base: main ← Head: fix/home-leak-tests


📝 Commits (3)

  • d271176 Tools and harnesses start the game in scratch folders, not a player's
  • 7598373 Merge branch 'main' into fix/home-leak-tests
  • 7c27b85 server_pack_e2e: start the game and the servers through lab.game_env

📊 Changes

28 files changed (+193 additions, -41 deletions)

View changed files

📝 docs/parity-workflow.md (+4 -0)
➕ tests/test_game_home.py (+102 -0)
📝 tools/agent_control_e2e.py (+9 -6)
📝 tools/graphics_bench.py (+3 -4)
📝 tools/lab.py (+33 -0)
📝 tools/lan_e2e.py (+1 -2)
📝 tools/launcher_mcp_e2e.py (+1 -2)
📝 tools/mod_browser_harness.py (+6 -2)
📝 tools/parity.py (+7 -0)
📝 tools/perf_bench.py (+1 -1)
📝 tools/server_bench.py (+1 -1)
📝 tools/server_pack_e2e.py (+3 -4)
📝 tools/test_block_removal_parity.py (+1 -1)
📝 tools/test_command_exec_parity.py (+1 -1)
📝 tools/test_composter_parity.py (+1 -1)
📝 tools/test_crafter_parity.py (+1 -1)
📝 tools/test_dedicated_server_parity.py (+2 -2)
📝 tools/test_dispenser_parity.py (+1 -1)
📝 tools/test_friends.py (+1 -1)
📝 tools/test_mace_parity.py (+1 -1)

...and 8 more files

📄 Description

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

What

Harnesses and tools that start the game now give it scratch folders instead of a player's own. Nothing under ~/Library/Application Support/horizon is written by them any more.

Why

The game logs into HORIZON_HOME and, when it is unset, falls back to the player's own game folder (logging::game_home()). On the Mac mini the real ~/Library/Application Support/horizon/logs/ kept getting a new 2026-10-24-N.log.gz and latest.log every minute or so, from games that had HORIZON_NO_AUDIO set and no HORIZON_HOME. Seen at 18:30 CEST: the game started by the self-hosted runner ludovics-mac-mini-2 (workflow checks, parity-target/release/horizon-client) had HORIZON_NO_AUDIO=1 and no HORIZON_HOME; another runner was running test_world_reopen_parity the same way. ~/code/horizon-parity/env.sh also exports HORIZON_NO_AUDIO=1 alone, which gave the same result for agents.

How

  • lab.game_env(base=None, **extra): the environment for any run of the game, horizon-ctl, the launcher or the dedicated server: no audio, no launcher self-update, and fresh mktemp folders for HORIZON_HOME, HORIZON_LAUNCHER_HOME, XDG_DATA_HOME, XDG_CONFIG_HOME (removed at exit). A folder the caller passes, or that the environment already has, is kept.
  • Every launcher uses it. Offenders on origin/main (no HORIZON_HOME): test_save_roundtrip, test_world_reopen, test_world_spawn, test_command_exec, test_secure_chat, test_online_mode, test_dedicated_server (its Server, also used by the test_server_*, test_locator_bar, test_user_cache harnesses), the fixture harnesses test_dispenser, test_composter, test_mace, test_crafter, test_block_removal, test_use_item_on, test_sculk, test_native_client (set nothing at all), perf_bench, server_bench, graphics_bench. Already passing a home but now through the helper: lan_e2e, agent_control_e2e (game_env(screen, home=)), test_friends, mod_browser_harness, launcher_mcp_e2e.
  • tools/parity.py gives each harness it starts its own HORIZON_HOME under .local/parity-runner/game-home/<harness> unless the environment has one.
  • tests/test_game_home.py: game_env unit tests, and an AST scan of tools/ that fails for a script that starts the game (names horizon-ctl, horizon-server, a game binary path) without game_env, or that sets HORIZON_NO_AUDIO by hand. On origin/main's tools it flags 17 and 21 scripts.
  • Not done: a warning in the game when HORIZON_NO_AUDIO is set and HORIZON_HOME is not. The default home for players is unchanged.
  • Not changed (outside this repo): ~/code/horizon-parity/env.sh exports HORIZON_NO_AUDIO=1 without HORIZON_HOME; tools/ci/runner-env.sh does the same for the runners' GITHUB_ENV. With this PR both are harmless for harnesses that use the helper.

Tested

Run on the Mac mini with HOME pointed at an empty folder, so any write to the "real" game folder shows up there instead of in Ludovic's:

Tools Sample Files in the fake ~/Library/Application Support/horizon
origin/main test_world_reopen_parity.py 2 (logs/latest.log, logs/.lock)
this PR test_world_reopen_parity.py, lan_e2e.py --check chest, agent_control_e2e.py --mode cli --scenario survival 0 (all three pass)

With the scratch folders kept, the game's latest.log is inside the harness's HORIZON_HOME. Python tests: python3 -m unittest discover -s tests: 292 run, the 2 errors (test_parity_runner reuse, test_rust_parity report) are the macOS /private/var path error and fail the same on origin/main; tests.test_game_home passes. No Rust change. CI reruns all 326 harnesses because tools/lab.py is a dependency of each.

Needs Ludovic: nothing. The existing logs in the real folder are untouched.

🤖 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/1571 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/24/2026 **Status:** ✅ Merged **Merged:** 10/25/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/home-leak-tests` --- ### 📝 Commits (3) - [`d271176`](https://github.com/horizon-rust/horizon/commit/d271176f2342e1c2033f4ca38005892c60801f3e) Tools and harnesses start the game in scratch folders, not a player's - [`7598373`](https://github.com/horizon-rust/horizon/commit/75983739ecdbc4bf99b3d806f89bc34adefcbdb2) Merge branch 'main' into fix/home-leak-tests - [`7c27b85`](https://github.com/horizon-rust/horizon/commit/7c27b85fbd290a48ff000dfcb3e84f862914752a) server_pack_e2e: start the game and the servers through lab.game_env ### 📊 Changes **28 files changed** (+193 additions, -41 deletions) <details> <summary>View changed files</summary> 📝 `docs/parity-workflow.md` (+4 -0) ➕ `tests/test_game_home.py` (+102 -0) 📝 `tools/agent_control_e2e.py` (+9 -6) 📝 `tools/graphics_bench.py` (+3 -4) 📝 `tools/lab.py` (+33 -0) 📝 `tools/lan_e2e.py` (+1 -2) 📝 `tools/launcher_mcp_e2e.py` (+1 -2) 📝 `tools/mod_browser_harness.py` (+6 -2) 📝 `tools/parity.py` (+7 -0) 📝 `tools/perf_bench.py` (+1 -1) 📝 `tools/server_bench.py` (+1 -1) 📝 `tools/server_pack_e2e.py` (+3 -4) 📝 `tools/test_block_removal_parity.py` (+1 -1) 📝 `tools/test_command_exec_parity.py` (+1 -1) 📝 `tools/test_composter_parity.py` (+1 -1) 📝 `tools/test_crafter_parity.py` (+1 -1) 📝 `tools/test_dedicated_server_parity.py` (+2 -2) 📝 `tools/test_dispenser_parity.py` (+1 -1) 📝 `tools/test_friends.py` (+1 -1) 📝 `tools/test_mace_parity.py` (+1 -1) _...and 8 more files_ </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. ## What Harnesses and tools that start the game now give it scratch folders instead of a player's own. Nothing under `~/Library/Application Support/horizon` is written by them any more. ## Why The game logs into `HORIZON_HOME` and, when it is unset, falls back to the player's own game folder (`logging::game_home()`). On the Mac mini the real `~/Library/Application Support/horizon/logs/` kept getting a new `2026-10-24-N.log.gz` and `latest.log` every minute or so, from games that had `HORIZON_NO_AUDIO` set and no `HORIZON_HOME`. Seen at 18:30 CEST: the game started by the self-hosted runner `ludovics-mac-mini-2` (workflow `checks`, `parity-target/release/horizon-client`) had `HORIZON_NO_AUDIO=1` and no `HORIZON_HOME`; another runner was running `test_world_reopen_parity` the same way. `~/code/horizon-parity/env.sh` also exports `HORIZON_NO_AUDIO=1` alone, which gave the same result for agents. ## How - `lab.game_env(base=None, **extra)`: the environment for any run of the game, `horizon-ctl`, the launcher or the dedicated server: no audio, no launcher self-update, and fresh `mktemp` folders for `HORIZON_HOME`, `HORIZON_LAUNCHER_HOME`, `XDG_DATA_HOME`, `XDG_CONFIG_HOME` (removed at exit). A folder the caller passes, or that the environment already has, is kept. - Every launcher uses it. Offenders on origin/main (no `HORIZON_HOME`): `test_save_roundtrip`, `test_world_reopen`, `test_world_spawn`, `test_command_exec`, `test_secure_chat`, `test_online_mode`, `test_dedicated_server` (its `Server`, also used by the `test_server_*`, `test_locator_bar`, `test_user_cache` harnesses), the fixture harnesses `test_dispenser`, `test_composter`, `test_mace`, `test_crafter`, `test_block_removal`, `test_use_item_on`, `test_sculk`, `test_native_client` (set nothing at all), `perf_bench`, `server_bench`, `graphics_bench`. Already passing a home but now through the helper: `lan_e2e`, `agent_control_e2e` (`game_env(screen, home=)`), `test_friends`, `mod_browser_harness`, `launcher_mcp_e2e`. - `tools/parity.py` gives each harness it starts its own `HORIZON_HOME` under `.local/parity-runner/game-home/<harness>` unless the environment has one. - `tests/test_game_home.py`: `game_env` unit tests, and an AST scan of `tools/` that fails for a script that starts the game (names `horizon-ctl`, `horizon-server`, a game binary path) without `game_env`, or that sets `HORIZON_NO_AUDIO` by hand. On origin/main's tools it flags 17 and 21 scripts. - Not done: a warning in the game when `HORIZON_NO_AUDIO` is set and `HORIZON_HOME` is not. The default home for players is unchanged. - Not changed (outside this repo): `~/code/horizon-parity/env.sh` exports `HORIZON_NO_AUDIO=1` without `HORIZON_HOME`; `tools/ci/runner-env.sh` does the same for the runners' `GITHUB_ENV`. With this PR both are harmless for harnesses that use the helper. ## Tested Run on the Mac mini with `HOME` pointed at an empty folder, so any write to the "real" game folder shows up there instead of in Ludovic's: | Tools | Sample | Files in the fake `~/Library/Application Support/horizon` | | --- | --- | --- | | origin/main | `test_world_reopen_parity.py` | 2 (`logs/latest.log`, `logs/.lock`) | | this PR | `test_world_reopen_parity.py`, `lan_e2e.py --check chest`, `agent_control_e2e.py --mode cli --scenario survival` | 0 (all three pass) | With the scratch folders kept, the game's `latest.log` is inside the harness's `HORIZON_HOME`. Python tests: `python3 -m unittest discover -s tests`: 292 run, the 2 errors (`test_parity_runner` reuse, `test_rust_parity` report) are the macOS `/private/var` path error and fail the same on origin/main; `tests.test_game_home` passes. No Rust change. CI reruns all 326 harnesses because `tools/lab.py` is a dependency of each. Needs Ludovic: nothing. The existing logs in the real folder are untouched. 🤖 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:10:42 +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#3598
No description provided.