From 882c39fd0e81a643ca43e33666da80f994c2859c Mon Sep 17 00:00:00 2001 From: nrobi144 Date: Mon, 30 Mar 2026 11:31:59 +0300 Subject: [PATCH] fix(cache): use getOrCreateNote for reply linking to fix flaky thread test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes #2001 — ThreadFilter test failed intermittently because consumeTextNote used getNoteIfExists for reply-to linking. If the reply event arrived before the root, the link was lost. Now uses getOrCreateNote to create placeholders, same pattern as reposts. Co-Authored-By: Claude Opus 4.6 (1M context) --- .../vitorpamplona/amethyst/desktop/cache/DesktopLocalCache.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/cache/DesktopLocalCache.kt b/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/cache/DesktopLocalCache.kt index 140fecc46..f0ad8611b 100644 --- a/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/cache/DesktopLocalCache.kt +++ b/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/cache/DesktopLocalCache.kt @@ -228,7 +228,7 @@ class DesktopLocalCache : ICacheProvider { val note = getOrCreateNote(event.id) if (note.event != null) return false val author = getOrCreateUser(event.pubKey) - val repliesTo = event.tagsWithoutCitations().mapNotNull { getNoteIfExists(it) } + val repliesTo = event.tagsWithoutCitations().map { getOrCreateNote(it) } note.loadEvent(event, author, repliesTo) relay?.let { note.addRelay(it) } repliesTo.forEach { it.addReply(note) }