Skip to content

chore: register SearchOptions and SortBy in the capability matrix - #1670

Merged
spydon merged 1 commit into
mainfrom
fix/register-search-options
Aug 7, 2026
Merged

spydon merged 1 commit into
mainfrom
fix/register-search-options

Conversation

@spydon

@spydon spydon commented Aug 7, 2026 •

Copy link
Copy Markdown
Contributor

Summary

SearchOptions is the options type StorageFileApi.list takes, and SortBy is the type of its sortBy field. Neither was registered anywhere in sdk-compliance.yaml, so 12 public symbols went unaccounted for, while the paginated equivalents sitting right next to them (PaginatedSearchOptions, FileSort) were listed in full.

Both are supporting types rather than entry points, so they go under supporting_symbols on storage.file_buckets.list_files, alongside the paginated ones.

storage.file_buckets.list_files:
  status: implemented
  symbols:
    - StorageFileApi.list
    - StorageFileApi.listPaginated
  supporting_symbols:
    # ...
    - SearchOptions
    - SearchOptions.limit
    - SearchOptions.offset
    - SearchOptions.search
    - SearchOptions.sortBy
    - SearchOptions.toMap
    - SortBy
    - SortBy.column
    - SortBy.order
    - SortBy.toMap

Verified SortBy is referenced only by SearchOptions.sortBy, and SearchOptions only by StorageFileApi.list, so neither is shared with another capability.

Found while reconciling the merged list_files entry in #1667.

Test plan

  • validate-compliance: OK — compliance file is valid.
  • check-drift: ✅ No capability matrix drift detected.
  • Registered symbol count 887 → 899, exactly the 12 added.

Note on the wider gap

This fixes the case that surfaced in review, but it is one instance of a much larger pattern. Against the current public surface:

count
Public symbols extracted 1952
Registered in sdk-compliance.yaml 899
Unregistered 1051

By package: gotrue 463, realtime_client 230, storage_client 121, supabase_flutter 73, postgrest 71, supabase 64, functions_client 16, yet_another_json_isolate 13.

This is not a regression and does not fail CI, because check-api-symbols only fires on symbols a PR adds, diffing base against head. Everything already present is grandfathered in. But it does mean the matrix currently accounts for under half the public API, which weakens the guarantee the check is meant to provide.

Worth deciding separately whether to backfill, and if so whether some of that surface should be @internal instead (Fetch, Constants, ToQueryParams and similar look like they were never meant to be public). Not attempting that here.

Summary by CodeRabbit

  • New Features
    • Added support for search options and symbol-based sorting when listing files in storage buckets.

SearchOptions is the options type StorageFileApi.list takes, and SortBy
is its sortBy field type. Neither was registered anywhere, so both went
unaccounted for while the paginated equivalents next to them were listed
in full. Both are supporting types rather than entry points, so they go
under supporting_symbols alongside PaginatedSearchOptions.

Found while reconciling the merged list_files entry in #1667.
@spydon
spydon requested a review from a team as a code owner August 7, 2026 13:31
@coderabbitai

coderabbitai Bot commented Aug 7, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: f3a5d5c9-e5b3-455a-a6c5-b94945c90105

📥 Commits

Reviewing files that changed from the base of the PR and between 8b6a634 and 9b1de61.

📒 Files selected for processing (1)
  • sdk-compliance.yaml

📝 Walkthrough

Walkthrough

The storage file-listing capability metadata now supports SearchOptions and SortBy, including their constructors, fields, and serialization methods.

Changes

File listing compliance

Layer / File(s) Summary
File listing symbol declarations
sdk-compliance.yaml
Adds SearchOptions and SortBy metadata to storage.file_buckets.list_files, including constructors, fields, and serialization methods.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Suggested reviewers: dshukertjr

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: registering SearchOptions and SortBy in the capability matrix.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/register-search-options

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

Comment @coderabbitai help to get the list of available commands.

@spydon
spydon merged commit c6b5b35 into main Aug 7, 2026
28 checks passed
@spydon
spydon deleted the fix/register-search-options branch August 7, 2026 14:10
spydon added a commit that referenced this pull request Aug 10, 2026
## Summary

The capability matrix extractor treats every non-underscore name in
`lib/` as public API, without following exports:

> Dart privacy is name-based, so a declaration is public when its name
does not start with `_`. [...] Declarations annotated with `@internal`
are excluded: the annotation is the canonical marker that a name is
public by Dart's underscore rule but is not part of the package's public
API.

