Skip to content

build: pass --locked to cargo for vendored Rust deps#29095

Merged
alii merged 7 commits intomainfrom
claude/cargo-locked
Apr 10, 2026
Merged

build: pass --locked to cargo for vendored Rust deps#29095
alii merged 7 commits intomainfrom
claude/cargo-locked

Conversation

@ant-kurt
Copy link
Copy Markdown
Collaborator

@ant-kurt ant-kurt commented Apr 9, 2026

Pass --locked to cargo build in emitCargo() so transitive Rust crate versions can't silently re-resolve against crates.io.

Bumps LOLHTML_COMMIT one commit forward (e3aa54777127cd) because the old pin's c-api/Cargo.lock was stale (upstream forgot to regenerate it for 2.7.2). The new pin is the upstream lockfile fix; only c-api/Cargo.lock differs between the two — same lol-html 2.7.2 source.

emitCargo() now passes --locked so cargo refuses to re-resolve transitive
crates if the dep's shipped Cargo.lock is missing or out of sync with its
Cargo.toml. lolhtml (the only cargo dep today) ships c-api/Cargo.lock in its
tarball, so this is a no-op for the current pin — it just turns silent
re-resolution (e.g. on a yanked crate) into a build error, keeping the set
of crates linked into liblolhtml.a deterministic across builds.

:house: Remote-Dev: homespace
@robobun
Copy link
Copy Markdown
Collaborator

robobun commented Apr 9, 2026

Updated 10:49 AM PT - Apr 10th, 2026

@ant-kurt, your commit 2c9ef58 has 5 failures in Build #44809 (All Failures):


🧪   To try this PR locally:

bunx bun-pr 29095

That installs a local version of the PR into your bun-29095 executable, so you can run:

bun-29095 --bun

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 9, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 94f33ec0-ac36-409d-b6cb-900d92292f1f

📥 Commits

Reviewing files that changed from the base of the PR and between 9ebc0cd and 2c9ef58.

📒 Files selected for processing (1)
  • test/js/node/process/process.test.js

Walkthrough

Whitespace/formatting change in scripts/build/config.ts; emitCargo() in scripts/build/source.ts adds --locked to cargo invocations; scripts/build/deps/lolhtml.ts updates the LOLHTML_COMMIT value to a different commit hash; corresponding test expectation updated in test/js/node/process/process.test.js.

Changes

Cohort / File(s) Summary
Config formatting
scripts/build/config.ts
Moved the features.push(...) call that builds the zig-commit feature string onto its own line; no logic or behavior changed.
Cargo invocation
scripts/build/source.ts
emitCargo() now includes --locked in the cargo arguments (["--locked", "--target-dir", targetDir]), so cargo will refuse to update the lockfile.
Dependency pin & test
scripts/build/deps/lolhtml.ts, test/js/node/process/process.test.js
Updated LOLHTML_COMMIT from e3aa54798602dd27250fafde1b5a66f080046252 to 77127cd2b8545998756e8d64e36ee2313c4bb312 and adjusted the test expectation for process.versions.lolhtml to match the new commit hash.
🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The PR title clearly and concisely describes the main change: adding --locked flag to cargo builds for vendored Rust dependencies.
Description check ✅ Passed The PR description covers both required template sections: what the PR does (passing --locked to cargo, bumping LOLHTML_COMMIT) and verification performed (TypeScript compilation, cargo metadata testing, diff confirmation).

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@claude claude Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM — simple, well-reasoned one-liner that improves build reproducibility.

Extended reasoning...

Overview

Single-file change to scripts/build/source.ts: adds --locked to the cargo build args array in emitCargo(), plus a JSDoc comment on CargoBuild formalizing the contract that the dep's tarball must ship a Cargo.lock.

Security risks

None. This is a build-script change that makes dependency resolution more deterministic. It reduces supply-chain risk (prevents silent re-resolution against crates.io when crates are yanked) rather than introducing any.

Level of scrutiny

Low. The change is a single element prepended to an args array in a build orchestration script. The --locked flag is a standard cargo practice for reproducible builds. lolhtml (the only cargo dep) already ships c-api/Cargo.lock at the pinned commit, so CI should confirm this is a no-op today.

Other factors

