mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2026-08-12 01:07:46 +00:00
Reviewer davotoula (PR #3483) flagged three commons/wot issues that would bite the Android app on adoption: 2. Guardrail bypass. handleFollowSet assigned myFollows before the MAX_FOLLOWS check, so subsequent applyKind3 calls whose follower landed in the huge set fully repopulated reverseIndex/_scores — defeating the "skip WoT for mega-follow accounts" promise. Fix: check size FIRST, clear myFollows, expose a disabled StateFlow, and early-return handleKind3 while disabled. Guardrail also releases itself when the follow set later shrinks back under the cap. 3. No teardown API. WoTService owned a writer coroutine + ops Channel but had no close(). On account switch a new instance was created while the old one leaked its writer. Fix: implement AutoCloseable; close() shuts the channel so writerLoop exits and post-close trySend calls are dropped silently. Main.kt wires it via DisposableEffect(iAccount) so account switch is a clean teardown. 4. Misleading docs. KDoc claimed Snapshot.withMutableSnapshot conferred per-key isolation. That's a SnapshotStateMap property, not a withMutableSnapshot property; the wrap only coalesces an op's writes into a single Compose commit. Rewritten to be accurate so future integrators don't trust the wrong invariant. Tests: existing guardrail test extended with isDisabled assertion, plus new tests for guardrail-holds-under-applyKind3, guardrail-releases-when- follow-set-shrinks, close-stops-accepting-ops, and close-is-idempotent. Plan: commons/plans/2026-07-06-fix-wot-outbox-model-and-review-fixes-plan.md