@@ -1932,6 +1932,71 @@ void main() {
19321932 );
19331933 }
19341934
1935+ test ('unscoped proof reconciles other retained channel targets' , () async {
1936+ final session = _RecordingRelaySessionNotifier (
1937+ queryResults: [
1938+ [
1939+ _event (id: 'root' , createdAt: 10 ),
1940+ _event (id: 'other-root' , createdAt: 9 ),
1941+ _event (id: 'unrelated' , createdAt: 8 ),
1942+ _summary (rootId: 'unrelated' , replyCount: 2 ),
1943+ _bounds (),
1944+ ],
1945+ < NostrEvent > [],
1946+ < NostrEvent > [],
1947+ ],
1948+ );
1949+ final container = _buildContainer (session);
1950+ addTearDown (container.dispose);
1951+ container.listen (channelMessagesProvider (_channelId), (_, _) {});
1952+ await _pumpEventQueue ();
1953+ final notifier = container.read (
1954+ channelMessagesProvider (_channelId).notifier,
1955+ );
1956+ for (final root in ['root' , 'other-root' ]) {
1957+ notifier.cacheCompleteThreadQuery (root, {}, [
1958+ _event (
1959+ id: '$root -reply' ,
1960+ createdAt: 20 ,
1961+ extraTags: [
1962+ ['e' , root, '' , 'reply' ],
1963+ ],
1964+ ),
1965+ ]);
1966+ }
1967+ final deletion = NostrEvent (
1968+ id: 'multi-target-proof' ,
1969+ pubkey: 'author' ,
1970+ createdAt: 30 ,
1971+ kind: EventKind .deletion,
1972+ tags: const [
1973+ ['e' , 'root-reply' ],
1974+ ['e' , 'other-root-reply' ],
1975+ ['e' , 'outside-channel' ],
1976+ ],
1977+ content: '' ,
1978+ sig: 'original-signature' ,
1979+ );
1980+ notifier.cacheThreadDeletions ([deletion], scopedTargetIds: {'root-reply' });
1981+ expect (notifier.cachedThreadReplyIds ('other-root' ), isEmpty);
1982+ expect (notifier.threadSummaries['other-root' ]? .descendantCount, 0 );
1983+ expect (notifier.threadSummaries['unrelated' ]! .isCountPending, isFalse);
1984+ await Future <void >.delayed (const Duration (milliseconds: 350 ));
1985+ expect (notifier.threadSummaries['other-root' ]? .descendantCount, 0 );
1986+ expect (notifier.threadSummaries['other-root' ]? .isLowerBound, isFalse);
1987+ expect (
1988+ session.queryFilters.where (
1989+ (filter) => filter.extensions['resolve_thread_roots' ] == true ,
1990+ ),
1991+ isEmpty,
1992+ );
1993+ final cached = container
1994+ .read (channelMessagesProvider (_channelId))
1995+ .value!
1996+ .singleWhere ((event) => event.id == deletion.id);
1997+ expect (cached, same (deletion));
1998+ });
1999+
19352000 for (final multiTarget in [false , true ]) {
19362001 test (
19372002 'unacknowledged reply needs deletion proof (multi-target: $multiTarget )' ,
0 commit comments