feat(cli): make pg-delta the only and the default diff engine - #6391
feat(cli): make pg-delta the only and the default diff engine#6391avallete wants to merge 22 commits into
Conversation
…ape hatch (CLI-2211)
The bundled in-process pg-delta engine (formerly "pg-delta next") is now the
only pg-delta implementation. Setting SUPABASE_USE_PG_DELTA_NEXT no longer has
any effect; the temporary opt-out shipped in v2.115.0 is retired as announced
in its release notes.
Removed along with the legacy engine:
- the SUPABASE_USE_PG_DELTA_NEXT flag module and the engine selector layer;
the LegacyPgDeltaEngine service loses its `implementation` discriminator and
every handler branch keyed on it
- the edge-runtime pg-delta Deno script templates, the npm-version pin read
from supabase/.temp/pgdelta-version, and the PGDELTA_NPM_REGISTRY /
PGDELTA_{SOURCE,TARGET}_SSLROOTCERT plumbing (all legacy-engine-only)
- the migrations-catalog cache warmup after db push / db reset / start /
db start / bootstrap, and the whole catalog snapshot machinery
(legacy-pgdelta.cache.ts); the shared migration lister moves to
legacy-migration-list.ts
- the legacy declarative catalog seam (LegacyDeclarativeSeam.exportCatalog),
the pg-delta declarative-apply engine (legacy-pgdelta.apply.ts) and its
unreachable shadow-source sub-branch, and db pull's legacy empty-diff debug
bundle
- the "--strict-coverage has no effect with the legacy pg-delta engine"
warning: the flag is now always effective
SIDE_EFFECTS.md files and db diff/pull docs are updated to match; tests that
exercised the legacy implementation are removed or repointed at the in-process
engine.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BQAoY9JF4uiZRvKVkSd9Wy
…s (CLI-1588)
An absent [experimental.pgdelta] section (or a section that omits `enabled`)
now resolves to pg-delta for db diff, db pull, and the delegated
db remote commit. Rollback stays a one-liner:
[experimental.pgdelta]
enabled = false
or per-invocation `db diff --use-migra` / `db pull --diff-engine migra`.
- TypeScript config reader: `enabled` defaults to true when absent
- @supabase/config schema + published config.schema.json: default true
- Go binary (delegated db remote changes/commit, db pull --experimental):
the ejected config template now defaults `enabled = true`, so viper's
key-level merge resolves both an absent section and a section without the
key to enabled; `IsPgDeltaEnabled` treats a nil section as enabled. The
init-only PgDeltaInitEnabled flag is gone — the scaffold and the runtime
default are the same value now.
- Knock-on defaults that key off "pg-delta enabled": the declarative schema
commands' gate is open by default (no --experimental needed), and
db reset --experimental only takes the schema-files path when pg-delta is
explicitly disabled.
- The --use-pg-schema deprecation warning now points at the default pg-delta
engine / --use-migra rather than "the default migra engine".
- apps/cli-go/CONTRIBUTING.md scopes the Verdaccio/PGDELTA_NPM_REGISTRY
workflow to the Go binary, which is the only remaining reader.
Existing projects pinned to migra output should set `enabled = false` before
upgrading if they depend on byte-identical migra diffs.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BQAoY9JF4uiZRvKVkSd9Wy
…CLI-1588) The declarative commands' gate is open by default now, so the gate-closed tests seed an explicit [experimental.pgdelta] enabled = false config, and new tests pin the default-open behavior. The sync recovery-reset tests' fixture fails apply once instead of always: under the pg-delta default the in-process recovery reset genuinely replays migrations, so a permanently failing ALTER made the reset itself fail rather than exercising the recovery flow. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BQAoY9JF4uiZRvKVkSd9Wy
Migra-subject pull tests opt out explicitly (--diff-engine migra, or enabled = false when the disabled config state or the declarative alias is the subject), and new tests pin the flip: no config section -> pg-delta engine, enabled = false -> migra, --diff-engine migra -> migra despite the default. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BQAoY9JF4uiZRvKVkSd9Wy
…ts (CLI-1588) Migra-subject diff tests opt in with --use-migra; the experimental schema-files reset tests disable pg-delta explicitly, since that branch now requires enabled = false. New tests pin the flip on both commands: no config section -> pg-delta engine (db diff), enabled = false -> migra, --use-migra override, and an experimental versionless reset without a pgdelta section replaying migrations instead of schema files. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BQAoY9JF4uiZRvKVkSd9Wy
gofmt -l flagged pkg/config/db.go and pkg/function/deploy_test.go (pre-existing whitespace drift from #6253); fixed so the Go CI format check stays green on branches touching apps/cli-go. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BQAoY9JF4uiZRvKVkSd9Wy
chmod 0o000 cannot make paths unreadable for root, so the workers-push unlistable-root test now expects the successful deploy on its root/listable branch (mirroring its unreadable-source sibling), and the legacyApplySchemaFiles read-failure test skips under root like reset's own chmod tests. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BQAoY9JF4uiZRvKVkSd9Wy
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BQAoY9JF4uiZRvKVkSd9Wy
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2f97b70424
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Supabase CLI previewnpx --yes https://pkg.pr.new/supabase/cli/supabase@89db526a789d197a3d30a185d76d9b09ec593640Preview package for commit |
…aults on With pg-delta enabled by default, the pgcache warmup after SetupLocalDatabase and migration-down resets started firing in the Go binary's db start / db reset paths, opening an extra Postgres connection their pgmock tests never scripted (10s dial timeouts in CI). The catalog it writes is a legacy-engine artifact with no consumer reachable through the delegated command surface, and the TypeScript CLI removed its counterpart in CLI-2211 — remove the two call sites rather than script the connection. Also pin TestWriteDeclarativeSchemas to the explicitly-disabled state its schema_paths config write is now gated on. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BQAoY9JF4uiZRvBVkSd9Wy
Narrow the not-found read error with Predicate.isTagged instead of reading ._tag directly, and rewrite the module's comments in terms of the legacy shell's own established behavior instead of Go citations. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BQAoY9JF4uiZRvKVkSd9Wy
|
CI status note — The failing test is Why it's not this PR's:
No fix PR exists yet that I can port. A fresh run (33239773281) is already in progress on the current head 64831cd and serves as the re-run; I'll keep watching it. All other failures from the previous run are resolved: the 14 Go test failures were fixed in 4234d36, and the "Run unit and integration tests" red on the old head was Generated by Claude Code |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 64831cdca5
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
CI status note (2/2) — The failing test is Together with the shard 2/3 Generated by Claude Code |
…ne docs Address AI review findings on the default-engine flip: - `[experimental.pgdelta] enabled = false` now always selects migra: the historical SUPABASE_EXPERIMENTAL_PG_DELTA opt-in env var is no longer consulted (TS engine resolution and the Go delegated surface alike). With pg-delta on by default the opt-in added nothing, and honoring a stale one silently defeated the documented config rollback. The now-unused `envLookup` config accessor is removed with its last consumers. - db diff docs no longer open by claiming migra runs by default; the intro describes the pg-delta default with migra as the containerized fallback. - The Go CONTRIBUTING Verdaccio workflow now demonstrates a delegated command (`db pull --experimental` / `db remote commit`) instead of an ordinary `db pull`, which runs the TS in-process engine and ignores PGDELTA_NPM_REGISTRY. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BQAoY9JF4uiZRvKVkSd9Wy
…fault flip The warmup path is gone; keep layers, comments, and docs aligned with pg-delta as the only default engine. Co-authored-by: Cursor <cursoragent@cursor.com>
The published spec still advertised migra as on by default after the help-text flip. Co-authored-by: Cursor <cursoragent@cursor.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BQAoY9JF4uiZRvKVkSd9Wy
…b.com/supabase/cli into claude/pg-delta-default-engine-rfpryl
…defaults Help and overlays still described the pre-flip engine model after pg-delta became the default. Co-authored-by: Cursor <cursoragent@cursor.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BQAoY9JF4uiZRvKVkSd9Wy
The Codegen check regenerates pkg/api from the live Management API spec, which gained an oauth2 security scheme; apply the generator's output so the check passes until develop carries the upstream sync. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BQAoY9JF4uiZRvKVkSd9Wy
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BQAoY9JF4uiZRvKVkSd9Wy
…fault-engine-rfpryl # Conflicts: # apps/cli/src/legacy/shared/legacy-pgdelta.cache.ts
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f7d2498e48
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
pg-delta 1.0.0-alpha.48 declares a ^1.0.0-alpha.6 peer range on pg-topo, so the alpha.5 pin resolved an unsupported combination. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BQAoY9JF4uiZRvKVkSd9Wy
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e80e88a719
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
A typed NO_MIGRATIONS constant covers both empty returns, and the mutable result array is assignable to the readonly return without an assertion. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BQAoY9JF4uiZRvKVkSd9Wy
Summary
Two changes that finish the pg-delta migration, tracked as CLI-2211 and CLI-1588:
1. The in-process pg-delta engine is now the only pg-delta implementation (CLI-2211)
The
SUPABASE_USE_PG_DELTA_NEXTescape hatch shipped in v2.115.0 as a temporary opt-out back to the legacy edge-runtime engine; its release notes announced removal after ~a month. Setting it now has no effect. Deleted with the legacy engine (net −4,300 lines):LegacyPgDeltaEngineloses itsimplementationdiscriminator and every handler branch keyed on itsupabase/.temp/pgdelta-versionnpm pin, and thePGDELTA_NPM_REGISTRY/PGDELTA_{SOURCE,TARGET}_SSLROOTCERTplumbing (all legacy-engine-only; the edge-runtime service itself stays — migra still runs through it)db push/db reset/start/db start/ bootstrap, and the whole catalog snapshot machinery (legacy-pgdelta.cache.ts); the shared migration lister moves tolegacy-migration-list.tsLegacyDeclarativeSeam.exportCatalog), the declarative-apply engine (legacy-pgdelta.apply.ts), anddb pull's legacy empty-diff debug bundle--strict-coveragehas no effect with the legacy pg-delta engine" warning — the flag is now always effective2. pg-delta is the default diff engine for all projects (CLI-1588)
An absent
[experimental.pgdelta]section — or a section that omitsenabled— now resolves to pg-delta fordb diff,db pull, anddb remote commit, in the TypeScript CLI,@supabase/config(and the published JSON schema), and the Go binary backing the delegateddb remote changes|commit/db pull --experimentalcommands.The Go zero-value tri-state called out in CLI-1588 needed no
*bool: the ejected config template now defaultsenabled = true, and sincemergeDefaultValuesfeeds that template to viper as the default config, viper's key-level merge resolves both the absent-section and omitted-key cases totruewhile an explicitenabled = falsestill wins.Rollback stays one line:
[experimental.pgdelta] enabled = falseinconfig.toml, or per-invocation--use-migra(db diff) /--diff-engine migra(db pull). Migra is unchanged. The explicit config rollback is authoritative: the historicalSUPABASE_EXPERIMENTAL_PG_DELTAopt-in env var is no longer consulted (with pg-delta on by default it added nothing, and a stale opt-in would have silently defeatedenabled = false);--use-pg-deltaremains the per-run opt-in that overrides the rollback.Knock-on behavior changes to note in release notes:
db schema declarativecommands' gate (--experimental || pgdelta enabled) is now open by defaultdb reset --experimentalonly takes the[db.migrations].schema_pathsschema-files path when pg-delta is explicitly disabled; otherwise it replays migrationsSUPABASE_EXPERIMENTAL_PG_DELTAis ignored (see Rollback above)SIDE_EFFECTS.md files,
db diff/db pulldocs, and the Go CONTRIBUTING pg-delta section were updated to match. Tests pin the new default (absent config → pg-delta), the explicit-false → migra rollback (including with a stale env opt-in present), and the per-invocation flag overrides; migra-subject tests opt out explicitly.Linked issue
Linear: CLI-2211, CLI-1588
open-for-contributionlabel (or I'm a Supabase maintainer).Checklist
fix(cli): …).pnpm check:allpasses; relevant package tests pass for every touched workspace, andpnpm types:checkpasses for each touched TypeScript workspace (or workspace declaring it).🤖 Generated with Claude Code
https://claude.ai/code/session_01BQAoY9JF4uiZRvKVkSd9Wy