Repository navigation
fix(typegen): disambiguate embeds of opposite-direction keys and junction tables, alias embeds named like columns - #2020
Merged
spydon merged 2 commits intoOct 23, 2026
Conversation
…s embeds named like columns
Contributor
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 6 minutes. View limit details
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
deleted the
lukasklingsbo/sdk-2359-fixtypegen-generated-embeds-are-ambiguous-for-opposite
branch
October 23, 2026 12:53
This was referenced Oct 23, 2026
spydon
added a commit
that referenced
this pull request
Oct 23, 2026
…anges met (#2046) Three combinations of PRs that were each green on their own broke main. - `supabase_auth`: #2027 added `pkce_failed_request_test.dart` passing `HttpMethod.x.value`, but #2025 changed `requestsTo` and the stub helpers to take an `HttpMethod`, so the package no longer analyzes. - `supabase_test`: since #2027, a local `signOut()` revokes the session in the background. The `stubSignOut` test looked for the `/logout` request right after `signOut()` returned, so it now waits for the event queue first. - `supabase_typegen`: #2020 added a `badge` table to the hostile fixture, and #2044 suffixes generated names that clash with Flutter types, so the class is now `BadgeTable`. The hostile golden is regenerated, and the tests that reference the class use the new name.
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.
Fixes SDK-2359.
Problem
Some foreign key shapes produced embeds that PostgREST could not serve:
profile.team -> teamandteam.owner_id -> profile, the generator only added a!fkeyhint when two keys pointed the same way.Profile.teamByTeamandProfile.teamViaOwnerIdboth sentselect=team(*), which PostgREST rejects withPGRST201.badge.profile -> profile,selectOnly([Badge.profile, Badge.profileByProfile.select()])sentselect=profile,profile(*). The response then carries a duplicateprofilekey, so reading the column fails.badge.team -> teamand ateam_badgejunction whose primary key covers its keys to both tables, PostgREST sees a many-to-one and a many-to-many relationship, so the unhintedteam(*)is ambiguous too.All three were reproduced against the local stack before the fix.
Fix
Generated member names do not change. Embeds of the affected shapes now resolve and come back under their own keys.
Tests
team,profile,badgeand theteam_badgejunction, covering all three shapes, and the hostile golden is regenerated. New generator tests assert the hints and the alias, and that a junction whose primary key does not cover both keys adds no relationship.supabase/migrations/20240101000005_embed_disambiguation.sql, creates the same tables, andsupabase/seed.sqlfills them.generated_embeds_integration_test.dartembeds them through the members in the hostile golden.supabase_typegennow runs with the local stack in CI (backend, concurrency 1), andAGENTS.mdlists it among the stack-backed packages. The list now also includessupabase, which it was missing.The integration test is deliberately left untagged, like the other stack-backed suites in the repository, so the package runs the same way every other backend package does.