Skip to content

Chore: Move dispatcher for sdk functions into SDK sources#6995

Merged
david-livefront merged 1 commit into
mainfrom
update-sdk-dispatchers
May 29, 2026
Merged

Chore: Move dispatcher for sdk functions into SDK sources#6995
david-livefront merged 1 commit into
mainfrom
update-sdk-dispatchers

Conversation

@david-livefront
Copy link
Copy Markdown
Collaborator

🎟️ Tracking

N/A

📔 Objective

This PR moves the usages of the io dispatcher for SDK operations in the the AuthSdkSource and the GeneratorSdkSource. This ensures that it will always be applied appropriately no matter where it is called from and simplifies the higher level classes that are currently do this manually.

@david-livefront david-livefront requested a review from a team as a code owner May 29, 2026 15:59
@david-livefront david-livefront added the ai-review-vnext Request a Claude code review using the vNext workflow label May 29, 2026
@github-actions github-actions Bot added the app:password-manager Bitwarden Password Manager app context label May 29, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 29, 2026

Bitwarden Claude Code Review

Overall Assessment: APPROVE

This PR moves withContext(dispatcherManager.io) wrapping from caller classes (AuthRepositoryImpl, KeyConnectorManagerImpl, GeneratorRepositoryImpl) into the SDK source implementations (AuthSdkSourceImpl, GeneratorSdkSourceImpl). The refactor preserves runtime behavior — affected SDK calls still execute on the IO dispatcher — and centralizes the dispatcher concern at the SDK boundary so higher-level classes do not need to reapply it. DI modules, constructors, and tests are updated consistently, with FakeDispatcherManager injected at the new construction sites.

Code Review Details

No findings.

The change is a focused tech-debt refactor:

  • withContext wrapping is moved inside the four postKeysFor* functions in AuthSdkSourceImpl and inside generateForwardedServiceEmail in GeneratorSdkSourceImpl, matching exactly the set of SDK calls that were previously wrapped at their call sites.
  • KeyConnectorManagerImpl no longer needs a DispatcherManager field; its constructor and DI provider are updated together.
  • AuthRepositoryImpl and GeneratorRepositoryImpl retain DispatcherManager only for CoroutineScope construction, with the field modifier dropped where no longer needed.
  • Tests are updated to inject FakeDispatcherManager at the SDK source layer.

@david-livefront david-livefront changed the title Move dispatcher for sdk functions into SDK sources Chore: Move dispatcher for sdk functions into SDK sources May 29, 2026
@david-livefront david-livefront added the t:tech-debt Change Type - Tech debt label May 29, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented May 29, 2026

Codecov Report

❌ Patch coverage is 98.27586% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 86.22%. Comparing base (09f0f5b) to head (47e612f).

Files with missing lines Patch % Lines
...arden/data/auth/manager/KeyConnectorManagerImpl.kt 92.85% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6995      +/-   ##
==========================================
+ Coverage   85.70%   86.22%   +0.51%     
==========================================
  Files        1004      917      -87     
  Lines       66310    65508     -802     
  Branches     9304     9281      -23     
==========================================
- Hits        56834    56485     -349     
+ Misses       6279     5833     -446     
+ Partials     3197     3190       -7     
Flag Coverage Δ
app-data 17.15% <98.27%> (+<0.01%) ⬆️
app-ui-auth-tools 19.00% <0.00%> (-0.33%) ⬇️
app-ui-platform 16.97% <0.00%> (-0.01%) ⬇️
app-ui-vault 28.28% <0.00%> (+<0.01%) ⬆️
authenticator 6.19% <0.00%> (-0.07%) ⬇️
lib-core-network-bridge 4.09% <0.00%> (-0.02%) ⬇️
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
Copy link
Copy Markdown
Collaborator Author

Thanks @SaintPatrck

@david-livefront david-livefront added this pull request to the merge queue May 29, 2026
Merged via the queue into main with commit 217bfc1 May 29, 2026
28 of 35 checks passed
@david-livefront david-livefront deleted the update-sdk-dispatchers branch May 29, 2026 17:12
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:password-manager Bitwarden Password Manager app context t:tech-debt Change Type - Tech debt

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants