Decode advert node type as enum; add sensor type; drop empty packets - #49
Open
ajvpot wants to merge 1 commit into
Open
Decode advert node type as enum; add sensor type; drop empty packets#49ajvpot wants to merge 1 commit into
ajvpot wants to merge 1 commit into
Conversation
The advert app_data flags byte (Core Protocol §2.8.3) uses split encoding: the low 4 bits are an integer node-type enum (1=chat/companion, 2=repeater, 3=room server, 4=sensor) and the high 4 bits are independent presence flags. The decode treated the type as independent bit flags, so a room server (type 3 = 0b0011) matched is_chat_node, is_repeater AND is_room_server at once, and a sensor (type 4) matched none and rendered as an untyped node. Migration 008 fixes the derivation in the meshcore_adverts / meshcore_adverts_latest views (read-time only, retroactive over all history), adds is_sensor and a node_type column, and carries neighbor_is_sensor onto the direct-neighbor graph. The UI gains a sensor badge across the node page, node cards, and advert details, and search/streaming/node queries expose is_sensor. Ingest: drop envelopes whose decoded packet has zero bytes instead of storing them. They decode to an empty payload and a degenerate packet_hash and carry no signal; dropped rows are counted and logged. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
ajvpot
force-pushed
the
ajvpot/advert-type-decode
branch
from
June 20, 2026 19:10
01a4b04 to
0265a90
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Advert node type: enum, not bit flags
The advert app_data flags byte (Core Protocol §2.8.3) uses split encoding: the low 4 bits are an integer node-type enum and the high 4 bits are independent presence flags.
The decode treated the type as independent bit flags (
is_chat_node = flags & 0x01,is_repeater = flags & 0x02,is_room_server = flags & 0x03). Because a room server is type3(0b0011) it matched all three at once (shown as repeater + companion + room simultaneously), and a sensor (type4) matched none (rendered as an untyped/unknown node).Migration 008 corrects the derivation in the
meshcore_adverts/meshcore_adverts_latestviews, adds anis_sensorboolean and anode_typecolumn, and carriesneighbor_is_sensoronto the direct-neighbor graph. These are read-time view changes over already-stored data (appdata_flags/payload), so the fix applies retroactively to all history with no reingest or backfill. The presence-flag (has_*) decoding was already correct and is unchanged. FullDownrestores the prior view/MV definitions.The UI gains a sensor badge (node page, node cards, advert details),
getNodeTypeis corrected, andis_sensoris threaded through the node/neighbor/search/streaming queries, types, and API docs. Grafana readsis_repeater/is_room_serverstraight from the view, so its node-type counts self-correct on the next refresh.Ingest: drop empty packets
A growing share of upstream publishers (observer nodes, repeater tx-confirmations) emit an otherwise-valid JSON envelope with an empty/absent packet-bytes field. Stored, these decode to an empty payload and a degenerate
packet_hashand carry no signal.enqueuePacketnow drops zero-byte packets, counted and logged viadroppedEmpty. (Confirmed by sampling the live feeds: the bytes are simply not present upstream — not a renamed field — so nothing decodable is lost.)Validation
0x03) decodes tonode_type=3, is_room_server=1withis_chat_node=0, is_repeater=0(previously chat+repeater+room all 1).tsc --noEmit+ lint clean;go build+go testpass (incl. new empty-drop test).🤖 Generated with Claude Code