Skip to content

refactor: keep internal helpers out of the public api - #1950

Merged
spydon merged 2 commits into
mainfrom
fix/v3-public-api-compliance
Nov 3, 2026
Merged

spydon merged 2 commits into
mainfrom
fix/v3-public-api-compliance

Conversation

@spydon

@spydon spydon commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

After main switched to v3 in #1370, the capability check flagged 57 public names that are new compared with 2.x and missing from sdk-compliance.yaml. Most of them are internals that were public by accident.

Made private

These are only used inside their own package, and none of them existed in 2.x:

Package Names
auth AsyncSessionManager, SyncSessionManager, SessionManagerCommon, AsyncTimer, SyncTimer, save_session_and_sign_in, is_implicit_grant_flow and the helpers module functions
postgrest can_retry, model_validate_json
realtime RealtimeClient.send, send_no_wait, get_message_or_raise, RealtimeChannel.send_event, send_event_no_wait
storage validate_adapter, validate_model, maybe_read_file, VectorBucketScope.with_metadata, VectorIndexScope.with_metadata
functions on_error_response

RealtimeClient.send was public on AsyncRealtimeClient in 2.x. In v3 it is the low-level transport under RealtimeChannel.send_broadcast and the other channel methods, and no capability covers raw sends.

sanitize_pattern_param in postgrest was unused, so it is removed.

Registered in sdk-compliance.yaml

  • BaseRequestClient as a supporting name of database.configuration.auto_retry, since BaseRequestClient.retry is already registered there.

  • BucketName as a supporting name of storage.file_buckets.create_file_bucket, since it is the return type of create_bucket.

  • ChannelLeaveMessage next to the other shared realtime message models.

  • StorageVectorsClient.get_bucket as a supporting name of storage.vector_buckets.access_vector_index. The capability registry has no entry for getting a single vector bucket yet.

  • auth.session.auto_refresh now uses no_public_symbols: true. It listed start_auto_refresh_token on the session managers, which are now private. Users control auto refresh through the auto_refresh_token constructor option, as the entry's note already says.

Resolves SDK-2694

Prefix internal helpers, session managers, timers and transport methods with
an underscore so the capability check no longer counts them as public API.
Register the remaining public names in sdk-compliance.yaml and remove the
unused sanitize_pattern_param.
@coderabbitai

coderabbitai Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • Chores
    • Updated internal SDK helpers and methods to be private across authentication, functions, database, realtime, and storage components. Existing request, response, and session behavior remains unchanged.
    • Removed the pattern-sanitization helper from the database client.
    • Updated the Python SDK compliance registry with supporting symbols and revised session-refresh symbol coverage.

Internal helpers and methods across Auth, Functions, PostgREST, Realtime, and Storage now use underscore-prefixed names, with internal call sites updated to match. Their described behavior remains unchanged, except PostgREST removes sanitize_pattern_param. The SDK compliance registry marks automatic session refresh as having no public symbols and adds supporting symbols for database, Storage, and Realtime entries.

Possibly related PRs

Change: Refactor

Merge Risk: Minimal · up to 01caa

The internal API cleanup presents no identified merge-blocking risk and appears mergeable after normal checks.

- [ ] Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

CodeRabbit Verify

  • Run CodeRabbit Verify to test the changes in this pull request.
Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: a23d2570-2d21-4eba-b2c2-8fd6f2a55d93
Commits

Reviewing files that changed from the base of the PR and between f585dbd and 01caa7b.

Files selected for processing: 23
  • sdk-compliance.yaml
  • src/auth/src/supabase_auth/admin_api.py
  • src/auth/src/supabase_auth/client.py
  • src/auth/src/supabase_auth/helpers.py
  • src/auth/src/supabase_auth/mfa.py
  • src/auth/src/supabase_auth/session.py
  • src/auth/src/supabase_auth/timer.py
  • src/auth/tests/test_helpers.py
  • src/functions/src/supabase_functions/client.py
  • src/functions/src/supabase_functions/errors.py
  • src/functions/tests/test_errors.py
  • src/postgrest/src/postgrest/request_builder.py
  • src/postgrest/src/postgrest/utils.py
  • src/postgrest/tests/_async/test_request_builder.py
  • src/postgrest/tests/_sync/test_request_builder.py
  • src/realtime/src/realtime/channel.py
  • src/realtime/src/realtime/client.py
  • src/realtime/tests/test_unknown_refs.py
  • src/storage/src/storage3/analytics.py
  • src/storage/src/storage3/client.py
  • src/storage/src/storage3/exceptions.py
  • src/storage/src/storage3/file_api.py
  • src/storage/src/storage3/vectors.py

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

@spydon
spydon merged commit 4478ef0 into main Nov 3, 2026
42 checks passed
@spydon
spydon deleted the fix/v3-public-api-compliance branch November 3, 2026 18:20
spydon added a commit that referenced this pull request Nov 4, 2026
…ors (#1979)

Resolves SDK-2725. Continues the work from #1950 (SDK-2694).

## What changed

Every package now declares `__all__`, and every service's public error
classes can be imported from the package itself and from `supabase`.

| Package | Change |
| -------------------- |
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
| `supabase_auth` | Replaced the `X as X` re-exports with grouped
imports and `__all__`. Now exports the error classes from `errors.py`
and `ErrorCode`. |
| `realtime` | Replaced the `X as X` re-exports with grouped imports and
`__all__`. Dropped the internal `T_ParamSpec` and `T_Retval` type
variables from the package. |
| `storage3` | Exports `StorageException`, `StorageApiError`,
`StorageApiErrorMessage` and `VectorBucketException`. |
| `supabase_functions` | Exports `FunctionsError`, `FunctionsHttpError`,
`FunctionsRelayError`, `FunctionsApiErrorDict` and `__version__`. |
| `supabase_utils` | Declares an empty `__all__`. Its public API lives
in the `http` and `types` submodules. |
| `supabase` | Turns `__all__` into a list. Adds `StorageApiError`,
`VectorBucketException`, `AuthInvalidJwtError`, `CustomAuthError` and
`UserDoesntExist`. Imports them from the package roots. |
| `supabase.client` | Keeps the same error exports as `supabase`. |

## Breaking changes

`realtime.T_ParamSpec` and `realtime.T_Retval` are no longer importable
from `realtime`. They are still available from `realtime.types`.

## Tests

`src/supabase/tests/test_exports.py` checks that every package declares
`__all__`, that each listed name exists, and that the error classes are
the same objects in the package, in `supabase` and in `supabase.client`.
spydon added a commit to supabase/sdk that referenced this pull request Nov 9, 2026
Adds a capability for retrieving a single vector bucket by name. The
storage service has a `GetVectorBucket` route, and the SDKs already
implement it, but the registry has no feature for it:

- supabase-js has `getVectorBucket` in `VectorBucketApi`.
- supabase-flutter registers `SupabaseVectorsClient.getBucket` under
`storage.vector_buckets.list_vector_buckets`, because no better feature
exists.
- supabase-py registers `StorageVectorsClient.get_bucket` as a
supporting name of `storage.vector_buckets.access_vector_index` for the
same reason (supabase/supabase-py#1950).

It mirrors `storage.vector_buckets.get_index` for indexes. `bun test`,
`bun run format-and-lint`, `bun run knip` and `bun run validate` pass.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant