fix(build): reduce turbo cache invalidation fanout#2538
fix(build): reduce turbo cache invalidation fanout#2538Yradex merged 5 commits intolynx-family:mainfrom
Conversation
Move shared builds away from repo-scoped //#build dependencies so unrelated website edits stop invalidating unrelated packages. Document the guardrails and verification trail for future Turbo config changes.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (7)
✅ Files skipped from review due to trivial changes (7)
📝 WalkthroughWalkthroughAdds Turbo cache/invalidation guidance; removes repo-scoped Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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. Review rate limit: 7/8 reviews remaining, refill in 7 minutes and 30 seconds.Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b520637b53
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Make web-explorer wait for the root TypeScript outputs it consumes and include rsbuild-plugin config files in the Turbo hash so clean CI jobs and config-only edits cannot reuse stale artifacts.
Add missing rslib-related files to package build inputs so config-only edits cannot replay stale cached artifacts across the remaining Turbo-managed rslib packages.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6fdf5d3032
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Merging this PR will not alter performance
Comparing Footnotes
|
React External#823 Bundle Size — 680.27KiB (-0.02%).6fdf5d3(current) vs caadd3b main#818(baseline) Bundle metrics
Bundle size by type
Bundle analysis report Branch colinaaa:build/turbo-cache-fanou... Project dashboard Generated by RelativeCI Documentation Report issue |
Web Explorer#9281 Bundle Size — 900.02KiB (0%).6fdf5d3(current) vs caadd3b main#9275(baseline) Bundle metrics
Bundle size by type
|
| Current #9281 |
Baseline #9275 |
|
|---|---|---|
495.88KiB |
495.88KiB |
|
401.92KiB |
401.92KiB |
|
2.22KiB |
2.22KiB |
Bundle analysis report Branch colinaaa:build/turbo-cache-fanou... Project dashboard
Generated by RelativeCI Documentation Report issue
React MTF Example#840 Bundle Size — 196.54KiB (-0.02%).6fdf5d3(current) vs caadd3b main#834(baseline) Bundle metrics
Bundle size by type
Bundle analysis report Branch colinaaa:build/turbo-cache-fanou... Project dashboard Generated by RelativeCI Documentation Report issue |
React Example#7708 Bundle Size — 225.38KiB (-0.02%).6fdf5d3(current) vs caadd3b main#7702(baseline) Bundle metrics
Bundle size by type
Bundle analysis report Branch colinaaa:build/turbo-cache-fanou... Project dashboard Generated by RelativeCI Documentation Report issue |
PR #2538 dropped `//#build` from `build.dependsOn`. `//#build` runs `tsc --build`, which produces composite-project `lib/` outputs that several workspace packages declare as their public types (`@lynx-js/rspeedy` → `./lib/index.d.ts`, etc.). `//#build` still runs as part of `pnpm turbo build` (no filter), but now in parallel with package builds. Two packages whose `tsgo` dts generation imports types from `lib/` race against `//#build`: - `@lynx-js/config-rsbuild-plugin` → imports `@lynx-js/rspeedy`, `@lynx-js/template-webpack-plugin` - `@lynx-js/reactlynx-testing-library` → imports `@lynx-js/rspeedy` When the race is lost, builds fail with `TS2307: Cannot find module …`. Add `//#build` to those two packages' own `dependsOn` (rather than the global `build.dependsOn`) so they wait for `tsc --build` without re-introducing the cache fanout #2538 was avoiding. Verified: `find packages -name "*.tsbuildinfo" -delete && find packages -type d -name lib -exec rm -rf {} + && pnpm turbo build --force` succeeds end-to-end (49/49 tasks).
## Summary [#2538](#2538) dropped `//#build` from `build.dependsOn` to reduce cache fanout. `//#build` runs the root `tsc --build`, which produces the composite-project `lib/` outputs that several workspace packages declare as their public types: - `@lynx-js/rspeedy` → `"types": "./lib/index.d.ts"` - `@lynx-js/template-webpack-plugin`, `@lynx-js/web-rsbuild-server-middleware`, etc. `//#build` still runs as part of `pnpm turbo build` (no filter), but now in parallel with package builds. Two packages whose `tsgo` dts generation imports types from those `lib/` outputs race against `//#build`: - `@lynx-js/config-rsbuild-plugin` (imports `@lynx-js/rspeedy`, `@lynx-js/template-webpack-plugin` in `LynxConfigWebpackPlugin.ts` / `pluginLynxConfig.ts`) - `@lynx-js/reactlynx-testing-library` (imports `@lynx-js/rspeedy` in `rstest-config.ts`) When the race is lost, those builds fail with `TS2307: Cannot find module …`. This was hit on PR #2543 ([build / Build (Ubuntu)](https://github.com/lynx-family/lynx-stack/actions/runs/25103126514/job/73557596812) — same failure on Windows). ## Fix Add `//#build` to the `dependsOn` of just the two affected packages (not to the global `build.dependsOn`) so they wait for `tsc --build` without re-introducing the cache fanout #2538 was avoiding. ## Test plan - [x] ```bash find packages -name "*.tsbuildinfo" -delete find packages -type d -name lib -exec rm -rf {} + pnpm turbo build --force ``` succeeds end-to-end (49/49 tasks). On `main` (without this fix) the same command fails on `@lynx-js/config-rsbuild-plugin#build` and `@lynx-js/reactlynx-testing-library#build`. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Resolved TypeScript type resolution failures in clean CI/build environments. * **Chores** * Ensured root composite build runs before package builds to enforce correct build ordering and artifact availability. * Added build configuration for a new extractor package and updated package build dependencies. * **Documentation** * Clarified maintenance guidance for produced/generated build artifacts and cache outputs. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
Summary
globalDependenciesand trim redundant//#buildedges so unrelated edits stop fanning out across the build graph@lynx-js/web-explorer#builddepend on//#build, and hash the web plugin config so clean CI jobs do not consume missing or stale workspace artifactsrslib.config.tsinputs across Turbo-managed rslib packages, plus referenced helper files such asloaders/**andtsconfig.build.json, so config-only edits cannot replay stale cached outputsTest Plan
NODE_OPTIONS=\"--max-old-space-size=32768\" pnpm turbo build --summarize --output-logs=noneNODE_OPTIONS=\"--max-old-space-size=32768\" pnpm turbo build --filter=@lynx-js/gesture-runtime --force --summarize --output-logs=noneNODE_OPTIONS=\"--max-old-space-size=32768\" pnpm turbo build --filter=@lynx-js/gesture-runtime --summarize --output-logs=noneNODE_OPTIONS=\"--max-old-space-size=32768\" pnpm turbo build --filter=@lynx-js/motion --force --summarize --output-logs=noneNODE_OPTIONS=\"--max-old-space-size=32768\" pnpm turbo build --filter=@lynx-js/motion --summarize --output-logs=nonepnpm turbo build --filter @lynx-js/web-platform-rsbuild-plugin --summarizepnpm turbo build --filter @lynx-js/web-platform-rsbuild-plugin --dry=jsonpnpm turbo build --filter @lynx-js/web-explorer --force --summarizeafter removingdist/and*.tsbuildinfoforweb-core,web-elements,web-worker-rpc, andweb-explorerrslib.config.tsnow covers that config file inbuild.inputs, with extra helper files included whererslib.config.tsreaches outsidesrc/**Summary by CodeRabbit
Documentation
Chores