Repository navigation
fix(auth): port main's changes to v3 - #1795
Merged
Merged
Conversation
This was referenced Oct 20, 2026
fix(supabase): sync client options fix from main and make storage list_v2 folder keys optional
#1793
Merged
grdsdev
reviewed
Oct 20, 2026
grdsdev
reviewed
Oct 20, 2026
grdsdev
reviewed
Oct 20, 2026
grdsdev
reviewed
Oct 20, 2026
grdsdev
reviewed
Oct 20, 2026
grdsdev
reviewed
Oct 20, 2026
grdsdev
reviewed
Oct 20, 2026
spydon
force-pushed
the
v3-sync/05-auth
branch
from
October 21, 2026 07:13
e141300 to
49a3a63
Compare
spydon
force-pushed
the
v3-sync/05-auth
branch
from
October 21, 2026 07:46
49a3a63 to
481b949
Compare
grdsdev
approved these changes
Oct 21, 2026
spydon
force-pushed
the
v3-sync/05-auth
branch
from
October 22, 2026 07:49
481b949 to
9376e46
Compare
spydon
force-pushed
the
v3-sync/05-auth
branch
2 times, most recently
from
October 26, 2026 13:45
3f1356f to
860362f
Compare
spydon
force-pushed
the
v3-sync/05-auth
branch
from
October 26, 2026 14:08
860362f to
9671595
Compare
spydon
force-pushed
the
v3-sync/05-auth
branch
from
October 27, 2026 16:26
9671595 to
8d31630
Compare
spydon
force-pushed
the
v3-sync/05-auth
branch
2 times, most recently
from
October 27, 2026 16:55
a1be85b to
abcd9e5
Compare
spydon
force-pushed
the
v3-sync/05-auth
branch
from
October 27, 2026 17:10
abcd9e5 to
5c03cbb
Compare
(cherry picked from commit 29ff4ff)
(cherry picked from commit 2658d8b)
(cherry picked from commit aa73211)
v3 already builds an immutable URLQuery from query_params without mutating it, so only the tests are ported. (cherry picked from commit 553cb47)
(cherry picked from commit 66cd7ee)
exchange_code_for_session() now takes the auth code first, with code_verifier and redirect_to as keyword-only arguments. Without a verifier it reads the one stored by the flow, removes it after the exchange, saves the session and emits SIGNED_IN, as on main. An autoconfirmed sign-up removes its unused verifier, unsubscribing twice no longer raises, and every flow stores its verifier through one helper.
A listener that raises is logged instead of aborting the other listeners, and it no longer makes initialize() drop a session it just refreshed. sign_in_with_sso() clears the current session first, as on main. The stored verifier is removed on sign-out and after a failed exchange, so it cannot leak into a later one.
v3 builds every URL with yarl's joinpath, which already ignores a trailing slash on the base URL, so only the tests are ported. (cherry picked from commit de040ec)
(cherry picked from commit 7d68e6b)
Ported to v3's shared _set_session: when the returned session still has the given access token, it was not refreshed, so set_session emits SIGNED_IN. (cherry picked from commit 9c092db)
spydon
force-pushed
the
v3-sync/05-auth
branch
from
October 27, 2026 17:14
5c03cbb to
6979847
Compare
…hared base sign_in_with_sso, reset_password_for_email and exchange_code_for_session are now defined on AsyncSupabaseAuthClient and SyncSupabaseAuthClient to handle the PKCE verifier, so they are public symbols of those classes.
Contributor
|
The following capabilities are marked
The following capabilities are marked
These may have been renamed, removed, or never registered. Please update the capability matrix. |
spydon
added a commit
that referenced
this pull request
Nov 16, 2026
Step 4 of [SDK-2765](https://linear.app/supabase/issue/SDK-2765) ([SDK-2987](https://linear.app/supabase/issue/SDK-2987)): the typed query builder over the table definition, the request value and the executors of #2043. A port of the typed builders of supabase-flutter #1795, as they are today on top of `PostgrestTableRequest`. ```python books = ( client.table(Books.table) .select() .where((Books.pages.gt(300) | Books.isbn.is_null()) & ~Books.id.eq(1)) .order(Books.title.desc().nulls_last()) .limit(10) .execute() ) # books: list[BooksRow] ``` ## What - `PostgrestClient.table(Books.table)` returns `TypedQueryBuilder[Executor, Row, Insert, Update]` through an overload on the type of the client: `TableExecutor` on `SyncPostgrestClient` and `AsyncTableExecutor` on `AsyncPostgrestClient`, over the HTTP executor of that client. `table("books")` keeps returning the string builder. - The builders collect a `TableRequest` without rendering anything. `execute()` hands it to the executor and converts the `TableResult`: it returns `T` on the sync client and an awaitable of `T` on the async one, through overloads on `self` as `handle_http_io` does, with the runtime branch decided by what the executor returns. Every method returns a copy. - `TypedQueryBuilder`: `select()` resolves to `list[Row]` through a cached `TypeAdapter(list[Row])`, `select_only([...])` to `list[PartialRow[Row]]`; `insert`, `upsert(on_conflict=, ignore_duplicates=)`, `update`, `delete` and `count()`. - `TypedFilterBuilder.where(filter)`, combining repeated calls with `&`. `TypedTransformBuilder`: `select`, `select_only`, `order` (appends), `limit`, `range`, `strip_nulls`, `dry_run`, `max_affected`, `csv` (`str`), `head` (`None`), `geojson` (`dict[str, JSON]`), `explain` (`str`, or `JSON` with `format="json"`), `count` (`CountedResponse[T]`), and `single` (`Row`) and `maybe_single` (`Row | None`), which an explicit `self` type offers on a builder that resolves to a list only, so a write needs `select()` first. `retry()` and `request_timeout()` on every builder. - `TypedMutationBuilder`, what `update()` and `delete()` return: no `execute()` until `where()` or `all()`. A mutation resolves to `None` unless `select()` or `select_only()` asks the rows back, the one default that differs from the string builder. `TypedCountBuilder`, what `count()` on the table returns: `where()` only, resolving to `int`. - Writes take `Insert | Iterable[Insert]` and `Update`. A view's `Table[Row, Never, Never]` makes `insert`, `upsert` and `update` uncallable. `delete()` takes no value of the write type, so it is gated by an overload on `self`: with an `Update` of `Never` the checkers see `None`, so neither `where()` nor `all()` can follow and nothing can be sent; Dart gates it with an extension and Swift with an unavailable twin. A payload goes through `pydantic_core.to_jsonable_python`, so `date` and `UUID` values and pydantic models serialize, and the request holds the plain JSON that `TableRequest.payload` promises. - `PartialRow[Row]`: `row[Books.title]` is a `str`, a `NullableColumn` or `ComputedField` entry reads `Value | None`, and an entry of another table is a type error, through `__getitem__` overloads. A value decodes through the field of `Row` the entry is named after, so a `date` column reads as a `date` as it does from `select()`, and as the decoded JSON for an ad hoc column. A computed field, which `Row` never carries, decodes through the new optional `value_type` of `ComputedField`, the Python form of Dart's `fromJson`, which the generator will give for every field whose type differs from its JSON form; without it the value is the decoded JSON, which is right for `str`, `int`, `float`, `bool` and JSON values. An entry the list did not ask for raises `KeyError`, a stripped column reads `None`, and `to_row()` decodes the whole row; the row holds its table, so `to_row()` takes no argument. - `CountedResponse(data, count)`. `ValueError` before anything is sent for an empty `select_only`, an empty `on_conflict`, a `range` whose end comes before its start and `head()` after a write; `TypeError` for a payload that is neither a row, a mapping, nor an iterable of rows. ## Tests - `test_typed_builder.py`: the request each method collects, against recording executors; the conversion of each shape; write payloads as one row, a list, a tuple, an iterator and a pydantic model, and the rejected ones; immutability and equality; sync and async `execute()`; both clients end to end through `MockTransport`, with `features=typed-api` on the wire. - `test_partial_row.py`: reads by column kind, decoding through the row model, its aliases, the annotations of a dataclass and a row type without fields, `KeyError`, stripped nulls, `to_row()`, repr and equality. - `tests/typecheck/queries.py` under mypy, pyright and pyrefly: the result type of every method on both clients with `assert_type`, filters and orderings of another table, `single()` on a mutation, `where()` after a shape, the `__getitem__` overloads, `Never` write types on a view including `delete()`, a mutation without `where()` or `all()` having no `execute()`, and `await` of a sync result. - Integration tests for every method on both clients, `tests/_async/test_typed_query_builder_integration.py` and `_sync/`, against the local stack. A new migration adds a `books` table with identity ids, a nullable column, an array, a jsonb column, a unique constraint and a computed field, a `book_titles` view, and a `places` table with PostGIS for `geojson()`. It sets `pgrst.db_tx_end = commit-allow-override` for `dry_run()`, and `safeupdate.enabled = false` on the API role: the stack loads `safeupdate`, which rejects the unfiltered update and delete that the tests of `all()` send on purpose, in a dry run; the migration role cannot change `session_preload_libraries` itself. ## Compliance The new symbols are listed under the top-level `supporting_symbols` of `sdk-compliance.yaml`, as in the earlier steps; the feature status changes in step 8. Linear: SDK-2987
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.
Cherry-picks main's auth commits onto v3, ported to v3's
client.py,session.py,errors.pyandhelpers.py. Where v3 already had the behavior (899302e, 553cb47), only the tests are ported, and the commit message says so.Review fixes
exchange_code_for_session(auth_code, *, code_verifier=None, redirect_to=None): without a verifier it reads the one stored by the flow and removes it afterwards, and it saves the session and emitsSIGNED_IN, as on main. The keyword-only arguments make old positional calls fail instead of swapping the verifier and the code.initialize()drop a session it just refreshed.sign_in_with_sso()clears the current session first, as on main.Commits
Stack
This replaces #1789: main's changes since 6f522d3 are cherry-picked onto v3 one package at a time, so each part can be reviewed on its own. Merge from the bottom up.