Repository navigation
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
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>
spydon
added a commit
that referenced
this pull request
Sep 16, 2026
…eta (#192) ## Why The scheduled "Parity vs. real postgres-meta" job in `postgrest-typegen-validate.yml` has failed every night since 2026-09-10 (SDK-1847). The ticket assumed postgres-meta had changed its Python template after the cutover. It is the other way around: postgres-meta deleted its templates in supabase/postgres-meta#1084 (postgres-meta v0.99.0, 2026-08-31) and now consumes `@supabase/postgrest-typegen`, with its lockfile pinned to `0.2.0`. The job therefore diffs `main` against our own `0.2.0` release as installed by postgres-meta's `npm ci`. Every intentional generator change since then shows up as "drift": - Python `JsonValue`, `typing_extensions` imports, and `Optional[...]` composite attributes (#124, released in 0.2.1). In the diff, the `-` lines are postgres-meta's output and the `+` lines are ours. - TypeScript fixed-collation ordering (#181, released in 0.2.2), which started failing today's run as well. There is no independent upstream left to compare against. Comparing against postgres-meta only measures how far behind its pinned version is, and postgres-meta's own snapshot tests cover its adapter. ## What - Remove the `parity-check` job and the `schedule` and `workflow_dispatch` triggers that only existed for it; the remaining `test` job runs on push and pull requests as before. - Delete `scripts/load-fixtures.ts`, `scripts/print-generated.ts`, and `scripts/canonicalize-typescript.ts`, which only served that job, and drop their knip entries. - Replace the "Byte-Parity Constraint" section in the package `CLAUDE.md` with a description of the post-cutover relationship (this package is the single source of truth; output changes are behavior changes for postgres-meta and the CLI, reviewed via the regenerated snapshots and goldens). Adjust the README and the golden test's doc comment to match. The `prettier` pin note was already stale since the package has no prettier dependency. The golden test under `test/parity/` and its `expected/` files stay as the in-repo regression gate. ## Verification `bun run check-types`, `bun run format-and-lint`, `bun run knip`, and `bun run test` (134 tests, including the testcontainers-backed golden test) pass locally. Closes SDK-1847.
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.