Skip to content

fix(dart-extractor): exclude @internal symbols from the public API surface - #54

Merged
spydon merged 1 commit into
mainfrom
fix/dart-extractor-respect-internal
Jul 1, 2026
Merged

spydon merged 1 commit into
mainfrom
fix/dart-extractor-respect-internal

Conversation

@spydon

@spydon spydon commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

What

The Dart symbol extractor now skips declarations and members annotated with @internal (from package:meta), excluding them from the extracted public API surface.

Why

The extractor is purely syntactic and name-based: it treats every non-underscore declaration under lib/** as public API. But @internal is the canonical Dart marker for a symbol that is public by the underscore rule yet explicitly not part of the package's public API (typically a lib/src helper that is not exported from the package's public library).

Today those symbols are false positives. The only escape hatch is listing individual files in .sdk-parse-ignore by hand, which is easy to forget and drifts out of sync with the code. Honouring @internal lets the annotation on the declaration be the single source of truth.

This came up in supabase-flutter: a new internal helper RetryTimer.cancel in packages/realtime_client/lib/src/retry_timer.dart (a lib/src class that is not exported) tripped the capability-matrix check even though it is not public API.

What changed

  • extractFromSource skips any top-level declaration whose metadata contains @internal.
  • _emitContainer skips any member (method, field, constructor) annotated with @internal.
  • Matching is syntactic by annotation name, so both the bare @internal and a prefixed @meta.internal are recognised, consistent with the rest of the parser not resolving elements.

Tests

Added a test covering an @internal class, an @internal method, an @meta.internal field, and an @internal top-level function, asserting each is excluded while sibling public symbols are still captured. All existing extractor tests pass.

Note

Symbols marked @internal will now disappear from generated symbol sets. That is the intended effect, and it also means some entries in consumer .sdk-parse-ignore files can be replaced by an @internal annotation on the declaration over time.

…lic API surface

The Dart symbol extractor treats every non-underscore declaration under
lib/** as public API. Symbols annotated with @internal (from package:meta)
are public by Dart's underscore rule but are explicitly not part of the
package's public API, so they were false positives that had to be listed
by hand in .sdk-parse-ignore.

Skip any top-level declaration or member carrying @internal (bare or via
an import prefix such as @meta.internal), matched syntactically by name
since parsing does not resolve elements.
@spydon
spydon requested a review from a team as a code owner July 1, 2026 16:29
@spydon
spydon merged commit 9bd358e into main Jul 1, 2026
3 checks passed
@spydon
spydon deleted the fix/dart-extractor-respect-internal branch July 1, 2026 16:43
spydon added a commit to supabase/supabase-flutter that referenced this pull request Jul 2, 2026
…arse-ignore (#1510)

## What

Replaces the three `.sdk-parse-ignore` entries for the clear-auth-url
helpers with `@internal` annotations on the declarations, and removes
those entries.

## Why

The SDK capability-matrix symbol extractor now honours `@internal` (from
`package:meta`), see supabase/sdk#54. Before that, the extractor treated
every non-underscore `lib/src` declaration as public API, so the
internal auth-url helpers had to be excluded by path in
`.sdk-parse-ignore`.

`@internal` on the declaration is a better source of truth than a
hand-maintained path list: it lives next to the code, travels with
refactors, and documents intent directly.

## What changed

- `removeAuthParametersFromUrl` (`clear_auth_url_parameters.dart`)
marked `@internal`.
- `clearAuthUrlParameters` in both conditional-import shims
(`clear_auth_url_parameters_web.dart`,
`clear_auth_url_parameters_stub.dart`) marked `@internal`.
- Removed the three entries from `.sdk-parse-ignore`; its header now
points to `@internal` as the preferred mechanism and reserves the file
for paths that cannot carry the annotation (for example generated
sources).

All three symbols are used only within `supabase_flutter`, so
`@internal` produces no cross-package analyzer warnings. Verified
against the updated extractor that the package no longer emits these
symbols while its other 466 public symbols are unchanged.
grdsdev pushed a commit that referenced this pull request Aug 12, 2026
🤖 I have created a release *beep* *boop*
---


## [1.0.0](v1.0.0...v1.0.0)
(2026-08-12)


### ⚠ BREAKING CHANGES

* reconcile capability matrix inconsistencies from skill audit
([#74](#74))

### Features

* add capabilities based on supabase-js public methods
([#19](#19))
([8b07e38](8b07e38))
* add capability-matrix maintenance skill
([#73](#73))
([070e2c9](070e2c9))
* add review-spec and review-spec-compliance skills
([#6](#6))
([b2646c1](b2646c1))
* add SDK implementation status matrix to README and skill
([#4](#4))
([753f06c](753f06c))
* **api-check:** include file path and line number in compliance failure
messages ([#45](#45))
([2f4be47](2f4be47))
* **auth:** add sign-out reason capability
([#47](#47))
([51a3abd](51a3abd))
* canonical SDK capability matrix
([#8](#8))
([215bc3e](215bc3e))
* **capability-matrix:** strict cross-SDK parity score + coverage scope
([#63](#63))
([de1abe1](de1abe1))
* CI check 1 — block PRs adding public API not in capability matrix
([#31](#31))
([293440c](293440c))
* **compliance:** list undeclared features after validation
([#48](#48))
([29f396a](29f396a))
* **compliance:** list undeclared features as notes after validation
([29f396a](29f396a))
* **compliance:** split symbol evidence from symbol coverage
([#75](#75))
([abc8e71](abc8e71))
* initial SDK specs, skills, and install script
([e662b17](e662b17))
* move SDK compliance to per-repo files
([#15](#15))
([4d32675](4d32675))
* **parsers:** add Dart public API parser via package:analyzer
(alternative to [#35](#35))
([#41](#41))
([e3ba07a](e3ba07a))
* **parsers:** add griffe-based Python public API surface parser
([#36](#36))
([c44f836](c44f836))
* **parsers:** replace Swift regex parser with swift-symbolgraph-extract
([#38](#38))
([80529a7](80529a7))
* **realtime:** add multiple postgres_changes filters capability
([#70](#70))
([825ab0c](825ab0c))
* reconcile capability matrix inconsistencies from skill audit
([#74](#74))
([9c53a70](9c53a70))
* rename sdk-parse-ignore to .sdk-parse-ignore
([#37](#37))
([4f4ab61](4f4ab61))
* render symbol names as clickable links in capability matrix
([#14](#14))
([dcaf122](dcaf122))
* show feature description as visible sub-text in capability matrix
([#13](#13))
([3a750ab](3a750ab))
* **site:** serve compliance.json with precomputed parity from GitHub
Pages ([#46](#46))
([0d9106c](0d9106c))
* **storage:** add purge_cache and purge_bucket_cache canonical
capabilities ([#44](#44))
([9a6f864](9a6f864))
* **storage:** add storage.errors.error_codes capability
([#71](#71))
([fabb9a7](fabb9a7))
* **storage:** add the five missing Iceberg catalog capabilities
([#76](#76))
([c3c8f9e](c3c8f9e))


### Bug Fixes

* **aggregate:** point csharp and go SDKs at correct repo slugs
([#62](#62))
([8b7320f](8b7320f))
* **aggregate:** point kotlin SDK at supabase-community/supabase-kt
([#61](#61))
([b1a99e9](b1a99e9))
* **capability-matrix:** correct coverage scope metric description
([#64](#64))
([5daeaf5](5daeaf5))
* **ci:** repair python pipeline and simplify sdk-compliance workflow
([#42](#42))
([2140f44](2140f44))
* **ci:** use nx to run docs:json so workspace deps are built first
([#56](#56))
([9b449bb](9b449bb))
* **dart-extractor:** exclude
[@internal-annotated](https://github.com/internal-annotated) symbols
from the public API surface
([9bd358e](9bd358e))
* **dart-extractor:** exclude [@internal](https://github.com/internal)
symbols from the public API surface
([#54](#54))
([9bd358e](9bd358e))
* remove broken sticky thead, add scroll-margin-top and group-row
borders ([#10](#10))
([68761cd](68761cd))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: supabase-releaser[bot] <223506987+supabase-releaser[bot]@users.noreply.github.com>
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