Run the corpus-sync NIF's three builds on one cargo profile #10

Manually merged
terra merged 1 commit from ceres/9-lint-one-profile into main 2026-11-24 01:26:39 +00:00
Member

Purpose (from macula-services/mcl-rag#9): lint on main finishes inside its own timeout, so a landing on main reads green or red for a reason in the code.

What changed

One file, .github/workflows/lint.yml, in the check job, for native/mcl_rag_corpus_sync_nif only:

  • cargo clippy --all-targets -- -D warnings → cargo clippy --release --all-targets -- -D warnings
  • cargo test --locked → cargo test --release --locked
  • bash scripts/build-corpus-sync-nif.sh unchanged — it already runs cargo build --release

Cargo runs a build script's work once per profile. The crate's dependency tree is mostly C — vendored libgit2 and openssl-src, the 5m38s the issue measured inside the clippy step — so the dev passes compiled it once and the release build compiled it a third time from cold. All three builds now name the release profile the NIF script already builds, so the C is compiled once and the release artefacts the script copies are already in place.

Nothing was added or loosened: no new step, no check removed, timeout-minutes: 15 unchanged, the same clippy flags and the same tests. cargo test --release runs exactly the suite cargo test ran — neither crate has debug_assert!, an overflow-checks setting, #[should_panic] or a timing assertion (grep over native/*/src), so release changes no test's meaning.

The store NIF's three steps are untouched: its build script pins RUSTFLAGS=-C target-cpu=x86-64, a different fingerprint from an unpinned test build, so the same trick there would need that pin moved into the crate first. It is not the issue's measured cost (msi00: 20s clippy + 10s test + 85s build).

Cold timing of the changed steps

msi00, ghcr.io/macula-io/macula-ci-otp:20261120-1240@sha256:39da31…, fresh tree, no target directory, nice -n 10, 8 cores, steps in the workflow's own order:

step before (load avg 1.5 at start, 4 at end) after (load avg 2.6 at start, 13 at end)
clippy corpus 121 s 193 s
test corpus 115 s 23 s
build corpus (NIF script) 132 s 1 s
corpus total 368 s 217 s

The after run carried a much heavier machine load than the before run, which is the whole subject of the issue, so its clippy figure is pessimistic; what both runs show plainly is the two steps that used to recompile the dependency tree now reuse it — cargo test 115 s → 23 s and the NIF script 132 s → 1 s. On the forge's loaded runner, where the issue measured 6m43s clippy and 6m54s test, that is the second C compile and the whole second codegen pass removed.

This PR's own lint run

The proof is the lint-and-test run on this tip: the same workflow, the same 15-minute ceiling. Forge baseline from the issue and the run list: green lint runs 7m35s–8m, run 63 14m26s, run 68 cancelled at 15m01s, and main's tip f8f0d355 (run 81) was cancelled too.

Refs macula-services/mcl-rag#9.

Purpose (from macula-services/mcl-rag#9): lint on main finishes inside its own timeout, so a landing on main reads green or red for a reason in the code. ## What changed One file, `.github/workflows/lint.yml`, in the `check` job, for `native/mcl_rag_corpus_sync_nif` only: - `cargo clippy --all-targets -- -D warnings` → `cargo clippy --release --all-targets -- -D warnings` - `cargo test --locked` → `cargo test --release --locked` - `bash scripts/build-corpus-sync-nif.sh` unchanged — it already runs `cargo build --release` Cargo runs a build script's work once per profile. The crate's dependency tree is mostly C — vendored libgit2 and openssl-src, the 5m38s the issue measured inside the clippy step — so the dev passes compiled it once and the release build compiled it a third time from cold. All three builds now name the release profile the NIF script already builds, so the C is compiled once and the release artefacts the script copies are already in place. Nothing was added or loosened: no new step, no check removed, `timeout-minutes: 15` unchanged, the same clippy flags and the same tests. `cargo test --release` runs exactly the suite `cargo test` ran — neither crate has `debug_assert!`, an `overflow-checks` setting, `#[should_panic]` or a timing assertion (grep over `native/*/src`), so release changes no test's meaning. The store NIF's three steps are untouched: its build script pins `RUSTFLAGS=-C target-cpu=x86-64`, a different fingerprint from an unpinned test build, so the same trick there would need that pin moved into the crate first. It is not the issue's measured cost (msi00: 20s clippy + 10s test + 85s build). ## Cold timing of the changed steps msi00, `ghcr.io/macula-io/macula-ci-otp:20261120-1240@sha256:39da31…`, fresh tree, no target directory, `nice -n 10`, 8 cores, steps in the workflow's own order: | step | before (load avg 1.5 at start, 4 at end) | after (load avg 2.6 at start, 13 at end) | |---|---|---| | clippy corpus | 121 s | 193 s | | test corpus | 115 s | 23 s | | build corpus (NIF script) | 132 s | 1 s | | **corpus total** | **368 s** | **217 s** | The after run carried a much heavier machine load than the before run, which is the whole subject of the issue, so its clippy figure is pessimistic; what both runs show plainly is the two steps that used to recompile the dependency tree now reuse it — `cargo test` 115 s → 23 s and the NIF script 132 s → 1 s. On the forge's loaded runner, where the issue measured 6m43s clippy and 6m54s test, that is the second C compile and the whole second codegen pass removed. ## This PR's own lint run The proof is the `lint-and-test` run on this tip: the same workflow, the same 15-minute ceiling. Forge baseline from the issue and the run list: green lint runs 7m35s–8m, run 63 14m26s, run 68 cancelled at 15m01s, and main's tip `f8f0d355` (run 81) was cancelled too. Refs macula-services/mcl-rag#9.
Run the corpus-sync NIF's three builds on one cargo profile
All checks were successful
c4 model / c4-model-1 (pull_request) Successful in 5s
c4 model / c4-model (pull_request) Successful in 0s
lint-and-test / check (pull_request) Successful in 5m47s
lint-and-test / The tested lock arrives whole (pull_request) Successful in 3s
f18beab438
lint.yml's check job compiled native/mcl_rag_corpus_sync_nif's dependency
tree three times, cold: clippy's dev check pass, the dev test build, and the
release build scripts/build-corpus-sync-nif.sh makes for the NIF itself. Most
of that tree is C -- vendored libgit2 and openssl-src, 5m38s of the clippy
step's 6m43s in the log mcl-rag#9 quotes -- and cargo runs a build script's
work once per profile, so the C was compiled twice and the job overran its
15-minute ceiling (lint runs 68 at 15m01s, and a green run at 14m26s).

clippy and the tests now name the release profile, which the NIF script
already builds, so the C is compiled once and the release artefacts the
script copies are already there. Same tests, same lints, same NIF, same
timeout; no step was added and no gate was loosened.
terra manually merged commit 4a2526f893 into main 2026-11-24 01:26:39 +00:00
Sign in to join this conversation.
No reviewers
No labels
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
macula-services/mcl-rag!10
No description provided.