feat: local first - #679
Conversation
|
Important Review skippedToo many files! This PR contains 478 files, which is 378 over the limit of 100. To get a review, narrow the scope: Upgrade to a paid plan to raise the limit. Usage-priced reviews support at most 300 files. ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (2)
📒 Files selected for processing (480)
You can disable this status message by setting the ✨ 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 |
|
Caution Review failedAn error occurred during the review process. Please try again later. ✨ 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 |
…roducing broadcast_sender
remove metadata/contactlists tables in drift
remove metadata/contactlists tables in objectbox
Nip17 usecase
|
After a restart, I want a way get the list of unbroadcasted events. |
|
Reformatted files that only appeared correctly formatted locally because a stale .dart_tool pub cache let flutter_lints resolve; CI's format.yml has no `dart pub get` step, so package:flutter_lints never resolves and the formatter falls back to different defaults. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…idth) CI's format check runs before pub get, so flutter_lints never resolves and the formatter falls back to its default page width, which disagrees with a locally-resolved run on these two statements. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UjVUC8pP1TLVRYGL1DuZ8q
Previous format ran via flutter-bundled dart which produced different output; reformatted all files with standalone Dart SDK matching CI. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UjVUC8pP1TLVRYGL1DuZ8q
Missed by prior glob; formatted with standalone Dart SDK 3.12.2 to match CI. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UjVUC8pP1TLVRYGL1DuZ8q
This work established the core local-first delivery and cache model for NDK, focusing first on correctness and high-level behavior before broader sync work.
Key changes
Nip01Event.sources; source relays are now loaded on demand throughCacheManagerAPIs instead of always living on the event object.Nip01Event.sources.EventDeliveryRecord, so local-first work can survive while an event is still unsigned and waiting on an external signer flow.MetadataandContactListfully onto the generic authoritative event store, keeping them as convenience accessors/views instead of separate primary cache silos.CacheManagerwrite/remove APIs forMetadataandContactListin favor of generic event persistence.OK falsefailures such as rate limits are retried even when no relay connectivity change happens.EventSignerwith local-first scheduling hints for delayed signing:requiresInteractiveSigningrequiresSignerNetworksignerTransportRelayUrlsPendingBroadcastDeliveryso it can retry signing as well as relay delivery:EventKindClassificationfor replaceable, addressable, regular replaceable, parameterized replaceable, and ephemeral kinds.Metadata.kKind,ContactList.kKind,10002, andChannelMetadata.kKindfor kind41.loadEvent(id); they now use visibility-awareloadEvents(ids: ...).MockRelaybehavior so deletion events are persisted and can participate in realistic sync/tombstone tests.DecryptedEventPayloadRecord, so encrypted event payloads can be reused from cache instead of re-decrypting on every read.GiftWrap/ NIP-17 unwrapping, including cache-only unwrap paths for instant local reads when decrypted payloads are already available.Testing added
delivery_policyunit tests for retry classification, replaceable policy,auth-required, transient/permanent failures, and raw relay message handling.EventKindClassificationtests.NdkrestartNdkrestart and later completes signing plus publishPendingBroadcastDeliverycoverage for:GiftWrap/ DM codepaths.Net result
This moves NDK from
cache plus best-effort broadcasttoward a real local-first model where app-level reads and writes behave correctly across offline creation, delayed signing, restart recovery, retry, replaceable convergence, foreign-event deletion semantics, bounded-cache operation, and encrypted-content reads that can now become cache-first instead of repeatedly signer-bound.fixes #230
fixes #470
fixes #684
fixes #685
fixes #687
fixes #184
fixes #591
fixes #563
fixes #547