Repository navigation
feat: CI check 1 — block PRs adding public API not in capability matrix - #31
Conversation
Implements SDK-992. Adds a reusable GitHub Actions workflow that parses
the TypeScript public API of an SDK, diffs it against the base branch,
and fails with an actionable error if any new public symbol is not
registered in sdk-compliance.yaml.
Key pieces:
- `src/ts-parser.ts`: syntactic TS AST walker (no type-resolution, works
without node_modules installed in the SDK repo)
- `src/parse-ts.ts`: CLI — takes SDK root path, emits ParseResult JSON
- `src/api-check.ts`: diff logic — `checkNewSymbols(base, pr, compliance)`
- `src/check-api-symbols.ts`: CLI — compares two ParseResult files against
sdk-compliance.yaml, exits 1 with a clear error on uncovered symbols
- `.github/workflows/check-api-compliance.yml`: reusable workflow for SDK
repos; checks out PR + base branches, runs both parsers, runs the check
- `src/compliance.ts`: adds `symbols?: string[]` to ComplianceEntry and
RawValue; validates the field; adds `buildSymbolIndex` helper
- `src/types.ts`: adds `symbols?: string[]` to ComplianceEntry
SDK repos opt in by calling the reusable workflow on pull_request and
annotating sdk-compliance.yaml entries with the SDK symbol names:
auth.sign_up:
status: implemented
symbols:
- GoTrueClient.signUp
58 tests pass, typecheck clean.
- src/swift-parser.ts: line-by-line Swift AST scanner with brace-depth context tracking. Handles public/open/nonisolated class/struct/actor/ enum/protocol, extensions (including dotted names like AuthClient.Configuration), public func/var/let/typealias/init. Skips Tests/ and TestHelpers/ directories. - src/parse-swift.ts: CLI wrapper (same contract as parse-ts.ts) - package.json: adds parse-swift script - check-api-compliance.yml: reads sdk: field from compliance file and dispatches to parse-ts or parse-swift accordingly 26 new Swift parser tests; full suite 84/84.
There was a problem hiding this comment.
Given the nature of the places that this runs and the method by which I assume the code has been generated (mostly AI, I'm guessing), this feels like one of those things it's better to "get out there" so we can "suck it and see" (it's low risk, only bringing benefits 💪). The proof'll be in the pudding as this amount of new code here is difficult to quickly review without having seen your planning and development process (full input context).
The main principle I would stick to is "fail early and loudly" - both in terms of setup/prerequisites and in terms of the checks themselves. This should be as brittle as possible at runtime so we can iterate spot the pain points early so they can be fixed in smaller, isolated moves as our landscape morphs.
|
Approving this, but I tend to use this https://github.com/supabase/supabase-js/blob/master/scripts/audit-sdk-compliance.ts for the js sdk repo, which looks at the |
github.workflow_sha returns a SHA that is not directly fetchable via git (likely an internal merge-evaluation commit). Extract the branch ref from github.workflow_ref (e.g. refs/heads/main) instead — this is always a real ref that actions/checkout can resolve.
github.workflow_ref in a reusable workflow context gives the calling repo's event ref (e.g. refs/pull/N/merge), not the workflow file's own ref in supabase/sdk. Add an explicit sdk-ref input (default: main) so callers can pin the scripts version during pre-merge testing.
npm run writes "> package@version script" to stdout, which pollutes the JSON output redirected to pr-symbols.json / base-symbols.json. Add --silent to suppress it.
… parse steps
Instead of detecting the language from sdk-compliance.yaml at runtime,
require callers to declare it as a required input. This removes the
detect step and collapses 4 conditional parse steps into 2 unconditional
ones using parse-${{ inputs.language }}.
…nguage Direct interpolation of inputs.language into the script name breaks for javascript (command is parse-ts). Add a resolve step with a case statement that maps language → command and emits a descriptive error for unsupported values.
- Document `symbols` field in sdk-compliance.yaml format (added in #31) - Update opt-in workflow example with required `language` input - Expand opt-in section to describe both CI checks (compliance + public API) - Add `validate:online` to local dev command table - Update CI table: validate-capabilities.yml now runs nightly with two tiers; validate-sdk-compliance.yml now includes the public API check (merged from #33) - Add 7 new source files to CLAUDE.md architecture section: ts-parser, swift-parser, parse-ts, parse-swift, parse-ignore, api-check, check-api-symbols
🤖 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>
Closes SDK-992.
What changed
Implements a reusable GitHub Actions workflow that SDK repos call on
pull_requestto block merges when a new public symbol is added without a corresponding entry in the capability matrix. Supports TypeScript and Swift SDKs. Pilot: supabase/supabase-swift#1026.New modules (
scripts/capability-matrix/src/)ts-parser.tsts.createSourceFile(no type-resolution, works withoutnode_modulesin the SDK).swift-parser.tspublic/open/nonisolated public, extensions (including dotted names likeAuthClient.Configuration),func/var/let/typealias/init.parse-ts.ts/parse-swift.tsnpm run parse-ts -- /path/to/sdk→ParseResultJSON on stdoutapi-check.tscheckNewSymbols(base, pr, compliance)— diffs two symbol sets, checks new ones against thesymbolsindex. Also detects removed registered symbols (stale compliance entries).check-api-symbols.tscheck-api-symbols pr.json base.json compliance.yaml— exits 1 with actionable messages for uncovered new symbols or removed registered onesparse-ignore.tsloadIgnore(root)— loadssdk-parse-ignorefrom the project root using theignorepackage (standard gitignore semantics). Returns empty instance if file is absent.Extended schema
sdk-compliance.yamlentries accept an optionalsymbolsarray mapping capability features to SDK symbol names:buildSymbolIndexincompliance.tsinverts this into aMap<symbolName, featureId>used by the CI check.sdk-parse-ignore— per-SDK file exclusionEach SDK repo can place an
sdk-parse-ignorefile (gitignore format) alongsidesdk-compliance.yamlto control which files the parser skips. Replaces hardcodedSKIP_DIRS/TEST_DIRSconstants in both parsers.File is optional — absent means no filtering.
Reusable workflow
.github/workflows/check-api-compliance.yml— SDK repos opt in:The workflow:
sdk:field insdk-compliance.yamlcheck-api-symbols— fails with actionable output on:Error output (new symbol):
Error output (removed symbol):
Test plan
npm test)npm run typecheck)