Skip to content

feat: migrate to Riverpod 3.x#613

Merged
grunch merged 4 commits into
mainfrom
feat/migrate-riverpod-3x-512
Jun 19, 2026
Merged

feat: migrate to Riverpod 3.x#613
grunch merged 4 commits into
mainfrom
feat/migrate-riverpod-3x-512

Conversation

@AndreaDiazCorreia

@AndreaDiazCorreia AndreaDiazCorreia commented Jun 12, 2026

Copy link
Copy Markdown
Member

Closes #512

Important

Depends on #612 — that PR must be merged first. This branch is based on it and
Riverpod 3.x requires the Flutter 3.44.1 / Dart 3.12 toolchain it introduces.

Upgrades flutter_riverpod/hooks_riverpod to ^3.3.2, keeping the existing StateNotifier architecture via the legacy compatibility layer (full Notifier migration is out of scope).

  • Add flutter_riverpod/legacy.dart imports for StateNotifier/StateProvider.
  • Replace removed AutoDispose* aliases with the .autoDispose modifier.
  • Tests: Ref/ProviderSubscription are now sealed — drop them from
    @GenerateMocks and migrate 6 test files to a real ProviderContainer.
  • Adopt 3.x defaults (automatic retry self-heals the foreground init-order error).

Validation: flutter analyze clean, 449 tests passing.

Summary by CodeRabbit

  • Chores
    • Updated Flutter to 3.44.1 and aligned Android build tooling (Gradle/Kotlin) for improved build stability and compatibility.
    • Refreshed core dependencies (including Riverpod packages) and switched the app to the newer Lucide icon package.
  • Bug Fixes
    • Improved chat list scrolling performance by refining the offscreen scroll cache behavior.
  • Tests
    • Updated test setup to match the newer Riverpod behavior.

- Bump Flutter version from 3.35.7 to 3.44.1 across .fvmrc and all GitHub workflow files
- Upgrade Gradle wrapper from 8.9 to 8.14.3
- Upgrade Android Gradle Plugin from 8.6.0 to 8.11.1
- Upgrade Kotlin from 2.1.0 to 2.2.20
- Add Android build flags (builtInKotlin=false, newDsl=false) to gradle.properties
- Replace deprecated lucide_icons package with lucide_icons_flutter (0.257.0 → 3.1.14)
- Replace deprecated cacheExtent with scrollCache
chore: migrate to Flutter's built-in Kotlin support and update Kotlin configuration

