Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
📝 WalkthroughWalkthroughThe changes update the ratelimit namespace cache system to use a new Changes
Sequence Diagram(s)sequenceDiagram
participant Handler
participant Cache
participant DB
Handler->>Cache: Get(ScopedKey{WorkspaceID, Key})
alt Cache miss
Cache->>DB: Query FindRatelimitNamespace by WorkspaceID and Key
DB-->>Cache: Return namespace data
Cache-->>Handler: Return namespace data
else Cache hit
Cache-->>Handler: Return cached namespace data
end
Handler->>Cache: Remove(ctx, ScopedKey{WorkspaceID, NamespaceID}, ScopedKey{WorkspaceID, NamespaceName})
Suggested reviewers
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (32)
🧰 Additional context used🧠 Learnings (27)📓 Common learningsgo/apps/api/routes/v2_ratelimit_delete_override/400_test.go (1)go/apps/api/routes/v2_ratelimit_limit/200_test.go (2)go/apps/api/routes/v2_ratelimit_limit/accuracy_test.go (2)go/apps/api/routes/v2_ratelimit_limit/404_test.go (1)go/apps/api/routes/v2_ratelimit_get_override/200_test.go (1)go/apps/api/routes/v2_ratelimit_limit/403_test.go (1)go/apps/api/routes/v2_ratelimit_get_override/404_test.go (1)go/apps/api/routes/v2_ratelimit_get_override/403_test.go (1)go/apps/api/routes/v2_ratelimit_set_override/401_test.go (1)go/apps/api/routes/v2_ratelimit_set_override/400_test.go (1)go/apps/api/routes/v2_ratelimit_delete_override/403_test.go (1)go/apps/api/routes/v2_ratelimit_delete_override/200_test.go (1)go/apps/api/routes/v2_ratelimit_get_override/401_test.go (1)go/apps/api/routes/v2_ratelimit_set_override/handler.go (1)go/apps/api/routes/v2_ratelimit_delete_override/404_test.go (1)go/apps/api/routes/v2_ratelimit_set_override/403_test.go (2)go/apps/api/routes/v2_ratelimit_set_override/404_test.go (1)go/apps/api/routes/v2_ratelimit_get_override/handler.go (1)go/apps/api/routes/v2_ratelimit_limit/400_test.go (1)go/apps/api/routes/v2_ratelimit_delete_override/401_test.go (1)go/apps/api/routes/v2_ratelimit_limit/handler.go (2)go/pkg/cache/scoped_key.go (2)go/apps/api/routes/v2_ratelimit_limit/401_test.go (1)go/apps/api/routes/v2_ratelimit_set_override/200_test.go (1)go/apps/api/routes/v2_ratelimit_get_override/400_test.go (1)go/apps/api/routes/v2_ratelimit_delete_override/handler.go (1)🧬 Code Graph Analysis (22)go/apps/api/routes/v2_ratelimit_delete_override/400_test.go (1)
go/apps/api/routes/v2_ratelimit_limit/404_test.go (1)
go/apps/api/routes/v2_ratelimit_get_override/200_test.go (1)
go/apps/api/routes/v2_ratelimit_limit/403_test.go (1)
go/apps/api/routes/v2_ratelimit_get_override/404_test.go (1)
go/apps/api/routes/v2_ratelimit_get_override/403_test.go (1)
go/apps/api/routes/v2_ratelimit_set_override/401_test.go (1)
go/apps/api/routes/v2_ratelimit_set_override/400_test.go (1)
go/apps/api/routes/v2_ratelimit_delete_override/403_test.go (1)
go/apps/api/routes/v2_ratelimit_delete_override/200_test.go (1)
go/apps/api/routes/v2_ratelimit_get_override/401_test.go (1)
go/apps/api/routes/v2_ratelimit_set_override/handler.go (2)
go/apps/api/routes/v2_ratelimit_delete_override/404_test.go (1)
go/apps/api/routes/v2_ratelimit_set_override/403_test.go (1)
go/apps/api/routes/v2_ratelimit_set_override/404_test.go (1)
go/apps/api/routes/v2_ratelimit_limit/400_test.go (1)
go/apps/api/routes/v2_ratelimit_delete_override/401_test.go (1)
go/pkg/cache/scoped_key.go (1)
go/apps/api/routes/v2_ratelimit_limit/401_test.go (1)
go/apps/api/routes/v2_ratelimit_set_override/200_test.go (1)
go/apps/api/routes/register.go (6)
go/apps/api/routes/v2_ratelimit_get_override/400_test.go (1)
⏰ 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). (5)
🔇 Additional comments (37)
✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
This stack of pull requests is managed by Graphite. Learn more about stacking. |
|
Thank you for following the naming conventions for pull request titles! 🙏 |
Graphite Automations"Notify author when CI fails" took an action on this PR • (07/18/25)1 teammate was notified to this PR based on Andreas Thomas's automation. "Post a GIF when PR approved" took an action on this PR • (07/21/25)1 gif was posted to this PR based on Andreas Thomas's automation. |
|
More of a nit, but what if we made the type a generic so we could later also scope keys to something else than a workspace |
|
I thought about it, but figured there isn’t any point in preoptimizing this. any change would need a redeployment and therefore clean the cache anyways |
|
yeah fair |


What does this PR do?
Refactors the ratelimit namespace cache to use a more robust scoped key approach. This change replaces the previous
RatelimitNamespaceByNameCachewith a newRatelimitNamespaceCachethat uses aScopedKeytype to properly isolate cached data between workspaces.The new implementation:
ScopedKeytype that combines workspace ID with resource keysFixes # (issue)
Type of change
How should this be tested?
Checklist
Required
pnpm buildpnpm fmtconsole.logsgit pull origin mainSummary by CodeRabbit
New Features
Refactor
Tests