feat(parsers): replace Swift regex parser with swift-symbolgraph-extract - #38
Conversation
7cb1a77 to
5f182e3
Compare
Replaces the regex-based swift-parser with swift-symbolgraph-extract, the Swift compiler's own tool for public API surface extraction.
ca944df to
4471c55
Compare
spydon
left a comment
There was a problem hiding this comment.
Can't we use the swift package dump-symbol-graph instead of going as low-level as we do in this PR?
swift package dump-symbol-graph \
--minimum-access-level public \
--skip-synthesized-members \
--output-directory ./symbolgraph
…raph Replaces the manual swift build + module-discovery loop + swift-symbolgraph-extract invocation with a single `swift package dump-symbol-graph` call, which handles build, module discovery, and extraction internally.
|
Good call — replaced the manual 🤖 Addressed by Claude Code |
…e dump-symbol-graph) swift package dump-symbol-graph always writes to .build/<triple>/symbolgraph. Locate it with `find .build -maxdepth 3 -type d -name "symbolgraph"` instead.
swift package dump-symbol-graph tries all targets including test targets. Test modules can't be loaded in CI SDK search paths. Library target files land before the test-target attempt, so || true lets the step continue. Guard ensures the step still fails if zero files were produced.
spydon
left a comment
There was a problem hiding this comment.
The symbol graph should be regenerated with swift package dump-symbol-graph --minimum-access-level public --skip-synthesized-members I think?
If you do that the the access-filter assertions can be dropped.
…filter assertions Regenerate symbolgraph-sample.json with swift package dump-symbol-graph --minimum-access-level public --skip-synthesized-members. The fixture now reflects actual CI output: only public/open symbols, no InternalClass. Remove the access-filter test block and the "excludes InternalClass" smoke test — with --minimum-access-level public enforced upstream, those inputs can never arrive at the normalizer.
|
Done in commit a88c801 — fixture regenerated with 🤖 Addressed by Claude Code |
--minimum-access-level public on dump-symbol-graph ensures only public/open symbols reach the normalizer. Remove the accessLevel field from SymbolGraphSymbol and the redundant filter loop in normalizeSymbolGraph.
…icts Merge origin/main (PRs #37–#40) into this branch: - #37: sdk-parse-ignore → .sdk-parse-ignore (already synced) - #38: Dart symbol extractor - #39: Swift symbolgraph parser (replaces regex parser, deletes swift-parser.test.ts) - #40: CODEOWNERS, README, CLAUDE.md updates Conflict resolutions: - package.json: keep both normalize-griffe (ours) and normalize-symbolgraph (main) - validate-sdk-compliance.yml: add Python steps alongside Dart/Swift symbolgraph steps; conditions on Resolve/Parse steps now exclude python, swift, and dart
🤖 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>
Summary
Replaces the handrolled
swift-parser.ts(a ~170-line regex scanner with brace-depth tracking) withswift package dump-symbol-graph— the Swift compiler's own tool for public API surface extraction — and a thin TypeScript normalizer.Why
The regex parser had known blind spots: multi-line declarations,
#ifconditional compilation, attributes spanning lines, and could not model access control semantics (@_spi,@usableFromInline, re-exports). Root cause: regex cannot reliably parse Swift.swift package dump-symbol-graphuses the Swift compiler and gets it right by construction.Approach
Changes
Added
src/normalize-symbolgraph.ts— core normalizer:SymbolGraphSymbol[]→ParseResultsrc/normalize-symbolgraph-cli.ts— CLI entry point (npm run normalize-symbolgraph)test/normalize-symbolgraph.test.ts— 103 tests (kind mapping, name construction, file path, fixture smoke tests)test/fixtures/symbolgraph-sample.json— realdump-symbol-graphoutput (17 symbols, public/open only)Removed
src/swift-parser.ts,src/parse-swift.ts— regex parsertest/swift-parser.test.ts— regex parser testsModified
.github/workflows/validate-sdk-compliance.yml— Swift-conditional steps:macos-latestrunner,swift package dump-symbol-graph,jqmerge, normalizer dispatch; existing parse steps guarded for onlyjavascript;actions/cacheSHA-pinned; Dart steps from feat(parsers): add Dart public API parser via package:analyzer (alternative to #35) #41 integratedpackage.json—normalize-symbolgraphreplacesparse-swiftKey decisions
--minimum-access-level public: filters at source, so the normalizer needs no access-level check of its own--skip-synthesized-members: prevents_Concurrencyprotocol conformance methods (e.g.withSerialExecutor) from generating false-positive "new symbol" CI failures when a PR adds a newpublic actor|| trueon extraction:dump-symbol-graphalso tries test targets, which can fail to load on CI runners; library targets land before the test-target attempt, so|| true+ a file-count guard lets the step continue correctlymacos-latestrunner: Swift is pre-installed; avoidsswift-actions/setup-swiftoverhead on ubuntuTest plan
npm test— 11 files)npm run typecheck)dump-symbol-graph --minimum-access-level publicoutput (not hand-authored)validateandcheckjobs)