fix(cli): honour deletion of extension-managed objects in declarative sync - #6449
Open
avallete wants to merge 4 commits into
Open
fix(cli): honour deletion of extension-managed objects in declarative sync#6449avallete wants to merge 4 commits into
avallete wants to merge 4 commits into
Conversation
… sync Removing a pg_cron job or pgmq queue declaration from a manifest-less declarative tree was refused as a legacy pg-delta export, and the refusal then blocked every later sync of that tree, unrelated schema work included. The engine already plans the cron.unschedule / pgmq.drop_queue calls; the refusal was CLI-side classification. - Only a missing CREATE EXTENSION declaration is legacy-export evidence now. An extension-managed object removal whose owning extension the tree still declares is an intentional delete or rename and flows through the destructive-changes warning instead, as `pg_cron job <name>` / `pgmq queue <name>` lines appended to the engine's data-loss statements (pg-delta does not flag cron.unschedule as data loss itself). - Whole-extension removals keep the gate, and its evidence still enumerates the jobs/queues at risk when their owner is not declared. - The staged-export prompt now offers "Continue with removals", and the new `sync --allow-removals` flag is its non-interactive equivalent, named in the gate's suggestion. `--yes` deliberately does not double as it. CLI-2282 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Wh8sCVwt29sYWSYdcDUbWN
Keep the classification fix and the interactive "Continue with removals" choice; non-interactive runs that still hit the legacy-export gate refuse with the staged-export recipe as before. CLI-2282 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Wh8sCVwt29sYWSYdcDUbWN
Only a dropped extension is legacy-export evidence; removing or renaming a pg_cron job or pgmq queue declaration is an ordinary change and no longer refuses the sync. Reverts the destructive-warning lines, the interactive "Continue with removals" choice, and the extra unit coverage in favour of one integration scenario and an e2e scenario that removes a queue and renames a job from the declarative tree. CLI-2282 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Wh8sCVwt29sYWSYdcDUbWN
Contributor
Supabase CLI previewnpx --yes https://pkg.pr.new/supabase/cli/supabase@cc83f6009d2386484590c4acfa0cffea00f362a3Preview package for commit |
Contributor
There was a problem hiding this comment.
🤖 AI Review
Both independent reviews were available. The overlapping data-loss findings are confirmed as one issue: managed-object removals now bypass the legacy gate but are not added to destructive-change warnings. Four additional Claude findings are confirmed, covering missing advertised affordances, two test-quality gaps, and prose wrapping.
Findings
| Severity | Location | Category | Sources | Claim |
|---|---|---|---|---|
| 🟠 MAJOR | apps/cli/src/legacy/commands/db/schema/declarative/declarative.flow.ts:95 |
data-loss |
claude+codex | Extension-managed object removals whose owning extension remains declared—including removals encountered after repairing an unrelated implicit extension—proceed without the destructive-change warning promised by the PR, allowing --yes to apply cron.unschedule or pgmq.drop_queue silently. |
| 🟡 MINOR | apps/cli/src/legacy/commands/db/schema/declarative/sync/sync.e2e.test.ts:200 |
test-quality |
claude | The new e2e helper reads only the lexicographically last migration, making the assertions brittle when pg-delta splits a valid plan across multiple migration files. |
| 🟡 MINOR | apps/cli/src/legacy/commands/db/schema/declarative/sync/sync.handler.ts:553 |
documentation |
claude | The PR description advertises an --allow-removals flag and a staged-export Continue with removals choice, but neither exists in the checked-out implementation. |
| 🟡 MINOR | apps/cli/src/legacy/commands/db/shared/legacy-pgdelta-next-adapter.layer.ts:154 |
test-coverage |
claude | The dropped-extension evidence path is not covered with a real pg-delta plan, leaving unverified whether managed-object intents remain available after the summarizer discards child removal facts. |
| ⚪ NIT | apps/cli/src/legacy/commands/db/schema/declarative/sync/SIDE_EFFECTS.md:97 |
style |
claude | The edited paragraph leaves line 97 at 85 columns, disrupting its approximately 80-column prose wrapping. |
Findings outside the diff
- 🟡 MINOR
apps/cli/src/legacy/commands/db/schema/declarative/sync/sync.handler.ts:553— The PR description advertises an--allow-removalsflag and a staged-exportContinue with removalschoice, but neither exists in the checked-out implementation. - 🟡 MINOR
apps/cli/src/legacy/commands/db/shared/legacy-pgdelta-next-adapter.layer.ts:154— The dropped-extension evidence path is not covered with a real pg-delta plan, leaving unverified whether managed-object intents remain available after the summarizer discards child removal facts.
Stats
Claude findings: 5 · Codex findings: 1 · 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.
Member
Author
|
On the two review findings without an inline thread:
Generated by Claude Code |
… e2e A next-engine plan may span several ordered migration files; assert on the concatenation of the files each sync added instead of the last one. Also rewraps a SIDE_EFFECTS.md paragraph. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Wh8sCVwt29sYWSYdcDUbWN
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.
Removing a
pg_cronjob orpgmqqueue declaration from a manifest-less declarative tree was refused as a legacy pg-delta export, and the refusal then blocked every later sync of that tree, unrelated schema work included. The engine already plans thecron.unschedule/pgmq.drop_queuecalls; the refusal was CLI-side classification.The legacy-export gate now only fires when the plan drops an extension. Extension-managed object removals (cron jobs, pgmq queues) no longer count toward it, so deleting or renaming one on a converged tree generates the unschedule / drop_queue statements like any other change. The gate still enumerates those objects as evidence when their owning extension itself is being dropped, which is the legacy-export case it was built for.
No new flags, prompts, or warning output. The change is confined to
legacyClassifyDeclarativeCompatibilityGapindeclarative.flow.ts, plus an integration scenario and an e2e scenario that adds a job and a queue to the tree, then renames the job and drops the queue.Resolves CLI-2282.
🤖 Generated with Claude Code
https://claude.ai/code/session_01Wh8sCVwt29sYWSYdcDUbWN