feat: add mostro-p2p.tech as fallback default relay#607
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughThe PR expands default Nostr relays from one hardcoded endpoint to a configurable list: ChangesMultiple Default Relays
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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 `@lib/features/relays/relays_notifier.dart`:
- Around line 64-69: The duplicate-filtering logic uses
Config.nostrRelays.contains(url) without normalizing URLs; update the filter on
saved.relays to compare normalized URLs by calling _normalizeRelayUrl(url) (and
_normalizeRelayUrl on entries of Config.nostrRelays if not already normalized)
before contains checks so trailing slashes don't cause misses; change the
where(...) predicate that builds relaysFromSettings to use normalized
comparisons, then continue mapping to Relay.fromMostro and adding to
loadedRelays as before.
🪄 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: 8f8f2f6b-26b3-49c5-b6cb-72bacdea849d
📒 Files selected for processing (2)
lib/core/config.dartlib/features/relays/relays_notifier.dart
When relay.mostro.network is unreachable, clients have no fallback and all communication with any Mostro instance breaks. Adding mostro-p2p.tech as a second default relay ensures connectivity is maintained when the primary relay has an outage. Also refactors RelaysNotifier to derive default relay seeds from Config.nostrRelays instead of a hardcoded single URL, so future additions only require updating Config.
a11d30f to
e6ce046
Compare
There was a problem hiding this comment.
This is a small PR, but I do see one real correctness issue and I would request changes for it.
Blocking issue:
- The new duplicate-filtering path compares saved relays against
Config.nostrRelayswithcontains(_normalizeRelayUrl(url)), but the configured defaults themselves are not normalized before the comparison. That means a saved relay likewss://mostro-p2p.tech/orwss://relay.mostro.network/will not match the slashless default entry and will be loaded as an extra custom relay even though it is the same endpoint. - In practice this can leave duplicate logical relays in state and can lead to duplicate connections/subscriptions against the same server, which is exactly what this refactor is supposed to avoid.
Please normalize both sides of the comparison (or precompute a normalized default set) before filtering saved.relays.
Aside from that, the direction of the refactor is fine, and deriving defaults from Config.nostrRelays is the right cleanup. But I would still block until the duplicate detection is actually normalization-safe.
|
Hi @21Mill How's this PR going? Please take into account the changes requested by mostroneitor. |
Thanks for reminding me, Catrya, I'd forgotten. I'll get on it. |
The previous filter normalized the saved URL but compared against raw Config.nostrRelays entries. A trailing slash on either side would cause a mismatch, leaving duplicate logical relays in state. Precompute a normalized Set from Config.nostrRelays so both sides of the contains() check are normalized consistently.
There was a problem hiding this comment.
I re-reviewed the latest head with the normalization fix in place, and I do not see a remaining blocking issue.
What I re-checked strictly:
- The duplicate-filtering bug is fixed correctly. Precomputing a normalized default set and comparing saved relays against that set closes the trailing-slash mismatch I previously blocked on.
- The reset path now derives its seed state from
Config.nostrRelaysas well, so the notifier is no longer split between one hardcoded default in one path and a configurable list in another. - The scope is still tight: this changes the default relay seed behavior without altering unrelated relay logic.
I do not see another correctness issue that should hold merge on this revision.
Approved.
|
closing this one in favor of #610 |
When relay.mostro.network is unreachable, clients have no fallback and all communication with any Mostro instance breaks. Adding mostro-p2p.tech as a second default relay ensures connectivity is maintained when the primary relay has an outage.
Also refactors RelaysNotifier to derive default relay seeds from Config.nostrRelays instead of a hardcoded single URL, so future additions only require updating Config.
Summary by CodeRabbit