Repository navigation
feat(portability): native pgpm deployment, control-file extensions, native roles - #29
Merged
Merged
Conversation
… native roles Replace the hand-rolled runBundle deploy loop with native pgpm deployment, declare generic extensions through pgpm/control files instead of raw CREATE EXTENSION, and drive roles through pgsql-test's native role config instead of an imperative CREATE ROLE / GRANT bootstrap. - deploy-ported: deploys the apply proxy as an ordinary workspace module via PgpmPackage(workspace).deploy(..., 'vendor-app-ported') inside a seed.fn, so pgpm resolves and deploys the provider, its uuid-ossp extension, then the transpiled app — provider-first, application-second — with no CREATE EXTENSION and no runBundle. Roles come from getConnections; only narrow object-level grants remain. - deploy-vendor: same native deployment for the reverse direction; the vendored fixture deploys via seed.pgpm and the round-trip module via PgpmPackage. - vendor-app.control declares uuid-ossp (fixture uses extensions.uuid_generate_v4); the apply proxy requires uuid-ossp so it is installed on deploy. - transpile.test: excluded subsystem changes are now dropped (not empty tombstones); role-translation demo moved to an inline spec so the deployable on-disk spec can use native standard roles. Depends on constructive #1533 (drop excluded changes) — pinned via tarball override until published.
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
Plain postgres-plus:18 ships no application roles. Instead of a hand-rolled CREATE ROLE loop, seed base roles with generateCreateBaseRolesSQL (the same generator pgpm init uses) and grant them to the app connection role with generateGrantRoleSQL so transaction-local SET ROLE works in tests.
materializeApplyModule writes a bare module (no pgpm.json); native deploy resolves its target from a workspace module map, so a standalone outDir yields MODULE_NOT_FOUND. Materialize the reverse module into a throwaway single-package workspace and deploy it via the ordinary path.
…rrides makage update-deps bumps @pgpmjs/* to the now-published versions (core 7.17.2, bundle 0.12.4, slice 0.11.2, transform 0.12.2, types 2.48.1, env 2.39.2) that carry the #1533 drop-excluded-changes fix. Removes the temporary file: pnpm overrides and portability/.tarballs/.
…d-deps chore(portability): consume published pgpm packages, drop tarball overrides
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.
Summary
Follow-up to #28 answering three "is this actually native?" questions about the portability suite. The old tests hand-rolled deployment and setup; this makes all of it native to how we deploy pgpm modules and test with
pgsql-test.1.
runBundle→ native pgpm deploy.runBundlewas a hand-rolled stand-in for a real deploy:It's gone. The apply proxy deploys as an ordinary workspace module through a seed adapter:
pgpm resolves the proxy's declared dependencies and deploys them in order — the generic
auth-providermodule, then itsuuid-osspextension, then the transpiled app — i.e. provider-first, application-second, for real.deploy-vendordoes the same for the reverse direction (vendored fixture viaseed.pgpm, round-trip module viaPgpmPackage).2. Extensions via control files, not raw SQL. No more
pg.any('CREATE EXTENSION ...')in tests. The fixture usesextensions.uuid_generate_v4(), souuid-osspis declared as a generic dependency invendor-app.control(requires = 'plpgsql,uuid-ossp') and in the apply proxy'srequires, and pgpm installs it during deploy.3. Roles via
pgsql-test, not an imperative bootstrap. TheDO $$ … CREATE ROLE / GRANT … $$block is gone. Roles come fromgetConnections(native standard roles:anonymous/authenticated/administrator, image-provided), and only narrow, application-level grants remain in a seed (GRANT USAGE ON SCHEMA app_auth TO authenticated,GRANT EXECUTE ON FUNCTION app_auth.current_user_id() TO authenticated). The deployable on-disk apply spec no longer renames roles; the role-translation capability is still demonstrated intranspile.test.tsvia an inline spec, so the SQL-level proof stays without forcing a non-image role into the deploy path.transpile.test.tsalso updated for the new engine behavior: an excluded subsystem's changes are now dropped from the artifact, so the assertions check they're absent rather than emptied tombstones.Dependency
The native deploy path exercises constructive #1533 (drop excluded subsystem changes instead of emitting empty tombstones) — without it, the excluded
authchanges deploy as byte-identical empty scripts and collide on the migration ledger's(package, script_hash)uniqueness. Until #1533 is published,@pgpmjs/bundle+@pgpmjs/coreare pinned viapnpm.overridesto tarballs inportability/.tarballs/. After publish:makage update-deps --from ./constructive --in .and drop the tarballs/overrides.Tests
Plain-PostgreSQL suites pass locally (
postgres-plus:18):deploy-ported(3),transpile(2),contract(2) — 9 tests,deploy-vendorskipped (noVENDOR_STACK). tsc + eslint clean. The vendor-image job validatesdeploy-vendorin CI.Link to Devin session: https://app.devin.ai/sessions/025fb88043964fdbb335ac5e39df2478
Requested by: @pyramation