feat(server): attribute transmitters by reported address, not by popularity - #1829
Open
clonea1 wants to merge 4 commits into
Open
feat(server): attribute transmitters by reported address, not by popularity#1829clonea1 wants to merge 4 commits into
clonea1 wants to merge 4 commits into
Conversation
The frame parser accepts one magic (0xC5110001) and a fixed 20-byte header, so
a frame carrying transmitter or transmission identity is rejected outright.
That makes it impossible for a node to tell the server anything about WHICH
link a measurement belongs to, or WHICH transmission produced it.
Adds named constants for the three wire versions and dispatches on the magic:
v1 0xC5110001 20-byte header, unchanged
v2 0xC5110008 + transmitter MAC (addr2) at bytes 20..25
v3 0xC511000A + 802.11 rx_seq (u16 LE) at bytes 26..27
Esp32Frame gains source_mac and rx_seq, both Option, both None for a v1 frame.
A mixed fleet therefore keeps working: older firmware parses exactly as before
and newer firmware simply carries more.
This is the receiver half of the wire change and should land BEFORE any
firmware starts emitting v2/v3, so there is never a moment where a node sends
something the server rejects.
It is also a prerequisite for two follow-on changes that cannot work without
per-frame identity: per-link CSI state keyed on (receiver, transmitter), and
cross-node pairing keyed on (transmitter, rx_seq).
Co-Authored-By: claude-flow <ruv@ruv.net>
Adds a LinkTable that accumulates CSI per (rx_node, tx_mac) pair, and runs it BEFORE the existing per-node subcarrier-grid gate. The gate locks each node to the densest grid it has seen. A node associates with one AP and receives HE-SU data from it at 256 bins, while everything else it merely overhears sends beacons and management frames at 64. The lock therefore always settles on the associated AP's format, and every non-associated transmitter is sparser BY CONSTRUCTION -- dropped by a bare continue before it can become a link. Grid consistency is a property of the TRANSMITTER, so it belongs on the link rather than the node. LinkTable applies the same densest-wins policy per (rx_node, tx_mac). The existing gate is NOT modified. The per-node feature path behaves exactly as before; the link path simply runs ahead of the continue, so a frame the node path cannot use stays available to consumers that can. MEASURED 2026-09-01, before -> after: links 31 -> 137 transmitters 10 -> 32 renderable 29 -> 88 grids in use 256 only -> 64:97, 256:33, 128:7 illuminators with two or more receivers: 1 -> 24 97 of the 137 recovered links are 64-bin: precisely the population being discarded. No firmware, hardware or network change -- the frames were always arriving. Adds GET /api/v1/links and GET /api/v1/links/inventory. The inventory endpoint reports the table's full contents including links the metrics view omits, with the reason for each, because that filter_map dropped links silently. Co-Authored-By: claude-flow <ruv@ruv.net>
The v1 ESP-NOW sync packet carries timing only, so a node's identity on the mesh is inferred rather than stated, and its condition is not reported at all. Two consequences: the server guesses which node a sync came from, and a node that is overheating, has rebooted, or is running low on heap looks identical to a healthy one until it stops responding entirely. v2 extends the packet to 38 bytes, adding the node's own MAC and a NodeHealth block: die temperature, thermal state, transmit power, minimum heap seen, and the reset reason. The reset reason is the useful part operationally. reset_reason_name() renders it, and rebooted_badly() distinguishes a panic or watchdog reset from a deliberate software restart -- a node that reboots quietly and rejoins looks healthy from the outside, and the distinction is what separates "somebody updated it" from "it is crashing". Version-gated so a v1 node keeps parsing exactly as before, and a padded v1 packet explicitly yields no MAC rather than reading whatever happened to sit in those bytes. Both cases are covered by tests. Co-Authored-By: claude-flow <ruv@ruv.net>
…larity Link attribution inferred node identity from a hearing set: "a MAC heard by every receiver except one belongs to that one". That signature exists only while every node hears every other, which is true on a bench and false in a building. MEASURED with nine nodes placed through a house: the heuristic attributed 0 of 32 links and reported every peer link as infrastructure, because a node three rooms away is missing from far more than one hearing set. The failure is also silent -- a misattributed link is still a link, so nothing downstream reports that the geometry it is being given is wrong. Nodes already report their own WiFi STA MAC in the sync packet (proto v2+), and a CSI frame already carries the transmitter address. So attribution becomes a lookup on an address both ends agree about, rather than an inference about which addresses are popular. The heuristic survives only for a fleet where nothing has reported a MAC yet -- every node on pre-v2 firmware -- which is the case it was written for and the only one where a guess beats nothing. A mixed fleet mid-OTA therefore moves to address-based attribution as soon as any node reports, rather than switching on some threshold. Co-Authored-By: claude-flow <ruv@ruv.net>
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.
Link attribution inferred node identity from a hearing set: "a MAC heard by
every receiver except one belongs to that one". That signature exists only
while every node hears every other, which is true on a bench and false in a
building.
MEASURED with nine nodes placed through a house: the heuristic attributed 0 of
32 links and reported every peer link as infrastructure, because a node three
rooms away is missing from far more than one hearing set. The failure is also
silent -- a misattributed link is still a link, so nothing downstream reports
that the geometry it is being given is wrong.
Nodes already report their own WiFi STA MAC in the sync packet (proto v2+), and
a CSI frame already carries the transmitter address. So attribution becomes a
lookup on an address both ends agree about, rather than an inference about
which addresses are popular.
The heuristic survives only for a fleet where nothing has reported a MAC yet --
every node on pre-v2 firmware -- which is the case it was written for and the
only one where a guess beats nothing. A mixed fleet mid-OTA therefore moves to
address-based attribution as soon as any node reports, rather than switching on
some threshold.
Stacked. This carries four commits, three of which are already open on their own:
csi-wire-v3— CSI frame transmitter identityhardware-sync-packet— sync packet v2server-links— per-link metricsOnly the last commit is new here. Once those three merge this shrinks to a single commit; review just that one, or merge the stack in order.
Rebased onto current
main; conflicts were purely additive (maingained the room-debounce fields in #1793) and resolved by keeping both sides. 294 server tests pass.