So implementation plumbing in `lib/src/` counted as public surface that
had to be either registered in `sdk-compliance.yaml` or left as an
unexplained gap. This marks that plumbing `@internal`. The repo already
uses the annotation on individual members; this extends it to the
declarations themselves.

Annotates **24 declarations**:

| Package | Declarations |
|---|---|
| `realtime_client` | `Push`, `Hook`, `Message`, `Serializer`,
`RetryTimer`, `Callback`, `TimerCallback`, `TimerCalculation` |
| `gotrue` | `GotrueFetch`, `GotrueRequestOptions`, `RequestMethodType`,
`ApiVersion`, `Constants`, `OAuthClientResponse`,
`OAuthClientListResponse` |
| `storage_client` | `Fetch`, `ToQueryParams`, `Constants` |
| `supabase` | `AuthHttpClient`, `Counter`, `Constants` |
| `supabase_flutter` | `SupabaseAuth`, `Constants` |
| `functions_client` | `Constants` |

## How the set was chosen

Not by eye. A declaration qualifies only if it is **unreachable from its
package's public library**, resolving `export` directives transitively
and honouring `show`/`hide`. That makes the annotation truthful rather
than a judgement call, and keeps it analyzer-legal, since `@internal` on
something in the public API is itself a diagnostic.

Candidates were then filtered against `sdk-compliance.yaml`. Annotating
a class hides its **members** from the extractor too, so anything with
registered symbols would silently break the drift check. That filter
removed six:

| Excluded | Registered symbols |
|---|---|
| `storage_client/StorageBucketApi` | 10 (`createBucket`, `listBuckets`,
...) |
| `gotrue/GoTrueAdminCustomProvidersApi` | 7 |
| `gotrue/GoTrueAdminOAuthApi` | 6 |
| `gotrue/GoTrueAdminMFAApi` | 2 |
| `realtime_client/Constants` | 1 (`defaultConnectionCloseTimeout`) |
| `realtime_client/ChannelFilter` | 1 (`select`) |

Two more were excluded for being publicly reachable in ways a naive
export scan misses:

- `storage_client/File` is a conditional-import typedef used in
`StorageFileApi.upload` signatures, so it is effectively public.
- `yet_another_json_isolate/YAJsonIsolate` lives in `_isolates_web.dart`
but is conditionally *exported* (`if (dart.library.js_interop)`), so it
is the package's public entry point.

## Effect

| | before | after |
|---|---|---|
| Symbols reported as public API | 1952 | **1831** |
| Unregistered | 1051 | **930** |
| Matrix coverage | 46.2% | **49.2%** |

111 symbols stop being counted as public API. No symbol newly appears,
and no registered symbol disappears.

This shrinks the backfill problem noted in #1670 by about a ninth. The
remaining 930 are genuine public API that is simply unregistered; that
is a separate task.

## Test plan

- [x] `dart analyze packages/`: **No issues found.** This is the real
gate: the analyzer reports `invalid_internal_annotation` for anything
annotated inside a public API, and `invalid_use_of_internal_member` for
cross-package use. Neither fires.
- [x] Independent cross-package reference sweep, not trusting the lint
config alone. The only hits were `Constants`, which each package
declares for itself; verified `supabase_flutter/src/supabase.dart`
imports its own `src/constants.dart`, so that use is same-package.
- [x] `check-drift` against a freshly extracted surface: `✅ No
capability matrix drift detected.`
- [x] `dart format packages/`: 0 changed.
- [x] `gotrue` tests: `+448 -23`, **identical to unmodified `main`**
(`+448 -23`). The 23 failures are integration tests needing a local
GoTrue on `localhost:9999` and are unrelated to this change, which is
annotation-only and cannot affect runtime behaviour.

## Note

`functions_client` gains a `meta: ^1.16.0` dependency, which it did not
previously have. Every other touched package already depended on it.


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Refactor**
* Clarified API boundaries across authentication, storage, realtime,
functions, and Flutter integrations.
* Internal implementation details are now explicitly identified and
excluded from the supported public API.
* Added required metadata support for improved API visibility
annotations.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
spydon added a commit that referenced this pull request Aug 10, 2026
)

Stacked on #1671. Closes the backfill that #1670 and #1671 flagged:
capability-matrix coverage of the Dart public API goes from **49% to
100%**.

| | before | after |
|---|---|---|
| Symbols reported as public API | 1831 | **1774** |
| Registered | 899 | **1766** |
| Unregistered | 930 | **0** |

## How the 881 unregistered symbols were placed

**26 are entry points the matrix was missing outright.** These go in
`symbols`, so the drift check now verifies them:

