Files
Meshtastic-Android/core/data
James RichandClaude Sonnet 5 4f90acbcaa fix(node): grow session membership as nodes are heard mid-session
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>
2026-08-17 07:46:04 -05:00
..

:core:data

Overview

The :core:data module holds the concrete implementations of the :core:repository contracts, serving as the primary data source for ViewModels in feature modules. It orchestrates data flow between the local database (core:database), remote services, and network repositories.

Key Components

1. Repository implementations (repository/)

  • NodeRepositoryImpl: High-level access to node information and mesh state (Room KMP backed).
  • MeshLogRepositoryImpl: Access to historical logs and diagnostics.
  • FirmwareReleaseRepositoryImpl: Manages the discovery and retrieval of firmware updates.

2. Manager implementations (manager/)

  • SessionManagerImpl: Per-node remote-admin passkey store.
  • PacketHandlerImpl / MeshMessageProcessorImpl: Inbound mesh packet handling and message processing.

Dependency Graph

graph TB
  :core:data[data]:::kmp-library
  :core:data --> :core:repository
  :core:data -.-> :core:common
  :core:data -.-> :core:database
  :core:data -.-> :core:datastore
  :core:data -.-> :core:di
  :core:data -.-> :core:model
  :core:data -.-> :core:network
  :core:data -.-> :core:prefs
  :core:data -.-> :core:takserver
  :core:data -.-> :core:testing

classDef android-application fill:#CAFFBF,stroke:#000,stroke-width:2px,color:#000;
classDef android-application-compose fill:#CAFFBF,stroke:#000,stroke-width:2px,color:#000;
classDef compose-desktop-application fill:#CAFFBF,stroke:#000,stroke-width:2px,color:#000;
classDef android-feature fill:#FFD6A5,stroke:#000,stroke-width:2px,color:#000;
classDef android-library fill:#9BF6FF,stroke:#000,stroke-width:2px,color:#000;
classDef android-library-compose fill:#9BF6FF,stroke:#000,stroke-width:2px,color:#000;
classDef android-test fill:#A0C4FF,stroke:#000,stroke-width:2px,color:#000;
classDef jvm-library fill:#BDB2FF,stroke:#000,stroke-width:2px,color:#000;
classDef kmp-feature fill:#FFD6A5,stroke:#000,stroke-width:2px,color:#000;
classDef kmp-library-compose fill:#FFC1CC,stroke:#000,stroke-width:2px,color:#000;
classDef kmp-library fill:#FFC1CC,stroke:#000,stroke-width:2px,color:#000;
classDef unknown fill:#FFADAD,stroke:#000,stroke-width:2px,color:#000;