Skip to content

refactor: session scoped metro graph [WPB-25946]#4916

Merged
MohamadJaara merged 6 commits into
developfrom
refactor/session-scoped-metro-graph
Jun 3, 2026
Merged

refactor: session scoped metro graph [WPB-25946]#4916
MohamadJaara merged 6 commits into
developfrom
refactor/session-scoped-metro-graph

Conversation

@Garzas

@Garzas Garzas commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

https://wearezeta.atlassian.net/browse/WPB-25946


PR Submission Checklist for internal contributors

  • The PR Title

    • conforms to the style of semantic commits messages¹ supported in Wire's Github Workflow²
    • contains a reference JIRA issue number like SQPIT-764
    • answers the question: If merged, this PR will: ... ³
  • The PR Description

    • is free of optional paragraphs and you have filled the relevant parts to the best of your ability

What's new in this PR?

This PR makes Metro-created ViewModels session-aware and removes the old Hilt wireViewModel helper surface.

Main changes:

  • adds viewModelScopeKey to MetroViewModelGraph
  • scopes Metro ViewModel keys by the current user id
  • exposes current valid user id from WireActivityViewModel
  • recreates WireActivity graph-backed ViewModels with a user-scoped key
  • migrates remaining wireViewModel call sites in navigation, Home, Import Media, and App Lock to Metro/Hilt bridge helpers
  • removes AssistedViewModelExt.kt
  • removes the Hilt/Resaca scoped ViewModel fallback from ViewModelScoped.kt

Why?

The temporary Hilt bridge can otherwise keep a ViewModel/factory graph tied to the previous @CurrentAccount after account switch.

This PR does not remove the bridge yet, but it makes the current bridge session-aware and removes the old generic Hilt ViewModel helper so the final cleanup can focus on replacing the bridge with an explicit SessionGraph(userId).

@Garzas Garzas requested review from MohamadJaara and saleniuk June 2, 2026 22:56
@Garzas Garzas self-assigned this Jun 2, 2026
Base automatically changed from refactor/remaining-viewmodels-metro-boundary to develop June 3, 2026 07:54
@pull-request-size pull-request-size Bot added size/XL and removed size/M labels Jun 3, 2026
@pull-request-size

Copy link
Copy Markdown

Ups 🫰🟨

This PR is too big. Please try to break it up into smaller PRs.

@Garzas Garzas force-pushed the refactor/session-scoped-metro-graph branch from 5b8cd61 to a942f40 Compare June 3, 2026 08:19
@pull-request-size pull-request-size Bot added size/L and removed size/XL labels Jun 3, 2026
@codecov

codecov Bot commented Jun 3, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 39.28571% with 17 lines in your changes missing coverage. Please review.
✅ Project coverage is 49.59%. Comparing base (1240234) to head (7d0b7fd).

Files with missing lines Patch % Lines
...rc/main/kotlin/com/wire/android/ui/WireActivity.kt 0.00% 13 Missing ⚠️
...otlin/com/wire/android/ui/WireActivityViewModel.kt 73.33% 0 Missing and 4 partials ⚠️

❌ Your patch check has failed because the patch coverage (39.28%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #4916      +/-   ##
===========================================
- Coverage    49.63%   49.59%   -0.05%     
===========================================
  Files          630      642      +12     
  Lines        22530    22565      +35     
  Branches      3427     3429       +2     
===========================================
+ Hits         11182    11190       +8     
- Misses       10311    10337      +26     
- Partials      1037     1038       +1     
Files with missing lines Coverage Δ
.../ui/authentication/AuthenticationViewModelGraph.kt 0.00% <ø> (ø)
...lin/com/wire/android/ui/home/HomeViewModelGraph.kt 0.00% <ø> (ø)
...re/android/feature/cells/ui/CellsViewModelGraph.kt 0.00% <ø> (ø)
...otlin/com/wire/android/ui/WireActivityViewModel.kt 75.50% <73.33%> (+0.31%) ⬆️
...rc/main/kotlin/com/wire/android/ui/WireActivity.kt 0.00% <0.00%> (ø)

... and 10 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1240234...7d0b7fd. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@sonarqubecloud

sonarqubecloud Bot commented Jun 3, 2026

Copy link
Copy Markdown

@MohamadJaara MohamadJaara added this pull request to the merge queue Jun 3, 2026
@MohamadJaara MohamadJaara removed this pull request from the merge queue due to a manual request Jun 3, 2026
@MohamadJaara MohamadJaara merged commit ecc858c into develop Jun 3, 2026
20 checks passed
@MohamadJaara MohamadJaara deleted the refactor/session-scoped-metro-graph branch June 3, 2026 09:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants