mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2026-08-09 08:04:45 +00:00
DesktopLocalCache stores users in LargeSoftCache, which holds each User via a WeakReference. FindUsersTest populated the cache but kept no strong reference to the created users, so a GC between consumeMetadata and findUsersStartingWith could collect them — LargeSoftCache.forEach then skips (and evicts) the cleared entries, making the search return fewer results. multipleUsersWithMetadata allocates the most objects and tripped this most often (AssertionError at FindUsersTest.kt:115). Verified with a forced-GC probe: without a strong reference all three users were evicted (found=0); holding a reference kept all three (found=3). Pin each test's users in a strong-reference list that stays reachable through the assertions, mirroring how Notes/Account/follow lists keep authors alive in the real app. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01X4BThbs8tz9egmFDYv2RPB