fix(postgrest-typegen): order generated output with a fixed collation - #181
Merged
Merged
Conversation
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 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. Comment |
spydon
added this pull request to stack #182
September 14, 2026 15:56
spydon
force-pushed
the
lukasklingsbo/postgrest-typegen-explicit-collation
branch
from
September 14, 2026 15:59
b4f122d to
0472baf
Compare
mandarini
approved these changes
Sep 15, 2026
spydon
force-pushed
the
lukasklingsbo/postgrest-typegen-explicit-collation
branch
from
September 15, 2026 08:55
0472baf to
ba0dcf3
Compare
Base automatically changed from
lukasklingsbo/postgrest-typegen-introspection-cleanup
to
main
September 15, 2026 08:56
Every ordering in the package used String.prototype.localeCompare without a locale, which follows the host's default locale. Under Node a Swedish locale sorts a table named ä after z while an English one sorts it next to a, so the same database produced differently ordered output on differently configured machines. All comparisons now go through one Intl.Collator pinned to English, which is the order the English CI runners and the postgres-meta parity fixtures already have.
spydon
force-pushed
the
lukasklingsbo/postgrest-typegen-explicit-collation
branch
from
September 15, 2026 08:56
ba0dcf3 to
c06ecac
Compare
spydon
deleted the
lukasklingsbo/postgrest-typegen-explicit-collation
branch
September 15, 2026 08:56
spydon
pushed a commit
that referenced
this pull request
Sep 15, 2026
🤖 I have created a release *beep* *boop* --- ## [0.2.2](postgrest-typegen-v0.2.1...postgrest-typegen-v0.2.2) (2026-09-15) ### Bug Fixes * **postgrest-typegen:** order generated output with a fixed collation ([#181](#181)) ([af7f8e8](af7f8e8)) * **postgrest-typegen:** resolve composite args on foreign tables and matviews ([#143](#143)) ([e422eb7](e422eb7)) * **postgrest-typegen:** update-only trigger views, PG18 virtual generated columns, legacy metadata compatibility ([#128](#128)) ([50661bd](50661bd)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: supabase-releaser[bot] <223506987+supabase-releaser[bot]@users.noreply.github.com>
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.
Stacked on #180 (which is stacked on #179).
Summary
sortGeneratorMetadata, the TypeScript generator's merge sorts and the Swift generator's sorts all usedString.prototype.localeComparewithout a locale, so the canonical order of generated output depended on the default locale of the machine running the generator.Reproduction with Node 26:
Bun currently ignores the host locale and always resolves
en-US, so the CLI binary is not affected today, but postgres-meta and any Node consumer are, and nothing pins the behaviour.All 24 comparisons now go through a single
Intl.Collator("en")insrc/collation.ts. English has no tailoring over the ICU root collation, so this is exactly the order the English CI runners and the postgres-meta parity fixtures already produce; only machines with another default locale change, and they now agree with CI.Verification
sort.test.tsasserting["a", "ä", "b", "z"]regardless of host locale.bun run testwith Docker: 134 pass. No snapshot or parity fixture changed, which is the point.check-types,format-and-lintandknippass.