Skip to content

Commit f12a6c5

Browse files
YourGitHubUsernameclaude
andcommitted
fix(e2e): scope rate_limit_attempts cleanup to exclude brute-force
The blanket DELETE FROM rate_limit_attempts in global-setup raced with brute-force.spec.ts: another shard's global-setup could wipe the brute-force test's accumulated failed-attempt rows mid-test, causing attempt 6 to get "Invalid login credentials" instead of the expected "temporarily locked" message. Scope the DELETE to NOT LIKE 'brute-force-test-%', preserving rows created by brute-force.spec.ts while still cleaning up cross-run lockout accumulation from e2e/mailinator test users. Run 24255175890: firefox/chromium/webkit gen-3/4 all failed on brute-force.spec.ts:79 with this exact race condition. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 84e1acf commit f12a6c5

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

tests/e2e/global-setup.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -805,10 +805,14 @@ export default async function globalSetup(config: FullConfig): Promise<void> {
805805
await ensurePublicProfileCompany();
806806
await ensureDiscoverableWorker();
807807

808-
// Clear rate_limit_attempts to prevent cross-run lockout accumulation.
809-
// 18 parallel shards each calling check_rate_limit RPC with row-level
810-
// locks caused 478 rows and DB connection timeouts (2026-04-09).
811-
await executeSQL(`DELETE FROM rate_limit_attempts`).catch((err: unknown) =>
808+
// Clear rate_limit_attempts for known test users to prevent cross-run
809+
// lockout accumulation (478 rows observed on 2026-04-09 causing DB
810+
// connection timeouts). Exclude brute-force-test-* rows — those are
811+
// created and consumed within a single brute-force.spec.ts test run
812+
// and would race with a concurrent shard's global-setup DELETE.
813+
await executeSQL(
814+
`DELETE FROM rate_limit_attempts WHERE identifier NOT LIKE 'brute-force-test-%'`
815+
).catch((err: unknown) =>
812816
console.warn('⚠ Rate limit cleanup warning:', err)
813817
);
814818

0 commit comments

Comments
 (0)