Skip to content

feat: generate splinter.json manifest and publish via release workflow - #175

Merged
soedirgo merged 3 commits into
mainfrom
feat/splinter-json-manifest
Jul 31, 2026
Merged

feat: generate splinter.json manifest and publish via release workflow#175
soedirgo merged 3 commits into
mainfrom
feat/splinter-json-manifest

Conversation

@soedirgo

@soedirgo soedirgo commented Jul 31, 2026

Copy link
Copy Markdown
Member

What

Emit a structured splinter.json manifest alongside splinter.sql, and add a release workflow that publishes it to GitHub Releases + S3.

splinter.sql is a single monolithic union all query. Consumers that want to select/filter/combine individual lints (e.g. supabase/platform's advisor) currently reverse-engineer structure out of that blob with a paren-depth scanner and regexes — fragile, and it fails silently against live customer DBs when the SQL shape changes. The manifest exposes that structure as data instead.

Shape

{
  "version": "<CalVer YYYY.MM.Micro>",
  "setup": "set local search_path = '';\n\ndo $$ ... $$;",
  "lints": [ { "name": "...", "categories": ["SECURITY"], "query": "(select ...)" } ]
}
  • query is the same union-ready parenthesized SQL that splinter.sql uses — consumers treat it as opaque.
  • name / categories are lifted from each lint's SQL at build time, so a malformed lint fails CI rather than a consumer's regex failing silently later.
  • setup is the existing header (search_path='' + the do $$ block), run once before the union.

Changes

  • bin/compile.py — refactored into importable compile_sql() / main() under a __main__ guard. splinter.sql output is byte-identical (verified: empty diff).
  • bin/compile_json.py (new) — the manifest generator. Reuses compile.load_sql_files.
  • .github/workflows/release.yml (new) — on push to main:
    • Release only when there's a release-worthy Conventional Commit since the last tag: feat:, fix:, or any breaking change (type!:, or a BREAKING CHANGE: / BREAKING-CHANGE: footer). chore/docs/refactor/test/ci/perf do not trigger a release.
    • Compute YYYY.MM.Micro (micro = next counter for the current month). All release-worthy commits bump the single micro equally — no feat→minor / fix→patch distinction in CalVer.
    • Create the tag + GitHub release with splinter.json.
    • Publish to s3://<shared-services-bucket>/splinter/<calver>/splinter.json via OIDC role-chaining (mirrors the supautils release).
  • .gitignoresplinter.json is generated/published, never committed.

⚠️ Prerequisites for the S3 upload

  • IAM role granting this repo PutObject under splinter/*: supabase/platform#36435 (must be deployed first).
  • Repo secrets SHARED_SERVICES_OIDC, SHARED_SERVICES_ROLE (= the new role's ARN), SHARED_SERVICES_BUCKET must be set.
  • The OIDC jump role already trusts repo:supabase/*, so no OIDC-provider change is needed.

Consumer side

supabase/platform#36414 — advisor consumes this manifest instead of scraping splinter.sql.

🤖 Generated with Claude Code

soedirgo and others added 2 commits July 31, 2026 17:19
Emit a structured manifest (splinter.json) alongside splinter.sql so
downstream consumers can select, filter, and combine lints by reading
fields instead of parsing the monolithic union-all SQL blob.

- bin/compile.py: refactor into importable compile_sql()/main() under a
  __main__ guard; splinter.sql output is byte-identical.
- bin/compile_json.py: new generator emitting {version, setup, lints[]}
  where each lint is {name, categories, query}. name/categories are
  lifted from each lint's SQL at build time, so a malformed lint fails
  CI rather than a consumer's regex failing silently at runtime.
- .github/workflows/release.yml: on push to main, release when there is
  a Conventional Commit since the last tag (prefix-indifferent), compute
  CalVer YYYY.MM.Micro, tag + create the GitHub release, and publish to
  s3://<shared-services-bucket>/splinter/<calver>/splinter.json
  (OIDC role-chaining, mirroring the supautils release).
- .gitignore: splinter.json is generated/published, never committed.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- Gate the release on a release-worthy Conventional Commit since the last
  tag: feat:, fix:, any breaking change (type!: or a BREAKING CHANGE: /
  BREAKING-CHANGE: footer). chore/docs/refactor/test/ci/perf no longer
  trigger a release. All release-worthy commits bump the single micro
  equally (no feat->minor / fix->patch distinction in CalVer).
- Comment out the S3 upload steps for now; publishing to GitHub Releases
  only until the shared-services bucket wiring is ready.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@soedirgo
soedirgo force-pushed the feat/splinter-json-manifest branch from 906751e to 36f1205 Compare July 31, 2026 10:01
@soedirgo
soedirgo marked this pull request as ready for review July 31, 2026 10:05
@soedirgo
soedirgo merged commit 748b722 into main Jul 31, 2026
3 checks passed
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