Skip to content

PM-38280: Fix: Update collection API to V2#7014

Open
david-livefront wants to merge 1 commit into
mainfrom
PM-38280-collections-api-v2
Open

PM-38280: Fix: Update collection API to V2#7014
david-livefront wants to merge 1 commit into
mainfrom
PM-38280-collections-api-v2

Conversation

@david-livefront
Copy link
Copy Markdown
Collaborator

@david-livefront david-livefront commented Jun 3, 2026

🎟️ Tracking

PM-38280

📔 Objective

This PR migrates the collections update call from the legacy PUT /ciphers/{id}/collections endpoint to PUT /ciphers/{id}/collections_v2.

The _v2 endpoint returns the updated cipher and an unavailable flag. If the cipher is null, the user has lost access to the item and the cipher is removed from storage; otherwise the returned cipher is stored locally.

@david-livefront david-livefront requested a review from a team as a code owner June 3, 2026 16:07
@david-livefront david-livefront added the ai-review-vnext Request a Claude code review using the vNext workflow label Jun 3, 2026
@github-actions github-actions Bot added app:password-manager Bitwarden Password Manager app context app:authenticator Bitwarden Authenticator app context t:bug Change Type - Bug labels Jun 3, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 3, 2026

🤖 Bitwarden Claude Code Review

Overall Assessment: APPROVE

This PR migrates the collection update call from PUT /ciphers/{id}/collections to the V2 endpoint, which returns the updated cipher (or null when the user has lost access to the item). The client now stores the server-returned cipher directly or removes the item from disk when access is lost — removing the previous client-side re-encryption step. Interface, implementation, callers, and tests are updated consistently across the :app and :network modules.

Code Review Details

No new findings. Prior review threads have all been addressed:

  • Service-failure test path for updateCipherCollections — added at CipherManagerTest.kt:1521
  • Unused cipherView parameter cleanup — removed from interface, impl, and VaultMoveToOrganizationViewModel caller
  • JSON syntax in CiphersServiceTest.kt — verified well-formed; earlier missing-comma flag was a false positive
  • unavailable flag question on UpdateCipherCollectionsResponseJson — addressed (a null cipher conveys the unavailable state)

Test coverage verified for:

  • No active user → Error
  • Service failure → Error, no disk writes
  • Success with null cipher → deletes cipher locally, returns Success
  • Success with valid cipher → saves cipher locally, returns Success

Comment thread network/src/test/kotlin/com/bitwarden/network/service/CiphersServiceTest.kt Outdated
@david-livefront david-livefront force-pushed the PM-38280-collections-api-v2 branch from d0f5b74 to 23be10a Compare June 3, 2026 16:17
@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 3, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.50%. Comparing base (c45ae58) to head (982d56b).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7014      +/-   ##
==========================================
+ Coverage   85.21%   86.50%   +1.29%     
==========================================
  Files        1055      873     -182     
  Lines       66975    63881    -3094     
  Branches     9368     9259     -109     
==========================================
- Hits        57073    55261    -1812     
+ Misses       6690     5427    -1263     
+ Partials     3212     3193      -19     
Flag Coverage Δ
app-data 17.41% <100.00%> (+0.30%) ⬆️
app-ui-auth-tools 18.98% <0.00%> (-0.29%) ⬇️
app-ui-platform 16.43% <0.00%> (-0.35%) ⬇️
app-ui-vault 27.79% <0.00%> (-0.55%) ⬇️
authenticator 6.20% <0.00%> (+<0.01%) ⬆️
lib-core-network-bridge 4.07% <0.00%> (+0.01%) ⬆️
lib-data-ui 1.14% <0.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@david-livefront david-livefront force-pushed the PM-38280-collections-api-v2 branch 2 times, most recently from de2a929 to 841268b Compare June 3, 2026 16:48
Comment thread app/src/test/kotlin/com/x8bit/bitwarden/data/vault/manager/CipherManagerTest.kt Outdated
@david-livefront david-livefront force-pushed the PM-38280-collections-api-v2 branch from 841268b to f3dcabb Compare June 3, 2026 16:57
@david-livefront david-livefront force-pushed the PM-38280-collections-api-v2 branch from f3dcabb to 6fb2ce1 Compare June 3, 2026 17:49
@david-livefront david-livefront force-pushed the PM-38280-collections-api-v2 branch from 6fb2ce1 to 982d56b Compare June 3, 2026 18:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-review-vnext Request a Claude code review using the vNext workflow app:authenticator Bitwarden Authenticator app context app:password-manager Bitwarden Password Manager app context t:bug Change Type - Bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant