Skip to content

chore(repo): restructure into packages/ monorepo layout - #93

Merged
spydon merged 2 commits into
mainfrom
chore/monorepo-restructure
Aug 26, 2026
Merged

spydon merged 2 commits into
mainfrom
chore/monorepo-restructure

Conversation

@spydon

@spydon spydon commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor

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 requested review from a team as code owners August 26, 2026 13:55
@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: 0de3f158-c77c-4fea-83bc-78005b7c4375


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.

@spydon
spydon force-pushed the chore/monorepo-restructure branch from 5f5452f to f4fdb82 Compare August 26, 2026 14:10
@spydon
spydon merged commit 2097c67 into main Aug 26, 2026
6 checks passed
@spydon
spydon deleted the chore/monorepo-restructure branch August 26, 2026 14:12
@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
spydon added a commit to supabase/supabase-flutter that referenced this pull request Aug 28, 2026
## What

Bumps the pinned `supabase/sdk` reusable workflow ref from `v1.2.0` to
`v1.3.0`, in both `validate-capabilities.yml` and `sync-compliance.yml`.

## Why

`supabase/sdk` was restructured into a `packages/` monorepo layout
([supabase/sdk#93](supabase/sdk#93)), moving
`scripts/capability-matrix` to `packages/capability-matrix` and
`scripts/dart_symbol_extractor` to `packages/dart-symbol-extractor`.

Pinning there is not fully hermetic: the pinned workflow body comes from
the tag, but the composite actions it calls are referenced `@main` and
check out `supabase/sdk` at `main`. So on `v1.2.0` we get a
post-restructure checkout combined with a workflow body that still
hardcodes `_sdk-spec/scripts/...`. That only works today because
`supabase/sdk` carries transitional `scripts/` → `packages/` symlinks,
which are there purely for pinned callers like this one and are meant to
be deleted.

Bumping to `v1.3.0` puts the workflow body and the checked-out layout
back in agreement, and lets those symlinks be removed upstream.

## Risk

Low. Between `v1.2.0` and `v1.3.0` the reusable workflows changed
**only** in these `scripts/` → `packages/` paths. No input was added,
removed, renamed, or given a new default, so this is a pure ref bump
with no call-site changes needed.

Worth confirming the compliance check job goes green here before merge,
since that is the actual thing being verified.


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Chores**
* Updated automated compliance and capability validation workflows to
use the latest validation standards.
  * Improved consistency and reliability of ongoing project checks.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
spydon added a commit that referenced this pull request Aug 28, 2026
## ⚠️ Do not merge until all four caller bump PRs are merged

This PR removes the compatibility layer that pinned callers depend on.
Merging it early breaks the compliance check on any SDK repo that has
not yet bumped.

| Repo | Bump PR | Status |
| --- | --- | --- |
| supabase-flutter | supabase/supabase-flutter#1780 | open, CI green |
| supabase-swift | supabase/supabase-swift#1297 | open, CI green |
| supabase-js | supabase/supabase-js#2636 | open, CI green |
| supabase-py | supabase/supabase-py#1595 | open, CI green |

`supabase-go` already tracks `@main` and needs nothing.

## What

Removes the two transitional symlinks left behind by the `packages/`
restructure (#93):

```
scripts/capability-matrix      -> ../packages/capability-matrix
scripts/dart_symbol_extractor  -> ../packages/dart-symbol-extractor
```

With both gone, `scripts/` is empty and disappears.

Follow-on cleanup of the same concept:

- **`README.md`** — drops the `scripts/` entry from the repository
layout block.
- **`CLAUDE.md`** — drops the paragraph explaining the symlinks and when
to remove them.
- **`sdk-ref` input descriptions** (5 reusable workflows + 2 composite
actions) — reworded from "Ref to checkout from supabase/sdk for scripts"
to "... for tooling", since `scripts` no longer names anything.
Description-only, not part of the call contract. Easy to drop from this
PR if you would rather keep the diff to the symlinks alone.

## Why the symlinks existed

Pinning to these reusable workflows is not fully hermetic: the pinned
workflow body comes from the tag, but the composite actions it calls are
referenced `@main` and check out this repo at `main`. After the
restructure, a caller pinned to `v1.2.0` therefore combined a
post-restructure checkout with a workflow body still hardcoding
`_sdk-spec/scripts/...`. The symlinks bridged exactly that gap.

`v1.3.0` was cut (#97, #98) to give callers a post-restructure ref to
pin to, which is what the four PRs above do.

## Verification

- `npm run validate` — OK
- `npm test` — 195 passed (14 files)
- `npm run typecheck` — clean
- `git grep "scripts/"` — no matches anywhere in the repo

The four caller PRs are the real proof: each one's own compliance run
resolves the `packages/` paths against a `main` checkout, and all four
passed.

## Note for later

This class of breakage recurs whenever a path referenced by a pinned
workflow body moves, because the composite actions float on `@main`.
Pinning the `sdk-compliance-*` action refs alongside the workflow ref,
or having the workflows resolve tooling paths dynamically, would make
pinning actually hermetic. Out of scope here.
spydon added a commit that referenced this pull request Aug 28, 2026
… SHA (#107)

## What

Restructures the five reusable `validate-sdk-compliance-*` workflows so
that the composite actions and the capability spec are resolved from the
single supabase/sdk commit the caller pinned the workflow at
(`job.workflow_sha`), instead of being referenced remotely by a
hardcoded SHA or `@main`.

Each job now checks out supabase/sdk once into `_sdk-spec` at
`inputs.sdk-ref || job.workflow_sha` and references the actions locally
(`./_sdk-spec/.github/actions/...`). The actions' own spec checkouts
become transitional no-ops when `sdk-ref` is empty.

## Why

The supabase-go compliance job broke on every PR ([example
run](https://github.com/supabase/supabase-go/actions/runs/33156922333/job/98801800438?pr=55)):

```
An error occurred trying to start process '/usr/bin/bash' with working directory
'.../_sdk-spec/scripts/capability-matrix'. No such file or directory
```

Root cause: `validate-sdk-compliance-go.yml` pins its composite actions
to the v1.2.0 SHA (`29e402da`), whose steps still use the pre-monorepo
`scripts/capability-matrix` paths, while the actions check out the spec
at `sdk-ref` defaulting to `main`. #93 restructured the repo into
`packages/` with compatibility symlinks, and #102 removed the symlinks,
so the frozen action code and the floating spec checkout diverged.

`uses:` cannot carry an expression, so a reusable workflow cannot
remotely reference its sibling actions at its own SHA. The Go workflow
worked around that with a hardcoded previous-release SHA that #93 forgot
to bump; the other language workflows used `@main`, which hides the same
skew and defeats the callers' SHA pins. Checking the repo out at
`job.workflow_sha` (the pattern `sync-sdk-compliance.yml` already uses)
and referencing the actions locally removes the entire failure class:
workflow, action code, and spec always come from one immutable commit.

## Compatibility

- Consumers pinned to v1.3.0 and earlier keep working: those workflow
versions reference the actions remotely and always pass a non-empty
`sdk-ref`, which now triggers the actions' transitional self-checkout
path (against `main`, whose layout matches). The transitional steps and
the actions' `sdk-ref` inputs can be deleted once every consumer is on
the new release.
- `sdk-ref` on the workflows remains as an explicit override for
pre-merge testing; its default changes from `main` to the called
workflow's SHA.
- supabase-go stays broken until it bumps: its pinned v1.3.0 Go workflow
references the actions at the v1.2.0 SHA, which no ref can fix from the
caller side alone. Pinning `sdk-ref: v1.3.0` there is the only stopgap.

## Follow-up after merge

1. Cut a release (v1.4.0) including this change.
2. Bump the reusable-workflow pins in supabase-go (dropping its
`sdk-ref: main` override), then supabase-flutter, supabase-js,
supabase-py, supabase-swift.
3. Once all consumers are bumped, remove the transitional `sdk-ref`
handling from the two composite actions.
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