[PM-28555] Add idempotent sproc to create My Items collections#6801
[PM-28555] Add idempotent sproc to create My Items collections#6801
Conversation
- DRY up collection arrangement - DRY up tests because bulk and non-bulk share same behavior - use EF native AddRange instead of bulk insert, because we expect smaller data sizes on self-host
|
Claude finished @eliykat's task in 1m 41s —— View job Code Review SummaryPR: PM-28555 Add idempotent sproc to create My Items collections Status: Approved Review AssessmentThis PR adds a stored procedure to create My Items (default user) collections with idempotent behavior, ensuring no duplicate collections are created. Key Changes Reviewed:
Architecture:
Security: No concerns - parameterized queries via stored procedure, no sensitive data exposure Correctness: The idempotent design prevents duplicate collections. The acknowledged TOCTOU race condition is an acceptable tradeoff per architecture decision. Test Coverage: Good integration test coverage with three scenarios: success case, partial creates (new users only), and full idempotency verification. No issues identified that would block merge. |
|
Great job! No new security vulnerabilities introduced in this pull request |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #6801 +/- ##
==========================================
+ Coverage 56.00% 59.90% +3.89%
==========================================
Files 1965 1966 +1
Lines 86886 86883 -3
Branches 7740 7741 +1
==========================================
+ Hits 48663 52045 +3382
+ Misses 36422 32955 -3467
- Partials 1801 1883 +82 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|

🎟️ Tracking
https://bitwarden.atlassian.net/browse/PM-28555
📔 Objective
Add a sproc to:
After some iteration in #6791 , we are accepting some time-of-check time-of-use risk here. Architecture did not want to enforce uniqueness at the database level so we will keep it simple, filter out existing My Items collections in the sproc, and we can increase the isolation level later if it proves to be a problem.
📸 Screenshots
⏰ 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