You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix: return client bundle collections in a stable order - #583
Collections in the client bundle can end up in a different order depending
on when they finish loading. This can change the bundle's chunk hash between
builds even when the icons haven't changed.
Sort collections by prefix before returning them. The comparison doesn't
depend on the build machine's locale.
This one is literally a one-line fix 😄
Tests
Added a regression test that resolves the same collections in different
input orders and checks that the result is identical. It fails before the
fix and passes after it.
No actionable comments were generated in the recent review.
Walkthrough
resolveBundleIcons now sorts returned collections by prefix in ascending lexicographical order. A new test checks that reversing the requested icon order produces the same collection order and data.
This change makes client bundle collection order deterministic, so identical icons should produce stable chunk hashes. No merge-blocking risk was found.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title states the main change: client bundle collections are now returned in a stable order. The raw summary confirms that resolveBundleIcons now sorts returned collections by prefix. The title is …
Description check
The description explains the nondeterministic collection order, the one-line sort-by-prefix fix, the locale-independent comparison, and the regression test. It relates directly to the changeset.
Linked Issues check
Issue #582 requires that collections returned by resolveBundleIcons have a stable order, sorted by prefix with a locale-independent comparison. At the reviewed head, src/core/bundle.ts returns `[.…
Out of Scope Changes check
The whole-PR diff against the merge base 28c9943 changes two files only. src/core/bundle.ts adds a one-line sort to the return value of resolveBundleIcons, which is the change requested by #582.…
Full details: Title check
Explanation
The title states the main change: client bundle collections are now returned in a stable order. The raw summary confirms that resolveBundleIcons now sorts returned collections by prefix. The title is concise and specific, and it matches the linked objectives.
Full details: Linked Issues check
Explanation
Issue #582 requires that collections returned by resolveBundleIcons have a stable order, sorted by prefix with a locale-independent comparison. At the reviewed head, src/core/bundle.ts returns [...collections.values()].sort((a, b) => a.prefix < b.prefix ? -1 : a.prefix > b.prefix ? 1 : 0). This uses code-point ordering, not localeCompare(), so it does not depend on the build machine's locale. Because src/context.ts and src/vite.ts both call this function, both the module client bundle and the standalone Vite plugin receive the stable order. The new test in test/bundle.test.ts resolves the same collections in two request orders and checks that the prefixes are ['alpha', 'zeta'] and that both results are equal. This covers the automated test requirement. The issue's exact test uses a different name and fixture, but it checks the same behaviour. No unmet coding requirement is found in the diff.
Full details: Out of Scope Changes check
Explanation
The whole-PR diff against the merge base 28c9943 changes two files only. src/core/bundle.ts adds a one-line sort to the return value of resolveBundleIcons, which is the change requested by #582. test/bundle.test.ts adds one regression test for the same function and ordering behaviour. Neither change falls outside the scope of #582. The icon-name sort from #446 is not changed, which matches the issue scope.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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.
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Organization UI
Review profile: CHILL
Plan: Advanced
Run ID: 68b2c7a3-d7c9-4685-a98c-a74f15189e8f
Commits
Reviewing files that changed from the base of the PR and between 28c9943 and b2d657c.
Files selected for processing: 2
src/core/bundle.ts
test/bundle.test.ts
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.
This branch has not been deployed
No deployments
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
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.
Resolves #582
Description
Collections in the client bundle can end up in a different order depending
on when they finish loading. This can change the bundle's chunk hash between
builds even when the icons haven't changed.
Sort collections by prefix before returning them. The comparison doesn't
depend on the build machine's locale.
This one is literally a one-line fix 😄
Tests
Added a regression test that resolves the same collections in different
input orders and checks that the result is identical. It fails before the
fix and passes after it.