[PR #6401] [MERGED] parity.py runs harnesses on Windows: file locks, process trees, no peak or shim there #6848

Closed
opened 2026-11-03 06:27:59 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/6401
Author: @Ragbie
Created: 11/1/2026
Status: ✅ Merged
Merged: 11/1/2026
Merged by: @ludovic111

Base: main ← Head: fix/parity-windows


📝 Commits (1)

  • 5ebf42f parity.py runs harnesses on Windows: file locks, process trees, no peak or shim there

📊 Changes

5 files changed (+95 additions, -25 deletions)

View changed files

➕ tests/test_file_lock.py (+25 -0)
➕ tools/file_lock.py (+28 -0)
📝 tools/integration_env.py (+6 -3)
📝 tools/parity.py (+33 -19)
📝 tools/test_datafix_parity.py (+3 -3)

📄 Description

🤖 Opened by Ragbie's AI agent (Claude Code, Opus 5.5), not by Ragbie personally.

What and why

tools/parity.py starts on Windows since #3428 but stopped before running any harness: machine_slot locked its slot files with fcntl (ModuleNotFoundError: No module named 'fcntl'), so python tools/parity.py <name> and pr_ready.py's local harness run failed on every Windows machine with the vanilla data. The rest of the run path was POSIX too (#6391):

  • Locks: new tools/file_lock.py: an exclusive lock held until the file closes, flock where it exists, msvcrt's byte lock on Windows. Used by machine_slot, integration_env.suite_lock and test_datafix_parity's generate.lock. tests/test_file_lock.py checks a held lock refuses another until closed.
  • Timeouts: kill_tree: the process group as before, taskkill /T /F on Windows (no os.killpg there).
  • Peak memory: without resource, the trace has no peak_bytes; the scheduler already falls back to DEFAULT_MEMORY (records.get(name, {}).get("peak_bytes", DEFAULT_MEMORY)).
  • Oracle reuse: off on Windows. The shim goes on PATH as a java symlink to a Python script; Windows needs a privilege for the symlink (WinError 1314), finds a program started without a shell only as an .exe, and the shim's os.execv returns before the program there. Harnesses run their oracles fresh on Windows.

Linux and macOS take the same paths as before.

Measured on Windows 11, Python 3.14, JDK 25, upstream main b3c2b6ddd:

  • python tools/parity.py rule_test: before, ModuleNotFoundError: No module named 'fcntl' at once; after, PASS rule_test 84s, 1 passed, 0 failed.
  • Timeout path: --fresh --timeout 19 rule_test with the oracle's java.exe running at 14, 16 and 18 s: --- rule_test: timed out after 19s, and no java.exe left afterwards.
  • Linux (rust:1.98 container, Python 3.13, from git archive of this branch and of main): tests.test_file_lock passes; tests/ gives the same failures on both (the archive lacks the rest of the repository), 360 tests vs 359.

This changes the harness runner, so CI's parity job may select every harness (full-parity?).

Fixes #6391

Kind

  • parity: Horizon now does what vanilla 26.3 does
  • bug: a crash or a breakage
  • perf: faster, or less memory
  • feature: something new for players (listed under New in the release notes)
  • extra: Horizon-only, off by default
  • tooling: tools, CI, tests, harnesses
  • docs

Vanilla reference

none (harness runner)

Other projects' code

none

Self-check

--quick: the harnesses this reaches are all of them; rule_test ran through the changed runner above.

pr_ready (tools/pr_ready.py --quick --base upstream/main on Evrim-PC, against upstream/main at b3c2b6ddd, 1 min 23 s)

Check Result
Scope ✅ 5 files, +95 −25
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 595 passed (1 min 22 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 ➖ not run (--quick): CI's parity job picks the affected harnesses
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/6401 **Author:** [@Ragbie](https://github.com/Ragbie) **Created:** 11/1/2026 **Status:** ✅ Merged **Merged:** 11/1/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/parity-windows` --- ### 📝 Commits (1) - [`5ebf42f`](https://github.com/horizon-rust/horizon/commit/5ebf42f7bfc2d81b2beb4328dc125bd2a9d3f681) parity.py runs harnesses on Windows: file locks, process trees, no peak or shim there ### 📊 Changes **5 files changed** (+95 additions, -25 deletions) <details> <summary>View changed files</summary> ➕ `tests/test_file_lock.py` (+25 -0) ➕ `tools/file_lock.py` (+28 -0) 📝 `tools/integration_env.py` (+6 -3) 📝 `tools/parity.py` (+33 -19) 📝 `tools/test_datafix_parity.py` (+3 -3) </details> ### 📄 Description > 🤖 Opened by Ragbie's AI agent (Claude Code, Opus 5.5), not by Ragbie personally. ## What and why `tools/parity.py` starts on Windows since #3428 but stopped before running any harness: `machine_slot` locked its slot files with `fcntl` (`ModuleNotFoundError: No module named 'fcntl'`), so `python tools/parity.py <name>` and `pr_ready.py`'s local harness run failed on every Windows machine with the vanilla data. The rest of the run path was POSIX too (#6391): - **Locks:** new `tools/file_lock.py`: an exclusive lock held until the file closes, `flock` where it exists, `msvcrt`'s byte lock on Windows. Used by `machine_slot`, `integration_env.suite_lock` and `test_datafix_parity`'s `generate.lock`. `tests/test_file_lock.py` checks a held lock refuses another until closed. - **Timeouts:** `kill_tree`: the process group as before, `taskkill /T /F` on Windows (no `os.killpg` there). - **Peak memory:** without `resource`, the trace has no `peak_bytes`; the scheduler already falls back to `DEFAULT_MEMORY` (`records.get(name, {}).get("peak_bytes", DEFAULT_MEMORY)`). - **Oracle reuse:** off on Windows. The shim goes on PATH as a `java` symlink to a Python script; Windows needs a privilege for the symlink (`WinError 1314`), finds a program started without a shell only as an `.exe`, and the shim's `os.execv` returns before the program there. Harnesses run their oracles fresh on Windows. Linux and macOS take the same paths as before. Measured on Windows 11, Python 3.14, JDK 25, upstream `main` `b3c2b6ddd`: - `python tools/parity.py rule_test`: before, `ModuleNotFoundError: No module named 'fcntl'` at once; after, `PASS rule_test 84s`, `1 passed, 0 failed`. - Timeout path: `--fresh --timeout 19 rule_test` with the oracle's `java.exe` running at 14, 16 and 18 s: `--- rule_test: timed out after 19s`, and no `java.exe` left afterwards. - Linux (`rust:1.98` container, Python 3.13, from `git archive` of this branch and of main): `tests.test_file_lock` passes; `tests/` gives the same failures on both (the archive lacks the rest of the repository), 360 tests vs 359. This changes the harness runner, so CI's parity job may select every harness (`full-parity`?). Fixes #6391 ## Kind - [ ] parity: Horizon now does what vanilla 26.3 does - [ ] bug: a crash or a breakage - [ ] perf: faster, or less memory - [ ] feature: something new for players (listed under New in the release notes) - [ ] extra: Horizon-only, off by default - [x] tooling: tools, CI, tests, harnesses - [ ] docs ## Vanilla reference none (harness runner) ## Other projects' code none ## Self-check `--quick`: the harnesses this reaches are all of them; `rule_test` ran through the changed runner above. **pr_ready** (`tools/pr_ready.py --quick --base upstream/main` on Evrim-PC, against upstream/main at b3c2b6ddd, 1 min 23 s) | Check | Result | | --- | --- | | Scope | ✅ 5 files, +95 −25 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 595 passed (1 min 22 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 | ➖ not run (--quick): CI's parity job picks the affected harnesses | | 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 06:27:59 +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#6848
No description provided.