[Core] Update cache for workspace permission check#9125
[Core] Update cache for workspace permission check#9125DanielZhangQD wants to merge 3 commits intomasterfrom
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly refactors the workspace permission checking mechanism by migrating from an in-memory, request-scoped LRU cache to a persistent, database-backed key-value store. This change addresses potential inconsistencies in permission checks across distributed components and ensures that all processes operate with the most up-to-date access policies. The update also includes robust invalidation strategies to clear relevant cache entries whenever user roles or workspace policies are altered, thereby guaranteeing data freshness and correctness. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces a DB-backed KV cache for workspace permission checks, significantly improving performance and ensuring consistency across server and executor processes. The implementation includes robust cache invalidation mechanisms, which are correctly triggered when user roles or workspace policies are modified. New utility functions for deleting cache entries by prefix and pattern have been added to kv_cache.py, along with comprehensive unit tests to cover both the new cache functionalities and the cache invalidation logic within the permission service. The changes are well-designed and contribute positively to the system's efficiency and reliability.
|
Hi @SeungjinYang @ibrahimnd2000 PTAL when you're available. Thanks! |
Fix #8991
Update the cache mechanism from LRU cache to a DB-backed KV cache to avoid the stale cache result when the permission of the workspace or the role of the users is changed.
Tested (run the relevant ones):
bash format.sh/smoke-test(CI) orpytest tests/test_smoke.py(local)/smoke-test -k test_name(CI) orpytest tests/test_smoke.py::test_name(local)/quicktest-core(CI) orpytest tests/smoke_tests/test_backward_compat.py(local)