[PR #1443] [MERGED] parity: prebuild probes with each harness's own package selection #3524

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

📋 Pull Request Information

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

Base: main ← Head: fix/parity-prebuild-selection


📝 Commits (2)

  • ac54227 parity: prebuild probes with each harness's own package selection
  • 7c42cc6 parity: leave out of the prebuild probes that no longer exist

📊 Changes

2 files changed (+117 additions, -24 deletions)

View changed files

📝 tests/test_parity_runner.py (+31 -3)
📝 tools/parity.py (+86 -21)

📄 Description

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

What

tools/parity.py prebuilds each probe with the same package and feature flags its harness uses. Until now every harness rebuilt its own crate and probe after the prebuild.

Why

Workstream 1 of the review plan (review-1-ci, item 4: repeated dependency rebuilds).

The prebuild ran cargo build --workspace --profile <p> --example a --example b ..., or --workspace --examples --bins when any selected harness had no record. The harnesses build with cargo build -p <crate> --example a. Cargo unifies features over the packages a command selects, so the two commands give the shared dependencies different features:

  • for horizon-world: flate2, libc, memchr, syn, thiserror, postcard and digest (cargo +nightly build --unit-graph, both selections);
  • for horizon-client: horizon-mods pack and horizon-telemetry upload.

Different features give different artifact hashes. So the prebuild built a variant of every probe that no harness ran. Each harness then compiled its crate and its probe again, while the others queued on Cargo's lock.

The CI runner's own logs show this:

  • entity_death_loot: its vanilla oracle took 7 s, then its cargo build took 14 min, then its probe ran for 1 s.
  • tab_list: its cargo run --profile fast steps (build plus a short run) took 16.6 min, against 6 min for the oracle.
  • save_roundtrip: --profile fast -p horizon-client --bins took 11 min. --bins was never recorded, so it was never prebuilt.
  • Over 5 hours of runs, 211 of 260 harness compile logs show compilation, and 39 waited on the build-directory lock.

Most of the 49.5-minute median parity job is that work. The 108-minute job had 27.6 min of prebuild, then 78 min of harnesses at 4 at a time, and the harnesses' own time includes these rebuilds.

How

  • artifacts_of records [kind, name, profile, selection, examples]:
    • selection is the command's -p/--package, --features/-F, --workspace, --all-features and --no-default-features;
    • examples says whether that command builds any example (examples turn dev-dependencies on, which can add features);
    • --bins and --examples are recorded too.
  • prebuild_commands runs one cargo build per (profile, selection, examples). Within such a group features resolve the same way, so one run builds all its targets exactly as each harness would.
  • Records from before this change ([kind, name, profile]) are taken as -p <their crate>, which is how nearly every harness builds (cargo metadata maps target to package). Each harness's next run records its real selection. This means the CI runners' existing state gets the fix on the first run.
  • A harness that never ran here takes its probes from the shared dependency list (parity-shared/dependencies/<name>.json). It no longer triggers a --workspace --examples --bins build of all ~275 binaries, which no harness used anyway.
  • Records of targets that no longer exist are left out of the prebuild. One unknown target (no example target named ...) failed the whole Cargo run, so nothing was prebuilt; the probe-binary PRs rename ~250 examples.

Numbers

Cargo-only replay on the ThinkPad (3 jobs, CARGO_INCREMENTAL=0 as on the runner, parity profile). Ten horizon-world harness builds after a real edit to horizon-world, both variants warm first. The ThinkPad is noisy, so each case ran twice:

prebuild the harnesses' own cargo builds builds that compiled
before (--workspace prebuild) 83 s / 130 s 125 s / 80 s 10 of 10
after (this PR) 123 s / 72 s 1.5 s / 1.3 s 0 of 10

The prebuild does the same work either way, only in the right variant. Everything the harnesses compiled after it is gone. On the runner that work was also serialised on Cargo's lock while harness slots sat idle.

The end-to-end CI parity numbers before and after will come from the next PRs that touch horizon-world, once this has merged. This PR's own parity job runs only mob_ai, the one harness that imports tools/parity.py.

How tested

  • python3 -m unittest tests.test_parity_runner passes. The new tests cover selection parsing (--package, -F, --bins, --profile=), the grouping, legacy records, and a record for a target that no longer exists.
    • OracleReuseTests.test_reuses_until_an_input_or_output_changes errors on the Mac mini (exit 127 from the fake java), and fails the same way on origin/main. Linux CI runs it.
  • prebuild_commands on the CI runner's real state (all 329 records, 266 probes, every one still in the old format) gives 10 Cargo runs, each -p <crate> with its own profile, for example --profile release -p horizon-world with 168 examples.

Nothing here needs Ludovic.

🤖 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/1443 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/23/2026 **Status:** ✅ Merged **Merged:** 10/23/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/parity-prebuild-selection` --- ### 📝 Commits (2) - [`ac54227`](https://github.com/horizon-rust/horizon/commit/ac54227465703e3e18c5462eb22735fa44fd1439) parity: prebuild probes with each harness's own package selection - [`7c42cc6`](https://github.com/horizon-rust/horizon/commit/7c42cc63ce78a1b181033286dac63df31e1c0605) parity: leave out of the prebuild probes that no longer exist ### 📊 Changes **2 files changed** (+117 additions, -24 deletions) <details> <summary>View changed files</summary> 📝 `tests/test_parity_runner.py` (+31 -3) 📝 `tools/parity.py` (+86 -21) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. ## What `tools/parity.py` prebuilds each probe with the same package and feature flags its harness uses. Until now every harness rebuilt its own crate and probe after the prebuild. ## Why Workstream 1 of the review plan (review-1-ci, item 4: repeated dependency rebuilds). The prebuild ran `cargo build --workspace --profile <p> --example a --example b ...`, or `--workspace --examples --bins` when any selected harness had no record. The harnesses build with `cargo build -p <crate> --example a`. Cargo unifies features over the packages a command selects, so the two commands give the shared dependencies different features: - for horizon-world: flate2, libc, memchr, syn, thiserror, postcard and digest (`cargo +nightly build --unit-graph`, both selections); - for horizon-client: horizon-mods `pack` and horizon-telemetry `upload`. Different features give different artifact hashes. So the prebuild built a variant of every probe that no harness ran. Each harness then compiled its crate and its probe again, while the others queued on Cargo's lock. The CI runner's own logs show this: - `entity_death_loot`: its vanilla oracle took 7 s, then its `cargo build` took **14 min**, then its probe ran for 1 s. - `tab_list`: its `cargo run --profile fast` steps (build plus a short run) took **16.6 min**, against 6 min for the oracle. - `save_roundtrip`: `--profile fast -p horizon-client --bins` took **11 min**. `--bins` was never recorded, so it was never prebuilt. - Over 5 hours of runs, 211 of 260 harness compile logs show compilation, and 39 waited on the build-directory lock. Most of the 49.5-minute median parity job is that work. The 108-minute job had 27.6 min of prebuild, then 78 min of harnesses at 4 at a time, and the harnesses' own time includes these rebuilds. ## How - `artifacts_of` records `[kind, name, profile, selection, examples]`: - `selection` is the command's `-p`/`--package`, `--features`/`-F`, `--workspace`, `--all-features` and `--no-default-features`; - `examples` says whether that command builds any example (examples turn dev-dependencies on, which can add features); - `--bins` and `--examples` are recorded too. - `prebuild_commands` runs one `cargo build` per (profile, selection, examples). Within such a group features resolve the same way, so one run builds all its targets exactly as each harness would. - Records from before this change (`[kind, name, profile]`) are taken as `-p <their crate>`, which is how nearly every harness builds (`cargo metadata` maps target to package). Each harness's next run records its real selection. This means the CI runners' existing state gets the fix on the first run. - A harness that never ran here takes its probes from the shared dependency list (`parity-shared/dependencies/<name>.json`). It no longer triggers a `--workspace --examples --bins` build of all ~275 binaries, which no harness used anyway. - Records of targets that no longer exist are left out of the prebuild. One unknown target (`no example target named ...`) failed the whole Cargo run, so nothing was prebuilt; the probe-binary PRs rename ~250 examples. ## Numbers Cargo-only replay on the ThinkPad (3 jobs, `CARGO_INCREMENTAL=0` as on the runner, parity profile). Ten horizon-world harness builds after a real edit to horizon-world, both variants warm first. The ThinkPad is noisy, so each case ran twice: | | prebuild | the harnesses' own `cargo build`s | builds that compiled | |---|---|---|---| | before (`--workspace` prebuild) | 83 s / 130 s | **125 s / 80 s** | 10 of 10 | | after (this PR) | 123 s / 72 s | **1.5 s / 1.3 s** | 0 of 10 | The prebuild does the same work either way, only in the right variant. Everything the harnesses compiled after it is gone. On the runner that work was also serialised on Cargo's lock while harness slots sat idle. The end-to-end CI parity numbers before and after will come from the next PRs that touch horizon-world, once this has merged. This PR's own parity job runs only `mob_ai`, the one harness that imports `tools/parity.py`. ## How tested - `python3 -m unittest tests.test_parity_runner` passes. The new tests cover selection parsing (`--package`, `-F`, `--bins`, `--profile=`), the grouping, legacy records, and a record for a target that no longer exists. - `OracleReuseTests.test_reuses_until_an_input_or_output_changes` errors on the Mac mini (exit 127 from the fake `java`), and fails the same way on origin/main. Linux CI runs it. - `prebuild_commands` on the CI runner's real state (all 329 records, 266 probes, every one still in the old format) gives 10 Cargo runs, each `-p <crate>` with its own profile, for example `--profile release -p horizon-world` with 168 examples. Nothing here needs Ludovic. 🤖 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:09 +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#3524
No description provided.