[PR #1964] [MERGED] parity: pick harnesses by the Rust items their probes reach (−53% harnesses per PR) #3893

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

📋 Pull Request Information

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

Base: main ← Head: perf/ci-speed-selection


📝 Commits (1)

  • 21d8e53 parity: pick harnesses by the Rust items their probes reach, not whole crates

📊 Changes

4 files changed (+925 additions, -7 deletions)

View changed files

📝 docs/parity-workflow.md (+4 -0)
➕ tests/test_parity_reach.py (+111 -0)
📝 tools/parity.py (+42 -7)
➕ tools/parity_reach.py (+768 -0)

📄 Description

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

What

tools/parity.py --changed (CI's parity job) and --changed-files (pr_ready) picked every harness whose probe links a changed crate: one line in horizon-client reran ~110 harnesses, one in horizon-world ~310. They now pick a harness only if its probes can reach the changed file.

tools/parity_reach.py builds an item-level graph of the workspace (parsed by regex, cached by content in .local/parity-runner/reach-cache.json): from the probe modules a harness ran (or the binary it built), free items are reached by name in their own module, through a path or an import of a named module, or a glob import; inherent methods once their type is reached and their name mentioned; trait impls once trait and type are reached; macros once invoked. #[cfg(test)] code never counts. Parent modules count only through their mod declarations, compared with the merge base. Names match by spelling, so it over-approximates.

Safe fallbacks: a harness whose probe can't be found keeps every source; deleted dependencies count as changed; added files take part; Cargo.lock / research-lock.json still select everything; non-Rust files are kept; --by-crate restores the old behaviour.

Before / after

Last 20 PRs merged on 2026-10-25, records from the Mac mini runner (harness-minutes = each harness's last measured duration):

Before After
Harnesses picked 2255 1061 (−53%)
Harness-minutes 2384 1592 (−33%)

The floor is the ~25 game-binary harnesses (~62 harness-minutes), which link all of game/. Choosing takes 15 s cold, under 1 s warm, up to ~80 s on a change that reaches many harnesses (Mac mini under load).

PR Files Harnesses Harness-min
#1936 1 113 → 30 102 → 62
#1884 6 110 → 35 102 → 72
#1858 6 33 → 25 65 → 62
#1847 3 29 → 27 64 → 62
#1839 11 0 → 0 0 → 0
#1827 8 110 → 25 102 → 62
#1817 16 339 → 339 323 → 323
#1804 3 316 → 90 300 → 115
#1795 1 30 → 25 64 → 62
#1779 4 110 → 25 102 → 62
#1736 3 313 → 86 299 → 112
#1727 3 27 → 25 64 → 62
#1718 6 109 → 82 102 → 38
#1695 5 312 → 122 299 → 192
#1690 3 29 → 25 64 → 62
#1681 1 29 → 25 64 → 62
#1673 1 108 → 25 101 → 62
#1665 4 30 → 25 65 → 62
#1655 6 108 → 25 101 → 62
#1730 5 0 → 0 0 → 0

Evidence it misses nothing

  • CI failures replayed: all 61 failed parity runs of 2026-10-18 to 25 (104 failed harnesses), each at its head and the main it was based on: every failed harness the old selection picked is still picked (missed empty everywhere).
  • Coverage: probes built with -C instrument-coverage, harness run unmodified, llvm-cov export: food (4 files executed), block_update (40), options (7), tooltip_display (5), place_recipe (17), command_parse (25): every executed workspace file is among those kept.
  • tests/test_parity_reach.py: reached vs unreached modules with the same names, methods, std trait impls, macros, test modules, parents through declarations, added/deleted files, unknown probes.

Size: tools/parity_reach.py is ~770 lines, over the ~500 guideline; it is one new self-contained module and can't ship usefully in parts.

Self-check

pr_ready (tools/pr_ready.py on ludovics-mac-mini, against origin/main at ed11f614f, 2 min 37 s)

Check Result
Scope ⚠️ 4 files, +923 −7; 817 lines of code: over 500, split it if it can ship in parts
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ❌ 292 run, FAILED (errors=2) (1 min 36 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 ✅ no harness affected
Label skip-release

The two Python errors (test_parity_runner.OracleReuseTests.test_reuses_until_an_input_or_output_changes, test_rust_parity.ParityRunnerTests.test_report_rejects_sources_changed_during_a_run) fail the same way on main on this machine (tmp-path /private resolution).

Measurements and method: ci-speed-1's log.

🤖 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/1964 **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:** `perf/ci-speed-selection` --- ### 📝 Commits (1) - [`21d8e53`](https://github.com/horizon-rust/horizon/commit/21d8e530346f3e05c0256e2c085bceb0103f823d) parity: pick harnesses by the Rust items their probes reach, not whole crates ### 📊 Changes **4 files changed** (+925 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `docs/parity-workflow.md` (+4 -0) ➕ `tests/test_parity_reach.py` (+111 -0) 📝 `tools/parity.py` (+42 -7) ➕ `tools/parity_reach.py` (+768 -0) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. ## What `tools/parity.py --changed` (CI's parity job) and `--changed-files` (pr_ready) picked every harness whose probe *links* a changed crate: one line in `horizon-client` reran ~110 harnesses, one in `horizon-world` ~310. They now pick a harness only if its probes can *reach* the changed file. `tools/parity_reach.py` builds an item-level graph of the workspace (parsed by regex, cached by content in `.local/parity-runner/reach-cache.json`): from the probe modules a harness ran (or the binary it built), free items are reached by name in their own module, through a path or an import of a named module, or a glob import; inherent methods once their type is reached and their name mentioned; trait impls once trait and type are reached; macros once invoked. `#[cfg(test)]` code never counts. Parent modules count only through their `mod` declarations, compared with the merge base. Names match by spelling, so it over-approximates. Safe fallbacks: a harness whose probe can't be found keeps every source; deleted dependencies count as changed; added files take part; `Cargo.lock` / `research-lock.json` still select everything; non-Rust files are kept; `--by-crate` restores the old behaviour. ## Before / after Last 20 PRs merged on 2026-10-25, records from the Mac mini runner (harness-minutes = each harness's last measured duration): | | Before | After | | --- | --- | --- | | Harnesses picked | 2255 | **1061** (−53%) | | Harness-minutes | 2384 | **1592** (−33%) | The floor is the ~25 game-binary harnesses (~62 harness-minutes), which link all of `game/`. Choosing takes 15 s cold, under 1 s warm, up to ~80 s on a change that reaches many harnesses (Mac mini under load). | PR | Files | Harnesses | Harness-min | | --- | --- | --- | --- | | #1936 | 1 | 113 → 30 | 102 → 62 | | #1884 | 6 | 110 → 35 | 102 → 72 | | #1858 | 6 | 33 → 25 | 65 → 62 | | #1847 | 3 | 29 → 27 | 64 → 62 | | #1839 | 11 | 0 → 0 | 0 → 0 | | #1827 | 8 | 110 → 25 | 102 → 62 | | #1817 | 16 | 339 → 339 | 323 → 323 | | #1804 | 3 | 316 → 90 | 300 → 115 | | #1795 | 1 | 30 → 25 | 64 → 62 | | #1779 | 4 | 110 → 25 | 102 → 62 | | #1736 | 3 | 313 → 86 | 299 → 112 | | #1727 | 3 | 27 → 25 | 64 → 62 | | #1718 | 6 | 109 → 82 | 102 → 38 | | #1695 | 5 | 312 → 122 | 299 → 192 | | #1690 | 3 | 29 → 25 | 64 → 62 | | #1681 | 1 | 29 → 25 | 64 → 62 | | #1673 | 1 | 108 → 25 | 101 → 62 | | #1665 | 4 | 30 → 25 | 65 → 62 | | #1655 | 6 | 108 → 25 | 101 → 62 | | #1730 | 5 | 0 → 0 | 0 → 0 | ## Evidence it misses nothing - **CI failures replayed:** all 61 failed parity runs of 2026-10-18 to 25 (104 failed harnesses), each at its head and the main it was based on: every failed harness the old selection picked is still picked (`missed` empty everywhere). - **Coverage:** probes built with `-C instrument-coverage`, harness run unmodified, `llvm-cov export`: food (4 files executed), block_update (40), options (7), tooltip_display (5), place_recipe (17), command_parse (25): every executed workspace file is among those kept. - `tests/test_parity_reach.py`: reached vs unreached modules with the same names, methods, std trait impls, macros, test modules, parents through declarations, added/deleted files, unknown probes. Size: `tools/parity_reach.py` is ~770 lines, over the ~500 guideline; it is one new self-contained module and can't ship usefully in parts. ## Self-check **pr_ready** (`tools/pr_ready.py` on ludovics-mac-mini, against origin/main at ed11f614f, 2 min 37 s) | Check | Result | | --- | --- | | Scope | ⚠️ 4 files, +923 −7; 817 lines of code: over 500, split it if it can ship in parts | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ❌ 292 run, FAILED (errors=2) (1 min 36 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 | ✅ no harness affected | | Label | `skip-release` | The two Python errors (`test_parity_runner.OracleReuseTests.test_reuses_until_an_input_or_output_changes`, `test_rust_parity.ParityRunnerTests.test_report_rejects_sources_changed_during_a_run`) fail the same way on main on this machine (tmp-path `/private` resolution). Measurements and method: ci-speed-1's log. 🤖 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:13:04 +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#3893
No description provided.