Skip to content

feat: track removed registered symbols in api compliance check - #32

Merged
grdsdev merged 1 commit into
claude/elegant-ptolemy-c2121dfrom
feat/track-removed-api-symbols
Jun 18, 2026
Merged

grdsdev merged 1 commit into
claude/elegant-ptolemy-c2121dfrom
feat/track-removed-api-symbols

Conversation

@grdsdev

@grdsdev grdsdev commented Jun 18, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Extends CheckResult with removedRegisteredSymbols: Array<{ symbol, featureId }> — symbols present in the base branch that are gone in the PR and are registered in sdk-compliance.yaml
  • Adds formatRemovedMessage to produce an actionable error with the feature ID for each stale entry
  • Updates the CLI (check-api-symbols) to hard-fail when registered symbols are removed, printing both failure types in a single run
  • 13 tests covering the new logic (4 for checkNewSymbols, 2 for formatRemovedMessage)

Behaviour

When a PR removes a public symbol that is registered in the compliance file, CI now fails with:

❌ Capability matrix check failed
Registered public API was removed — sdk-compliance.yaml is now stale:
  - AuthClient.signInWithPassphrase (swift) → auth.sign_in.passphrase

Update the affected feature entries in sdk-compliance.yaml:
  - Remove the symbol from the symbols list
  - Update the status if the feature is no longer implemented

Both "new uncovered" and "removed stale" errors are reported in the same CI run so the developer can fix everything at once.

@grdsdev
grdsdev requested review from a team as code owners June 18, 2026 15:07
@grdsdev
grdsdev merged commit e63f708 into claude/elegant-ptolemy-c2121d Jun 18, 2026
2 checks passed
@grdsdev
grdsdev deleted the feat/track-removed-api-symbols branch June 18, 2026 15:10
grdsdev added a commit that referenced this pull request Jun 18, 2026
…ix (#31)

* feat: CI check 1 — block PRs adding public API not in capability matrix

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.

* feat: add Swift public API parser and wire up supabase-swift

- 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.

* feat: track removed registered symbols in api compliance check (#32)

* feat: add parse-ignore module — load sdk-parse-ignore via ignore package

* test: fix negation test to use valid gitignore semantics

* test: restore negation test to brief intent (Tests/* pattern)

* refactor: ts-parser uses loadIgnore, removes hardcoded SKIP_DIRS

* refactor: swift-parser uses loadIgnore, removes hardcoded SKIP_DIRS/TEST_DIRS

* test: fix vacuous directory-exclusion test in swift-parser

* chore: remove unused mkdirSync import in ts-parser test

* fix: checkout sdk spec at workflow_sha so scripts match the running workflow

* fix(ci): resolve sdk spec ref from workflow_ref instead of workflow_sha

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.

* fix(ci): use sdk-ref input for capability spec checkout

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.

* fix(ci): silence npm lifecycle banner in parse steps

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.

* refactor(ci): accept language input, drop detect step and conditional 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 }}.

* refactor(ci): map language input to parse command, fail on unknown language

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.
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