Skip to content

test(web): fix the ConnectedApps flake that failed two deploys - #699

Merged
mrviduus merged 1 commit into
mainfrom
fix/flaky-connected-apps-test
Oct 4, 2026
Merged

mrviduus merged 1 commit into
mainfrom
fix/flaky-connected-apps-test

Conversation

@mrviduus

@mrviduus mrviduus commented Oct 4, 2026

Copy link
Copy Markdown
Owner

Why

ConnectedApps › Disconnect revokes and removes only that row failed the #691 deploy (2026-10-04, re-run passed) and the #698 deploy, and a deploy on 2026-10-01 (then "fixed" with a 3s timeout).

Root cause

The test's useTranslation mock returned a new t on every render. ConnectedApps loads grants in useEffect(..., [isAuthenticated, t]), so in the test every render re-ran the load; after Disconnect filtered "Claude" out, a late reload resolved the full list again and put it back. Timing-dependent → worse on a loaded runner. The real hook memoizes t (useCallback), so production is unaffected.

Fix

Hoisted one stable t for the mock; dropped the 3s timeout; added expect(listOAuthGrants).toHaveBeenCalledTimes(1), which fails with the old mock (verified) — so the cause can't come back silently.

Verified

5/5 runs green locally; reverting the mock makes the new assertion fail.

🤖 Generated with Claude Code

The mock returned a new t per render; the component's load effect depends on t, so every
render reloaded the list and a late reload restored a disconnected row. Assert one load.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@mrviduus
mrviduus merged commit 2bfb58c into main Oct 4, 2026
10 checks passed
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