fix(pg-delta): order leading enum value additions#313
Open
pjpjq wants to merge 1 commit into
Open
Conversation
🦋 Changeset detectedLatest commit: a06f8da The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
RED: the new enum.diff unit test produced ADD 'a' BEFORE 'b' before b existed, and the new PG17 integration test failed with 22023: "b" is not an existing enum label.\n\nGREEN: the planner now only emits enum ADD VALUE statements whose BEFORE/AFTER anchors are already present in the simulated working label list.
pjpjq
force-pushed
the
codex/fix-leading-enum-values
branch
from
July 23, 2026 10:27
1a65f76 to
a06f8da
Compare
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
Fixes #304.
b BEFORE cthena BEFORE bRED evidence
Before the fix:
enum.diffproduceda BEFORE bbeforebexisted for source('c')-> target('a','b','c')22023: "b" is not an existing enum labelValidation
bun run --cwd packages/pg-delta test src/core/objects/type/enum/enum.diff.test.tsPGDELTA_SKIP_DUMMY_SECLABEL_BUILD=1 PGDELTA_TEST_POSTGRES_VERSIONS=17 TESTCONTAINERS_RYUK_DISABLED=true bun run --cwd packages/pg-delta test --retry=0 --test-name-pattern "add multiple leading enum values before the first existing value" tests/integration/type-operations.test.tsPGDELTA_SKIP_DUMMY_SECLABEL_BUILD=1 PGDELTA_TEST_POSTGRES_VERSIONS=17 TESTCONTAINERS_RYUK_DISABLED=true bun run --cwd packages/pg-delta test --retry=0 tests/integration/type-operations.test.tsbun run format-and-lintbun run check-typesbun run knipNote: I also attempted
PGDELTA_SKIP_DUMMY_SECLABEL_BUILD=1 PGDELTA_TEST_POSTGRES_VERSIONS=17 TESTCONTAINERS_RYUK_DISABLED=true bun run test:pg-delta; it hit unrelated local Testcontainers/Postgres connection timeouts in non-enum integration files, so I stopped it after confirming the targeted enum coverage and project checks above.