feat(pgpm): generate revert/verify scripts for restructured exports - #1562
Merged
Conversation
restructureChanges now derives per-change revert (mechanical inverses in reverse topological order via revertFor) and verify (raise-on-failure existence checks via verifyFor) scripts from each change's statement group, and pgpm export writes them instead of empty files. Refs constructive-planning#1329 (Phase 4 follow-up).
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:
|
revertFor/verifyFor moved out of @pgsql/transform into the new @pgsql/scripts package upstream. Lockfile update deferred until the package is published.
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
Phase 4 follow-up to #1554 (refs constructive-io/constructive-planning#1329): granularity-restructured exports previously emitted empty revert/verify files. This wires the
revertFor/verifyForgenerators from@pgsql/scripts(constructive-io/pgsql-parser#327, published as@pgsql/scripts@18.0.1) throughrestructureChangesandpgpm exportso every restructured change ships populated, mechanically-derived scripts.@pgpmjs/transform—restructureChangesnow returnsRestructuredChange extends GranularityChange:revert not derivable: ...for non-invertible statements) are surfaced inresult.warnings, prefixed with the owning change name.@pgpmjs/export—restructureExportRowscarrieschange.revert/change.verifyinto the emitted rows instead of''. pgpm headers and transaction wrappers are unchanged (they're owned bywritePgpmFiles).@pgsql/scripts@^18.0.0(new),@pgsql/transform@^18.11.0(facts now carry the raw statement node the generators need).e2e round-trip
export-granularity.test.tsproves the full loop against Postgres: export atconsolidated→ deploy →verifypasses on the generated checks →revertsucceeds and leaves the DB clean (pets_consolidated_publicgone), with noCASCADEin any generated script.pgpm/transform43/43 and the granularity e2e suite 10/10 pass against the published packages; the 7 failures in otherpgpm/exportsuites are pre-existing onmain(confirmed on a clean worktree).Link to Devin session: https://app.devin.ai/sessions/7f032c8e1bf245eeac2def99fdcc1623
Requested by: @pyramation