fix(e2e): submit login once with rate-limit backoff, surface the hub banner #445
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/PMS-654-e2e-login-backoff"
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?
What
Fixes the recurring E2E failure where the bunyip hub login "re-renders with empty fields" (reported as PMS-592) and every spec fails at global setup. Root cause (PMS-654): the login helper's own retry burst self-trips the hub's 5-request/60s per-email login rate limit, and it swallows the hub's error banner so CI cannot see why.
Root cause (evidence-based)
submitCredentialsretried the fill+submit up to 4x on ONE page load with no backoff => up to 4POST /loginin seconds; withglobal.setup.tsretries: 1, up to 8. The hub rate-limits login at 5/60s per email (bunyipRateLimitConfig::LOGIN, checked before credential verification), and the suite shares one account, so the burst blows the window. The hub then rejects every subsequent POST, which the loop misread as the chromium re-render race and retried harder.0226b8c(build 2026-07-08), so this is NOT a hub regression. The login markup, the email/password/"Sign In" selectors, redirect handling, and CSRF/Origin behavior are all healthy (a same-origin browser POST passes; a no-Origincurl gets the expected 403).mainand every PR since the 2026-07-09/10 merge burst raised login frequency on the shared account.Fix
Ports bunyip's own harness pattern into
e2e/lib/login.ts:submitCredentialsOnce: fill via DOM-set value, submit ONCE, then race the redirect to/login/2faagainst the.text-destructiveerror banner so a rejection is seen in about a second. Returnsadvanced, the banner text, ornull(no banner and no navigation = a stalled POST / PMS-148, or a fill lost to a re-render).loginViaSpa: retry only after waiting out the interval the hub names on a rate-limit rejection (rateLimitBackoffMs), or with a freshgoto('/login')on an unclear submit; throw immediately with the hub's banner text on any other rejection. At most one login POST per attempt, spaced under the 5/min cap./oauth2/consenthandling unchanged.Effect
Testing
bun x tsc --noEmitstrict: clean.Relates PMS-592 (superseded diagnosis), PMS-148.
#PMS-654