@@ -4024,6 +4024,80 @@ void main() {
40244024 },
40254025 );
40264026
4027+ for (final lookupFails in [false , true ]) {
4028+ test (
4029+ 'direct-only broadcast deletion stays uncertain (lookup fails: $lookupFails )' ,
4030+ () async {
4031+ final session = _RecordingRelaySessionNotifier (
4032+ queryResults: [
4033+ [
4034+ _event (
4035+ id: 'broadcast' ,
4036+ createdAt: 20 ,
4037+ extraTags: const [
4038+ ['e' , 'root' , '' , 'root' ],
4039+ ['e' , 'root' , '' , 'reply' ],
4040+ ['broadcast' , '1' ],
4041+ ],
4042+ ),
4043+ _summary (rootId: 'broadcast' , replyCount: 1 , descendantCount: 0 ),
4044+ _bounds (),
4045+ ],
4046+ if (lookupFails)
4047+ for (var i = 0 ; i < 3 ; i++ ) Exception ('ownership unavailable' )
4048+ else
4049+ < NostrEvent > [],
4050+ ],
4051+ );
4052+ final container = _buildContainer (session);
4053+ addTearDown (container.dispose);
4054+ container.listen (channelMessagesProvider (_channelId), (_, _) {});
4055+ await _pumpEventQueue ();
4056+ final notifier = container.read (
4057+ channelMessagesProvider (_channelId).notifier,
4058+ );
4059+ session.emit (
4060+ NostrEvent (
4061+ id: 'delete-evicted-child' ,
4062+ pubkey: 'author' ,
4063+ createdAt: 30 ,
4064+ kind: EventKind .deletion,
4065+ tags: const [
4066+ ['h' , _channelId],
4067+ ['e' , 'evicted-child' ],
4068+ ],
4069+ content: '' ,
4070+ sig: 'sig' ,
4071+ ),
4072+ );
4073+ expect (notifier.threadSummaries['broadcast' ]? .isCountPending, isTrue);
4074+ await Future <void >.delayed (
4075+ Duration (milliseconds: lookupFails ? 1800 : 50 ),
4076+ );
4077+ final entries = buildMainTimelineEntries (
4078+ formatTimeline (
4079+ container.read (channelMessagesProvider (_channelId)).value! ,
4080+ ),
4081+ relaySummaries: notifier.threadSummaries,
4082+ );
4083+ expect (entries.single.summary? .isCountPending, isTrue);
4084+ expect (entries.single.summary? .isLowerBound, isTrue);
4085+ expect (
4086+ session.queryFilters.where (
4087+ (f) => f.extensions['resolve_thread_roots' ] == true ,
4088+ ),
4089+ hasLength (lookupFails ? 3 : 1 ),
4090+ );
4091+ expect (
4092+ session.queryFilters.where (
4093+ (f) => f.extensions.containsKey ('depth_limit' ),
4094+ ),
4095+ isEmpty,
4096+ );
4097+ },
4098+ );
4099+ }
4100+
40274101 for (final rootVisible in [false , true ]) {
40284102 for (final source in ['known' , 'owner' , 'live' ]) {
40294103 for (final survives in [false , true ]) {
0 commit comments