mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2026-10-05 11:18:24 +00:00
`DesktopCachePipelineTest` consumes events and then queries the cache for the notes they produced. Nothing in between held a strong reference to those notes -- until this branch, `DesktopLocalCache.notesByAuthor` did, incidentally: an unbounded `ConcurrentHashMap<HexKey, MutableSet<Note>>` that pinned every note the Desktop app ever saw and quietly defeated the point of storing them in a `LargeSoftCache`. Removing that index was the right call, but it took the tests' only referent with it, so a GC landing between `consume` and the assertion now empties the cache. That is what turned `compose-ui-test` red: `FollowingFeedFilter only includes notes from followed users` got `expected:<1> but was:<0>`. It reproduces exactly with two `System.gc()` calls before the query, and it is not specific to that test -- all 46 consume sites have the same shape, so CI's heap picked the victim. Route every consume through an `ingest` helper that pins what the cache built for the lifetime of the test instance, the way a screen holds the notes it is showing in the app. Keep the forced GC in the test that failed, so the contract is asserted rather than left to the heap. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KkULS5SVq4GHDdoCzajKi8