No bugs found. No existing reviewer comments outstanding. The PR description is thorough and the author verified the upstream lockfile exists. CI is running (#44796).

Copy link
Copy Markdown
Contributor

@claude claude Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM — adding --locked to cargo is the right call for reproducible builds, and the only cargo dep (lolhtml) already ships c-api/Cargo.lock.

Extended reasoning...

Overview

The PR touches two build script files: a cosmetic line-break reformat in config.ts and a one-line functional change in source.ts (inserting "--locked" into the cargo args array in emitCargo()), plus a new JSDoc block on the CargoBuild interface.

Security Risks

None. This is a build-script hardening change that restricts what cargo is allowed to resolve — it's additive safety, not a relaxation of any constraint.

Level of Scrutiny

Low. The functional diff is a single string prepended to an args array. The logic is: without --locked, a yanked crate or drifted lockfile silently re-resolves against crates.io; with --locked, that fails loudly. This is standard practice for vendored Rust deps and is well-documented in the PR description.

Other Factors

  • The only bug found is a documentation nit: the JSDoc says "Cargo.lock in manifestDir" when it should say manifestDir must be the workspace root. This is already noted as an inline comment and is genuinely minor — the current code is correct for lolhtml, and any violation fails at build time with a clear cargo error.
  • CI failures visible in the timeline are on unrelated files (scripts/build/ci.ts, vendor/libuv/src/unix/udp.c) and appear to be pre-existing platform issues, not caused by this change.
  • CodeRabbit found no actionable comments.

Comment thread scripts/build/source.ts Outdated
ant-kurt added 4 commits April 9, 2026 23:14
The 2.7.2 release commit (e3aa547) shipped a c-api/Cargo.lock that still
pinned lol_html at 2.7.1, so cargo build --locked rejects it. 77127cd is
the immediately-following upstream commit that regenerated the lockfile
(only c-api/Cargo.lock changes between the two). Same lol-html source,
now passes --locked.

:house: Remote-Dev: homespace
🏠 Remote-Dev: homespace
🏠 Remote-Dev: homespace
Copy link
Copy Markdown
Contributor

@claude claude Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM — my previous JSDoc nit was addressed by dropping the comments.

Extended reasoning...

Overview

Three files touched: cosmetic line-break in config.ts, commit hash bump in lolhtml.ts, and --locked added to cargo args in source.ts.

Security risks

None. This is a build-hardening change that makes dependency resolution more deterministic, not less.

Level of scrutiny

Low. The core functional change is a single flag addition to a well-understood cargo invocation. The lolhtml bump is a no-op semantically (same lol-html 2.7.2 source, only c-api/Cargo.lock regenerated upstream). My earlier concern about imprecise JSDoc was addressed by removing the comments outright.

Other factors

No bugs found by the automated system. Previous inline comment resolved. Straightforward build-system hardening.

Copy link
Copy Markdown
Contributor

@claude claude Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM — the JSDoc concern from my previous review was addressed by removing the imprecise comment, the CI failures are fixed, and the changes are correct.

Extended reasoning...

Overview

The PR adds --locked to cargo build invocations in emitCargo() (scripts/build/source.ts) to prevent silent re-resolution of transitive Rust crates. It bumps LOLHTML_COMMIT from e3aa547 to 77127cd because the old pin had a stale c-api/Cargo.lock (upstream omitted it for 2.7.2); the new pin is the upstream fix commit with only the lockfile regenerated. The process.versions test is updated to match the new hash, and there is one trivial whitespace formatting change in config.ts.

Security risks

None. This is a build-system change that makes dependency resolution stricter (fail-fast if lockfile would change), which is a security improvement, not a regression.

Level of scrutiny

Low. The change is mechanical: one flag added, one commit hash bumped, one test hash updated. The logic is straightforward and self-consistent. The only concern from my prior review (a slightly imprecise JSDoc comment about where Cargo.lock must live) was resolved by removing that comment entirely in commit 9ff2d8f.

Other factors

My prior inline comment is marked resolved. The CI failures were caused by the test hash not being updated alongside the commit bump; that was fixed in commit 2c9ef58. No outstanding reviewer comments remain unaddressed.

@alii alii merged commit f0c014a into main Apr 10, 2026
60 of 65 checks passed
@alii alii deleted the claude/cargo-locked branch April 10, 2026 17:19
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.

3 participants