feat(cli)!: make pg-delta the default diff engine everywhere - #6391
feat(cli)!: make pg-delta the default diff engine everywhere#6391avallete wants to merge 5 commits into
Conversation
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@870dde114c8b9250939d57255bff0b3c9c719ae5Preview package for commit |
|
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 |
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".
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".
|
/ai-review |
There was a problem hiding this comment.
🤖 AI Review
Eight deduplicated findings were adjudicated: five confirmed and three refuted. The confirmed issues are two SIDE_EFFECTS documentation gaps, two stale comment/test-layer remnants, and one violation of the trusted TypeScript-authority documentation convention. The db remote commit engine switch itself is intentional and documented, so its finding is narrowed from a major behavioral defect to a minor documentation gap.
Findings
| Severity | Location | Category | Sources | Claim |
|---|---|---|---|---|
| 🟡 MINOR | apps/cli-go/cmd/db.go:168 |
documentation |
claude | The default flip routes delegated db remote commit through the Go edge-runtime pg-delta path, but the command's SIDE_EFFECTS.md does not document the container, pg-delta version/registry inputs, or conditional debug artifacts. |
| 🟡 MINOR | apps/cli/src/legacy/commands/db/pull/pull.handler.ts:520 |
documentation |
claude | db pull --declarative only rewrites [db.migrations].schema_paths when pg-delta is disabled, but SIDE_EFFECTS.md omits this conditional config.toml write; the new true default makes the no-write branch apply to configurations without a pgdelta section. |
| ⚪ NIT | apps/cli/src/legacy/commands/db/schema/declarative/sync/sync.integration.test.ts:118 |
test-quality |
claude | The inert LegacyEdgeRuntimeScript test layer and its comment are stale because the mocked engine and native reset path no longer require that service. |
| ⚪ NIT | apps/cli/src/legacy/commands/db/shared/legacy-shadow-source.ts:6 |
documentation-conventions |
codex | The edited header continues to frame the TypeScript implementation through old Go function names and source locations, contrary to the trusted package convention. |
| ⚪ NIT | apps/cli/src/legacy/shared/db-bootstrap/shadow-database.ts:4 |
documentation |
claude | Comments still reference the deleted legacyPrepareRawShadow symbol and deleted usePgDelta/ctx input fields. |
Findings outside the diff
- 🟡 MINOR
apps/cli-go/cmd/db.go:168— The default flip routes delegateddb remote committhrough the Go edge-runtime pg-delta path, but the command's SIDE_EFFECTS.md does not document the container, pg-delta version/registry inputs, or conditional debug artifacts. - 🟡 MINOR
apps/cli/src/legacy/commands/db/pull/pull.handler.ts:520—db pull --declarativeonly rewrites[db.migrations].schema_pathswhen pg-delta is disabled, but SIDE_EFFECTS.md omits this conditional config.toml write; the new true default makes the no-write branch apply to configurations without a pgdelta section. - ⚪ NIT
apps/cli/src/legacy/shared/db-bootstrap/shadow-database.ts:4— Comments still reference the deletedlegacyPrepareRawShadowsymbol and deletedusePgDelta/ctxinput fields.
Refuted findings (kept for transparency, not posted as review comments)
packages/config/src/experimental.ts:78(config-schema): The optional[experimental.pgdelta]section allegedly lacks a section-level decoding default, causing absent sections to decode differently from the CLI default.
Refuted: The checked-out code already contains exactly the proposed section-level default at line 100, matching the sibling webhooks pattern. An absent section therefore decodes through{}and receivesenabled: true.apps/cli/src/legacy/commands/db/reset/SIDE_EFFECTS.md:137(documentation): The false value ofSUPABASE_EXPERIMENTAL_PGDELTA_ENABLEDis allegedly undocumented even though it selects the schema-files reset branch.
Refuted: Although the environment-variable table describes the truthy direction, the document's opening behavior description explicitly documents that false selects the schema-files branch and that true is the default.apps/cli/src/legacy/commands/experimental/workers/push/push.integration.test.ts:722(scope): The root-specific workers-push success branch and skipped unreadable-file test allegedly relax unrelated assertions without justification.
Refuted: Both changes accurately account for root bypassing POSIX permission bits. Under root the workers directory and file are genuinely readable, so expecting failure would test behavior that did not occur; the changes correct environment-dependent tests rather than relax production behavior.
Stats
Claude findings: 7 · Codex findings: 1 · Confirmed: 5 · Refuted: 3 · 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.
65cfecf to
75328d8
Compare
5746f85 to
51e1063
Compare
b7b35e1 to
c72b479
Compare
An absent [experimental.pgdelta] section, or a section that omits `enabled`, now resolves to pg-delta for db diff, db pull, and db remote commit: in the TypeScript CLI, in @supabase/config (and the published JSON schema), and in the residual Go binary (the config template `supabase init` scaffolds, plus the delegated `db remote changes` and `db diff --use-pg-schema` paths that still read the setting). The Go zero-value tri-state needed no *bool: the ejected config template defaults `enabled = true`, and because mergeDefaultValues feeds that template to viper as the default config, viper's key-level merge resolves both the absent-section and omitted-key cases to true while an explicit `enabled = false` still wins. PgDeltaInitEnabled / InitParams.UsePgDelta go away with it. Rollback stays one line: `[experimental.pgdelta] enabled = false` in config.toml, or per invocation --use-migra (db diff) / --diff-engine migra (db pull). Migra itself is unchanged. The config rollback is authoritative: the historical SUPABASE_EXPERIMENTAL_PG_DELTA opt-in env var is no longer consulted (with pg-delta on by default it added nothing, and a stale opt-in would silently defeat `enabled = false`); --use-pg-delta remains the per-run opt-in that overrides the rollback. Knock-on behavior changes: - the db schema declarative commands' gate (--experimental || pgdelta enabled) is now open by default - a versionless `db reset --experimental` only takes the [db.migrations].schema_paths schema-files path when pg-delta is explicitly disabled; otherwise it replays migrations - SUPABASE_EXPERIMENTAL_PG_DELTA is ignored 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. BREAKING CHANGE: pg-delta is now the default schema diff engine. Projects that want to keep using migra must set `[experimental.pgdelta] enabled = false` in config.toml, or pass --use-migra / --diff-engine migra per invocation. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BQAoY9JF4uiZRvKVkSd9Wy
c72b479 to
46af87e
Compare
…ntation (supabase#6487) ## Summary First half of the pg-delta cleanup, tracked as [CLI-2211](https://linear.app/supabase/issue/CLI-2211). The second half (flipping the default engine to pg-delta, CLI-1588) is stacked on top of this PR in [supabase#6391](supabase#6391). 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; its release notes announced removal after ~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 (all legacy-engine-only; 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 whole catalog snapshot machinery (`legacy-pgdelta.cache.ts`); the shared migration lister moves to `command-internal/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 - leftover writer/debug/edge-runtime surface that only the deleted engine used (manifest-less wipe-and-rewrite, orphan debug-bundle fields, `extraFiles` / `extraEnv`) `db pull --experimental` and `db remote commit` now run in-process as well (commit is a thin `db pull` wrapper with a fixed `remote_commit` name and the cobra deprecation line). The deprecated `--experimental` export 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 diff` only serves the TypeScript `--use-pg-schema` proxy. `db remote changes` still uses Go migra. Also bumps `@supabase/pg-delta` to `1.0.0-alpha.49` (same `@supabase/pg-topo 1.0.0-alpha.6` peer; 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-style `db 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 resolves `enabled = false`, so declarative export still writes `[db.migrations].schema_paths` in that default case. SIDE_EFFECTS.md files, the `db pull` docs, and the Go CONTRIBUTING pg-delta section were updated to match. ## Linked issue Linear: [CLI-2211](https://linear.app/supabase/issue/CLI-2211) - [x] The linked issue is **open** and carries the `open-for-contribution` label (or I'm a Supabase maintainer). ## Checklist - [x] The PR title follows [Conventional Commits](https://www.conventionalcommits.org/) (e.g. `fix(cli): …`). - [x] Tests added or updated for the change. - [x] From the repository root, `pnpm check:all` passes; relevant package tests pass for every touched workspace, and `pnpm types:check` passes for each touched TypeScript workspace (or workspace declaring it). --------- Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: Cursor <cursoragent@cursor.com>
|
CI note on Generated by Claude Code |
Restore a dropped legacy->non-legacy rename (legacyDbReset -> dbReset) in reset.integration.test.ts and reformat the hand-resolved conflict files to match oxfmt, both surfaced by pnpm check:all after merging develop.
|
I merged All conflicts were mechanical rename collisions between this PR's own changes (still using the old A few of the larger conflicted test files ( Verified after the merge:
Please double check the resolution, especially around |
…divergences ledger The --strict-coverage entry still called migra the db diff / migration-style db pull default, wording that predates the default flip in this change. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BQAoY9JF4uiZRvKVkSd9Wy
|
Double-checked the #6525 merge resolution; it holds up. Diff equivalence. I compared this PR's diff against its base before the merge ( Engine selection specifically. All of the flip's pieces are present and unchanged in meaning on the merged head:
Checks on the merged head (f016a81). oxfmt, oxlint, and One follow-up I pushed as f016a81: Generated by Claude Code |
Keep the `[experimental.pgdelta] enabled = false` code span on a single line so the markdown formatter stops flagging the paragraph. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BQAoY9JF4uiZRvKVkSd9Wy
Summary
Second half of the pg-delta work, tracked as CLI-1588. It follows #6487 (the bundled pg-delta engine became the only pg-delta implementation, CLI-2211), which is now merged; this PR is only the default flip on top of it.
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 residual Go binary (the config templatesupabase initscaffolds, plus the delegateddb remote changes/db diff --use-pg-schemapaths that still read the setting).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.PgDeltaInitEnabled/InitParams.UsePgDeltago away with it.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 and the
db diff/db pull/declarative docs 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-1588
open-for-contributionlabel (or I'm a Supabase maintainer).BREAKING CHANGES:
pg-delta is now the default schema diff engine. After this PR you must explicitly provide
--use-migra(db diff) /--diff-engine migra(db pull), or set[experimental.pgdelta] enabled = falseinconfig.toml, to keep using migra.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