Skip to content

feat: add @pgpmjs/transform + @pgpmjs/slice (slicing moved out of core, opt-in AST closure) - #1470

Merged
pyramation merged 5 commits into
mainfrom
feat/pgpm-transform
Jul 27, 2026
Merged

feat: add @pgpmjs/transform + @pgpmjs/slice (slicing moved out of core, opt-in AST closure)#1470
pyramation merged 5 commits into
mainfrom
feat/pgpm-transform

Conversation

@pyramation

@pyramation pyramation commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Summary

Combined PR (replaces #1471; plan: constructive-io/constructive-planning#1271 + #1272). Two new packages, and core slimmed. Layering now reads @pgpmjs/ast → @pgpmjs/bundle → @pgpmjs/transform → @pgpmjs/slice → @pgpmjs/core → cli.

pgpm/transform = @pgpmjs/transform

Change-aware SQL semantics — a superset of the published pure-AST @pgsql/transform@18.3.1:

export * from '@pgsql/transform';           // transformSql, classifyStatements, qualifyUnqualified, round-trip
export { makeSchemaTranspiler, makeNamespaceValidator } from './bundle-driver';
export { buildCategoryOf, categorizeChange, TIER_PROFILE } from './categorize';
export { resolveFixtureClosure } from './fixture-closure';

Source is verbatim from constructive-db's transform-schemas (the change-aware layer that had no home in pgsql-parser — that repo has no change concept; carved out there in constructive-io/pgsql-parser#318). bundle-driver is structurally typed on the transpileBundle/applyBundle seams — @pgpmjs/bundle is devDep-only (e2e test). 26 tests.

pgpm/slice = @pgpmjs/slice

pgpm/core/src/slice/ moved verbatim (slicePlan, pattern strategies, generatePlanContent, writeSliceResult; deps: @pgpmjs/ast + minimatch) plus the opt-in AST dependency closure from the #1469/#1471 prototype, rebuilt on @pgpmjs/transform's classifyStatements:

slicePlan(plan, {
  strategy: { type: 'pattern', slices: [{ package: 'api', patterns: ['schemas/api/**'], closure: true }] },
  closure: { moduleDir }
});
// result.closure => { autoIncluded: [{ change, package, requiredBy, reason: 'requires'|'ast', ref? }],
//                     dynamicSqlChanges, unresolvedReferences }

Cherry-picked slices pull in their TRUE transitive deps discovered from deploy SQL (function calls incl. PL/pgSQL bodies, table/view/type refs, FK targets) even when undeclared in requires. Opt-in only; default slicing unchanged. Callers await loadModule() first (WASM). 33 tests.

Core slimmed

  • src/slice/ deleted; export * from './slice' removed from core's index.
  • rebundle + workspace/minimal now import generatePlanContent / graph helpers / SliceWarning from @pgpmjs/slice (core → slice dep; slice does not depend on core).
  • pgpm CLI slice command imports from @pgpmjs/slice directly.

Verification

  • @pgpmjs/transform 26/26, @pgpmjs/slice 33/33, and full @pgpmjs/core suite 343/343 passing against a live Postgres 17.
  • transform/slice/core/cli all build.

Link to Devin session: https://app.devin.ai/sessions/1aa52746e60c4df38ef2678d168269b9
Requested by: @pyramation

@pyramation pyramation self-assigned this Jul 27, 2026
@devin-ai-integration

Copy link
Copy Markdown
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

@socket-security

socket-security Bot commented Jul 27, 2026

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedplpgsql-parser@​18.2.17610010096100

View full report

@devin-ai-integration devin-ai-integration Bot changed the title feat: add @pgpmjs/transform (change-aware superset of @pgsql/transform) feat: add @pgpmjs/transform + @pgpmjs/slice (slicing moved out of core, opt-in AST closure) Jul 27, 2026
@pyramation
pyramation merged commit 0060986 into main Jul 27, 2026
15 checks passed
@pyramation
pyramation deleted the feat/pgpm-transform branch July 27, 2026 08:38
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.

1 participant