fix(start-plugin-core): sort server fn manifest entries for deterministic build output#7287
Conversation
…stic build output
|
Note Reviews pausedIt 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 Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
📝 WalkthroughWalkthroughgetResolverManifestEntries now sorts Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 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 |
Bundle Size Benchmarks
Trend sparkline is historical gzip bytes ending with this PR measurement; lower is better. |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/start-plugin-core/src/start-compiler/server-fn-resolver-module.ts`:
- Line 19: The current sort uses localeCompare which is
implementation-dependent; update the comparator used on
Object.entries(serverFnsById) so it compares keys deterministically (e.g.,
replace the localeCompare call with a plain lexical comparator that returns
-1/0/1 using a < b and a > b checks) to ensure consistent ordering for the
output manifest; target the sort call where serverFnsById is turned into entries
and sorted.
🪄 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: defaults
Review profile: CHILL
Plan: Pro
Run ID: 09bc559a-5156-4286-b93d-2063875239e2
📒 Files selected for processing (1)
packages/start-plugin-core/src/start-compiler/server-fn-resolver-module.ts
|
Good point — switched to a plain lexical comparator ( |
|
i feel like we had this issue before but i cannot find the PR, didnt we merge something like this already? |
|
Not as far as I can tell — the closest is #7251 which fixed CSS asset ordering (stylesheet load sequence), but |
|
View your CI Pipeline Execution ↗ for commit b6f8f3b
☁️ Nx Cloud last updated this comment at |
Merging this PR will not alter performance
Comparing Footnotes
|
|
found the PR : https://github.com/TanStack/router/pull/6763/changes |
Add comments to clarify sorting logic for resolver manifest entries.
|
@DORI2001 please add a changeset |
There was a problem hiding this comment.
Nx Cloud has identified a flaky task in your failed CI:
Since the failure was identified as flaky, the solution is to rerun CI. Because this branch comes from a fork, it is not possible for us to push directly, but you can rerun by pushing an empty commit:
git commit --allow-empty -m "chore: trigger rerun"
git push
🎓 Learn more about Self-Healing CI on nx.dev
|
Added a changeset in |
Fixes #6762.
Problem
getResolverManifestEntriescallsObject.entries(serverFnsById)and maps over the result without sorting. TheserverFnsByIddictionary is built by processing source files in build-system order, which is non-deterministic across machines and runs. Because JS object key iteration follows insertion order, the generatedmanifestobject in the emitted__tanstack-start-server-fn-resolver-*.mjsartifact ends up with keys in a different order on each build — changing the file hash even when no functions have changed.This breaks:
git diffnoise on committed build artifactsFix
Sort the entries by ID (stable alphabetic order) before mapping. One-line change in
getResolverManifestEntries— no behavioural difference at runtime sincegetServerFnByIdlooks up by key, not by position.Summary by CodeRabbit