Skip to content

test: drive the Grants stage that is actually rendered - #386

Merged
cursor[bot] merged 1 commit into
cursor/v3-ui-phases-dbb9from
fix/v3-flaky-async-queries
Sep 8, 2026
Merged

test: drive the Grants stage that is actually rendered#386
cursor[bot] merged 1 commit into
cursor/v3-ui-phases-dbb9from
fix/v3-flaky-async-queries

Conversation

@huyplb

@huyplb huyplb commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Targets cursor/v3-ui-phases-dbb9 rather than main, since you are still pushing to it.

What was wrong

a7bdffce4 swapped DbAccessPermissionSections for the new AccessGrantsStage inside AccessPermissionPanel, but AccessPermissionPanel.test.tsx kept driving the old component — db-access-expand-table, db-access-permission-sections.

They looked 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 that load. Switching to findByTestId made 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 runAccessSql was 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, not read-only. The fixture already grants alice SELECT 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.tsx fails about 2 runs in 10, measured. When it fails the DOM is stuck on "Loading"loading never clears, so the empty state never renders.

I tried replacing the effect's per-run cancelled flag with the token idiom used in useAllSchemaObjects and UserManagement, on the theory that a superseded run skips its finally and 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.tsx so it exercises AccessGrantsStage instead of the removed DbAccessPermissionSections / per-table editor flow (db-access-* test IDs).

The session test waits for access-grants-stage with findByTestId after opening Grants, avoiding a race when the stage loads schema objects (the source of CI flakiness). A shared grantsStageFor helper 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 assert runAccessSql is 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.

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>
@cursor

cursor Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Bugbot couldn't run - usage limit reached

Bugbot 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)

@cursor
cursor Bot merged commit a7203e0 into cursor/v3-ui-phases-dbb9 Sep 8, 2026
11 checks passed
@cursor
cursor Bot deleted the fix/v3-flaky-async-queries branch September 8, 2026 04:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant