refactor(pg-delta): move execution phase classification onto BaseChange.phase#245
Draft
Copilot wants to merge 3 commits into
Draft
refactor(pg-delta): move execution phase classification onto BaseChange.phase#245Copilot wants to merge 3 commits into
BaseChange.phase#245Copilot wants to merge 3 commits into
Conversation
|
10 tasks
Agent-Logs-Url: https://github.com/supabase/pg-toolbelt/sessions/75313384-2283-4b79-ad7d-5e852f1fffc7 Co-authored-by: avallete <8771783+avallete@users.noreply.github.com>
Agent-Logs-Url: https://github.com/supabase/pg-toolbelt/sessions/75313384-2283-4b79-ad7d-5e852f1fffc7 Co-authored-by: avallete <8771783+avallete@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Refactor pg-delta to move execution phase onto BaseChange
refactor(pg-delta): move execution phase classification onto May 2, 2026
BaseChange.phase
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.
This refactor removes phase classification from sort-layer helpers and colocates it with change objects via
BaseChange.phase, while preserving existing execution behavior. It also renames the phase value fromcreate_alter_objecttoforwardacross pg-delta.Phase ownership moved to change model
Phase = "drop" | "forward"and defaultphasegetter toBaseChange.operation(create/alter/drop) with no fallback default.Layering cleanup
core/sort/utils.ts(getExecutionPhase, oldPhase, table-specificinstanceoflogic).isMetadataStableIdtocore/stable-id.tssoBaseChangeand sort code can share it without sort→object coupling.Load-bearing table alter overrides
phaseoverrides in:AlterTableAlterColumnDropDefault→dropAlterTableAlterColumnDropIdentity→dropAlterTableAlterColumnType→forwardfor custom type, otherwisedropSort pipeline updated to consume
change.phaselogical-sort.tsandsort-changes.tsto partition onchange.phase.create_alter_objectbuckets/maps withforward.Top-level drop predicate left intact (with clarification)
catalog.diff.tsobject-drop filtering logic (operation === "drop" && scope === "object") and added a clarifying comment that this is intentionally different from phase checks.Docs and tests
CONTEXT.mdat repo root with canonical terms: catalog, change, phase, plan.base.change.test.tsmatrix coverage for default phase behavior, metadata-only drops, and mixed metadata+object drops.table.alter.test.tsfor each override case.