Skip to content

Compliance checking tooling and infrastructure for Go - #92

Merged
QuintinWillison merged 3 commits into
mainfrom
go-compliance
Aug 26, 2026
Merged

QuintinWillison merged 3 commits into
mainfrom
go-compliance

Conversation

@QuintinWillison

@QuintinWillison QuintinWillison commented Aug 26, 2026 •

Copy link
Copy Markdown
Member

The contents of this PR are entirely AI generated. It looks sensible to me on a brief skim read, though there's a lot of sdk-repo and other domain knowledge coming together that I have not taken time to independently verify - so the proof will be when it gets first ran end to end - after which we can refine. The risk is low, this is internal tooling, to be utilised by a downstream, internal repository.

Note

The supabase/supabase-go repository is currently Internal, so not visible in the public domain. It will be opened up soon. See https://github.com/orgs/supabase/discussions/49311

🤖 AI-Generated Summary of Local Validations ran thus far...

Every command below was run locally before opening this PR, with output reproduced verbatim. Reading notes: pure navigation (cd, pwd) and blank prompts are elided, a bracketed number in a prompt (for example [1]) is the shell reporting the previous command's exit status, and one output is truncated where marked.

  • Tree under test: this PR's change on top of v1.2.0 (29e402d).
  • Real-world target for steps 2 to 5: the org-internal supabase/supabase-go at 8d47358, clean tree - the only Go SDK carrying an sdk-compliance.yaml today.
  • Environment: Apple Silicon macOS, Go 1.26.6 (go version go1.26.6 darwin/arm64), Node.js 26.7.0 via asdf.

Step 1 - extractor hygiene

Byte-for-byte what the new go-parser CI job runs, from scripts/go_symbol_extractor:

go_symbol_extractor % gofmt -l .
go_symbol_extractor % go vet ./...
go_symbol_extractor % go test ./...
ok      github.com/supabase/sdk/scripts/go_symbol_extractor    0.341s

Formatted, vet-clean, unit suite green. The suite covers a golden walk of a two-module fixture workspace (generics, embedded fields, interfaces, internal/, testdata/, nested modules, package main, _test.go and .sdk-parse-ignore rules), table tests for the ignore matcher and the go.work parser, the -module escape hatch, the missing-workspace error and the package-name-collision failure.

Step 2 - dump a real SDK

go_symbol_extractor % go run . /Users/quintin/code/supabase/supabase-go
{
  "symbols": [
    {
      "name": "configuration.Configuration",
      "kind": "class",
      "file": "core/configuration/configuration.go",
      "line": 42
    },

        [... truncated for this comment: 103 symbols in total across the
         configuration, core, postgrest and supabase packages ...]

    {
      "name": "supabase.New",
      "kind": "function",
      "file": "supabase/client.go",
      "line": 27
    }
  ]
}

This shows, on a real repository: package-qualified names in the registered spelling (postgrest.FilterBuilder.Eq), the ParsedSymbol kinds mapped from Go declarations (types as class, fields as property, funcs and methods, consts and vars as variable), root-relative paths with line numbers and name-sorted output. The exclusions hold too: no internal/ packages, no test files, no tooling modules, and unexported members are absent (postgrest.Query appears while its unexported interface method does not).

Step 3 - prepare the comparison inputs

Steps 4 and 5 compare files. These four commands created them (no output from any):

go_symbol_extractor % go run . /Users/quintin/code/supabase/supabase-go | jq -r '.symbols[].name' | sort -u > /tmp/dump-names.txt
go_symbol_extractor % grep -E '^      - ' /Users/quintin/code/supabase/supabase-go/sdk-compliance.yaml | sed 's/^      - //' | sort -u > /tmp/registered-names.txt
go_symbol_extractor % go run . /Users/quintin/code/supabase/supabase-go > /tmp/base-symbols.json
go_symbol_extractor % jq '.symbols += [{"name":"postgrest.Scratch","kind":"function","file":"postgrest/scratch.go","line":1}]' /tmp/base-symbols.json > /tmp/pr-symbols.json
  • dump-names.txt - every symbol name the extractor emits for supabase-go.
  • registered-names.txt - every symbol name registered in supabase-go's sdk-compliance.yaml.
  • base-symbols.json - the dump verbatim, standing in for a pull request's base branch.
  • pr-symbols.json - the dump plus one fabricated symbol, postgrest.Scratch, which exists in no source file and no registration. It is planted so that step 5 has an unregistered addition to catch: the ❌ there is that test passing.

