-
Notifications
You must be signed in to change notification settings - Fork 1.5k
[PM-25106] Refactor Misleading Stored Procedure/Repository Language #6890
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
[PM-25106] Refactor Misleading Stored Procedure/Repository Language #6890
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #6890 +/- ##
==========================================
+ Coverage 56.05% 59.99% +3.93%
==========================================
Files 1966 1968 +2
Lines 86892 86974 +82
Branches 7737 7748 +11
==========================================
+ Hits 48709 52176 +3467
+ Misses 36382 32911 -3471
- Partials 1801 1887 +86 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
New Issues (1)Checkmarx found the following issues in this Pull Request
|
BTreston
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me, just one non-blocking thought. I'll let a backend dev have the final approval
| var results = await connection.QueryMultipleAsync( | ||
| "[dbo].[OrganizationUserUserDetails_ReadWithCollectionsById]", | ||
| "[dbo].[OrganizationUserUserDetails_ReadWithSharedCollectionsById]", | ||
| new { Id = id }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💭 Since we technically are modifying the logic in the sprocs my knee jerk reaction is to throw in a feature flag. That is just my personal paranoia though and is creating mostly just tedious work. Not a blocker, but I think worth a brain cycle.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean modifying the renamed sprocs to also have Type = 0 instead of Type != 1? I see what you mean - trivial, yet a change nonetheless. We do have examples of it being done elsewhere e.g. OrganizationUserUserDetails_ReadByOrganizationId_V2.sql, but I understand the caution. I feel safe with the integration tests exercising the sprocs appropriately - if anyone feels strongly on the flags, I have no problem adding 'em.
...d Procedures/Collections/Collection_ReadSharedCollectionsByOrganizationIdWithPermissions.sql
Outdated
Show resolved
Hide resolved
|
Claude finished @sven-bitwarden's task in 2m 4s —— View job Code Review SummaryReviewed commit: 976fa81 (Fix dedented if) OverviewThis PR refactors stored procedure and repository method names to clarify that they filter to shared collections only, excluding default user collections. It follows the Evolutionary Database Design (EDD) pattern with additive stored procedures in this first deploy. Changes Reviewed
AssessmentRisk Level: Low The changes are well-structured:
FindingsNo critical, important, or suggested issues identified. The implementation is clean, well-tested, and follows established patterns. Result: Approved This is a well-executed refactoring that improves code clarity without changing runtime behavior. Automated review by Claude Opus 4.5 |
| join ou in userIdEntities on cu.OrganizationUserId equals ou.Id | ||
| join c in dbContext.Collections on cu.CollectionId equals c.Id | ||
| where c.Type != CollectionType.DefaultUserCollection | ||
| where c.Type == CollectionType.SharedCollection |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Plus one on this. I don’t think we agreed on a standard here, but I’m in favor of being explicit like this. That way, in the future, when we add more types, they won’t be automatically included. There are trade-offs, since this requires manual work to opt in future types, but I think it’s safer and more predictable.
mkincaid-bw
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM


🎟️ Tracking
https://bitwarden.atlassian.net/browse/PM-25106
📔 Objective
When CollectionType + DefaultCollection was added as a concept to Collection, we made a couple of sproc names mask some of their underlying behavior because they filter out these implicit default collections.
Renames
Stored Procedures
Repository Methods
Parameters
Where possible, comparisons of CollectionType were also changed away from
Type != DefaultCollectiontoType == Shared, so future collection types must be explicitly rather than implicitly added.Rollout Strategy
Following EDD, this effort will be fully completed over two deploys. This first deploy is additive, creating new sprocs with the desired name. The second deploy will either remove the old sprocs, or change their behavior to not filter (so
GetAllCollections.sqlappropriately gets all collections without filtering).⏰ Reminders before review
🦮 Reviewer guidelines
:+1:) or similar for great changes:memo:) or ℹ️ (:information_source:) for notes or general info:question:) for questions:thinking:) or 💭 (:thought_balloon:) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion:art:) for suggestions / improvements:x:) or:warning:) for more significant problems or concerns needing attention:seedling:) or ♻️ (:recycle:) for future improvements or indications of technical debt:pick:) for minor or nitpick changes