test: drive the Grants stage that is actually rendered - #386
Merged
Conversation
a7bdffc swapped DbAccessPermissionSections for the new AccessGrantsStage in AccessPermissionPanel but left the tests driving the old component, so three of them walked a UI that no longer exists — `db-access-expand-table`, `db-access-permission-sections`. They were reported as flaky rather than broken because they read with `getByTestId` immediately after a click, and the stage loads its own schema objects. A synchronous read races the load: sometimes the old markup was still mounted, sometimes not. Switching to `findByTestId` turned the same failure deterministic, which is what exposed the swap. Rewritten against the stage as it is now: pick a preset, read the generated SQL, copy it or hand it to the editor. Both paths still assert `runAccessSql` was never called, which is the guarantee the screen exists to keep — the stage says so itself: "Fox Schema generates GRANT/REVOKE SQL — it does not apply it." The preset is `read-write`, not `read-only`, because the fixture already grants alice SELECT on public.orders. Read-only therefore matches the catalog and correctly generates nothing — I had the buttons' disabled state down as a bug until the SQL panel said "Desired matrix matches the live catalog". That case is now a test of its own, since offering a GRANT that changes nothing would still be a write against production. Stable over 6 consecutive runs; suite 3617 passed / 0 failed. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Contributor
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_9be4513e-bd41-443d-b8de-19c6e1a21435) |
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.
Targets
cursor/v3-ui-phases-dbb9rather thanmain, since you are still pushing to it.What was wrong
a7bdffce4swappedDbAccessPermissionSectionsfor the newAccessGrantsStageinsideAccessPermissionPanel, butAccessPermissionPanel.test.tsxkept driving the old component —db-access-expand-table,db-access-permission-sections.They looked flaky rather than broken because they read with
getByTestIdimmediately after a click, and the stage loads its own schema objects. A synchronous read races that load. Switching tofindByTestIdmade the same failure deterministic, which is what revealed the swap.What the tests do now
Pick a preset → read the generated SQL → copy it, or hand it to the SQL Editor. Both paths still assert
runAccessSqlwas never called — the guarantee the screen exists to keep, and the one the stage states itself: "Fox Schema generates GRANT/REVOKE SQL — it does not apply it."One detail worth keeping: the preset is
read-write, notread-only. The fixture already grants aliceSELECT ON public.orders, so read-only matches the catalog and correctly generates nothing. I had the disabled Copy button down as a bug until the SQL panel said "Desired matrix matches the live catalog". That case is now its own test — offering a GRANT that changes nothing would still be a write against production.Stable across 6 consecutive runs. Full suite: 3617 passed, 0 failed.
Still open, and not fixed here
LokeeWeaveView.test.tsxfails about 2 runs in 10, measured. When it fails the DOM is stuck on "Loading" —loadingnever clears, so the empty state never renders.I tried replacing the effect's per-run
cancelledflag with the token idiom used inuseAllSchemaObjectsandUserManagement, on the theory that a superseded run skips itsfinallyand strands the spinner. It made things worse — 4 failures in 10 against a re-measured baseline of 2 in 10 — so I reverted it rather than ship a production change on a theory the numbers contradict.The diagnosis stands (stuck on
loading); the cause does not. It is in your new lokee code, so it is yours to take — I did not want to guess again in a file you are actively changing.🤖 Generated with Claude Code
Note
Low Risk
Test-only changes; no production behavior modified.
Overview
Updates
AccessPermissionPanel.test.tsxso it exercisesAccessGrantsStageinstead of the removedDbAccessPermissionSections/ per-table editor flow (db-access-*test IDs).The session test waits for
access-grants-stagewithfindByTestIdafter opening Grants, avoiding a race when the stage loads schema objects (the source of CI flakiness). A sharedgrantsStageForhelper centralizes navigation to a loaded Grants stage.Copy and open in SQL Editor cases now pick the read-write preset, wait for enabled
access-grants-copy/access-grants-open-sql, and still assertrunAccessSqlis never called. A new case covers read-only when the fixture already matches the catalog: the UI shows matches the live catalog, and copy/open stay disabled.Reviewed by Cursor Bugbot for commit 8ad67f4. Bugbot is set up for automated code reviews on this repo. Configure here.