| Feature | Entry point |
|---|---|
| `auth.session.update_user` | `GoTrueClient.updateUser` |
| `auth.session.get_session` / `get_user` |
`GoTrueClient.currentSession` / `currentUser` |
| `auth.sign_in.sign_in_with_oauth` | `GoTrueClient.getOAuthSignInUrl`,
`GoTrueClientSignInProvider.signInWithOAuth` |
| `auth.sign_in.sign_in_with_sso` |
`GoTrueClientSignInProvider.signInWithSSO` |
| `auth.identities.link_identity` |
`GoTrueClientSignInProvider.linkIdentity` |
| `auth.passkey.*` | `GoTruePasskeyApi.start/verifyRegistration`,
`start/verifyAuthentication` |
| `database.query.from_table` / `rpc` / `schema_selection` |
`SupabaseClient.from` / `rpc` / `schema` |
| `database.using_modifiers.explain` |
`PostgrestTransformBuilder.explain` |
| `realtime.subscriptions.postgres_changes` |
`RealtimeChannel.onPostgresChanges`, `onSystemEvents` |
| `realtime.client.*` | `SupabaseClient.channel`, `getChannels`,
`removeChannel`, `removeAllChannels`, `RealtimeClient.disconnect` |
| `storage.file_buckets.create_signed_url` |
`StorageFileApi.createSignedUrl` |
| `client.*` | `GoTrueClient.getSessionFromUrl`, `recoverSession`,
`setInitialSession` |

Several of these features previously listed only an option or enum as
their evidence. `storage.file_buckets.create_signed_url` claimed
`DownloadBehavior`; `database.using_modifiers.explain` claimed
`ExplainFormat`; `auth.session.update_user` claimed
`UserAttributes.currentPassword`. The method that actually implements
the capability was unregistered in each case.

**500 go in a feature's `supporting_symbols`**, where the type maps onto
one capability: the MFA response types to their operations,
`Jwt*`/`JWK*`/`DecodedJwt` to `get_claims`, `FileObjectV2` to
`file_info`, `SignedUrl*` to `create_signed_urls`, the presence payloads
to `subscribe_presence`, and so on.

**355 go in the top-level `supporting_symbols` list.** Four kinds:

- **Shared domain models** — `Session`, `User`, `AuthResponse`,
`Bucket`, `OAuthClient`, `Factor`. Accepted or returned by many features
at once, so no single feature id is a truthful home.
- **Exception hierarchies** — `AuthException`, `PostgrestException`,
`FunctionException`, `RealtimeSubscribeException` and subclasses. Thrown
rather than passed, so reachable from no signature.
- **Client and sub-API handles** — `SupabaseClient`, `GoTrueClient`,
`RealtimeClient`, `GoTrueAdminApi` and the accessors returning them gate
whole areas; their operations are attributed individually.
- **Surface with no canonical id** — see the last section.

## 26 symbols left the scan instead of entering the matrix

#1671's script only matched class-like declarations, so top-level
functions and variables slipped through. Now `@internal`:

- `realtime_client/src/transformers.dart`: `convertCell`,
`convertColumn`, `convertChangeData`, `toArray`, `toBoolean`,
`toDouble`, `toInt`, `toJson`, `toTimestampString`, `noop`,
`httpEndpointURL`, `getEnrichedPayload`, `getPayloadRecords`
- conditional-import platform shims: `accessToken`, `hasAccessToken`,
`persistSession`, `removePersistedSession`, `disposePreviousClient`,
`markClientToDispose`, `supabaseFlutterClientToDispose`,
`getBroadcastChannel`, `createWebSocketClient`
- `passkeyRegisterRequestFromOptions`,
`passkeyAuthenticateRequestFromOptions`, `maxShift`, `defaultHeaders`

`ChannelFilter` joins them, and this one is worth a second look: it is
hidden from `realtime_client`'s public library, so
`ChannelFilter.select` could never have been drift-verified evidence for
`realtime.subscriptions.postgres_changes`.
`RealtimeChannel.onPostgresChanges` replaces it.

Two paths cannot carry the annotation, so `.sdk-parse-ignore` excludes
them:

- `packages/*/example/` — each package ships its own example app, and
the extractor treats it as a package of its own because it has a
`pubspec.yaml`. `MyApp`, `MyWidget` and `main` were counted as SDK
public API. `examples/` was already excluded for exactly this reason.
- `packages/*/lib/src/version.dart` — the release tooling rewrites it
wholesale (`echo "const version = '$version';" > ...`), so an annotation
would not survive a release.

