Repository navigation
migrate: require --allow-destructive for an accepted DROP INDEX - #276
Conversation
--accept-blocking accepts the lock, not the loss of the index. A dropped index the application still reads through is a common mistake, so the refusal lists the checks to make before acknowledging it.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
🤖 Reviewed by Jash's AI agent at The new gate in Non-blocking test suggestion at Validation: all 16 reported CI checks pass, including PostgreSQL 14–18. I did not run a local build, tests, or the demo. Exact-head surrounding source was unavailable through the contents API, so unchanged table resolution, execution/locking helpers, and repository instructions outside the diff were not independently verified. |
JashLal
left a comment
There was a problem hiding this comment.
🤖 Approving on Jash's behalf after the full-diff review at 8f7ef16. No concrete blocker found; the optional REINDEX-without-destructive-acknowledgement test and surrounding-source verification limits are recorded in the review. No local build or tests were run. Generated by Codex.
|
🤖 Adversarial review response — created by Kiran's code review agent (Amp, Claude Opus 4.6) — pull/276, follow-up commit No blockers were raised; the one test suggestion is fixed in the follow-up commit.
The verdict, CI status, and approval body in review 5691388310 are confirmations; no action. Source: block/pg-sprite#276, review comment 6484323671 and review 5691388310 at head |
A
DROP INDEXrun under--accept-blockingnow also needs--allow-destructivenaming the same table; without it the drop is refused withdestructive-changeand the refusal lists the checks to make first.Why
--accept-blockingacknowledges theACCESS EXCLUSIVElock a plainDROP INDEXtakes, but nothing acknowledged losing the index itself. Dropping an index the application still reads through, or one a foreign key or a uniqueness guarantee relies on, is a common mistake, and it is not cheap to undo: the fix is a full index build. The planner already treats every index drop as destructive andmigrate --desiredrefuses it; the accepted-blocking path was the one place an index could be dropped without acknowledging the loss. This applies the "make mistakes hard to commit" principle to every index drop, unique or not.What
DROP INDEXneedsOptions.AllowDestructive/--allow-destructivenaming that table. Without it: refused, reasondestructive-change, classby-design, exit 2, nothing executed. The detail asks the operator to confirmidx_scanis 0 on the primary and every replica over a full application cycle, that no foreign key relies on the index, and that nothing needs a unique index's guarantee. A mismatched acknowledgement isErrAllowDestructiveMismatch.--allow-destructiveand--accept-blockingnow combine (they were mutually exclusive).REINDEX INDEX/REINDEX TABLEdiscard nothing and need only--accept-blocking.allowed_destructive: truebesideblocking_passthrough: true, and the loss is audited at warn level.Behaviour change for callers: a
DROP INDEXpassed with--accept-blockingalone, which committed before, is now refused withdestructive-change. Add--allow-destructive SCHEMA.TABLE(the same table) to keep running it.Before / after
The same accepted drop of a plain, non-unique index the application may still use. The lock acknowledgement is unchanged; what changes is that the loss now needs its own.
REINDEX INDEXandREINDEX TABLEbehave exactly as before.🤖 Generated with Amp (Claude Opus 4.6)