Step 4 - every registered symbol resolves against the dump

Set difference: any registered name missing from the dump would print.

go_symbol_extractor % comm -23 /tmp/registered-names.txt /tmp/dump-names.txt
go_symbol_extractor %

Empty. All 52 distinct registered names (53 registrations - one symbol sits under two features) resolve, so the package-qualified name contract holds against the one real Go compliance file with no respell needed.

Step 5 - end to end through the canonical check-api-symbols CLI

Two runs against the step 3 dumps: the pair differing only by the planted postgrest.Scratch, where ❌ is the wanted outcome, then the identical pair, expected clean. The transcript keeps the one-time environment setup hit on the way (asdf Node pin, then installing the validator's dependencies) since anyone reproducing this will hit it too:

capability-matrix % npm run check-api-symbols -- /tmp/pr-symbols.json /tmp/base-symbols.json /Users/quintin/code/supabase/supabase-go/sdk-compliance.yaml
No version is set for nodejs; please run `asdf set [options] nodejs <version>`
[1] capability-matrix % asdf install nodejs 26.7.0
Trying to update node-build... ok
To follow progress, use 'tail -f /var/folders/ls/qqf2gl5j4qd198qcd_11ygqc0000gn/T/node-build.20260825191621.40240.log' or pass --verbose
Downloading node-v26.7.0-darwin-arm64.tar.gz...
-> https://nodejs.org/dist/v26.7.0/node-v26.7.0-darwin-arm64.tar.gz
Installing node-v26.7.0-darwin-arm64...
Installed node-v26.7.0-darwin-arm64 to /Users/quintin/.asdf/installs/nodejs/26.7.0

capability-matrix % asdf set nodejs 26.7.0
capability-matrix % npm run check-api-symbols -- /tmp/pr-symbols.json /tmp/base-symbols.json /Users/quintin/code/supabase/supabase-go/sdk-compliance.yaml

> @supabase/[email protected] check-api-symbols
> tsx src/check-api-symbols.ts /tmp/pr-symbols.json /tmp/base-symbols.json /Users/quintin/code/supabase/supabase-go/sdk-compliance.yaml

sh: tsx: command not found
[127] capability-matrix % npm ci

added 78 packages, and audited 79 packages in 7s

21 packages are looking for funding
  run `npm fund` for details

1 high severity vulnerability

To address all issues, run:
  npm audit fix

Run `npm audit` for details.
npm warn install-scripts 2 packages have install scripts not yet covered by allowScripts:
npm warn install-scripts   [email protected] (postinstall: node install.js)
npm warn install-scripts   [email protected] (install: (install scripts present))
npm warn install-scripts
npm warn install-scripts Run `npm install-scripts ls` to review, or `npm install-scripts approve <pkg>` to allow.
capability-matrix % npm run check-api-symbols -- /tmp/pr-symbols.json /tmp/base-symbols.json /Users/quintin/code/supabase/supabase-go/sdk-compliance.yaml

> @supabase/[email protected] check-api-symbols
> tsx src/check-api-symbols.ts /tmp/pr-symbols.json /tmp/base-symbols.json /Users/quintin/code/supabase/supabase-go/sdk-compliance.yaml

❌ Capability matrix check failed
New public API detected that is not in the capability matrix:
  - postgrest.Scratch (go)
    defined at: postgrest/scratch.go:1

Register each symbol in sdk-compliance.yaml under the feature it belongs to:

  auth.my_feature:
    status: implemented
    symbols:
      - GoTrueClient.myFeature
    supporting_symbols:
      - MyFeatureOptions
      - MyFeatureResponse

`symbols` is for the entry points a caller invokes. Keep it precise: the
drift check treats every name in it as evidence the capability exists.
Option types, result types, schema models and errors belong under
`supporting_symbols`, which counts for coverage without claiming to
implement anything. Types shared across several features can go in the
top-level `supporting_symbols` list instead of being attributed to one.

If the feature does not exist in the matrix yet, add it there first:
  https://github.com/supabase/sdk/blob/main/CONTRIBUTING.md
[1] capability-matrix % npm run check-api-symbols -- /tmp/base-symbols.json /tmp/base-symbols.json /Users/quintin/code/supabase/supabase-go/sdk-compliance.yaml

> @supabase/[email protected] check-api-symbols
> tsx src/check-api-symbols.ts /tmp/base-symbols.json /tmp/base-symbols.json /Users/quintin/code/supabase/supabase-go/sdk-compliance.yaml

✅ All new public API symbols are covered in the capability matrix.
capability-matrix %

Exactly as intended: the dump is directly consumable by the canonical checker, the planted unregistered symbol blocks with exit 1 and an actionable message carrying its file and line straight from the dump, and the unchanged pair passes. The npm audit and allowScripts warnings are the validator's own pre-existing development-dependency posture, untouched by this PR.

Not exercised locally

The two workflow files only execute on GitHub. go-parser runs on this PR itself via the validate-capabilities.yml paths filter, and validate-sdk-compliance-go.yml is workflow_call-only, so its first execution comes from a calling repository - the sdk-ref input exists for exactly that pre-merge trial from a branch.

@QuintinWillison QuintinWillison self-assigned this Aug 26, 2026
@coderabbitai

coderabbitai Bot commented Aug 26, 2026 •

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: dd41f4e4-645e-4d55-8e52-d0a1e177ae25


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.

QuintinWillison and others added 2 commits August 26, 2026 12:22
Resolving:
validate / Check public API against capability matrix
Restore cache failed: Dependencies file is not found in /home/runner/work/supabase-go/supabase-go. Supported file pattern: go.mod
@QuintinWillison

Copy link
Copy Markdown
Member Author

Proven end-to-end in this run via supabase/supabase-go#48

@QuintinWillison
QuintinWillison marked this pull request as ready for review August 26, 2026 11:39
@QuintinWillison
QuintinWillison requested review from a team as code owners August 26, 2026 11:39

@grdsdev grdsdev left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@QuintinWillison
QuintinWillison merged commit 32e39e9 into main Aug 26, 2026
6 checks passed
@QuintinWillison
QuintinWillison deleted the go-compliance branch August 26, 2026 14:02
spydon added a commit that referenced this pull request Aug 26, 2026
## What

Restructures the repository into a lightweight monorepo (no Nx or
similar tooling): one `packages/` directory of flat sibling packages,
each with a single toolchain.

```
packages/
  capability-matrix/       # TypeScript — capability data + validator + site generator
    capabilities/          # moved from repo root
    specs/                 # moved from repo root
    schema/                # moved from repo root
    docs/                  # moved from repo root
    src/, test/, ...       # moved from scripts/capability-matrix
  dart-symbol-extractor/   # Dart — moved from scripts/dart_symbol_extractor
                           # (directory hyphenated; Dart package name keeps underscores)
  go-symbol-extractor/     # Go — moved from scripts/go_symbol_extractor (added on main
                           # in #92 and folded into the new layout on rebase)
  postgrest-typegen/       # empty scaffold — will generate types from PostgREST
                           # schemas; implementation comes later
```

All moves use `git mv`, so history follows the files. The capability
data (`capabilities/`, `specs/`, `schema/`, `docs/`) now lives inside
the package that consumes it, and the TypeScript root-resolution helpers
(`repoRoot()` in `cli.ts`, `compliance-cli.ts`, `aggregate.ts`,
`generate-site.ts`, `sync-compliance-cli.ts`) were changed to a
`packageRoot()` that resolves one level up from `src/`. GitHub blob URLs
emitted by the tools (spec links in the site, the drift-check docs link)
were updated to the new paths. The Go extractor's `go.mod` module path
was updated to `github.com/supabase/sdk/packages/go-symbol-extractor`.

## Rationale

- One `packages/` directory keeps the repository ready to host more
projects (the postgrest-typegen scaffold is the first addition) without
adopting workspace or monorepo build tooling.
- Flat siblings, one toolchain per package: npm/Vitest for
capability-matrix, pub/dart test for dart-symbol-extractor, the Go
toolchain for go-symbol-extractor. No cross-package dependency
management is needed.
- Each package is self-contained: the capability YAML data moved next to
the validator that reads it.

## External interface: unchanged

`.github/workflows/` and `.github/actions/` did **not** move, and no
externally consumed name changed:

- `validate-sdk-compliance-{dart,javascript,python,swift,go}.yml` and
`sync-sdk-compliance.yml` keep their exact names and locations (called
by supabase-flutter/js/py/swift as
`supabase/sdk/.github/workflows/<name>@<ref>`).
- The `sdk-compliance-{validate,check-setup,check-symbols,check-drift}`
composite actions keep their exact names and locations (referenced as
`supabase/sdk/.github/actions/<name>@main`).
- Inside those workflows and actions, every `working-directory`/path
reference flipped from `_sdk-spec/scripts/...` to
`_sdk-spec/packages/...` in this same commit, so the composite actions
and the scripts they check out flip together atomically. `grep -r
"scripts/" .github/` returns nothing.

**Compatibility symlinks:** the SDK repos pin the reusable workflows to
release SHAs (v1.1.x/v1.2.0) while the `sdk-ref` input for the
`_sdk-spec` checkout defaults to `main`. Those pinned workflow
definitions reference `_sdk-spec/scripts/...` inline, so the old paths
must keep resolving in a `main` checkout. `scripts/capability-matrix`
and `scripts/dart_symbol_extractor` are therefore kept as symlinks into
`packages/`. They can be removed once every caller has bumped past the
restructure release (Dependabot picks up the next tag). No symlink is
needed for the Go extractor: `validate-sdk-compliance-go.yml` is newer
than the latest release, so no caller pins a pre-monorepo revision of it
(verified by code search).

## Internal workflow renames

Two workflows are only triggered inside this repo and were renamed with
a project prefix (verified via code search that no external repository
references them):

- `validate-capabilities.yml` → `capability-matrix-validate.yml`
(display name `Validate Capabilities` kept, since `release.yml` triggers
on it via `workflow_run`)
- `deploy-pages.yml` → `capability-matrix-deploy-pages.yml`

Path filters and `working-directory` values in both now use
`packages/capability-matrix/**`, `packages/dart-symbol-extractor/**`,
and `packages/go-symbol-extractor/**`. The Pages build now aggregates
and uploads from `packages/capability-matrix/site/`.

Docs were updated accordingly: the root README is now a repository
overview with a package index (the capability-matrix content moved to
`packages/capability-matrix/README.md`), plus path updates in
CONTRIBUTING.md, CLAUDE.md, CODEOWNERS (per-directory package
ownership), `.gitignore`, and the capability-matrix project skill.
Action pins are untouched.

## Test results

- `packages/capability-matrix`: `npm ci`, `npm test` (14 files, 195
tests passed), `npm run typecheck`, `npm run validate` all pass.
- `packages/dart-symbol-extractor`: `dart pub get`, `dart test` (14
tests passed), `dart format` (no changes), `dart analyze` (no issues).
- `packages/go-symbol-extractor`: `gofmt` (no changes), `go vet`, `go
test ./...` all pass.
- Smoke checks through the compatibility symlinks: `npm run validate`,
`npm run report`, and `npm run validate-compliance` against
supabase-flutter's `sdk-compliance.yaml` from
`scripts/capability-matrix`, and `dart run bin/extract.dart` against a
local supabase-flutter checkout from `scripts/dart_symbol_extractor`,
all work.
- `npm run build-site` renders to
`packages/capability-matrix/site/index.html` (gitignored).

## Post-merge verification

After merge, trigger one caller repository's compliance workflow (for
example supabase-flutter's `validate-capabilities.yml` via
`workflow_dispatch`) to confirm the cross-repository paths: the pinned
reusable workflow should resolve the old `scripts/` paths through the
symlinks, and the `@main` composite actions should resolve the new
`packages/` paths.
@spydon spydon mentioned this pull request Aug 27, 2026
spydon added a commit that referenced this pull request Aug 27, 2026
## What

