refactor!: share one HttpMethod enum across the client packages - #1645
Open
spydon wants to merge 1 commit into
Open
refactor!: share one HttpMethod enum across the client packages#1645spydon wants to merge 1 commit into
spydon wants to merge 1 commit into
Conversation
Contributor
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
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 |
This was referenced Aug 5, 2026
Tr00d
approved these changes
Aug 5, 2026
Three packages each declared their own HTTP method enum: `HttpMethod` in postgrest (with a `value` getter), `HttpMethod` in functions_client (without one) and `RequestMethodType` in gotrue, while storage passed method strings around. They now all use a single `HttpMethod` in `supabase_common`. The two public enums collided when re-exported together, which is why `supabase` had to `hide HttpMethod` from postgrest. Both now resolve to the same declaration, so the workaround is gone and `HttpMethod` is finally reachable from `package:supabase` and `package:supabase_flutter`. For consumers: postgrest's `HttpMethod` is unchanged, functions_client's gains `head`, and gotrue's `RequestMethodType` is removed in favour of `HttpMethod` (it was only reachable through `src/`). The compliance matrix pointed `functions.invocation.method_override` at the `HttpMethod` symbol; since the enum now lives in the internal, unscanned `supabase_common`, the entry points at `FunctionsClient.invoke` instead. Part of #1572 (tier 3), under the v3 umbrella #1278.
spydon
force-pushed
the
breaking/supabase-exception-base
branch
from
August 5, 2026 15:14
d68a53b to
aa160d3
Compare
spydon
force-pushed
the
breaking/shared-http-method
branch
from
August 5, 2026 15:14
9a136d8 to
4b05226
Compare
spydon
added a commit
that referenced
this pull request
Aug 6, 2026
…1654) Closes #1652 ## What A Dart enum type names one value rather than the set, so its name should be singular. Five enums were ports of `realtime-js` / `gotrue-js` names instead: | Before | After | Was reachable by consumers? | | --- | --- | --- | | `ChannelStates` | `ChannelState` | No (omitted from the `show` list) | | `ChannelEvents` | `ChannelEvent` | No (omitted from the `show` list) | | `RealtimeListenTypes` | `RealtimeListenType` | No (named in the `hide` clause) | | `PostgresTypes` | `PostgresType` | Yes | | `AuthenticatorAssuranceLevels` | `AuthenticatorAssuranceLevel` | Yes | The three unreachable ones are now annotated `@internal`, which is both the accurate annotation and enough to keep them out of the capability matrix scan. Sweeping the rest of the monorepo's 51 enums turned up one more name that did not read as a noun naming a single value: `LoadTableSnapshots` (storage, Iceberg) is now `TableSnapshotScope`. ## Enum extensions folded in Enums can declare methods and static methods directly, so every extension that only existed to hang helpers off an enum is now part of the enum: - `ChannelEventsExtended` → `ChannelEvent.fromType` / `ChannelEvent.eventName` - `ToType` → `RealtimeListenType.toType` - `PostgresChangeEventMethods` → `PostgresChangeEvent.fromString` / `PostgresChangeEvent.toRealtimeEvent` - `PresenceEventExtended` → `PresenceEvent.fromString` - `AuthChangeEventExtended` → `AuthChangeEvent.fromString` - `GenerateLinkTypeExtended` → `GenerateLinkType.fromString` Those helpers decode wire values, so the folded members carry `@internal`, matching the visibility the extensions already had through the `hide` clauses. The now-unnecessary `hide` entries are dropped from the gotrue and realtime_client exports. `SupabaseEventTypesName` is deliberately left alone: its member is `name()`, which would shadow `Enum.name` if declared on the enum, and both it and its deprecated enum are due for removal anyway. ## Not changed - `SocketStates`, because #1404 already renames it. - `AMRMethod` / `AMREntry` violate Dart's "capitalize acronyms longer than two letters like words" rule (`AmrMethod` / `AmrEntry`). Out of scope here, worth a follow-up. - `RequestMethodType` in gotrue is replaced by the shared `HttpMethod` in #1645. - `FactorStatus`, `RealtimeHeartbeatStatus` and `RealtimeSubscribeStatus` end in `s` but are singular ("status"). - Enum *values* such as `GenerateLinkType.magiclink` and `OtpType.magiclink` are not lowerCamelCase, but they are load-bearing: the wire value is derived from the value name. ## Behaviour None. No enum value changes: `ChannelEvent.eventName()` still produces the same `phx_*` strings and `TableSnapshotScope` still sends `all` / `refs`. ## Capability matrix `PostgresType`, `AuthenticatorAssuranceLevel` and `TableSnapshotScope` are registered under `realtime.subscriptions.postgres_changes`, `auth.mfa.get_authenticator_assurance_level` and `storage.analytics.iceberg_table` (replacing the stale `LoadTableSnapshots` entries). ## Testing - `dart analyze packages examples`: clean - `realtime_client`, `supabase`, `supabase_flutter` suites: pass - `gotrue` MFA, constants and types suites: pass (the rest of the `gotrue` suite has pre-existing failures against my local stack on `main` too) - supabase/sdk `check-api-symbols`, `check-drift` and `validate-compliance` run locally against this branch: all pass <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Breaking Changes** - Renamed authentication assurance-level, realtime channel/event, Postgres type, and table snapshot enums. - Updated related method parameters and response fields to use the new names. - **Improvements** - Simplified enum parsing and conversion APIs. - Corrected public exports for supported types and utilities. - Preserved existing authentication, MFA, realtime, storage, and data-conversion behavior. - **Tests** - Updated coverage for enum parsing, serialization, realtime events, and MFA flows. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
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.
Tier 3 of #1572, second of four PRs. Stacked on #1644, so review that one first.
What
Four packages had four takes on the same enum:
HttpMethod { get, head, post, put, patch, delete }withString get valueHttpMethod { get, post, put, delete, patch }, callers didmethod.name.toUpperCase()RequestMethodType { get, post, put, patch, delete }'GET'/'POST'/'HEAD'strings threaded through the fetch layer and the Iceberg catalogAll four now use one
HttpMethodinsupabase_common:The conflict this removes
supabasecould not re-export both packages' enums, so it carried:Both now resolve to the same declaration, so the
hideis gone andHttpMethodis reachable frompackage:supabaseandpackage:supabase_flutterfor the first time (previouslyfunctions.invoke(method: ...)was usable fromsupabase_flutteronly because functions_client's copy happened to win).Breaking changes
RequestMethodTypeis gone; gotrue'sGotrueFetch.requesttakesHttpMethod. It lived inlib/src/and was not exported frompackage:gotrue.functions_client'sHttpMethodgains aheadvalue and avaluegetter. ExistingHttpMethod.poststyle usage is unaffected.HttpMethodis unchanged in shape, it just moved packages.Storage's changes are internal: its fetch layer and Iceberg REST catalog take
HttpMethodinstead of aString, which removes the last stringly-typed methods in the monorepo.gotrue's request switch gained a
headbranch to stay exhaustive; it sends viaClient.headlike the other verbs.Compliance matrix
functions.invocation.method_overridelisted theHttpMethodsymbol. The enum now lives in the internalsupabase_common, which is excluded from the public API scan, so the entry points atFunctionsClient.invoke(the method that actually takes the override) instead.Testing
melos analyzeandmelos formatclean. Full suites pass forgotrue,postgrest,storage_client,functions_client,realtime_client,supabase,supabase_commonandsupabase_flutter, plus theexamplesanalyzer. The capability matrix symbol, drift and compliance checks pass.