feat: exclude TRACE packets from logging in RepeaterHandler and PacketRouter

- Updated record_packet_only method to skip logging for TRACE packets, as TraceHelper manages trace paths.
- Enhanced documentation to clarify the handling of TRACE packets in the web UI.
- Added tests to ensure TRACE packets are not recorded, maintaining data integrity.
This commit is contained in:
agessaman
2026-03-22 15:26:28 -07:00
parent 3cb27d3310
commit c5c94fe60a
3 changed files with 23 additions and 2 deletions
+14 -1
View File
@@ -15,7 +15,7 @@ from unittest.mock import AsyncMock, MagicMock, patch
import pytest
from pymc_core.protocol import Packet
from pymc_core.protocol import Packet, PacketBuilder
from pymc_core.protocol.constants import (
MAX_PATH_SIZE,
PH_ROUTE_MASK,
@@ -1366,3 +1366,16 @@ class TestBadPacketArray:
assert pkt_hash not in handler.seen_packets, (
f"[{name}] bad packet was incorrectly added to seen cache"
)
class TestRecordPacketOnlyTrace:
"""record_packet_only must not log TRACE: TraceHelper owns trace path; packet.path is SNR."""
def test_record_packet_only_skips_trace(self, handler):
storage = handler.storage
storage.record_packet.reset_mock()
pkt = PacketBuilder.create_trace(tag=1, auth_code=2, flags=0, path=[0xAB, 0xCD])
n_before = len(handler.recent_packets)
handler.record_packet_only(pkt, {"rssi": -80, "snr": 10.0})
storage.record_packet.assert_not_called()
assert len(handler.recent_packets) == n_before