- Remove explicit kotlin-android plugin from app/build.gradle (now provided by Flutter)
- Move kotlinOptions from android block to top-level kotlin.compilerOptions block
- Update jvmTarget syntax to use org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_11
- Update comment to clarify KGP is declared in settings.gradle with apply false
```
chore: migrate from flutter_riverpod 2.x to 3.x with legacy compatibility layer

- Upgrade flutter_riverpod from 2.6.1 to 3.3.2 and hooks_riverpod from 2.6.1 to 3.3.2
- Add flutter_riverpod/legacy.dart imports across all provider files to maintain compatibility with 2.x API
- Replace AutoDisposeStateNotifierProvider shorthand with StateNotifierProvider.autoDispose long form
- Replace AutoDisposeProvider shorthand with Provider.autoDispose long form
- Update test mocks to use ProviderContainer
@coderabbitai

coderabbitai Bot commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 35396481-cbe2-451e-b895-8aa8921d85f3

📥 Commits

Reviewing files that changed from the base of the PR and between 9477686 and f1e839c.

📒 Files selected for processing (3)
  • lib/features/relays/relays_notifier.dart
  • test/notifiers/take_order_notifier_test.dart
  • test/services/mostro_service_test.dart
🚧 Files skipped from review as they are similar to previous changes (2)
  • lib/features/relays/relays_notifier.dart
  • test/services/mostro_service_test.dart

Walkthrough

This PR migrates the Flutter app from Riverpod 2.x to 3.x by updating dependencies, switching imports to legacy Riverpod APIs, replacing the Lucide icon package, and refactoring tests to use real ProviderContainer instead of mocked Ref instances. Flutter SDK and Android build tools are also upgraded.

Changes

Riverpod 3.x Migration with Flutter and Toolchain Upgrades

Layer / File(s) Summary
Flutter SDK, Android tooling, and dependency versions
.fvmrc, .github/workflows/desktop.yml, .github/workflows/flutter.yml, .github/workflows/main.yml, .github/workflows/release.yml, android/app/build.gradle, android/gradle.properties, android/gradle/wrapper/gradle-wrapper.properties, android/settings.gradle, pubspec.yaml
Flutter version updated from 3.32.x–3.35.7 to 3.44.1 across CI workflows and FVM config. Android Gradle plugin bumped to 8.11.1, Kotlin plugin to 2.2.20, Gradle wrapper to 8.14.3. Kotlin JVM target switched to top-level kotlin { compilerOptions { jvmTarget = JVM_11 } } block. pubspec.yaml upgrades flutter_riverpod and hooks_riverpod from 2.6.1 to 3.3.2, and lucide_icons to lucide_icons_flutter 3.1.14.
Riverpod legacy import migration across feature notifiers and providers
lib/features/auth/notifiers/auth_notifier.dart, lib/features/auth/providers/auth_notifier_provider.dart, lib/features/chat/chat_room_provider.dart, lib/features/chat/notifiers/chat_room_notifier.dart, lib/features/chat/notifiers/chat_rooms_notifier.dart, lib/features/chat/providers/active_chat_screens_provider.dart, lib/features/chat/providers/chat_room_providers.dart, lib/features/chat/providers/chat_tab_provider.dart, lib/features/community/providers/community_selector_provider.dart, lib/features/disputes/notifiers/dispute_chat_notifier.dart, lib/features/disputes/providers/dispute_read_status_provider.dart, lib/features/home/providers/home_order_providers.dart, lib/features/logs/logs_provider.dart, lib/features/mostro/mostro_instance_provider.dart, lib/features/mostro/mostro_nodes_notifier.dart, lib/features/mostro/mostro_nodes_provider.dart, lib/features/notifications/notifiers/notifications_notifier.dart, lib/features/notifications/providers/backup_reminder_provider.dart, lib/features/notifications/providers/notifications_provider.dart, lib/features/order/notifiers/abstract_mostro_notifier.dart, lib/features/order/providers/payment_methods_provider.dart, lib/features/relays/relays_notifier.dart, lib/features/relays/relays_provider.dart, lib/features/restore/restore_mode_provider.dart, lib/features/restore/restore_progress_notifier.dart, lib/features/settings/settings_notifier.dart, lib/features/settings/settings_provider.dart, lib/features/trades/providers/trades_provider.dart, lib/features/walkthrough/providers/first_run_provider.dart, lib/features/wallet/providers/nwc_provider.dart, lib/services/exchange_service.dart, lib/shared/notifiers/locale_notifier.dart, lib/shared/notifiers/navigation_notifier.dart, lib/shared/notifiers/session_notifier.dart, lib/shared/providers/drawer_provider.dart, lib/shared/providers/exchange_service_provider.dart, lib/shared/providers/navigation_notifier_provider.dart, lib/shared/providers/session_notifier_provider.dart, lib/shared/widgets/bottom_nav_bar.dart
Updates ~40 feature notifier and provider files to import Riverpod APIs from flutter_riverpod/legacy instead of direct flutter_riverpod for compatibility with Riverpod 3.x sealed Ref API; no provider logic or declarations change.
Lucide icon package replacement across app widgets and screens
lib/features/key_manager/key_management_screen.dart, lib/features/settings/about_screen.dart, lib/features/settings/notification_settings_screen.dart, lib/features/settings/settings_screen.dart, lib/features/trades/widgets/status_filter_widget.dart, lib/features/wallet/screens/connect_wallet_screen.dart, lib/features/wallet/screens/wallet_settings_screen.dart, lib/features/wallet/widgets/wallet_balance_widget.dart, lib/features/wallet/widgets/wallet_status_card.dart, lib/shared/widgets/custom_drawer_overlay.dart, lib/shared/widgets/ln_address_confirmation_widget.dart, lib/shared/widgets/nwc_connection_status_indicator.dart, lib/shared/widgets/nwc_invoice_widget.dart, lib/shared/widgets/nwc_notification_listener.dart, lib/shared/widgets/nwc_payment_receipt_widget.dart, lib/shared/widgets/nwc_payment_widget.dart
Replaces lucide_icons package imports with lucide_icons_flutter across ~25 widget and screen files; all icon constant references remain unchanged.
Provider factory API updates and ScrollCacheExtent migration
lib/features/order/providers/order_notifier_provider.dart, lib/services/event_bus.dart, lib/features/chat/widgets/chat_messages_list.dart
orderTypeNotifierProvider switched from AutoDisposeStateNotifierProvider to StateNotifierProvider.autoDispose syntax; eventBusProvider switched from AutoDisposeProvider to Provider.autoDispose; ChatMessagesList updated from deprecated cacheExtent: 1000 parameter to scrollCacheExtent: ScrollCacheExtent.pixels(1000).
Test infrastructure refactor for Riverpod 3.x sealed Ref
test/mocks.dart, test/features/mostro/mostro_integration_test.dart, test/features/mostro/mostro_nodes_notifier_test.dart, test/features/mostro/mostro_nodes_performance_test.dart
Removes Ref and ProviderSubscription from Mockito @GenerateMocks, introduces createTestRef(ProviderContainer) helper function to obtain real Riverpod Ref instances, and refactors Mostro test files to create real ProviderContainer instances with provider overrides instead of attempting to mock sealed Ref class.
Session and service test updates with real ProviderContainer refs
test/notifiers/add_order_notifier_test.dart, test/notifiers/take_order_notifier_test.dart, test/services/mostro_service_test.dart
Updates test setup to build MockSessionNotifier and services from real refs and container overrides, eliminating per-test mocked provider reads via mockRef.read(...) and replacing them with deterministic ProviderContainer configuration.

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly Related PRs

  • MostroP2P/mobile#436: Both PRs refactor test/features/mostro/mostro_nodes_notifier_test.dart to support Riverpod 3.x ProviderContainer-based test setup for the multi-node notifier logic.
  • MostroP2P/mobile#383: Both PRs touch lib/features/notifications/providers/backup_reminder_provider.dart; PR #383 introduced the notifier while the main PR updates its Riverpod import to legacy format.
  • MostroP2P/mobile#564: Both PRs update lib/features/community/providers/community_selector_provider.dart, supporting the community selector functionality introduced in that PR.

Suggested Reviewers

  • grunch
  • BraCR10

🐰 Riverpod rises from 2 to 3,
Legacy imports smooth the journey free,
Test refs now real, no mocks to see,
Icons flutter, bright as can be!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat: migrate to Riverpod 3.x' clearly and concisely summarizes the main change—upgrading the Riverpod state management framework from version 2.x to 3.x, which is the primary objective of this pull request.
Linked Issues check ✅ Passed The PR successfully addresses all key coding requirements from issue #512: upgraded flutter_riverpod and hooks_riverpod to ^3.3.2, migrated from removed AutoDispose aliases to .autoDispose modifier, updated imports to use flutter_riverpod/legacy.dart for StateNotifier compatibility, and refactored six test files to use ProviderContainer instead of sealed Ref mocks.
Out of Scope Changes check ✅ Passed All changes directly support the Riverpod 3.x migration objective. Updates to Flutter version (3.32.2→3.44.1), Gradle/Kotlin tooling, and icon package (lucide_icons→lucide_icons_flutter) are necessary infrastructure adjustments for compatibility with Riverpod 3.x and Flutter 3.44.1+, not out-of-scope.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/migrate-riverpod-3x-512

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9477686ccf

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread android/gradle.properties

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
lib/features/relays/relays_notifier.dart (1)

692-692: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Fix Spanish comment.

Line 692 contains a Spanish comment: "🔥 RESET COMPLETO: Limpiar todos los relays y hacer sync fresco". All code comments must be in English per the coding guidelines.

🔧 Proposed fix
-      // 🔥 RESET COMPLETO: Limpiar todos los relays y hacer sync fresco
+      // Reset all relays and perform fresh sync
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@lib/features/relays/relays_notifier.dart` at line 692, Replace the Spanish
inline comment "🔥 RESET COMPLETO: Limpiar todos los relays y hacer sync fresco"
with an English equivalent, e.g. "🔥 FULL RESET: Clear all relays and perform a
fresh sync", so comments in relays_notifier.dart are in English.

