build: Migrate Yarn from Berry v3.6.4 to v4.17.0#6417
Draft
antonis wants to merge 1 commit into
Draft
Conversation
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>
Contributor
Semver Impact of This PR⚪ None (no version bump detected) 📋 Changelog PreviewThis is how your changes will appear in the changelog.
🤖 This preview updates automatically when you update the PR. |
Contributor
Author
|
@sentry review |
Contributor
Author
|
@cursor review |
There was a problem hiding this comment.
✅ 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.
29bb869 to
2d592d8
Compare
Contributor
iOS (legacy) Performance metrics 🚀
|
| 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 |
Contributor
Android (legacy) Performance metrics 🚀
|
| 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 |
Contributor
iOS (new) Performance metrics 🚀
|
| 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 |
Contributor
Android (new) Performance metrics 🚀
|
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📢 Type of change
📜 Description
Migrates the repo's package manager from Yarn Berry v3.6.4 to v4.17.0 (corepack-managed via the
packageManagerfield).Changes (3 files):
package.json—packageManager→yarn@4.17.0, plus oneresolutionspin:"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 totypescript(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) — withCannot 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 onnodeLinker: node-modules, so the patch is unnecessary here anyway — but yarn applies it regardless, berry#3275.)The
downlevel-dtsresolutiondownlevel-dts@0.11.0(our TS-3.8.d.tsgenerator) depends ontypescript@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 stable5.9.3resolves it.The
enableScripts: truelineYarn 4 flipped the default for
enableScriptsfromtrue→false(supply-chain hardening). Without this line, dependency build scripts are silently disabled (YN0004forgeckodriver,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: 0opts 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-nativepackage (frompackages/core) carries nopackageManagerfield or yarn config;packageManager,yarn.lock, and.yarnrc.ymlall 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— cleanyarn build— ✓ (incl. thedownlevel-dtsTS-3.8 path + native replay-stubs)yarn test— ✓ 2003 tests (1668 core + 334 e2e + 1 sample)yarn circularDepCheck— ✓ none foundyarn api-report:check(inpackages/core) — ✓ up to dateyarn lint:lerna— ✓ 0 errorsenableScripts: trueclears allYN0004script-disabled warnings.📝 Checklist
sendDefaultPIIis enabled.🔮 Next steps
npmMinimalAgeGate(e.g.4320= 3 days) as a team security-policy decision; currently inherits the 1-day default.