feat(pgpm-core): shared SQL header model + control-only cross-package dep mode#1401
Merged
Conversation
… control-only cross-package dep mode
Contributor
🤖 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:
|
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
Atom 1 of the schema-transformation platform plan (constructive-io/constructive-planning#1226, design in #1225): a single shared model for pgpm SQL script headers, plus the
control-onlycross-package dependency mode forslicePlan.New
files/sql/header.ts(exported viafiles/sql):parsePgpmHeader(content) → { header: PgpmHeader, body }— structured, lossless parse of-- Deploy|Revert|Verify+-- requires:header blocks. Handles all three formats in the wild: legacy-- Deploy proj:change to pg, modern-- Deploy change, and the writer's-- Deploy: change.header.lines+bodyreassemble the file byte-exactly (writePgpmScript).renameInHeader(script, renames)— rewrites header identity and matching-- requires:refs (package-qualified refs handled; tag refs untouched). This is the primitive the rename/move atom (Atom 3) and bundle transpilation build on.scanDeployScript(content, { key, extname, makeKey })— the resolver's historical whole-file line scan, extracted verbatim fromresolution/deps.ts(same regexes, same identity-mismatch errors).resolveDependenciesnow consumes it; behavior unchanged, all 390 existing tests pass.verifyPlanMatchesHeaders(moduleDir) → HeaderDriftIssue[]— new read-only drift gate comparingpgpm.planchanges/deps against deploy scripts (missing-file/identity-mismatch/requires-drift).Slice:
crossPackageDepMode: 'change' | 'tag' | 'control-only'onSliceConfig:'change'(default) and'tag'are today's behaviors (useTagsForCrossPackageDepsstill honored as an alias for'tag').'control-only'drops per-change cross-package refs from sliced plan lines entirely; the dependency is carried only by the control file'srequires = '<pkg>'. Extension install ordering deploys the whole dependency package first, which subsumes any per-change ordering constraint — this is the "abstract the detail, depend on the module" mode from the modularization discussion (chore: update schemas from constructive-db #1225 deep dive 4).No breaking changes: all additions are opt-in;
generateSinglePackage's trailing param accepts the old boolean or the new mode.Note:
pnpm lintcurrently fails repo-wide on main (ESLint 9 installed but only.eslintrc.jsonpresent) — unrelated to this change; typecheck viapnpm buildand fullpnpm test(390/390) pass.Link to Devin session: https://app.devin.ai/sessions/ad40d16f38a349b48eb7ce9375e27e6e
Requested by: @pyramation