## One behaviour-visible change

`realtime_client.dart` changes from `export 'src/transformers.dart' hide
getEnrichedPayload, getPayloadRecords` to `show PostgresColumn,
PostgresType`. The 13 payload-conversion helpers above were public only
by accident of that hide list, and the analyzer requires it: `@internal`
on an exported member is `invalid_export_of_internal_element`. The
`show` form also stops the next helper added to that file from leaking.

This removes public API. It is not API anyone should be calling
(`toInt`, `noop`, `convertCell`), and v3 is already removing dead public
surface, but it is the one item here that is not purely additive.

## Also declared: `storage.errors.error_codes`

The validator reported it undeclared, and `StorageException.error`
already carries the machine-readable service code the capability
describes. Declared as implemented, which also gives `StorageException`
a real home instead of the shared bucket.

## Gaps this surfaced

Public API with no canonical capability id, currently parked in the
top-level list. Each is a candidate for a new id in `supabase/sdk`:

1. **Client construction and disposal** — `Supabase.initialize`,
`Supabase.instance`, `Supabase.client`, `isInitialized`, and `dispose`
on every client. `client.*` has no lifecycle group at all.
2. **User-facing passkey management** — `GoTruePasskeyApi.list`,
`delete`, `update`. The matrix has `auth.passkey_admin.list_passkeys`
and `delete_passkey` for the admin API, but nothing for a user managing
their own.
3. **Realtime streams as a database capability** —
`SupabaseQueryBuilder.stream` and `SupabaseStreamBuilder`. The stream
*filters* and *modifiers* are registered under
`database.using_filters.*` and `using_modifiers.*`, but `stream()`
itself is not a capability.
4. **Storage retry configuration** —
`StorageClientOptions.retryAttempts` and `StorageRetryController`.
`database.configuration.auto_retry` exists; there is no storage
equivalent.
5. **`realtime.subscriptions.postgres_changes_multiple_filters`** is the
one remaining undeclared feature, and Dart implements it
(`onPostgresChanges(filters: [...])`). Declaring it needs
`RealtimeChannel.onPostgresChanges` registered against two features, so
it is left out here rather than adding a duplicate registration.

Two more judgement calls worth flagging:

- **`RealtimeClient` exposes transport internals** — `sendBuffer`,
`stateChangeCallbacks`, `pendingHeartbeatRef`, `makeRef`, `ref`, `push`,
`heartbeatTimer`, `reconnectTimer`, and
`RealtimeChannel.canPush`/`trigger`. Registered here because they are
genuinely exported, but they read like `@internal` candidates for a
future breaking change.
- **`yet_another_json_isolate`** contributes 13 symbols with no Supabase
capability behind them. Registered in the top-level list; it could
instead be excluded from the scan the way `supabase_common` is.

## Test plan

- [x] `dart analyze packages/`: **No issues found.** This is the real
gate for `invalid_internal_annotation`, `invalid_use_of_internal_member`
and `invalid_export_of_internal_element`.
- [x] Compliance validator: `OK — compliance file is valid.`
- [x] `check-drift`: `✅ No capability matrix drift detected.`
- [x] `check-api-symbols` against #1671 as base: `✅ All new public API
symbols are covered in the capability matrix.` Nothing registered was
removed, and nothing new is uncovered.
- [x] Uncovered symbol count recomputed from a fresh extraction: **0**.
- [x] Checked for symbols registered in more than one place: 9, all
pre-existing and deliberate (one method serving two capabilities, e.g.
`StorageFileApi.move` for `move` and `move_cross_bucket`). This change
adds none.
- [x] `dart format packages/`: 0 changed.
- [x] Tests, all passing: `gotrue` 471, `realtime_client` 205,
`postgrest` 196, `supabase` 134, `storage_client` 210,
`supabase_flutter` 65, `functions_client` 48. `postgrest` needs `-j 1`;
run in parallel its test files race on the shared database reset helper,
which varies the failure count run to run on unmodified code.


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **API Improvements**
- Clarified which lower-level SDK helpers are intended for internal use,
improving API guidance and tooling.
- Explicitly exposed realtime PostgreSQL column and type definitions for
supported integrations.

- **Compatibility**
- Expanded SDK capability validation across authentication, database,
storage, realtime, functions, persistence, passkeys, and client
features.
- Added broader coverage for public models, builders, responses, errors,
enums, and utility types.

- **Bug Fixes**
  - Improved type safety for persisted session data handling.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
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.

2 participants