Skip to content

ci(measure): build each side once and hand the binaries to its shards as an artifact (#1457) - #1459

Merged
DrunkOnJava merged 7 commits into
mainfrom
ci/measure-builds-once-per-side
Nov 5, 2026
Merged

DrunkOnJava merged 7 commits into
mainfrom
ci/measure-builds-once-per-side

Conversation

@DrunkOnJava

@DrunkOnJava DrunkOnJava commented Nov 5, 2026 •

Copy link
Copy Markdown
Owner

Summary

Measure builds each side once, in a Build head / Build base job, and hands the binaries to that side's shards as the run artifact measure-bin-head / measure-bin-base. A shard no longer installs Rust, restores rust-cache or builds anything.

Motivation

One item of #1457. Every shard of a commit missed the binary cache at once and built the same binaries: over 36 dispatched runs Build was 150 of 720 job-minutes (21%), and a 12-shard run built 12 times. The figures under Testing are from runs on 8096218c; they are labelled measured, modelled or projected.

Changes

  • .github/workflows/measure.yml
    • plan also outputs sides (["head"] or ["head","base"]).
    • New job build (needs: plan, matrix over the sides, fail-fast: false): the measured checkout, Rust, rust-cache with today's save-if minus the shard clause, the binary cache key, restore, the Build step (MCP server rules and the probes unchanged), Save. It then copies rvt-ifc, rvt-gltf, rvt-info, rvt-rs-mcp when present and examples/<probe> for each probe that exists at the ref (no hashed copies, no .d files) into bin-out with built-commit.txt, and uploads it as measure-bin-<side> (3 days).
    • measure now needs: [plan, build], with if: !cancelled() && needs.plan.result == 'success' so that a failed Build job of one side does not take the other side's shards with it. It downloads its side's artifact into measured/target/ci, checks built-commit.txt against its own checkout of the ref, removes that file, sets the executable bit, and writes measured-commit.txt itself. It keeps the measured checkout (PROBE_SCORER_DIR, commit.txt). Rust, rust-cache, the binary cache steps and Build are gone from it; nothing left in a shard calls cargo or rustc (tools/ci/measure-reference-models.sh tests -x "$BIN/rvt-rs-mcp" and -x "$BIN/examples/$name", so an absent optional binary is skipped as before).
    • same-project-gates also needs build. A new step looks for any head result: with none (the head side's build failed) it prints a warning and leaves out its two checks, which would fail on a results directory that does not exist; with some (only the base side's build failed) the checks run on them as always. The verdict is written either way, and --measure-result names the Build jobs when they did not succeed.
    • Every upload-artifact that lacked it gains overwrite: true (the per-shard results, semantic-diff, compare-scorer-diff, timing-bin, measure-timing-shard-*, measure-timing), so a re-run of Compare or of all jobs does not fail at an upload with a 409.
    • timing-merge warns, in the log and under the table, when timing-build's commits differ from the plan's (full SHAs only; a ref that did not resolve, or an empty output, gets a notice). timing-build itself is unchanged.
    • Comments that no longer held are rewritten: the header, the plan job, the binary cache, the Save step, the score-cache restore ("Restored after the Build step, so that no build script of the measured ref ever sees a writable score cache"), the BIM4LCA save rule.
  • docs/maintaining.md: the score-cache "Where it lives" bullet and the build-script sentence, the MCP server bullet, and a new section "Measure builds each side once".

No cache-save rule is relaxed: the rust-cache, binary cache, score cache, BIM4LCA and R2025 save conditions are as they were, except that rust-cache's loses the rest/all shard clause because there is one job per side. The comments now say why the rules stand: a shard still runs the measured ref's binaries and, for a probe, its scorers, with the score cache and model folders writable.

The PR changes only .github/workflows/measure.yml and docs/maintaining.md. Neither is in the same-project gate paths (arm.sh's GATE_PATHS: src/, the two across-saves scorers and their check scripts, same_project_verdict.py, measure-reference-models.sh, fetch-autodesk-samples.sh, autodesk-sample-projects.tsv), so no samples verdict is needed to land it. The merges of main were clean.

Testing

Unit tests are banned; none added. This is workflow YAML and a docs page.

  • tools/check-local.sh passes: N/A, no Rust or tool code changed, and no local builds here (lane rule 2).
  • actionlint .github/workflows/measure.yml: only the known complaint about the uses: $/.github/actions/fetch-corpus form.
  • The Build step's staging, the shard's check, the timing warning and the new Head results step were run locally with shims for cargo and git (no build).
  • The runs below, dispatched with --ref ci/measure-builds-once-per-side on 8096218c (a branch dispatch saves no cache, the C2 rule). Everything after it (overwrite: true on six more uploads, and merges of main) changes behaviour only on a re-run, and no run was repeated for it.

A: run 42093529476 (base=main nordic=true scorers=none; three shards a side; head 8096218c, base main at 5c35e190). Measured:

  • ifc.sha256 is identical between the two sides on all 10 models (Core Interior, Einhoven, the four BIM4LCA office files, the four RE1 models).
  • 6 shards, 2 builds: one Finished line a side. Both sides built cold (binary cache key not found): head 54 s, base 82 s in the Build step, 1.08 and 1.65 job-minutes for the jobs.
  • Artifact: measure-bin-head and measure-bin-base are 13,892,029 bytes each (zipped; rvt-ifc, rvt-gltf, rvt-info, no server or probe in this run). Upload 2 s and 3 s; the download step is 1 to 3 s in each of the 6 shards.
  • The run took 7.9 job-minutes and 4.3 minutes wall-clock; the Build jobs were 2.73 of the 7.9.
  • Modelled, from this run's own step times (no old-workflow run with these inputs exists): in the old layout each shard spent its Install Rust, rust-cache and Build steps, about 58 s on a head shard and 88 s on a base shard, which is 7.3 job-minutes for the six; here the Build jobs and downloads cost 2.9. That saves about 4.4 job-minutes of a modelled 12.3 (36%).
  • Wall-clock rises. All six shards were created at 1.78 minutes, when the slower build (base, 82 s) ended, because a matrix job's needs: build covers both legs: the head shards waited 0.6 minute for the base build. They then waited 12 to 56 s for a runner, so a shard started 0.8 to 1.2 minutes after the head build and 0.2 to 1.0 after the base build, against starting at once and building inside the job. This run's shards were under a minute each, so the hand-off is a large share of it; a run whose shards take 10 minutes or more does not notice it. The old layout's wall-clock for these inputs was not measured.

Projected saving on old-workflow dispatched runs with many shards, from their measured Build steps (each of the two builds taking as long as the average Build step of that run, plus about 0.5 job-minutes for the hand-off). Not measured on this head:

Old run (main) Shards a side Build steps Job-minutes Two builds, projected Saved, projected
42054606416 5 14.1 42.8 2.8 about 10.8 (25%)
42040585454 6 32.9 127.4 5.5 about 26.9 (21%)
42067738690 6 25.6 106.8 4.3 about 20.8 (19%)

B: run 42093534779, the failure path (base=ead78d23, the parent of the commit that added rvt-gltf, models=core-interior samples=true sample_years=2027 scorers=bodies_across_saves). No base can lack a binary and still have the ci profile (rvt-gltf of 2026-04-20 predates it, 2026-08-30), so its Build fails at --profile ci. Run conclusion: failure. Measured:

  • Build base: failure in 0.18 minutes, error: profile 'ci' is not defined. Build head: success.
  • Measure head all: success (1.98 minutes). It exported and hashed Core Interior (the same ifc.sha256 as in A) and the five 2027 samples; bodies_across_saves read SKIPPED, since no 2024 or 2025 save is in the run.
  • Measure base all: failure at Measured binaries after 0.23 minutes, Unable to download artifact(s): Artifact not found for name: measure-bin-base.
  • Compare: skipped, so the run never reads as a pass.
  • Same-project gates: the job ended green, having read the head result, and wrote the check run 127480566389 (read with filter=all): conclusion neutral, title NOT MEASURED: a measure shard ended failure, the Build jobs ended failure, with the three 2027 samples and the Areas SKIPPED.

C: run 42093539067 (base=fadd80b5, the commit before rvt-mcp existed, models=einhoven probe=probe_re343_door_flips), success. Measured:

  • Base: Build base warns the measured ref has no rvt-mcp crate: the MCP server's answers are NOT MEASURED on this side and notes probe_re343_door_flips does not exist at the measured ref: skipped on this side. Its artifact is 12,719,068 bytes (the three binaries). Its Einhoven results hold the exports, info, schema and the space kinds, and no mcp_answers_vs_ifc.txt, no mcp-dump.json and no probe.txt.
  • Head: the artifact is 26,462,348 bytes (the three binaries, rvt-rs-mcp and the probe). Einhoven has mcp_answers_vs_ifc.txt (mcp answers: consistency PASS: every check equal) and probe.txt (8 lines, native records: 2 emitted, 2 graphs complete, 0 unsupported, exit 0).
  • Check run: neutral, NOT MEASURED: samples=true was not set.

The pull-request run on 8096218c, 42093503546, one shard a side: 11.6 job-minutes, 7.8 minutes wall-clock. On 9af280b7 (run 42071807841) it was 12.8 and 6.9. The same event on the old workflow was 10.1 and 6.4 (42069752413) and 9.8 and 6.5 (42069162886). With one shard a side nothing is saved, and the second runner start and the artifact hand-off cost about 1.5 to 2.7 job-minutes.

Audit-honesty checklist

  • Docs reflect the state after this PR; the saving is claimed only where measured (A, the pull-request run) and labelled where modelled or projected.
  • No user-visible change, so no changelog fragment (python3 tools/release/changelog.py check passes).
  • No emojis, private paths or personal addresses.
  • Not a reverse-engineering finding.

Legal and contribution hygiene

  • Apache-2.0; no Autodesk material; no fixtures.

Breaking changes

None for users of the tool. Three behaviours of the workflow change:

  • If a side's build fails, that side's shards fail at the artifact download and the other side's shards still run, as before (B). Compare, which needs every shard, is skipped, the run is red, and the gates' verdict reads NOT MEASURED (or a failure, if a result that arrived fails), never a success. With no head result at all the gates' two checks are left out and the job ends green with the neutral check run.
  • A ref that is not a full SHA (refs/pull/N/head) is checked out as given by the Build job and by every shard. If it moves between them, the shard fails with a message naming both commits, where before shards could silently measure different commits.
  • On a run with few or short shards the critical path is plan, build, shard instead of plan, shard, and the wall-clock rises by the hand-off (A: every shard waited for the slower of the two builds, then 12 to 56 s for a runner; the pull-request run: 7.8 and 6.9 against 6.4 and 6.5). Job-minutes fall once a side has more shards than builds.

Screenshots or output samples

None.

Related issues

Refs #1457

… as an artifact (#1457)

Every shard of a commit installed Rust, restored rust-cache and, all at once
on a commit the binary cache had not seen, built the same binaries: over 36
dispatched runs Build was 150 of 720 job-minutes, and a run of 12 shards built
12 times.

A new job per side (needs: plan) holds the measured checkout, Rust, rust-cache
with today's save-if rule (the shard clause goes), the binary cache key,
restore, the Build step with the MCP server rules and the probes, and Save. It
copies exactly rvt-ifc, rvt-gltf, rvt-info, rvt-rs-mcp when present and
examples/<probe> for each probe that exists at the ref into a clean directory
and uploads it as measure-bin-head or measure-bin-base. Each shard downloads
its side's artifact into measured/target/ci, checks that the commit the
binaries are of is its own checkout's, sets the executable bit and runs no
Rust. A failed build skips the shards; the same-project gates job then leaves
its two checks out and writes NOT MEASURED. Timing warns when timing-build's
commits differ from the plan's.

No cache-save rule is relaxed; their comments say what they are for now.

Refs #1457
… down, and a re-run overwrites its shard results (#1457)

The shards needed the Build jobs to succeed, so a base ref that no longer builds
skipped the head shards, the head results and the gates' verdict. The measure job
now runs after a failed Build job: that side's shards fail at the artifact
download, the other side's run, Compare (which needs every shard) is skipped, and
the verdict reads NOT MEASURED, never a success. The gates job leaves its two checks
out only when no head result exists at all.

The per-shard result upload gains overwrite: true, so a re-run of all jobs does not
fail at the upload.

Refs #1457
…s overwrite on a re-run (#1457)

A re-run of Compare, or of all jobs, uploads the same names again and hit a 409
conflict at these steps, as the per-shard results did before they gained
overwrite: true.

Refs #1457
@DrunkOnJava DrunkOnJava added the ready-when-green Draft whose code is complete: marked ready for review once its fast CI passes label Nov 5, 2026
@DrunkOnJava
DrunkOnJava marked this pull request as ready for review November 5, 2026 20:12
@DrunkOnJava DrunkOnJava removed the ready-when-green Draft whose code is complete: marked ready for review once its fast CI passes label Nov 5, 2026
@DrunkOnJava
DrunkOnJava enabled auto-merge (squash) November 5, 2026 20:22
@DrunkOnJava
DrunkOnJava merged commit f009976 into main Nov 5, 2026
47 checks passed
@DrunkOnJava
DrunkOnJava deleted the ci/measure-builds-once-per-side branch November 5, 2026 20:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant