fix(frontend): abort cancelled Terra connect and keep header above wallet backdrops (GL-137) #162
No reviewers
Labels
No labels
agent:implement
agent:ready
backend
bug
cannot-reproduce
confirmed
desktop
docs
documentation
duplicate
enhancement
feature
frontend
good first issue
help wanted
high-risk
in-review
invalid
mobile
needs-triage
P0-critical
P1-high
P2-medium
P3-low
qa
QA
question
ready
report
responsive
security
security-escalate
smart-contract
solana
tablet
test-pass
ux
wallet-issue
wallet:keplr
wallet:metamask
wallet:station
wallet:walletconnect
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
code/cl8y-bridge-monorepo!162
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/gl-137-cancel-abort-overlay"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
main; this hardens remaining completion-path and overlay gaps.cancelConnection/ disconnect bumps a connect epoch so a lateconnectTerraWalletsuccess cannot setconnected. Ghost sessions are disconnected.ConnectionCancelledErroris not shown asconnectionError.fixed inset-0menus (Terra / EVM / Solana) portal todocument.bodyatz-40(WalletMenuBackdrop) and close on route change (useDismissOnNavigate), so they cannot stack inside the header and cover Connect.DEV_MODEis false, in-app banner, Android Chrome UA e2e, History navigation dismisses backdrop.docs/frontend.md, QA template 3.11/3.15, andskills/agent-frontend-terra-wallet-mobile.mdupdated and crosslinked.Related #137 (kept open until Android 16 Chrome device QA passes)
Test plan
npm run test:uniton changed files — 27 passed; retested)npx tsc --noEmit)E2E_UI_ONLY=1 npx playwright test e2e/wallet-connect.spec.ts --workers=5— 9 passed (retested after backdrop portal)Checklist
packages/frontend/plus docs/skills/QA for invariantsmentioned in issue #137
RECOMMEND: FIX
Follow-up to !159 for #137. Cancel-abort and header-safe backdrops are real improvements (connect epoch,
WalletMenuBackdropportaled at z-40 under header z-50,useDismissOnNavigate). No prompt injection, XSS, WC-allowlist regression, or Legal-gate skip. Do not close #137 until Android 16 Chrome device QA.Must-fix
Stale
connectTerraWalletsuccess always callsdisconnectTerraWallet(), which can kill Retry.packages/frontend/src/stores/wallet.ts(epoch mismatch afterawait connectTerraWallet):connectTerraWalletalready wrote intoconnectedWalletsbefore returning.TerraWalletModal.handleRetrydoescancelConnection()thenconnect()100ms later. CosmesKeplrController.disconnectthen callsthis.wc.disconnect()when the controller map is empty — that drops the shared WalletConnect client under in-flight Retry.Unit tests only cover Cancel without a second
connect()(wallet.test.ts).Required: skip protocol disconnect when
get().connectingis true (a newer connect owns the singleton). Still throwConnectionCancelledErrorand do notset({ connected: true }). Add a unit test: connect A →cancelConnection→ connect B → resolve A →connectedstill false, B still running,disconnectTerraWalletnot called while B is connecting.Issue #137
connecting === falseon fresh visitapplyWalletHydrateReset)Security (no BLOCK)
fixed inset-0covering Connectconnectingfrom previous tabDEV_MODEgated + new test; storeconnectSimulated()still ungated (pre-existing)dangerouslySetInnerHTML)Nice-to-have (not merge blockers)
connect()ifconnectingis already true (Retry already clears it first).DEV_MODEguard onconnectSimulatedin the store.terra1, plus desktop Keplr extension smoke.added 1 commit
4761fa5a- fix(frontend): skip WalletConnect disconnect while Retry is connecting (GL-137)Compare with previous version
Review must-fix addressed (
4761fa5)Must-fix from the FIX review: a stale
connectTerraWalletsuccess always calleddisconnectTerraWallet(), which can kill Retry. CosmesKeplrController.disconnectdrops the shared WalletConnect client when the controller map is empty.TerraWalletModal.handleRetrydoescancelConnection()thenconnect()100ms later.Change: epoch mismatch still throws
ConnectionCancelledErrorand does notset({ connected: true }). Protocol disconnect runs only whenconnecting === false(shouldDisconnectGhostWalletConnect/disconnectGhostWalletConnectIfUnowned). If Retry already owns the singleton, skipdisconnectTerraWallet.Cancel-without-Retry still disconnects the ghost session (existing unit test unchanged).
Completed from the review
connect()is in flightConnectionCancelledError; do not setconnectedcancelConnection→ connect B → resolve A →connectedfalse, B stillconnecting,disconnectTerraWalletnot calleddocs/frontend.md, QA 3.12,skills/agent-frontend-terra-wallet-mobile.mdNot done (review nice-to-haves / out of scope)
connect()ifconnectingis already trueDEV_MODEguard on storeconnectSimulated()(UI already gated; store remains ungated)Verification already run on this commit
npm run test:unit -- src/stores/wallet.test.ts— 8 passed (retested)npx tsc --noEmit/ ESLint on changed TS — clean (pre-commit also passed)E2E_UI_ONLY=1 npx playwright test e2e/wallet-connect.spec.ts --workers=5— 9 passedChecklist to verify
Store / Retry race
connected/terra1in the header (ghost session disconnected)ConnectionCancelledErroris not shown asconnectionErrorand is not remapped to “install the extension”Already on this MR (regression)
connecting === false; header is Cancel while connecting, not a disabled spinner (QA 3.11)fixed inset-0backdrop gone after History / Verify; Connect still tappable (QA 3.15)DEV_MODEis falseDevice (do not close #137 until these pass)
terra1in headermentioned in commit
6e7a510c90mentioned in issue #139