fix(js): Coalesce concurrent first/second factor preparations#9225
fix(js): Coalesce concurrent first/second factor preparations#9225tmilewski wants to merge 14 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🦋 Changeset detectedLatest commit: 30e121c The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
@clerk/astro
@clerk/backend
@clerk/chrome-extension
@clerk/clerk-js
@clerk/electron
@clerk/electron-passkeys
@clerk/eslint-plugin
@clerk/expo
@clerk/expo-google-signin
@clerk/expo-passkeys
@clerk/express
@clerk/fastify
@clerk/hono
@clerk/localizations
@clerk/nextjs
@clerk/nuxt
@clerk/react
@clerk/react-router
@clerk/shared
@clerk/tanstack-react-start
@clerk/testing
@clerk/ui
@clerk/upgrade
@clerk/vue
commit: |
API Changes Report
Summary
@clerk/backendCurrent version: 3.12.0 Subpath
|
📝 WalkthroughWalkthrough
Estimated code review effort: 3 (Moderate) | ~25 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
packages/clerk-js/src/core/resources/__tests__/Web3Wallet.test.ts (1)
37-37: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winReplace the untyped deferred response.
Use the concrete response shape so this fixture catches invalid mock payloads.
Proposed fix
- const deferred = createDeferredPromise<any>(); + const deferred = createDeferredPromise<{ response: Web3WalletJSON }>();As per coding guidelines, “Avoid
anytype - preferunknownwhen type is uncertain.”🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/clerk-js/src/core/resources/__tests__/Web3Wallet.test.ts` at line 37, Replace the any type in the createDeferredPromise fixture within Web3Wallet tests with the concrete response type expected by the tested wallet resource. Ensure the deferred promise and its resolved mock payload are type-checked against that response shape, rather than using unknown or another untyped fallback.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@packages/clerk-js/src/core/resources/__tests__/Web3Wallet.test.ts`:
- Line 37: Replace the any type in the createDeferredPromise fixture within
Web3Wallet tests with the concrete response type expected by the tested wallet
resource. Ensure the deferred promise and its resolved mock payload are
type-checked against that response shape, rather than using unknown or another
untyped fallback.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository YAML (base), Organization UI (inherited)
Review profile: CHILL
Plan: Pro Plus
Run ID: 7c614ce2-8737-427f-a57b-1c6decd84a9b
📒 Files selected for processing (4)
packages/clerk-js/src/core/resources/Base.tspackages/clerk-js/src/core/resources/__tests__/EmailAddress.test.tspackages/clerk-js/src/core/resources/__tests__/SignIn.test.tspackages/clerk-js/src/core/resources/__tests__/Web3Wallet.test.ts
🔗 Linked repositories identified
CodeRabbit considers these linked repositories for cross-repo context during reviews:
clerk/clerk_go(manual)clerk/dashboard(manual)clerk/accounts(manual)clerk/backoffice(manual)clerk/clerk(manual)clerk/clerk-docs(manual)clerk/cloudflare-workers(manual)clerk/clerk-ios(auto-detected)clerk/cli(auto-detected)clerk/clerk-android(auto-detected)
💤 Files with no reviewable changes (1)
- packages/clerk-js/src/core/resources/Base.ts
🚧 Files skipped from review as they are similar to previous changes (1)
- packages/clerk-js/src/core/resources/tests/SignIn.test.ts
Summary
Why
Concurrent consumers could prepare the same verification factor more than once, sending duplicate one-time codes and invalidating the code the user received first.
Testing