Fix magic link validation for turnkey#3341
Conversation
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughMagic-link validation in ChangesMagic-link validation via URL origin
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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.
Inline comments:
In `@indexer/services/comlink/src/controllers/api/v4/turnkey-controller.ts`:
- Line 7: Move the built-in Node.js import "import { URL } from 'url';" to the
top of the import block so Node built-ins come before external and scoped
packages, and ensure there is a blank line separating the built-in group from
the next import group; locate the import in turnkey-controller.ts and reorder it
above other imports (keeping other imports unchanged) to satisfy ESLint
import/order.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: eaf20846-b55a-4d08-9b8e-6e8a0184e21c
📒 Files selected for processing (1)
indexer/services/comlink/src/controllers/api/v4/turnkey-controller.ts
| import express from 'express'; | ||
| import { matchedData } from 'express-validator'; | ||
| import fetch from 'node-fetch'; | ||
| import { URL } from 'url'; |
There was a problem hiding this comment.
Fix import order to resolve pipeline failure.
The url import violates ESLint's import/order rule. Built-in Node.js modules must come before external packages and scoped packages, with blank lines separating groups.
📦 Proposed fix for import order
Move the url import to the top and add proper spacing:
+import { URL } from 'url';
+
import { stats } from '@dydxprotocol-indexer/base';
import { TurnkeyUsersTable } from '@dydxprotocol-indexer/postgres';
import { TurnkeyApiClient, TurnkeyApiTypes, Turnkey as TurnkeyServerSDK } from '@turnkey/sdk-server';
import express from 'express';
import { matchedData } from 'express-validator';
import fetch from 'node-fetch';
-import { URL } from 'url';
import {
Controller, Post, Route, Body,
} from 'tsoa';📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| import { URL } from 'url'; | |
| import { URL } from 'url'; | |
| import { stats } from '@dydxprotocol-indexer/base'; | |
| import { TurnkeyUsersTable } from '@dydxprotocol-indexer/postgres'; | |
| import { TurnkeyApiClient, TurnkeyApiTypes, Turnkey as TurnkeyServerSDK } from '@turnkey/sdk-server'; | |
| import express from 'express'; | |
| import { matchedData } from 'express-validator'; | |
| import fetch from 'node-fetch'; | |
| import { | |
| Controller, Post, Route, Body, | |
| } from 'tsoa'; |
🧰 Tools
🪛 GitHub Actions: Indexer Lint / 0_lint.txt
[error] 6-7: ESLint (import/order): There should be at least one empty line between import groups (lines 6:1, 7:1).
[error] 7-7: ESLint (import/order): url import should occur before import of @dydxprotocol-indexer/base (line 7:1).
[error] Lint step failed: eslint --ext .ts,.js . (exit status 1).
🪛 GitHub Actions: Indexer Lint / lint
[error] 6-7: ESLint (import/order): There should be at least one empty line between import groups.
[error] 7-7: ESLint (import/order): url import should occur before import of @dydxprotocol-indexer/base.
[error] Step failed: eslint --ext .ts,.js . (lint: Failed; exit status 1, exit code != 0).
[error] pnpm run lint:all failed due to comlink@0.0.1 lint error (ERR_PNPM_RECURSIVE_RUN_FIRST_FAIL; Command failed with exit code 1).
🤖 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 `@indexer/services/comlink/src/controllers/api/v4/turnkey-controller.ts` at
line 7, Move the built-in Node.js import "import { URL } from 'url';" to the top
of the import block so Node built-ins come before external and scoped packages,
and ensure there is a blank line separating the built-in group from the next
import group; locate the import in turnkey-controller.ts and reorder it above
other imports (keeping other imports unchanged) to satisfy ESLint import/order.
Changelist
Test Plan
Test the turnkey flow
Summary by CodeRabbit
Release Notes