Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 36 minutes and 59 seconds. ⌛ 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)
📝 WalkthroughWalkthroughA single schema file was modified to remove the Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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 the current code and only fix it if needed.
Inline comments:
In `@src/lib/schema/transfersQuerySchema.ts`:
- Around line 26-37: Update the test expectations to match the new transform
behavior: when validateTransfersQuery(makeRequest()) is run in prod (IS_TESTNET
=== false) and no type is provided, assert that chainId is undefined (because
the transform's isProdTransfer branch leaves chainId unset), and add a separate
test case calling validateTransfersQuery(makeRequest({ type: 'some' })) that
asserts the default chainId is injected as base.id (or baseSepolia.id when
IS_TESTNET is true). Also add a short comment next to the isProdTransfer
calculation in the transform to explain the intent ("skip chainId default so all
chains are returned when no type filter is applied in prod") or consider
renaming isProdTransfer to something like noTypeInProd for clarity; reference
the transform block, IS_TESTNET, base.id/baseSepolia.id, and
validateTransfersQuery/makeRequest to locate the changes.
🪄 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: 45f26d25-90a5-4880-b449-559c768a2485
📒 Files selected for processing (1)
src/lib/schema/transfersQuerySchema.ts
| .transform((data) => { | ||
| const isProdTransfer = !data.type && !IS_TESTNET; | ||
|
|
||
| if (isProdTransfer || data.chainId) { | ||
| return data; | ||
| } | ||
|
|
||
| return { | ||
| ...data, | ||
| chainId: IS_TESTNET ? baseSepolia.id : base.id, | ||
| }; | ||
| }); |
There was a problem hiding this comment.
Existing test for default chainId will break in prod env.
The new branch where !data.type && !IS_TESTNET (i.e., production + no type filter) intentionally leaves chainId undefined to "allow all moments" across chains. However, src/lib/transfers/__tests__/validateTransfersQuery.test.ts has:
it('defaults chainId to the env chain id', () => {
const result = validateTransfersQuery(makeRequest());
expect(typeof (result as any).chainId).toBe('number');
});
When VERCEL_ENV is neither preview nor development in CI, IS_TESTNET is false, so isProdTransfer is true and chainId remains undefined — causing this assertion to fail (typeof undefined === 'undefined'). Please update the test to reflect the new intent (e.g., assert chainId is undefined when no type is provided in prod, and add a separate case with type set to verify the default still injects base.id).
Also, isProdTransfer is a slightly misleading name — it's really "prod env AND no type filter". A brief comment explaining the intent ("skip chainId default so all chains are returned when no type filter is applied in prod") would help future readers.
💡 Suggested clarification
.transform((data) => {
- const isProdTransfer = !data.type && !IS_TESTNET;
-
- if (isProdTransfer || data.chainId) {
+ // In prod, when no `type` filter is supplied, leave `chainId` undefined so
+ // transfers across all chains are returned. Otherwise, default to the env chain.
+ const skipChainIdDefault = !data.type && !IS_TESTNET;
+
+ if (skipChainIdDefault || data.chainId) {
return data;
}📝 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.
| .transform((data) => { | |
| const isProdTransfer = !data.type && !IS_TESTNET; | |
| if (isProdTransfer || data.chainId) { | |
| return data; | |
| } | |
| return { | |
| ...data, | |
| chainId: IS_TESTNET ? baseSepolia.id : base.id, | |
| }; | |
| }); | |
| .transform((data) => { | |
| // In prod, when no `type` filter is supplied, leave `chainId` undefined so | |
| // transfers across all chains are returned. Otherwise, default to the env chain. | |
| const skipChainIdDefault = !data.type && !IS_TESTNET; | |
| if (skipChainIdDefault || data.chainId) { | |
| return data; | |
| } | |
| return { | |
| ...data, | |
| chainId: IS_TESTNET ? baseSepolia.id : base.id, | |
| }; | |
| }); |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/lib/schema/transfersQuerySchema.ts` around lines 26 - 37, Update the test
expectations to match the new transform behavior: when
validateTransfersQuery(makeRequest()) is run in prod (IS_TESTNET === false) and
no type is provided, assert that chainId is undefined (because the transform's
isProdTransfer branch leaves chainId unset), and add a separate test case
calling validateTransfersQuery(makeRequest({ type: 'some' })) that asserts the
default chainId is injected as base.id (or baseSepolia.id when IS_TESTNET is
true). Also add a short comment next to the isProdTransfer calculation in the
transform to explain the intent ("skip chainId default so all chains are
returned when no type filter is applied in prod") or consider renaming
isProdTransfer to something like noTypeInProd for clarity; reference the
transform block, IS_TESTNET, base.id/baseSepolia.id, and
validateTransfersQuery/makeRequest to locate the changes.
Summary by CodeRabbit