Source: Coding guidelines

🧹 Nitpick comments (2)
lib/features/auth/providers/auth_notifier_provider.dart (1)

1-2: Fix Riverpod import consistency in provider/notifier files

  • lib/features/auth/providers/auth_notifier_provider.dart, lib/features/chat/chat_room_provider.dart, and lib/features/chat/notifiers/chat_rooms_notifier.dart only use Provider, StateNotifierProvider, StateProvider, Ref, and StateNotifier, so they can drop import 'package:flutter_riverpod/flutter_riverpod.dart'; and keep only import 'package:flutter_riverpod/legacy.dart';.
  • Keep lib/features/chat/notifiers/chat_room_notifier.dart importing package:flutter_riverpod/flutter_riverpod.dart because it declares ProviderSubscription<Session?>.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@lib/features/auth/providers/auth_notifier_provider.dart` around lines 1 - 2,
The file imports both flutter_riverpod.dart and legacy.dart but only uses legacy
APIs; remove the top-level import
"package:flutter_riverpod/flutter_riverpod.dart" from
auth_notifier_provider.dart and keep only
"package:flutter_riverpod/legacy.dart"; ensure the file still compiles by
verifying it only references Provider, StateNotifierProvider, StateProvider,
Ref, and StateNotifier (the symbols used by the provider/notifier code) and that
no ProviderSubscription or other flutter_riverpod-only types are referenced
here.
lib/features/settings/settings_notifier.dart (1)

2-3: ⚡ Quick win

Root cause: Incomplete Riverpod 3 migration in four files—keep only legacy.dart imports

Four files (settings_notifier.dart, trades_provider.dart, first_run_provider.dart, and nwc_provider.dart) retain both the old flutter_riverpod/flutter_riverpod.dart and the new flutter_riverpod/legacy.dart imports. In Riverpod 3, StateNotifier (used by all four) is only exported from the legacy entrypoint. The main flutter_riverpod import has become redundant and should be removed from each file to complete the migration cleanly and avoid analyzer warnings about unused imports. This aligns with the pattern correctly applied in other migrated files like relays_provider.dart and settings_provider.dart.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@lib/features/settings/settings_notifier.dart` around lines 2 - 3, Remove the
redundant import of "package:flutter_riverpod/flutter_riverpod.dart" and keep
only "package:flutter_riverpod/legacy.dart" so StateNotifier and related legacy
exports resolve correctly; update settings_notifier.dart (look for class
SettingsNotifier and any StateNotifier/StateNotifierProvider usages) to import
only the legacy entrypoint and repeat the same change in trades_provider.dart,
first_run_provider.dart, and nwc_provider.dart to eliminate the unused-import
analyzer warnings and complete the Riverpod 3 migration.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@android/app/build.gradle`:
- Around line 116-120: The comment stating that Kotlin is "provided by Flutter’s
built-in Kotlin support" is misleading because gradle.properties sets
android.builtInKotlin=false; update the comment near the kotlin {
compilerOptions { jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_11 }
} block to reflect that the project is opting out of AGP built-in Kotlin
(legacy/manual Kotlin plugin usage), or instead migrate to AGP built-in Kotlin
by removing/setting android.builtInKotlin to true and adjusting the Kotlin
plugin setup accordingly; ensure the comment accurately references
android.builtInKotlin and the kotlin { ... } configuration so future readers
understand which mode is in use.

In `@test/notifiers/take_order_notifier_test.dart`:
- Around line 50-56: The test constructs MockSessionNotifier with a throwaway
ProviderContainer (via createTestRef(refContainer)) and then injects it with
sessionNotifierProvider.overrideWith, causing ref-based reads in SessionNotifier
to resolve against the wrong provider graph; change each override (the
sessionNotifierProvider.overrideWith calls around the noted locations) to create
MockSessionNotifier using the override callback’s ref (i.e., overrideWith((ref)
=> MockSessionNotifier(ref, mockKeyManager, mockSessionStorage, testSettings)))
instead of prebuilding a ref from ProviderContainer, and remove the throwaway
createTestRef usage and its ProviderContainer/tearDown for those overrides so
provider wiring uses the same ref throughout.

In `@test/services/mostro_service_test.dart`:
- Around line 66-73: The file defines a file-scoped ProviderContainer named
dummyContainer (and dummyRef created via createTestRef) that's never disposed,
leaving Riverpod listeners from MockSubscriptionManager(dummyRef) alive for the
whole test suite; add a suite-level teardown to call dummyContainer.dispose()
(e.g., using tearDownAll(() => dummyContainer.dispose())) so
sessionNotifierProvider overrides and ref.onDispose handlers are cleaned up
after the suite.

---

Outside diff comments:
In `@lib/features/relays/relays_notifier.dart`:
- Line 692: Replace the Spanish inline comment "🔥 RESET COMPLETO: Limpiar todos
los relays y hacer sync fresco" with an English equivalent, e.g. "🔥 FULL RESET:
Clear all relays and perform a fresh sync", so comments in relays_notifier.dart
are in English.

---

Nitpick comments:
In `@lib/features/auth/providers/auth_notifier_provider.dart`:
- Around line 1-2: The file imports both flutter_riverpod.dart and legacy.dart
but only uses legacy APIs; remove the top-level import
"package:flutter_riverpod/flutter_riverpod.dart" from
auth_notifier_provider.dart and keep only
"package:flutter_riverpod/legacy.dart"; ensure the file still compiles by
verifying it only references Provider, StateNotifierProvider, StateProvider,
Ref, and StateNotifier (the symbols used by the provider/notifier code) and that
no ProviderSubscription or other flutter_riverpod-only types are referenced
here.

In `@lib/features/settings/settings_notifier.dart`:
- Around line 2-3: Remove the redundant import of
"package:flutter_riverpod/flutter_riverpod.dart" and keep only
"package:flutter_riverpod/legacy.dart" so StateNotifier and related legacy
exports resolve correctly; update settings_notifier.dart (look for class
SettingsNotifier and any StateNotifier/StateNotifierProvider usages) to import
only the legacy entrypoint and repeat the same change in trades_provider.dart,
first_run_provider.dart, and nwc_provider.dart to eliminate the unused-import
analyzer warnings and complete the Riverpod 3 migration.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: e908b7b5-7f68-4974-9cd5-9ab1a084dc01

📥 Commits

Reviewing files that changed from the base of the PR and between fbad36c and 9477686.

⛔ Files ignored due to path filters (1)
  • pubspec.lock is excluded by !**/*.lock
📒 Files selected for processing (75)
  • .fvmrc
  • .github/workflows/desktop.yml
  • .github/workflows/flutter.yml
  • .github/workflows/main.yml
  • .github/workflows/release.yml
  • android/app/build.gradle
  • android/gradle.properties
  • android/gradle/wrapper/gradle-wrapper.properties
  • android/settings.gradle
  • lib/features/auth/notifiers/auth_notifier.dart
  • lib/features/auth/providers/auth_notifier_provider.dart
  • lib/features/chat/chat_room_provider.dart
  • lib/features/chat/notifiers/chat_room_notifier.dart
  • lib/features/chat/notifiers/chat_rooms_notifier.dart
  • lib/features/chat/providers/active_chat_screens_provider.dart
  • lib/features/chat/providers/chat_room_providers.dart
  • lib/features/chat/providers/chat_tab_provider.dart
  • lib/features/chat/widgets/chat_messages_list.dart
  • lib/features/community/providers/community_selector_provider.dart
  • lib/features/disputes/notifiers/dispute_chat_notifier.dart
  • lib/features/disputes/providers/dispute_read_status_provider.dart
  • lib/features/home/providers/home_order_providers.dart
  • lib/features/key_manager/key_management_screen.dart
  • lib/features/logs/logs_provider.dart
  • lib/features/mostro/mostro_instance_provider.dart
  • lib/features/mostro/mostro_nodes_notifier.dart
  • lib/features/mostro/mostro_nodes_provider.dart
  • lib/features/notifications/notifiers/notifications_notifier.dart
  • lib/features/notifications/providers/backup_reminder_provider.dart
  • lib/features/notifications/providers/notifications_provider.dart
  • lib/features/order/notifiers/abstract_mostro_notifier.dart
  • lib/features/order/providers/order_notifier_provider.dart
  • lib/features/order/providers/payment_methods_provider.dart
  • lib/features/relays/relays_notifier.dart
  • lib/features/relays/relays_provider.dart
  • lib/features/restore/restore_mode_provider.dart
  • lib/features/restore/restore_progress_notifier.dart
  • lib/features/settings/about_screen.dart
  • lib/features/settings/notification_settings_screen.dart
  • lib/features/settings/settings_notifier.dart
  • lib/features/settings/settings_provider.dart
  • lib/features/settings/settings_screen.dart
  • lib/features/trades/providers/trades_provider.dart
  • lib/features/trades/widgets/status_filter_widget.dart
  • lib/features/walkthrough/providers/first_run_provider.dart
  • lib/features/wallet/providers/nwc_provider.dart
  • lib/features/wallet/screens/connect_wallet_screen.dart
  • lib/features/wallet/screens/wallet_settings_screen.dart
  • lib/features/wallet/widgets/wallet_balance_widget.dart
  • lib/features/wallet/widgets/wallet_status_card.dart
  • lib/services/event_bus.dart
  • lib/services/exchange_service.dart
  • lib/shared/notifiers/locale_notifier.dart
  • lib/shared/notifiers/navigation_notifier.dart
  • lib/shared/notifiers/session_notifier.dart
  • lib/shared/providers/drawer_provider.dart
  • lib/shared/providers/exchange_service_provider.dart
  • lib/shared/providers/navigation_notifier_provider.dart
  • lib/shared/providers/session_notifier_provider.dart
  • lib/shared/widgets/bottom_nav_bar.dart
  • lib/shared/widgets/custom_drawer_overlay.dart
  • lib/shared/widgets/ln_address_confirmation_widget.dart
  • lib/shared/widgets/nwc_connection_status_indicator.dart
  • lib/shared/widgets/nwc_invoice_widget.dart
  • lib/shared/widgets/nwc_notification_listener.dart
  • lib/shared/widgets/nwc_payment_receipt_widget.dart
  • lib/shared/widgets/nwc_payment_widget.dart
  • pubspec.yaml
  • test/features/mostro/mostro_integration_test.dart
  • test/features/mostro/mostro_nodes_notifier_test.dart
  • test/features/mostro/mostro_nodes_performance_test.dart
  • test/mocks.dart
  • test/notifiers/add_order_notifier_test.dart
  • test/notifiers/take_order_notifier_test.dart
  • test/services/mostro_service_test.dart

Comment thread android/app/build.gradle
Comment thread test/notifiers/take_order_notifier_test.dart Outdated
Comment thread test/services/mostro_service_test.dart
chore: remove throwaway ref container and add suite-level teardown

- Remove throwaway ProviderContainer and createTestRef() call from take_order_notifier_test setup; inline MockSessionNotifier construction in each override instead
- Rename mockSessionNotifier to testSettings since the mock is no longer shared
- Add tearDownAll(dummyContainer.dispose) in mostro_service_test to clean up the dummy container's subscription manager listeners at suite end
- Replace Spanish comment with English

@ermeme ermeme Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed on the current head SHA.

No blocking issues found. CI is green, the Riverpod 3 migration looks consistent, and the Android/Gradle updates are coherent on this branch.

Non-blocking note: this PR still depends on #612 as stated in the description, so merge order still matters.

@mostronatorcoder mostronatorcoder Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reviewed the current head and I do see one real blocking issue before merge.

Blocking issue:

  • This PR is framed as a Riverpod 3 migration, but the implementation relies heavily on flutter_riverpod/legacy.dart and on manufacturing a reusable Ref in tests via createTestRef(container) from a probe provider.
  • That captured Ref is tied to the lifecycle/ownership of the probe provider read, not a generic application-wide ref. Using it as a stand-in to construct long-lived objects such as MostroService, MostroNodesNotifier, and MockSubscriptionManager is a fragile pattern for a framework migration because Ref carries lifecycle semantics (listen, onDispose, ownership context), not just read().
  • In other words, the tests are making the code appear Riverpod-3-compatible by fabricating a reusable ref object outside the real provider that should own it.

Why I think this is a blocker:

  • For a migration PR, the correctness bar is not only “does CI pass today”, but “are we depending on compatibility shims and test-only ref fabrication in a way that can hide lifecycle breakage”.
  • If the new pattern for constructing/refactoring provider-owned objects is “capture a Ref from a probe and reuse it everywhere”, that is a shaky foundation and can mask bugs around listener ownership/disposal semantics.
  • This is especially relevant because the PR mixes direct flutter_riverpod.dart imports and legacy.dart imports across the tree, which reinforces that the migration is not yet conceptually settled.

What I would want:

  • Either keep the scope honest as a temporary compatibility shim and avoid presenting it as the Riverpod 3 migration proper, or refactor the affected construction/testing patterns so provider-owned objects are exercised through their real provider contexts instead of a synthetic captured Ref.
  • At minimum, I would not merge a framework migration whose test strategy depends on a probe-generated reusable Ref as the general substitute for ownership-aware provider refs.

I do not mean “rewrite the entire app to Notifier/AsyncNotifier now”, but I do think this lifecycle/testing pattern is too shaky to bless as the migration baseline.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Migrate from Riverpod 2.x to Riverpod 3.x

2 participants