Skip to content

fix: pin Yarn version from packageManager field in build scripts#10156

Merged
asheshv merged 3 commits into
masterfrom
fix/yarn-version-pin
Jul 16, 2026
Merged

fix: pin Yarn version from packageManager field in build scripts#10156
asheshv merged 3 commits into
masterfrom
fix/yarn-version-pin

Conversation

@asheshv

@asheshv asheshv commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Replace hardcoded yarn set version 4 in pkg/linux/build-functions.sh with a dynamic lookup from each workspace's packageManager field in package.json
  • Sync runtime/package.json Yarn version to 4.15.0 to match web/package.json

Root Cause

CI DEB build (#1708) failed with YN0028yarn install ran with --immutable but the lockfile would have been modified. The build script ran yarn set version 4 which fetched the latest Yarn 4.x release; that newer Yarn recomputes builtin compat patch hashes differently from the version used to generate the committed lockfile.

Fix

YARN_VERSION=$(node -p "require('./package.json').packageManager.split('@')[1]")
yarn set version "${YARN_VERSION}"

Both the web and runtime build blocks now use the version declared in their respective package.json. The build script never needs updating when Yarn is bumped — the single source of truth is packageManager.

Test plan

  • Trigger DEB snapshot build on CI and confirm yarn install passes
  • Confirm RPM/other Linux builds unaffected (same build-functions.sh)

Summary by CodeRabbit

  • Chores

    • Updated the project’s expected Yarn version to 4.15.0 via the runtime package configuration.
    • Desktop runtime and web/server bundling now automatically use the Yarn version declared in the project configuration, with validation to prevent empty version selection.
  • CI

    • CI “Upgrade yarn” steps now derive the Yarn version from the web package configuration instead of using hard-coded Yarn versions, keeping JavaScript checks and test runs consistent.

Replace hardcoded 'yarn set version 4' in build-functions.sh with a
dynamic lookup from each workspace's package.json packageManager field.
Also syncs runtime yarn version to 4.15.0 to match web/package.json.

Fixes CI build failures caused by Yarn 4.x fetching a newer patch that
produces different builtin compat hashes, breaking --immutable lockfile
validation.
@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 1d7a8fd6-3e22-415d-be53-de51c55d56e5

📥 Commits

Reviewing files that changed from the base of the PR and between 1a88a77 and 07eb1de.

📒 Files selected for processing (1)
  • pkg/linux/build-functions.sh
🚧 Files skipped from review as they are similar to previous changes (1)
  • pkg/linux/build-functions.sh

Walkthrough

The runtime now declares Yarn 4.15.0. Linux build steps and JavaScript-related CI workflows derive Yarn versions from package metadata instead of using hard-coded versions.

Changes

Yarn version alignment

Layer / File(s) Summary
Declared Yarn version and build integration
runtime/package.json, pkg/linux/build-functions.sh
The runtime package declares Yarn 4.15.0, while desktop and web/server build steps extract, validate, and apply the declared Yarn version using Node and yarn set version.
CI workflow Yarn integration
.github/workflows/check-javascript-style.yml, .github/workflows/run-feature-tests-epas.yml, .github/workflows/run-feature-tests-pg.yml, .github/workflows/run-javascript-tests.yml
JavaScript style, feature-test, and JavaScript-test workflows derive the Yarn version from web/package.json before continuing their existing tasks.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: deriving Yarn version from packageManager in build scripts.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/yarn-version-pin

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
pkg/linux/build-functions.sh (1)

260-261: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Align the remaining web test workflow with the declared Yarn version.

.github/workflows/run-javascript-tests.yml still runs yarn set version 4 before installing web, so CI can test with a different Yarn version than this packaging path. If version alignment is intended across build and test flows, derive the version from web/package.json there as well.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pkg/linux/build-functions.sh` around lines 260 - 261, Update the web test
workflow’s Yarn setup to derive the version from web/package.json’s
packageManager field, matching the existing YARN_VERSION logic in the packaging
path, instead of hardcoding Yarn 4 before installing web.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@pkg/linux/build-functions.sh`:
- Around line 212-213: Validate YARN_VERSION immediately after extracting it in
the build flow around the packageManager parsing command, ensuring the
packageManager field exists, identifies Yarn, and yields a non-empty valid
version before calling yarn set version. Fail fast with an appropriate error
when validation fails, and apply the same validation to the corresponding second
occurrence.

---

Nitpick comments:
In `@pkg/linux/build-functions.sh`:
- Around line 260-261: Update the web test workflow’s Yarn setup to derive the
version from web/package.json’s packageManager field, matching the existing
YARN_VERSION logic in the packaging path, instead of hardcoding Yarn 4 before
installing web.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: b8d3cfc5-57ee-4aea-92f8-33e3cea82aad

📥 Commits

Reviewing files that changed from the base of the PR and between dfc4ef3 and 8ae478c.

📒 Files selected for processing (2)
  • pkg/linux/build-functions.sh
  • runtime/package.json

Comment thread pkg/linux/build-functions.sh
@asheshv
asheshv merged commit b15c745 into master Jul 16, 2026
51 checks passed
@asheshv
asheshv deleted the fix/yarn-version-pin branch July 16, 2026 06:18
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