Repository navigation
feat: change pg_authid 2 pg_roles - #302
Merged
Merged
Conversation
|
🎉 This PR is included in version 0.41.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Contributor
Author
|
avallete
pushed a commit
that referenced
this pull request
Jun 20, 2026
The package isn't published to npm yet; pin the dependency to the pkg.pr.new preview build for pg-toolbelt PR #302 so CI can install it. The lockfile must be regenerated (`npm install`) in an environment with network access to pkg.pr.new — the remote sandbox's egress allowlist blocks that host. Co-Authored-By: Claude Sonnet 4.6 <[email protected]> Claude-Session: https://claude.ai/code/session_01B53a2ayu9d16u821FQ5Qqz
avallete
added a commit
that referenced
this pull request
Aug 31, 2026
* feat: consume @supabase/postgrest-typegen for type generation
Integrate the extracted @supabase/postgrest-typegen package as the single
source of truth for type generation, replacing the embedded templates.
- src/lib/generators.ts: rewrite getGeneratorMetadata as a ~30-line adapter
over the package's introspect(). It wraps pgMeta.query into the package's
structural Queryable (throws on {error}), preserves the
Promise<PostgresMetaResult<GeneratorMetadata>> contract, surfaces the first
query error, and still ends the pool. Re-exports GeneratorMetadata from the
package.
- src/server/server.ts: getTypeOutput now calls getGeneratorMetadata +
generateTypescript/Go/Python/Swift, threading GENERATE_TYPES_DEFAULT_SCHEMA,
POSTGREST_VERSION, detect-1:1, and Swift access-control env values. Behavior
freeze: the CLI path still only supports included schemas.
- src/server/routes/generators/*.ts: swap `apply` template imports for the
package's generateX; query params, headers, and error shapes unchanged.
- Delete src/server/templates/*.ts and test/server/templates/go.test.ts;
re-point test/types.test.ts's pgTypeToTsType import and constants.ts's
AccessControl import to the package; drop the now-unused VALID_* constants.
- Keep PostgresMetaRelationships.ts and src/lib/sql/*.sql.ts (they back the
REST endpoints) — accepted temporary duplication.
`npm run check` passes. Full-suite byte-parity validation is Phase 2.3
(PGMETA-114). The dependency is pinned to 1.0.0-alpha.1; local validation
installs it from Verdaccio via an uncommitted scoped .npmrc, and the lockfile
is finalized when the package is published to npm (Phase 3).
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Claude-Session: https://claude.ai/code/session_01B53a2ayu9d16u821FQ5Qqz
* chore: point @supabase/postgrest-typegen at pkg-pr-new preview build
The package isn't published to npm yet; pin the dependency to the
pkg.pr.new preview build for pg-toolbelt PR #302 so CI can install it.
The lockfile must be regenerated (`npm install`) in an environment with
network access to pkg.pr.new — the remote sandbox's egress allowlist
blocks that host.
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Claude-Session: https://claude.ai/code/session_01B53a2ayu9d16u821FQ5Qqz
* chore: update lockfile for postgrest-typegen pkg-pr-new build
* fix: sort generator metadata for deterministic type generation
The Go/Python/Swift generators emit objects in GeneratorMetadata order, so
output depended on the order introspection returned rows (environment-dependent
heap order). Apply the package's new sortGeneratorMetadata pass in the
getGeneratorMetadata adapter so all four generators receive canonically-ordered
metadata.
Regenerate the typegen go/python snapshots accordingly: only ordering changes
(the `a_view` view moves to its canonical oid position); struct/class contents
are byte-identical. TypeScript and Swift sort internally and are unaffected.
Requires @supabase/postgrest-typegen with sortGeneratorMetadata
(supabase/pg-toolbelt#302).
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Claude-Session: https://claude.ai/code/session_01B53a2ayu9d16u821FQ5Qqz
* test: regenerate typegen snapshots for semantic metadata ordering
Follow-up to the sortGeneratorMetadata semantic-key change
(supabase/pg-toolbelt#302): the canonical order is now schema+name based, so
the Go/Python typegen snapshots are regenerated to alphabetical order. Pure
reorder — struct/class contents are byte-identical. TypeScript/Swift sort
internally and are unaffected.
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Claude-Session: https://claude.ai/code/session_01B53a2ayu9d16u821FQ5Qqz
* chore: refresh lockfile for semantic-key sort build
* chore: refresh lockfile for semantic-key sort build
* chore: repin @supabase/postgrest-typegen to released ^0.1.0
* fix: honor PG_META_GENERATE_TYPES_DEFAULT_SCHEMA in the typescript generator route
* fix: restore worker-thread type generation on top of postgrest-typegen
The postgrest-typegen refactor dropped the worker path added in #1102: the
route calls generateTypescript() directly, the package formats with prettier
inline and exposes no format hook, so format-pool, format-worker, the piscina
dependency and the 503 load-shedding path were all left dead while CLAUDE.md
still documented the feature.
Rather than wait for a format hook upstream, hand the whole generateTypescript
call to the worker. Measured on a synthetic public schema (12 columns and 2
foreign keys per table), 400 tables: wall clock 1059ms on a worker vs 1065ms
inline, with the longest main-thread block dropping from ~1000ms to 21ms.
Metadata crosses the boundary as a structured clone, which is plain JSON and
costs nothing measurable. This also covers the ~10% of the cost that is string
building rather than prettier, which a format-only hook would have left on the
main thread.
format-pool/format-worker are renamed to typegen-pool/typegen-worker since they
no longer format, keeping the admission control, per-task timeout, idle pool and
503 shedding as they were. The PG_META_FORMAT_* env vars keep their names so
existing deployments do not need reconfiguring.
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0192KEBCPggQgUT7JLPc3Cz1
* chore: drop unrelated CLAUDE.md reflow and keep format callbacks off the worker boundary
* chore: bump @supabase/postgrest-typegen to ^0.2.0
0.2.0 formats with oxfmt instead of prettier (typescript snapshots regenerated; the only output change is oxfmt parenthesizing conditional types in generic-default positions), runs its introspection queries concurrently, and accepts a format hook, which stays unused here since the whole generateTypescript call already runs on the worker.
* chore: restore master's format-pool naming to minimize the diff
The typegen-pool/typegen-worker rename made the route's unchanged 503
load-shedding block show up as a diff against master because the error class
inside it changed name. Keep master's file and identifier names (format-pool,
format-worker, FormatQueueFullError, destroyFormatPool, isFormatPoolActive) so
the only diff left in these files is the delegation itself: the worker task
carries generator metadata into @supabase/postgrest-typegen's generateTypescript
instead of a prettier payload, and the exported entry point is
generateTypescriptTypes instead of format(code, options). No behavior change.
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0192KEBCPggQgUT7JLPc3Cz1
---------
Co-authored-by: Claude <[email protected]>
Co-authored-by: Lukas Klingsbo <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What kind of change does this PR introduce?
Bug Fix
What is the current behavior?
Please link any relevant issues here.
What is the new behavior?
Change the use of pg_authid to pg_roles