fix: create key with remaining null shouldn't panic#4297
Conversation
|
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
📝 WalkthroughWalkthroughThe PR fixes a panic occurring when creating an API key with null Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant Handler
participant Validator
Client->>Handler: POST /v2/keys.createKey
alt Refill provided with null credits.remaining
Handler->>Validator: Check credits.remaining is non-null
Validator->>Handler: Constraint violated
Handler->>Client: 400 (Validation Fault)
else Null credits.remaining without refill
Handler->>Validator: Check constraints
Validator->>Handler: Valid
Handler->>Client: 200 (Success)
else Non-null credits.remaining
Handler->>Validator: Check constraints
Validator->>Handler: Valid
Handler->>Client: 200 (Success)
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes
Possibly related PRs
Suggested labels
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (3)
🧰 Additional context used🧠 Learnings (8)📓 Common learnings📚 Learning: 2025-08-14T16:25:48.167ZApplied to files:
📚 Learning: 2025-10-30T15:10:52.743ZApplied to files:
📚 Learning: 2025-08-21T15:54:45.198ZApplied to files:
📚 Learning: 2025-08-08T15:09:01.312ZApplied to files:
📚 Learning: 2025-08-08T15:09:01.312ZApplied to files:
📚 Learning: 2025-08-08T15:09:01.312ZApplied to files:
📚 Learning: 2025-08-19T09:42:40.919ZApplied to files:
🧬 Code graph analysis (2)go/apps/api/routes/v2_keys_create_key/400_test.go (3)
go/apps/api/routes/v2_keys_create_key/200_test.go (3)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
🔇 Additional comments (6)
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 |
|
Thank you for following the naming conventions for pull request titles! 🙏 |
ogzhanolguncu
left a comment
There was a problem hiding this comment.
LGTM. Great test cases LFG
Graphite Automations"Post a GIF when PR approved" took an action on this PR • (11/10/25)1 gif was posted to this PR based on Andreas Thomas's automation. |

What does this PR do?
Fixes #4296
Type of change
How should this be tested?
See issue example code.
replace root key apiId and port if necessary.
Checklist
Required
pnpm buildpnpm fmtmake fmton/godirectoryconsole.logsgit pull origin mainAppreciated