Repository navigation
perf(release): build the NAPI addon on its own runners - #14138
Conversation
The Rust release built the CLI binary and the NAPI addon back to back in one matrix leg per target. The two are compiled under different Cargo profiles — `release` for the CLI, `napi-release` for the addon, which must keep `panic = "unwind"` so a panic reaching the FFI boundary becomes a JS exception instead of aborting the host node process. Different profile means a different target directory, so the two builds shared not one compiled dependency: every leg paid for the whole graph twice, in series. Split the addon into its own `build-rust-napi` matrix over the same eight targets. Measured on the 12.0.0-rc.9 release run, per-leg build time was: target CLI addon leg win32-arm64 508s 369s 17m09s win32-x64 495s 363s 15m06s darwin-arm64 477s 241s 12m30s darwin-x64 461s 235s 12m10s linux-* 322-351s 217-238s ~10m The stage is bounded by its slowest leg, so dropping the addon out of win32-arm64 takes the critical path from ~17 to ~11 minutes and the whole release run from ~25m30s to roughly 19 minutes. The addon legs run alongside and gate nothing. Downstream needs no changes: the new job uploads to `binaries-rust-napi-<code-target>`, which the `binaries-rust-*` download pattern the verify, publish and draft-release jobs already use picks up and merges into the same directory. It is also free of the node-gyp payload dependency, since only the CLI archives ship `dist/`. The toolchain prelude the two jobs share — installing cross, the clang-cl/ARM64 Visual Studio components, the rustup target, and the guard that the committed PNPM_VERSION matches the tag — moves into a `rust-release-target` composite action rather than being duplicated. zizmor flags that action's writes to GITHUB_ENV/GITHUB_PATH because a composite action cannot see who calls it; the values come from the Visual Studio install and `vcvarsall`, and the only caller is a release job running on a maintainer-signed tag, so the audit is suppressed on that step with that justification.
PR Summary by QodoSplit Rust release to build NAPI addon on separate runners
AI Description
Diagram
High-Level Assessment
Files changed (2)
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughThe release workflow adds a shared Rust target action, separates CLI and NAPI builds into parallel matrix jobs, uploads target-specific NAPI addons, and makes verification, publishing, and GitHub release jobs wait for addon builds. ChangesRust release pipeline
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: ⚪ Minimal · up to This PR reorganizes release builds and shared setup without any identified merge-blocking correctness, security, availability, or deployment risk; no actionable merge-blocking risk remains beyond normal checks and review. Sequence Diagram(s)sequenceDiagram
participant ReleaseWorkflow
participant RustReleaseTarget
participant CLIBuild
participant NAPIBuild
participant ReleaseJobs
ReleaseWorkflow->>RustReleaseTarget: Prepare target and validate version
RustReleaseTarget->>CLIBuild: Configure Rust CLI build
RustReleaseTarget->>NAPIBuild: Configure NAPI addon build
CLIBuild->>ReleaseJobs: Upload CLI archives
NAPIBuild->>ReleaseJobs: Attest and upload target-specific addons
ReleaseJobs->>ReleaseJobs: Verify, publish, and create GitHub release
Suggested labels: Suggested reviewers: ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains. Reviews (2): Last reviewed commit: "fix(release): wait on the Visual Studio ..." | Re-trigger Greptile |
Code Review by Qodo
1.
|
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |
Review follow-ups on the NAPI build split. `setup.exe modify` returned as soon as it had handed the work off, so the exit code checked right after it reported the launch rather than the install, and the polling loop below was the only thing standing between a half-installed toolchain and a release build. Pass `--wait` so the exit code means something, and accept 3010 alongside 0 — that is the installer's "succeeded, wants a reboot", which is exactly what `--norestart` asks for and does not stop the components from being used. The polling loop stays: the installer spawns work in processes it does not always account for. The split doubles how often this runs per release, once for each Windows ARM64 leg, so it is worth hardening now. Upload the addon by its exact filename instead of a `*.node` glob, so the artifact carries the one file the attestation step names and nothing else that happens to be sitting in the workspace root. Drop the before-and-after timings from the comment on the build jobs; the measurements belong in the commit message and the current rationale reads on its own.
Dismissed because a newer commit was pushed; Greptile will re-review the current head.
|
Thanks — three of the four findings are addressed in fd5d0d0, and one I'm pushing back on. 1. VS installer race risk — fixed. Replied on the thread. 2. Historical build comment — fixed. Fair call against the repo's comment convention. The comment now states why the two matrices are separate (distinct Cargo profiles, so separate target directories, so nothing shared) without the before-and-after timings. Those live in the commit message and the PR description. 4. Overbroad 3. Unsafe That is also why the Verified after the changes: Written by an agent (Claude Code, claude-opus-5). |
|
Code review by qodo was updated up to the latest commit fd5d0d0 |
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |
…staller call (#14144) The 12.0.0-rc.11 release failed on both win32-arm64 legs with "clang-cl was not installed under ...\VC\Tools\Llvm", five minutes after the Visual Studio installer was asked to add the LLVM and ARM64 components. `--wait` had been added to that `setup.exe modify` call. Microsoft documents it as bootstrapper-only: "The --wait parameter can only be passed into the bootstrapper; the installer (setup.exe) doesn't support it." We invoke the installer at `C:\Program Files (x86)\Microsoft Visual Studio\Installer\setup.exe`, so it rejected the command line and installed nothing. The logs show the call returning in under a second and no installer process alive for the whole polling window. The exit-code check could not catch that. `setup.exe` is a GUI-subsystem binary, so PowerShell's call operator does not wait for it and never sets $LASTEXITCODE from it — the value tested was still vswhere's. Check vswhere's own result instead, where the variable actually means something, and leave the poll loop as the sole confirmation that the components landed, which is what it was written for. Regressed in #14138; the split into separate CLI and NAPI matrices is unaffected, it only doubled the number of legs running the step.
Summary
The Rust release built the CLI binary and the NAPI addon back to back in one matrix leg per target. The two are compiled under different Cargo profiles —
releasefor the CLI,napi-releasefor the addon (which must keeppanic = "unwind") — so Cargo gives them separate target directories and they share not one compiled dependency. Every leg paid for the whole dependency graph twice, in series.This splits the addon into its own
build-rust-napimatrix over the same eight targets. Per-leg build time measured on thev12.0.0-rc.9release run:The stage is bounded by its slowest leg, so taking the addon out of
win32-arm64moves the critical path from ~17 to ~11 minutes, and the whole release run from ~25m30s to roughly 19 minutes. The addon legs run alongside and gate nothing.Nothing downstream needed changing: the new job uploads to
binaries-rust-napi-<code-target>, which thebinaries-rust-*download pattern that the verify, publish and draft-release jobs already use picks up and merges into the same directory. It also drops thebuild-node-gyp-payloaddependency, since only the CLI archives shipdist/.The toolchain prelude the two jobs share — installing
cross, the clang-cl/ARM64 Visual Studio components, the rustup target, and the guard that the committedPNPM_VERSIONmatches the tag — moves into arust-release-targetcomposite action instead of being duplicated.One thing worth a reviewer's eye: zizmor reports
github-env(high) against that composite action's writes toGITHUB_ENV/GITHUB_PATH. It is a false positive of the move — the same script inrelease.ymlwas not flagged, because there zizmor can see the workflow only triggers on tag pushes, whereas a composite action cannot see who calls it. The values come from the Visual Studio installation the step just made and fromvcvarsall, and the only caller is a release job running on a maintainer-signed tag. It is suppressed on that step with that justification. Verified withzizmor 1.29.0:.github/workflows/release.ymland the new action both report no findings.Not verifiable end to end before merge — the workflow only runs on a version tag. The YAML and job graph were validated locally; the first release after this lands is the real test, and a failure is resumable by rerunning the tag (the
planjob skips what is already published).Squash Commit Body
Checklist
pnpm/port, or the description notes what still needs porting.pnpm changeset) if this PR changes any publishedpackage. Keep it short and written for pnpm users — it becomes a release note.
Written by an agent (Claude Code, claude-opus-5).
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Summary by CodeRabbit
New Features
Improvements