feat(cli): make the bundled pg-delta engine the only pg-delta implementation - #6487
Conversation
…ntation
The SUPABASE_USE_PG_DELTA_NEXT escape hatch shipped in v2.115.0 as a
temporary opt-out back to the legacy edge-runtime pg-delta engine and was
announced for removal after about a month. Setting it now has no effect:
the in-process @supabase/pg-delta engine is the only pg-delta
implementation.
Deleted with the legacy engine:
- the flag module and the engine selector layer; LegacyPgDeltaEngine
loses its `implementation` discriminator and every handler branch keyed
on it
- the edge-runtime pg-delta Deno script templates, the
supabase/.temp/pgdelta-version npm pin, and the PGDELTA_NPM_REGISTRY /
PGDELTA_{SOURCE,TARGET}_SSLROOTCERT plumbing (the edge-runtime service
itself stays: migra still runs through it)
- the migrations-catalog cache warmups after db push / db reset / start /
db start / bootstrap (TypeScript and Go) and the catalog snapshot
machinery in legacy-pgdelta.cache.ts; the shared migration lister moves
to legacy-migration-list.ts
- the legacy declarative catalog seam (LegacyDeclarativeSeam.exportCatalog),
the declarative-apply engine (legacy-pgdelta.apply.ts), 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
Also bumps @supabase/pg-delta to 1.0.0-alpha.48 (with its
@supabase/pg-topo 1.0.0-alpha.6 peer).
Engine selection is unchanged: migra stays the default and pg-delta is
still opted into through [experimental.pgdelta] enabled = true,
SUPABASE_EXPERIMENTAL_PG_DELTA, --use-pg-delta, or --diff-engine pg-delta.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BQAoY9JF4uiZRvKVkSd9Wy
Supabase CLI previewnpx --yes https://pkg.pr.new/supabase/cli/supabase@3e19649d1a459429b1897cef077afb0e58cdedc8Preview package for commit |
Same @supabase/pg-topo ^1.0.0-alpha.6 peer and dependency set as alpha.48; the release is younger than the workspace's minimum release age, so it replaces alpha.48 on the exclusion list. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BQAoY9JF4uiZRvKVkSd9Wy
There was a problem hiding this comment.
Superseded by a newer AI review
🤖 AI Review
Claude reported five findings and Codex reported none. All five are confirmed: one test-coverage regression, one contradictory engine-default description, stale references to removed pg-delta code, silent removal of a documented environment-variable opt-out, and two unrelated test changes bundled into the cleanup. No correctness or security defect was identified.
Findings
| Severity | Location | Category | Sources | Claim |
|---|---|---|---|---|
| 🟡 MINOR | apps/cli/src/legacy/shared/legacy-migration-list.ts:28 |
test-coverage |
claude | The moved legacyListLocalMigrations implementation lost its dedicated unit coverage when legacy-pgdelta.cache.unit.test.ts was deleted, with no replacement test file added. |
| 🟡 MINOR | apps/cli/docs/go-cli-divergences.md:30 |
documentation |
claude | The --strict-coverage documentation incorrectly describes pg-delta as the default and selecting migra as “rolling back,” although migra remains the default for db diff and migration-style db pull. |
| ⚪ NIT | apps/cli/src/legacy/commands/db/shared/legacy-pgdelta-engine.layer.ts:18 |
user-experience |
claude | SUPABASE_USE_PG_DELTA_NEXT=false is no longer read and silently ceases to select the legacy engine, without a deprecation notice. |
| ⚪ NIT | apps/cli/src/legacy/commands/experimental/workers/push/push.integration.test.ts:1287 |
scope |
claude | The PR includes two root-environment test fixes unrelated to the pg-delta removal, increasing the scope of an already large cleanup. |
| ⚪ NIT | apps/cli/src/legacy/commands/db/shared/legacy-pgdelta.seam.integration.test.ts:85 |
documentation |
claude | Several surviving comments still refer to pg-delta modules and helpers deleted by this PR, including a seam-test comment describing edge-runtime scripts the seam no longer invokes. |
Findings outside the diff
- ⚪ NIT
apps/cli/src/legacy/commands/db/shared/legacy-pgdelta.seam.integration.test.ts:85— Several surviving comments still refer to pg-delta modules and helpers deleted by this PR, including a seam-test comment describing edge-runtime scripts the seam no longer invokes.
Stats
Claude findings: 5 · Codex findings: 0 · Confirmed: 5 · Refuted: 0 · Uncertain: 0
Models: claude-opus-5 + gpt-5.6-sol · Trigger: auto · Workflow run
This review runs once per PR. A maintainer can request another with a /ai-review comment.
- restore the six legacyListLocalMigrations unit cases in a colocated legacy-migration-list.unit.test.ts (they were only covered by the deleted legacy-pgdelta.cache.unit.test.ts) - drop the dead edge-runtime / SSL-probe fakes from the declarative seam integration test: the native seam layer no longer requires either service - stop describing pg-delta as the default in go-cli-divergences.md; migra remains the db diff / migration-style db pull default in this change - reword two comments that still pointed at the deleted legacy apply module - revert the two root-environment test tweaks (workers push root branch, schema-files unreadable-file skip) that were unrelated to this cleanup Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BQAoY9JF4uiZRvKVkSd9Wy
|
/ai-review |
There was a problem hiding this comment.
🤖 AI Review
Only Claude's independent review was available; the Codex review did not complete. All six Claude findings are confirmed: one minor latent destructive/dead-code concern and five nits involving dead code, unnecessary wiring, stale comments, and migration UX. No critical or major defects were identified.
Findings
| Severity | Location | Category | Sources | Claim |
|---|---|---|---|---|
| 🟡 MINOR | apps/cli/src/commands/db/shared/legacy-pgdelta.write.ts:321 |
dead-code |
claude | The removed legacy engine leaves a manifest-less declarative-output fallback that recursively deletes the declarative directory, despite all surviving production exports carrying a manifest. |
| ⚪ NIT | apps/cli/src/commands/db/shared/legacy-debug-bundle.ts:6 |
dead-code |
claude | Four debug-bundle fields and their artifact-writing branches remain after their sole db pull producer was deleted. |
| ⚪ NIT | apps/cli/src/commands/db/shared/legacy-pgdelta-engine.layer.ts:18 |
ux |
claude | SUPABASE_USE_PG_DELTA_NEXT=false is now silently ignored, so users retaining the former opt-out receive the in-process engine without notice. |
| ⚪ NIT | apps/cli/src/command-internal/legacy-edge-runtime-script.service.ts:33 |
dead-code |
claude | LegacyEdgeRuntimeRunOpts.extraFiles and extraEnv have no remaining producers after removal of the edge-runtime pg-delta registry injection. |
| ⚪ NIT | apps/cli/src/commands/db/shared/legacy-pgdelta-engine.layer.ts:60 |
maintainability |
claude | The shared pg-delta command runtime still installs the edge-runtime and TLS-probe layers for declarative generate and sync even though those commands use only the in-process engine. |
| ⚪ NIT | apps/cli/src/commands/db/diff/diff.integration.test.ts:279 |
documentation |
claude | Several comments still refer to functions or workflows deleted by this PR. |
Findings outside the diff
- 🟡 MINOR
apps/cli/src/commands/db/shared/legacy-pgdelta.write.ts:321— The removed legacy engine leaves a manifest-less declarative-output fallback that recursively deletes the declarative directory, despite all surviving production exports carrying a manifest. - ⚪ NIT
apps/cli/src/command-internal/legacy-edge-runtime-script.service.ts:33— LegacyEdgeRuntimeRunOpts.extraFiles and extraEnv have no remaining producers after removal of the edge-runtime pg-delta registry injection. - ⚪ NIT
apps/cli/src/commands/db/shared/legacy-pgdelta-engine.layer.ts:60— The shared pg-delta command runtime still installs the edge-runtime and TLS-probe layers for declarative generate and sync even though those commands use only the in-process engine. - ⚪ NIT
apps/cli/src/commands/db/diff/diff.integration.test.ts:279— Several comments still refer to functions or workflows deleted by this PR.
Stats
Claude findings: 6 · Codex findings: 0 · Confirmed: 6 · Refuted: 0 · Uncertain: 0
Models: claude-opus-5 + gpt-5.6-sol · Trigger: manual · Workflow run
This review runs once per PR. A maintainer can request another with a /ai-review comment.
- legacyWriteDeclarativeSchemas: remove the manifest-less wipe-and-rewrite fallback. The in-process engine always returns an export manifest, so the service's export result now requires it and the writer only ever runs the manifest-aware path; the legacy DeclarativeOutput envelope type goes with it. - legacy-debug-bundle: drop the sourceCatalog / targetCatalog / pgDeltaStderr / connectionInfo fields and their artifact writers — their only producer was the deleted db pull empty-diff bundle. - LegacyEdgeRuntimeRunOpts: drop extraFiles / extraEnv, which only the deleted pg-delta npm-registry injection populated. - legacyPgDeltaCommandRuntimeLayer no longer installs the edge-runtime script runner and TLS probe; they move to legacyMigraRuntimeLayer, composed only by db diff / db pull (the commands that can still select migra). The declarative generate/sync tests drop their now-unneeded SSL-probe fakes. - diff/pull integration tests: remove the dead PGDELTA_DEBUG catalog-export edge-runtime branches and reword comments that still described the removed legacy implementation. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BQAoY9JF4uiZRvKVkSd9Wy
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BQAoY9JF4uiZRvKVkSd9Wy
Move db remote commit and --experimental export off the Go proxy, then delete the unused Go pull, dump, and pg-delta engines. supabase-go db diff now only serves --use-pg-schema; db remote changes still uses migra. Co-authored-by: Cursor <cursoragent@cursor.com>
Remove unused npm-version/pgcache/pgadmin-diff seams after the engine delete, slim the commit mapper test, and restore the frozen Go reference while updating the current proxy-surface list. Co-authored-by: Cursor <cursoragent@cursor.com>
…' into claude/pg-delta-next-only-rfpryl Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
|
/ai-review |
An absent [experimental.pgdelta] section still resolves enabled=false, so declarative export writes schema_paths. The table had that invert. Co-authored-by: Cursor <cursoragent@cursor.com>
|
CI note on Generated by Claude Code |
## Summary Generate AI-review diffs locally from trusted, full-history Git checkouts instead of GitHub’s size-capped PR diff endpoint. A shared helper now serves the Claude, Codex, and adjudication stages while preserving triple-dot merge-base semantics. Add regression coverage for diffs beyond 20,000 lines and for diverged base/head histories. ## Why [AI Review run 34116168817](https://github.com/supabase/cli/actions/runs/34116168817) failed before either reviewer started because GitHub returned HTTP 406 once PR supabase#6487 exceeded the endpoint’s 20,000-line limit.
Summary
First half of the pg-delta cleanup, tracked as CLI-2211. The second half (flipping the default engine to pg-delta, CLI-1588) is stacked on top of this PR in #6391.
The
SUPABASE_USE_PG_DELTA_NEXTescape hatch shipped in v2.115.0 as a temporary opt-out back to the legacy edge-runtime pg-delta engine; its release notes announced removal after ~a month. Setting it now has no effect: the in-process@supabase/pg-deltaengine is the only pg-delta implementation.Deleted with the legacy engine:
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 (TypeScript and Go), and the whole catalog snapshot machinery (legacy-pgdelta.cache.ts); the shared migration lister moves tocommand-internal/legacy-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 effectiveextraFiles/extraEnv)db pull --experimentalanddb remote commitnow run in-process as well (commit is a thindb pullwrapper with a fixedremote_commitname and the cobra deprecation line). The deprecated--experimentalexport writes the same declarative tree as--declarative.Go is slimmed to match:
db pull,db dump,db remote commit, and the Go pg-delta / dump engines are gone.supabase-go db diffonly serves the TypeScript--use-pg-schemaproxy.db remote changesstill uses Go migra.Also bumps
@supabase/pg-deltato1.0.0-alpha.49(same@supabase/pg-topo 1.0.0-alpha.6peer; the release is younger than the workspace's minimum release age, so it is on the exclusion list).Engine selection is unchanged in this PR: migra stays the default for
db diff/ migration-styledb pull, and pg-delta is still opted into through[experimental.pgdelta] enabled = true,SUPABASE_EXPERIMENTAL_PG_DELTA,--use-pg-delta, or--diff-engine pg-delta. An absent[experimental.pgdelta]section still resolvesenabled = false, so declarative export still writes[db.migrations].schema_pathsin that default case. SIDE_EFFECTS.md files, thedb pulldocs, and the Go CONTRIBUTING pg-delta section were updated to match.Linked issue
Linear: CLI-2211
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).