Skip to content

revert: roll back Riverpod 3.x migration (#613) and dependent PRs (#624, #625)#628

Merged
AndreaDiazCorreia merged 3 commits into
mainfrom
revert/riverpod-3x-rollback
Jun 24, 2026
Merged

revert: roll back Riverpod 3.x migration (#613) and dependent PRs (#624, #625)#628
AndreaDiazCorreia merged 3 commits into
mainfrom
revert/riverpod-3x-rollback

Conversation

@grunch

@grunch grunch commented Jun 23, 2026

Copy link
Copy Markdown
Member

Summary

Reverts the Riverpod 3.x migration (#613), which broke the app, and the two PRs merged on top of it (#624, #625). This restores main to the exact state of #619.

Reverted commits (LIFO order)

Verification

Follow-up

The content of #624 and #625 is re-applied — without any Riverpod 3.x changes — in two separate PRs that stack on top of this one:

  • transport v2 Phase B → feat/transport-v2-phase-b-reapply
  • MWK payment methods → feat/mwk-payment-methods-reapply

Merge this PR first.

Summary by CodeRabbit

  • Bug Fixes

    • Simplified message transport protocol for improved reliability.
    • Updated session recovery mechanism to use optimized encryption layer.
  • Chores

    • Updated Flutter, Gradle, and dependency versions for compatibility.
    • Migrated to modern icon library package.
    • Refactored state management framework usage.
    • Removed MWK from supported payment methods.

@coderabbitai

coderabbitai Bot commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

Downgrades Flutter SDK to ~3.32.x, Riverpod to ^2.6.1, Gradle to 8.9, and replaces lucide_icons_flutter with lucide_icons. Removes wrapNip44 and wrapForTransport from MostroMessage, switching all callers to wrap(). Simplifies the session-restore subscription to kind-1059 only and rewrites test infrastructure from ProviderContainer-based wiring to direct MockRef stubbing.

Changes

Dependency Downgrade, Transport Simplification, and Test Refactor

Layer / File(s) Summary
Flutter, Gradle, and dependency version downgrades
pubspec.yaml, .fvmrc, .github/workflows/*, android/gradle/wrapper/gradle-wrapper.properties, android/settings.gradle, android/app/build.gradle, android/gradle.properties
Pins Flutter to ~3.32.x in all CI workflows and .fvmrc; downgrades Gradle wrapper to 8.9 and AGP/Kotlin plugin versions; downgrades flutter_riverpod and hooks_riverpod to ^2.6.1; replaces lucide_icons_flutter with lucide_icons ^0.257.0.
Riverpod legacy import removal across lib/ files
lib/features/auth/..., lib/features/chat/..., lib/features/community/..., lib/features/disputes/..., lib/features/home/..., lib/features/mostro/..., lib/features/notifications/..., lib/features/order/..., lib/features/relays/..., lib/features/restore/restore_progress_notifier.dart, lib/features/settings/..., lib/features/trades/..., lib/features/walkthrough/..., lib/features/wallet/..., lib/services/event_bus.dart, lib/services/exchange_service.dart, lib/shared/...
Removes all flutter_riverpod/legacy.dart imports (or replaces with flutter_riverpod/flutter_riverpod.dart). Updates orderTypeNotifierProvider to use AutoDisposeStateNotifierProvider and eventBusProvider to use AutoDisposeProvider.
lucide_icons_flutter → lucide_icons swap in widgets and screens
lib/features/key_manager/..., lib/features/settings/..., lib/features/trades/widgets/status_filter_widget.dart, lib/features/wallet/screens/*, lib/features/wallet/widgets/*, lib/shared/widgets/*, lib/features/chat/widgets/chat_messages_list.dart
Replaces lucide_icons_flutter imports with lucide_icons throughout all widgets and screens. Removes the unused flutter/rendering.dart import and updates ListView.builder from scrollCacheExtent: ScrollCacheExtent.pixels(1000) to cacheExtent: 1000.
Remove wrapNip44 / wrapForTransport from MostroMessage and call sites
lib/data/models/mostro_message.dart, lib/data/repositories/dispute_repository.dart, lib/services/mostro_service.dart
Strips the optional version parameter from toJson/sign/serialize, inlines SHA-256 digest signing, and deletes wrapNip44 and wrapForTransport. Updates MostroService.publishOrder and DisputeRepository.createDispute to call wrap() directly.
Restore flow: single kind-1059 subscription and inline gift-wrap decode
lib/features/restore/restore_manager.dart, lib/features/restore/restore_mode_provider.dart, docs/architecture/SESSION_RECOVERY_ARCHITECTURE.md, docs/architecture/TRANSPORT_V2_MIGRATION.md, test/data/mostro_message_nip44_test.dart, test/features/restore/restore_decode_test.dart
Refactors RestoreService to subscribe only on kind-1059, switches all three outbound requests to wrap(), replaces _decodeRestoreMessage with inline mostroUnWrap calls in all three extract methods, deletes the exported testing helper, adds isRestoringProvider, and removes the now-obsolete NIP-44 and restore-decode test files.
Test infrastructure: ProviderContainer → MockRef stubbing
test/mocks.dart, test/features/mostro/*, test/notifiers/add_order_notifier_test.dart, test/notifiers/take_order_notifier_test.dart, test/services/mostro_service_test.dart
Adds Ref and ProviderSubscription to @GenerateMocks, removes createTestRef. Rewires all affected test suites to construct MockRef and stub read()/listen() calls instead of using ProviderContainer overrides.
MWK currency removal and misc
assets/data/payment_methods.json, lib/features/relays/relays_notifier.dart
Removes the MWK entry from the payment methods JSON. Updates a reset-branch log comment in relays_notifier.dart to Spanish.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

  • MostroP2P/mobile#624: Directly related — this PR removes wrapNip44/wrapForTransport from MostroMessage and reverts all callers to wrap(), effectively reverting the dual-send Phase B implementation added in #624.
  • MostroP2P/mobile#613: Both PRs touch Riverpod test wiring in test/features/mostro/* and test/services/mostro_service_test.dart, but in opposite directions (this PR moves away from ProviderContainer toward MockRef).
  • MostroP2P/mobile#625: This PR removes the MWK entry from assets/data/payment_methods.json, directly conflicting with #625 which adds that same entry.

Suggested reviewers

  • BraCR10

Poem

🐇 Hop, hop, the versions fall back down,
Old Riverpod three wore too big a crown.
The NIP-44 wrappers? Gone with a bound!
Gift-wrap kind-1059 is the only wrap found.
MockRef stubs where containers once stood —
A simpler stack, just as it should! 🌿

🚥 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 clearly and specifically summarizes the main change: reverting Riverpod 3.x migration and two dependent PRs, with PR numbers explicitly referenced for clarity.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ 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 revert/riverpod-3x-rollback

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.

@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: 44556d6475

ℹ️ 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 .github/workflows/main.yml

@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: 4

🧹 Nitpick comments (1)
test/features/mostro/mostro_nodes_notifier_test.dart (1)

45-58: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Use .thenAnswer for dynamic state access to avoid re-stubbing.

Line 52 uses .thenReturn(mockSettingsNotifier.state) which captures the state value at stub time. This requires re-stubbing in lines 120-121, 143-144, 162-163, 182-183, and 288-289 whenever the state changes.

The integration test (mostro_integration_test.dart:72-77) and performance test use .thenAnswer((_) => mockSettingsNotifier.state) to dynamically read the current state, eliminating the need for re-stubbing.

♻️ Recommended fix for consistency and maintainability
     mockSettingsNotifier.state = makeSettings();
-    when(mockRef.read(settingsProvider)).thenReturn(mockSettingsNotifier.state);
+    when(mockRef.read(settingsProvider))
+        .thenAnswer((_) => mockSettingsNotifier.state);
     when(mockRef.read(settingsProvider.notifier))
         .thenReturn(mockSettingsNotifier);

Then remove the re-stubbing at lines 120-121, 143-144, 162-163, 182-183, and 288-289:

     mockSettingsNotifier.state = makeSettings(
       mostroPublicKey: unknownPubkey,
     );
-    when(mockRef.read(settingsProvider))
-        .thenReturn(mockSettingsNotifier.state);

     final notifier = createNotifier();
🤖 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 `@test/features/mostro/mostro_nodes_notifier_test.dart` around lines 45 - 58,
In the setUp method, change the stub for mockRef.read(settingsProvider) from
using .thenReturn(mockSettingsNotifier.state) to using .thenAnswer((_) =>
mockSettingsNotifier.state) so it dynamically accesses the current state instead
of capturing it at stub time. This dynamic approach will eliminate the need to
re-stub this mock in individual test methods whenever the state changes, so you
can remove all the re-stubbing occurrences at lines 120-121, 143-144, 162-163,
182-183, and 288-289.
🤖 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 @.github/workflows/release.yml:
- Line 138: Flutter versions are inconsistent across the project configuration
files (.fvmrc, .github/workflows/desktop.yml, .github/workflows/flutter.yml,
.github/workflows/main.yml, and .github/workflows/release.yml), which creates
environment mismatches between local development and CI workflows. Select a
single Flutter version that meets your project's compatibility and testing
requirements, then update the flutter-version property in all workflow files and
the version field in .fvmrc to use this unified version consistently across all
configuration files.

In `@lib/data/repositories/dispute_repository.dart`:
- Around line 55-60: The wrap() method call in the dispute message handling is
missing the masterKey and keyIndex parameters that are needed to respect the
user's privacy mode settings. Update the wrap() call to conditionally pass
masterKey and keyIndex parameters from the session object, similar to how it's
done in mostro_service.dart around lines 366-372. The session object (defined at
line 28) contains the fullPrivacy, masterKey, and keyIndex fields needed for
this conditional logic.

In `@lib/features/relays/relays_notifier.dart`:
- Line 691: The comment containing "🔥 RESET COMPLETO: Limpiar todos los relays
y hacer sync fresco" at line 691 in relays_notifier.dart is written in Spanish
and violates the English-only commenting guideline. Replace this Spanish comment
with an English equivalent that conveys the same intent about performing a
complete reset and fresh synchronization of the relays. Ensure the translated
comment maintains the same meaning and context as the original.

In `@pubspec.yaml`:
- Line 69: Replace the unmaintained lucide_icons package in pubspec.yaml with a
maintained alternative such as iconify_flutter or lucide_icons_flutter. After
updating the dependency version, update all imports and icon references in
custom_drawer_overlay.dart where LucideIcons.user, LucideIcons.settings, and
LucideIcons.info are currently used to match the API of the new package you
choose.

---

Nitpick comments:
In `@test/features/mostro/mostro_nodes_notifier_test.dart`:
- Around line 45-58: In the setUp method, change the stub for
mockRef.read(settingsProvider) from using
.thenReturn(mockSettingsNotifier.state) to using .thenAnswer((_) =>
mockSettingsNotifier.state) so it dynamically accesses the current state instead
of capturing it at stub time. This dynamic approach will eliminate the need to
re-stub this mock in individual test methods whenever the state changes, so you
can remove all the re-stubbing occurrences at lines 120-121, 143-144, 162-163,
182-183, and 288-289.
🪄 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: 223a53a2-fb6f-47ed-b9ce-7b47505b5c70

📥 Commits

Reviewing files that changed from the base of the PR and between 0c3676d and 44556d6.

⛔ Files ignored due to path filters (1)
  • pubspec.lock is excluded by !**/*.lock
📒 Files selected for processing (84)
  • .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
  • assets/data/payment_methods.json
  • docs/architecture/SESSION_RECOVERY_ARCHITECTURE.md
  • docs/architecture/TRANSPORT_V2_MIGRATION.md
  • lib/data/models/mostro_message.dart
  • lib/data/repositories/dispute_repository.dart
  • 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_manager.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/services/mostro_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/data/mostro_message_nip44_test.dart
  • test/features/mostro/mostro_integration_test.dart
  • test/features/mostro/mostro_nodes_notifier_test.dart
  • test/features/mostro/mostro_nodes_performance_test.dart
  • test/features/restore/restore_decode_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
💤 Files with no reviewable changes (25)
  • lib/features/settings/settings_notifier.dart
  • lib/features/walkthrough/providers/first_run_provider.dart
  • lib/features/notifications/providers/notifications_provider.dart
  • lib/shared/notifiers/session_notifier.dart
  • lib/features/order/notifiers/abstract_mostro_notifier.dart
  • lib/services/exchange_service.dart
  • lib/features/home/providers/home_order_providers.dart
  • lib/features/chat/providers/chat_room_providers.dart
  • lib/features/chat/notifiers/chat_rooms_notifier.dart
  • assets/data/payment_methods.json
  • android/gradle.properties
  • test/features/restore/restore_decode_test.dart
  • lib/features/disputes/notifiers/dispute_chat_notifier.dart
  • lib/features/chat/notifiers/chat_room_notifier.dart
  • lib/features/mostro/mostro_nodes_notifier.dart
  • lib/features/chat/chat_room_provider.dart
  • lib/features/trades/providers/trades_provider.dart
  • lib/features/order/providers/payment_methods_provider.dart
  • lib/features/notifications/notifiers/notifications_notifier.dart
  • lib/shared/providers/exchange_service_provider.dart
  • lib/features/community/providers/community_selector_provider.dart
  • lib/features/logs/logs_provider.dart
  • lib/features/auth/providers/auth_notifier_provider.dart
  • lib/features/wallet/providers/nwc_provider.dart
  • test/data/mostro_message_nip44_test.dart

Comment thread .github/workflows/release.yml
Comment thread lib/data/repositories/dispute_repository.dart
Comment thread lib/features/relays/relays_notifier.dart
Comment thread pubspec.yaml

@Catrya Catrya left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

tACK

@AndreaDiazCorreia AndreaDiazCorreia merged commit 6480c5e into main Jun 24, 2026
2 checks passed
@grunch grunch deleted the revert/riverpod-3x-rollback branch June 24, 2026 12:11
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.

3 participants