Skip to content

build: Migrate Yarn from Berry v3.6.4 to v4.17.0#6417

Draft
antonis wants to merge 1 commit into
mainfrom
chore/migrate-yarn-v4
Draft

build: Migrate Yarn from Berry v3.6.4 to v4.17.0#6417
antonis wants to merge 1 commit into
mainfrom
chore/migrate-yarn-v4

Conversation

@antonis

@antonis antonis commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

📢 Type of change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring

📜 Description

Migrates the repo's package manager from Yarn Berry v3.6.4 to v4.17.0 (corepack-managed via the packageManager field).

Changes (3 files):

  • package.jsonpackageManageryarn@4.17.0, plus one resolutions pin: "downlevel-dts@npm:0.11.0/typescript": "5.9.3".
  • .yarnrc.yml — one added line: enableScripts: true.
  • yarn.lock — expected v4 format bump (#~builtin#optional!builtin, new checksum format). Large but fully mechanical — no dependency version changes.

Why not just bump v3 → 3.8.6 (the last v3 release)?

It doesn't work in this repo. Yarn bundles @yarnpkg/plugin-compat, which auto-applies a line-based patch to typescript (for PnP support). 3.8.6's bundled patch fails to apply to the modern TypeScript versions our workspaces use — packages/core (~5.9.3), samples/react-native (5.8.3), samples/expo (~6.0.3) — with Cannot apply hunk #22 (berry#6189, #3722). The only 3.8.6 fix would be downgrading TypeScript repo-wide — a non-starter. v4 ships an up-to-date patch that applies cleanly. (Ironically we're on nodeLinker: node-modules, so the patch is unnecessary here anyway — but yarn applies it regardless, berry#3275.)

The downlevel-dts resolution

downlevel-dts@0.11.0 (our TS-3.8 .d.ts generator) depends on typescript@npm:next, which the lockfile froze to a nightly (5.7.0-dev.20240829). No compat patch — v3 or v4 — can patch a nightly build (ENOENT ... _tsc.js). Pinning it to stable 5.9.3 resolves it.

The enableScripts: true line

Yarn 4 flipped the default for enableScripts from truefalse (supply-chain hardening). Without this line, dependency build scripts are silently disabled (YN0004 for geckodriver, nx, pmd-bin, sharp). Adding it preserves the prior v3 behavior. All other settings yarn auto-wrote (compressionLevel, enableGlobalCache, approvedGitRepositories, npmMinimalAgeGate: 0) were intentionally dropped — they either matched a v4 default or would have loosened security (npmMinimalAgeGate: 0 opts out of the new 1-day publish cooldown; dropping it restores the safe default).

💡 Motivation and Context

Yarn Berry v3 is end-of-life — the last release (3.8.6) shipped in 2024 and receives no further updates. Moving to v4 keeps us on a supported line.

No consumer impact — this is dev-tooling only. The published @sentry/react-native package (from packages/core) carries no packageManager field or yarn config; packageManager, yarn.lock, and .yarnrc.yml all live at the repo root and are never part of the npm tarball. CI is already corepack-driven, so it picks up the new version automatically.

Closes #6411

💚 How did you test it?

Locally on yarn 4.17.0:

  • yarn install — clean
  • yarn build — ✓ (incl. the downlevel-dts TS-3.8 path + native replay-stubs)
  • yarn test — ✓ 2003 tests (1668 core + 334 e2e + 1 sample)
  • yarn circularDepCheck — ✓ none found
  • yarn api-report:check (in packages/core) — ✓ up to date
  • yarn lint:lerna — ✓ 0 errors
  • Confirmed enableScripts: true clears all YN0004 script-disabled warnings.

📝 Checklist

  • I added tests to verify changes.
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled.
  • I updated the docs if needed.
  • I updated the wizard if needed.
  • All tests passing.
  • Public API changes reviewed by another Mobile SDK team member or implemented according to the develop docs spec.
  • No breaking changes.

🔮 Next steps

  • CI runs Node 18 (unpinned minor); yarn 4 requires Node ≥ 18.12. Worth pinning the CI Node version to be safe — can be a follow-up.
  • Optionally adopt a stricter npmMinimalAgeGate (e.g. 4320 = 3 days) as a team security-policy decision; currently inherits the 1-day default.

Yarn Berry v3 is end-of-life (last release 3.8.6, 2024). Bumping to the
intermediate 3.8.6 is not viable: its bundled compat/typescript patch
fails to apply to the modern TypeScript versions used across the
workspaces (Cannot apply hunk). Yarn 4 ships an up-to-date patch that
applies cleanly, so v4 is the working path.

- Bump packageManager to yarn@4.17.0 (corepack-managed)
- Pin downlevel-dts's TypeScript to a stable 5.9.3 via resolutions;
  its typescript@npm:next dependency froze to a nightly build that no
  yarn compat patch (v3 or v4) can patch
- Add enableScripts: true to .yarnrc.yml to preserve prior behavior;
  yarn 4 flipped this default to false, which would otherwise disable
  dependency build scripts (geckodriver, nx, pmd-bin, sharp)

Dev-tooling only: the published @sentry/react-native package carries no
yarn config, so there is no consumer impact.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Semver Impact of This PR

None (no version bump detected)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


  • build: Migrate Yarn from Berry v3.6.4 to v4.17.0 by antonis in #6417
  • fix(deps): Bump js-yaml to 3.15.0 by antonis in #6414
  • feat(ios): Consume sentry-cocoa as a prebuilt xcframework by default by alwx in #6413
  • feat(tracing): Add extend app start API for standalone app start by antonis in #6392
  • fix(ios): Skip source maps upload on Debug builds by antonis in #6405
  • fix(ci): Bump codeql-action/init to v4.36.3 to match analyze/autobuild by antonis in #6410
  • Revert "feat(ios): Default to consuming sentry-cocoa as an xcframework" (feat(ios): Default to consuming sentry-cocoa as an xcframework #6381) by alwx in #6412

🤖 This preview updates automatically when you update the PR.

@antonis antonis added ready-to-merge Triggers the full CI test suite skip-changelog labels Jul 7, 2026
@antonis

antonis commented Jul 7, 2026

Copy link
Copy Markdown
Contributor Author

@sentry review

@antonis

antonis commented Jul 7, 2026

Copy link
Copy Markdown
Contributor Author

@cursor review

@cursor cursor 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.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 2d592d8. Configure here.

@antonis antonis force-pushed the chore/migrate-yarn-v4 branch from 29bb869 to 2d592d8 Compare July 7, 2026 15:09
@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

iOS (legacy) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 3839.00 ms 1217.71 ms -2621.29 ms
Size 4.98 MiB 6.47 MiB 1.49 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
580fb5c+dirty 3836.13 ms 1218.72 ms -2617.41 ms
d0e3b3e+dirty 3854.77 ms 1218.58 ms -2636.19 ms
37a2091+dirty 3821.77 ms 1212.34 ms -2609.43 ms
5789645+dirty 3841.18 ms 1220.67 ms -2620.52 ms
4e0ba9c+dirty 3839.22 ms 1221.06 ms -2618.16 ms
822d35b+dirty 3830.64 ms 1209.20 ms -2621.44 ms
0b5a379+dirty 3828.91 ms 1214.12 ms -2614.79 ms
68672fc+dirty 3841.58 ms 1228.89 ms -2612.69 ms
2c735cc+dirty 1229.67 ms 1221.50 ms -8.17 ms
7ff4d0f+dirty 3838.29 ms 1225.13 ms -2613.16 ms

App size

Revision Plain With Sentry Diff
580fb5c+dirty 4.98 MiB 6.46 MiB 1.48 MiB
d0e3b3e+dirty 4.98 MiB 6.51 MiB 1.53 MiB
37a2091+dirty 5.15 MiB 6.70 MiB 1.54 MiB
5789645+dirty 4.98 MiB 6.50 MiB 1.52 MiB
4e0ba9c+dirty 5.15 MiB 6.67 MiB 1.51 MiB
822d35b+dirty 4.98 MiB 6.50 MiB 1.53 MiB
0b5a379+dirty 5.15 MiB 6.70 MiB 1.54 MiB
68672fc+dirty 5.15 MiB 6.71 MiB 1.55 MiB
2c735cc+dirty 3.38 MiB 4.74 MiB 1.35 MiB
7ff4d0f+dirty 5.15 MiB 6.70 MiB 1.55 MiB

@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Android (legacy) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 420.06 ms 470.18 ms 50.12 ms
Size 49.74 MiB 55.09 MiB 5.35 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
1122a96+dirty 422.22 ms 464.33 ms 42.10 ms
1a5721e+dirty 424.07 ms 482.32 ms 58.25 ms
5c1e987+dirty 423.52 ms 471.64 ms 48.12 ms
b04af96+dirty 496.48 ms 557.88 ms 61.40 ms
e763471+dirty 426.57 ms 458.21 ms 31.64 ms
20fbd51+dirty 487.89 ms 535.60 ms 47.71 ms
a5d243c+dirty 424.52 ms 485.18 ms 60.66 ms
5257d80+dirty 423.37 ms 467.54 ms 44.17 ms
ab203f9+dirty 447.04 ms 507.43 ms 60.38 ms
f9c1ed4+dirty 431.00 ms 466.22 ms 35.22 ms

App size

Revision Plain With Sentry Diff
1122a96+dirty 48.30 MiB 53.54 MiB 5.24 MiB
1a5721e+dirty 49.74 MiB 55.09 MiB 5.34 MiB
5c1e987+dirty 43.75 MiB 48.08 MiB 4.33 MiB
b04af96+dirty 49.74 MiB 55.00 MiB 5.26 MiB
e763471+dirty 49.74 MiB 54.85 MiB 5.11 MiB
20fbd51+dirty 49.74 MiB 54.81 MiB 5.07 MiB
a5d243c+dirty 48.30 MiB 53.54 MiB 5.23 MiB
5257d80+dirty 48.30 MiB 53.58 MiB 5.28 MiB
ab203f9+dirty 49.74 MiB 54.85 MiB 5.11 MiB
f9c1ed4+dirty 49.74 MiB 54.86 MiB 5.12 MiB

@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

iOS (new) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 3839.07 ms 1216.79 ms -2622.28 ms
Size 4.98 MiB 6.47 MiB 1.49 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
0b1b5e3+dirty 3820.72 ms 1207.94 ms -2612.78 ms
d0e3b3e+dirty 3846.64 ms 1226.27 ms -2620.38 ms
0d9949d+dirty 1203.94 ms 1202.27 ms -1.67 ms
5789645+dirty 3841.36 ms 1214.81 ms -2626.55 ms
acd838e+dirty 3835.94 ms 1215.87 ms -2620.07 ms
822d35b+dirty 3841.52 ms 1221.75 ms -2619.77 ms
267d3ed+dirty 3860.14 ms 1223.39 ms -2636.76 ms
f9c1ed4+dirty 3842.09 ms 1220.70 ms -2621.40 ms
8929511+dirty 1223.41 ms 1222.49 ms -0.92 ms
9b5615c+dirty 3837.21 ms 1215.33 ms -2621.89 ms

App size

Revision Plain With Sentry Diff
0b1b5e3+dirty 5.15 MiB 6.70 MiB 1.54 MiB
d0e3b3e+dirty 4.98 MiB 6.51 MiB 1.53 MiB
0d9949d+dirty 3.38 MiB 4.76 MiB 1.38 MiB
5789645+dirty 4.98 MiB 6.50 MiB 1.52 MiB
acd838e+dirty 5.15 MiB 6.70 MiB 1.55 MiB
822d35b+dirty 4.98 MiB 6.50 MiB 1.53 MiB
267d3ed+dirty 5.15 MiB 6.69 MiB 1.54 MiB
f9c1ed4+dirty 4.98 MiB 6.50 MiB 1.53 MiB
8929511+dirty 3.38 MiB 4.80 MiB 1.42 MiB
9b5615c+dirty 4.98 MiB 6.51 MiB 1.53 MiB

@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Android (new) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 517.68 ms 543.00 ms 25.32 ms
Size 49.74 MiB 55.09 MiB 5.35 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
1a5721e+dirty 433.44 ms 462.80 ms 29.36 ms
3a829f0+dirty 410.78 ms 454.22 ms 43.44 ms
37a2091+dirty 429.71 ms 477.00 ms 47.29 ms
4966363+dirty 415.67 ms 448.60 ms 32.93 ms
15d4514+dirty 413.63 ms 449.62 ms 35.99 ms
04207c4+dirty 395.40 ms 456.55 ms 61.15 ms
7ac3378+dirty 410.67 ms 442.60 ms 31.92 ms
bc0d8cf+dirty 407.66 ms 461.35 ms 53.69 ms
e763471+dirty 538.31 ms 574.44 ms 36.13 ms
5b7e8a7+dirty 601.58 ms 634.98 ms 33.40 ms

App size

Revision Plain With Sentry Diff
1a5721e+dirty 49.74 MiB 55.09 MiB 5.34 MiB
3a829f0+dirty 48.30 MiB 53.58 MiB 5.28 MiB
37a2091+dirty 48.30 MiB 53.58 MiB 5.28 MiB
4966363+dirty 48.30 MiB 53.54 MiB 5.24 MiB
15d4514+dirty 48.30 MiB 53.60 MiB 5.30 MiB
04207c4+dirty 43.94 MiB 48.98 MiB 5.04 MiB
7ac3378+dirty 43.94 MiB 48.99 MiB 5.05 MiB
bc0d8cf+dirty 48.30 MiB 53.48 MiB 5.18 MiB
e763471+dirty 49.74 MiB 54.85 MiB 5.11 MiB
5b7e8a7+dirty 48.30 MiB 53.58 MiB 5.28 MiB

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-to-merge Triggers the full CI test suite skip-changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Migrate Yarn from Berry v3 to v4

1 participant