[PM-32699] Utilize cache to check ability of useMyItems if available#7922
[PM-32699] Utilize cache to check ability of useMyItems if available#7922JaredScar wants to merge 1 commit into
Conversation
…ization ability cache - Added IOrganizationAbilityCacheService to the constructor for improved performance. - Replaced direct organization repository calls with cache lookups in UpsertDefaultCollectionsForUsersAsync. - Introduced OrganizationUsesMyItemsAsync method to streamline cache access and fallback logic. - Updated tests to accommodate the new cache service and ensure correct behavior under various scenarios.
🤖 Bitwarden Claude Code ReviewOverall Assessment: APPROVE Reviewed the tech-debt change in No blocking issues found. Code Review DetailsNo findings. The change is focused, correctly wired, and well covered by tests. The registered |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7922 +/- ##
=======================================
Coverage 61.35% 61.36%
=======================================
Files 2236 2236
Lines 98547 98554 +7
Branches 8911 8912 +1
=======================================
+ Hits 60468 60476 +8
+ Misses 35943 35942 -1
Partials 2136 2136 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
| var organization = await organizationRepository.GetByIdAsync(organizationId); | ||
| if (organization == null) | ||
| { | ||
| throw new InvalidOperationException($"Organization with ID {organizationId} not found."); | ||
| } | ||
|
|
||
| return organization.UseMyItems; |
There was a problem hiding this comment.
This is unnecessary - we're doing this cleanup work because the cache has been fixed and we can rely on it. Please remove this and throw a NotFoundException instead if the org isn't in the cache.
🎟️ Tracking
https://bitwarden.atlassian.net/browse/PM-32699
📔 Objective
Uses useMyItems flag from cache if available, otherwise if null/miss, falls back to checking on the Organization model