mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-09-18 09:05:16 -04:00
currentSessionNodeNums was captured once, from the Stage 2 NodeDB download, and never updated again for the life of the connection. Any node that announced itself afterwards — extremely common on a long-lived BLE connection — was therefore absent from the set and got badged "Saved on phone" with its online/fresh status suppressed, reintroducing the very "presence looks wrong" defect #6263 exists to fix, only inverted: genuinely fresh nodes now looked falsely stale. Every mid-session path that learns about a node through the radio carries a RadioSessionContext, and every local-only write (optimistic admin projections, shared-contact imports, fixed-position edits) carries none. That distinction is exactly the one the badge needs, so it drives the new private noteHeardInSession(): NodeInfo via handleReceivedUser, position, node status, PaxCounter, and the updateNodeForSession path that mesh telemetry and admin replies arrive on all extend the set; sessionless writes deliberately do not, since those nodes really are phone-only. Membership is claimed only where the mutation actually committed. For handleReceivedUser that means the winning CAS branch, using a new ReceivedUserTransition.sessionMemberNodeNum so a suppressed retired-number replay claims nothing and a stale noncanonical presentation credits the canonical row it yields to rather than the slot it vacates. The generation is re-read inside the StateFlow update so a concurrent session boundary makes it a no-op instead of resurrecting a number into the new session's set, and an already-present member returns the same instance rather than copying a set of up to MAX_IN_MEMORY_NODES on every inbound packet. The converse gap is documented rather than fixed: a node evicted from the radio's own bounded NodeDB mid-session keeps its membership, because firmware sends no eviction notification and the phone has no signal short of re-downloading the NodeDB. Withholding a badge is the safe direction. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>