Repository navigation
fix(admin): show the privilege statements before running them - #558
Merged
Merged
Conversation
Closes #439. Most of this issue was already addressed: revokes are emitted before grants so an interruption leaves less access rather than more, privileges are batched per scope, a partial failure names the statement that failed and what had already applied, and the grants are re-read either way. What was missing is the half of its acceptance that asks for a preview. Apply Changes now shows the whole batch and runs nothing until Execute. That matters here more than anywhere else in the app. GRANT and REVOKE each force an implicit commit, so once the first statement runs there is no way back. Confirmed against MySQL 8: START TRANSACTION; GRANT SELECT ON test_db.* TO 'rbtest'@'%'; ROLLBACK; SHOW GRANTS FOR 'rbtest'@'%'; -> GRANT SELECT ON `test_db`.* TO `rbtest`@`%` So the transaction the issue proposes cannot work, and the preview is the last point at which the change can still be reconsidered. The comment at the execution site already said as much; the UI did not act on it. SQLPreviewDialog moves from components/designer to components/common. It was already generic — sql, onClose, onExecute — and admin is its second caller. Three tests, all failing against the previous version. One existing test now clicks through the preview, since that is the path. Their assertions filter by connection id: components mounted by earlier tests in this file keep settling promises into the same mock, which made a first version of these tests fail against calls another test had made. Co-Authored-By: Claude Opus 5 <[email protected]>
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.
Closes #439.
Most of this was already done
Revokes are emitted before grants so an interruption leaves less access rather than more, privileges are batched per scope, a partial failure names the statement that failed and what had already applied, and the grants are re-read either way. What was missing is the half of the acceptance asking for a preview.
Apply Changes now shows the whole batch and runs nothing until Execute.
Why that matters more here than anywhere else
GRANTandREVOKEeach force an implicit commit, so once the first statement runs there is no way back. Confirmed against MySQL 8:So the transaction the issue proposes cannot work — the same shape as #379 and #394. The preview is the last point at which the change can still be reconsidered. The comment at the execution site already said this; the UI just didn't act on it.
Structure
SQLPreviewDialogmoves fromcomponents/designertocomponents/common. It was already generic (sql,onClose,onExecute) and admin is its second caller.Tests
Three, all failing against the previous version. One existing test now clicks through the preview, since that's the path.
Their assertions filter by connection id — components mounted by earlier tests in this file keep settling promises into the same mock, which made a first version of these tests fail against calls a different test had made. Worth knowing if you touch this file.
1806 unit + 303 browser, tsc/dprint/eslint clean.
Remaining in admin
executeQuerywith no live-server coverage.🤖 Generated with Claude Code