-
Notifications
You must be signed in to change notification settings - Fork 20
Feat: Add multi-Mostro integration tests (P4) #443
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Add 18 integration tests verifying cross-component flows between MostroNodesNotifier and SettingsNotifier. Tests cover node switching with relay reset, custom node lifecycle, backward compatibility, persistence round-trips, and relay reconnection behavior. Update MULTI_MOSTRO_SUPPORT.md Phase 4 section with implementation details, test group descriptions, and coverage summary (64 total tests across Phases 1-4).
WalkthroughPhase 4 of multi-Mostro integration testing is marked completed; a new comprehensive integration test file for MostroNodesNotifier is added, docs updated with test plans and decisions, and small code tweaks normalize pubkey handling and a comment in SettingsNotifier. Changes
Sequence Diagram(s)(Skipped — changes are primarily tests, small normalization, and documentation; no new multi-component control flow requiring visualization.) Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
No actionable comments were generated in the recent review. 🎉 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. Comment |
- Add 4 missing edge case tests: selectNode with unknown pubkey (no-op), empty mostroPublicKey (null selectedNode), duplicate addCustomNode rejection, main relays list preserved on switch - Rename group "Case-insensitive pubkey handling" to "Pubkey case sensitivity" to accurately reflect exact-match behavior - Rename test "selected node persists via settings notifier" to "selectNode updates settings notifier state" for accuracy - Fix Spanish comments in settings_notifier.dart to English - Update MULTI_MOSTRO_SUPPORT.md with new test counts (22 tests, 68 total across Phases 1-4)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@test/features/mostro/mostro_integration_test.dart`:
- Around line 467-489: The addCustomNode and selectNode paths allow case-variant
pubkeys to be treated as distinct because duplicates and selection use direct
string comparison (e.g., state.any((n) => n.pubkey == pubkey) and if (n.pubkey
== pubkey)); fix by normalizing incoming pubkey strings to a canonical form
(lowercase) before validation and before comparisons in addCustomNode and
selectNode (ensure the validator still accepts hex with /^[0-9a-fA-F]{64}$/ but
apply pubkey = pubkey.toLowerCase() at the start of both methods), so all stored
MostroNode.pubkey values and lookup keys are lowercase and
duplicate/preselection logic works correctly.
Apply pubkey.toLowerCase() at the start of addCustomNode() and
selectNode() so all stored MostroNode.pubkey values and lookup keys
are in canonical lowercase form. This prevents case-variant duplicates
(e.g. uppercase hex treated as distinct from lowercase) and ensures
selectNode finds nodes regardless of input casing.
The hex validator still accepts [0-9a-fA-F]{64} but normalization
happens before validation and before all comparisons.
Update integration tests to verify the new behavior: uppercase
duplicate rejected, uppercase selectNode finds lowercase-stored node.
mostronator
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thorough integration test suite! 👏
What I like:
- 23 tests across 7 well-organized groups covering the full multi-Mostro lifecycle
- In-memory SharedPreferences mock for persistence round-trip testing is clever
- Dynamic mock ref pattern ensures state changes from
updateMostroInstance()are visible to subsequent reads - Good edge cases: malformed pubkey, empty pubkey, duplicate rejection, active node removal prevention
- Pubkey lowercase normalization in both
addCustomNodeandselectNodeis a nice defensive fix - Spanish comments cleaned up in
settings_notifier.dart
Minor note:
- The doc says 23 tests but the summary table adds up to 23 (4+4+4+3+4+2+2) ✅ consistent
LGTM! 🚀
Add 18 integration tests verifying cross-component flows between MostroNodesNotifier and SettingsNotifier. Tests cover node switching with relay reset, custom node lifecycle, backward compatibility, persistence round-trips, and relay reconnection behavior.
Update MULTI_MOSTRO_SUPPORT.md Phase 4 section with implementation details, test group descriptions, and coverage summary (64 total tests across Phases 1-4).
Summary by CodeRabbit
Documentation
Tests
Bug Fixes