Empty commit carrying a `Release-As: 1.3.0` footer, to force
release-please to cut a `v1.3.0` tag.

## Why

Two commits have landed since `v1.2.0`, and neither is releasable by
release-please:

| Commit | Subject | Why no bump |
|---|---|---|
| `32e39e9` | Compliance checking tooling and infrastructure for Go
(#92) | no conventional commit prefix |
| `2097c67` | `chore(repo):` restructure into packages/ monorepo layout
(#93) | `chore` does not bump |

So no release PR was opened and there is no post-restructure tag. That
blocks the SDK repos: `supabase-flutter` and `supabase-swift` pin
`v1.2.0`, `supabase-js` and `supabase-py` pin `v1.1.1`, all
pre-restructure. Their pinned workflow bodies hardcode
`_sdk-spec/scripts/...` while the composite actions they call are
`@main` and check out this repo at `main`, so the transitional
`scripts/` symlinks are currently load-bearing. A `v1.3.0` tag gives
those repos something to bump to, after which `scripts/` can be deleted.

Minor rather than patch because #92 added the Go compliance tooling, a
new feature. The externally consumed interface (reusable workflow names,
composite action names and inputs) did not change in #93.

## Note

The generated changelog entry for 1.3.0 will be thin, since the two
underlying commits are not changelog-eligible. Worth hand-editing the
release notes afterwards to mention the Go tooling and the `packages/`
restructure.

Release-As: 1.3.0
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