Delete file.patch

This commit is contained in:
AJ Quick
2026-08-09 12:15:04 -06:00
committed by GitHub
parent 9c50aaa7ba
commit 9186e9e65b
-108
View File
@@ -1,108 +0,0 @@
From d774fad9855a5b14dac3965af4fec6151246bcf6 Mon Sep 17 00:00:00 2001
From: ajquick
Date: Sun, 9 Aug 2026 17:57:25 +0000
Subject: [PATCH] fix(packet-capture): make observer_name change pass lint and
tests
The observer_name work broke three existing payload-decode tests and
tripped ruff:
- tests/unit/test_packet_capture_payload_decode.py built a bare service
with `bot = None` and stubbed `_get_bot_name`. `_format_packet_data`
now resolves the origin through `_get_observer_name`, which reads
`[PacketCapture] observer_name` off `self.bot.config` before falling
back, so the stub no longer intercepted the call and the three
`_format_packet_data` tests raised on `None.config`. Stub the new
entry point instead, keeping those tests about payload decoding.
- ruff: trailing whitespace on a blank line in
packet_capture_service.py, plus unsorted imports, an unused `pytest`
import, and another whitespace-only line in the new observer_name
test.
Also record the new option under CHANGELOG's [Unreleased].
---
CHANGELOG.md | 10 ++++++++++
modules/service_plugins/packet_capture_service.py | 2 +-
tests/unit/test_packet_capture_observer_name.py | 6 ++----
tests/unit/test_packet_capture_payload_decode.py | 5 ++++-
4 files changed, 17 insertions(+), 6 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index caa1a3f..38cf9f7 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,16 @@ All notable changes to this project are documented here. The format loosely foll
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and the project adheres to
semantic versioning.
+## [Unreleased]
+
+### Added
+
+- `[PacketCapture] observer_name` — an optional name reported as the `origin` of
+ MQTT packet and status payloads. It lets the observer/analyzer identity differ
+ from the MeshCore RF node, which is useful when one bot name is already taken
+ by the radio's advertised name. Unset (the default) keeps the previous
+ behavior: the connected device name, falling back to `[Bot] bot_name`.
+
## [1.0.0] — 2026-08-07
v1.0.0 marks the first stable release. It adds zero-hop neighbor discovery, a
diff --git a/modules/service_plugins/packet_capture_service.py b/modules/service_plugins/packet_capture_service.py
index f11567d..1c683c1 100644
--- a/modules/service_plugins/packet_capture_service.py
+++ b/modules/service_plugins/packet_capture_service.py
@@ -1572,7 +1572,7 @@ class PacketCaptureService(BaseServicePlugin):
return observer_name
return self._get_bot_name()
-
+
def _get_bot_name(self) -> str:
"""Get bot name from device or config.
diff --git a/tests/unit/test_packet_capture_observer_name.py b/tests/unit/test_packet_capture_observer_name.py
index 1e8e7a7..67c346f 100644
--- a/tests/unit/test_packet_capture_observer_name.py
+++ b/tests/unit/test_packet_capture_observer_name.py
@@ -3,11 +3,9 @@
from __future__ import annotations
import configparser
-from unittest.mock import MagicMock
-
import logging
import types
-import pytest
+from unittest.mock import MagicMock
from modules.service_plugins.packet_capture_service import PacketCaptureService
@@ -41,7 +39,7 @@ def build_service(
"public_key": DEVICE_KEY,
}
)
-
+
service = object.__new__(PacketCaptureService)
service.bot = bot
service.logger = LOGGER
diff --git a/tests/unit/test_packet_capture_payload_decode.py b/tests/unit/test_packet_capture_payload_decode.py
index c0cc1a8..c45d360 100644
--- a/tests/unit/test_packet_capture_payload_decode.py
+++ b/tests/unit/test_packet_capture_payload_decode.py
@@ -132,7 +132,10 @@ def _service_for_format(decode_payloads: bool) -> PacketCaptureService:
svc.debug = False
svc.logger = logging.getLogger("test-packet-capture")
svc.bot = None
- svc._get_bot_name = lambda: "TestBot" # type: ignore[method-assign]
+ # _format_packet_data resolves the reported origin through _get_observer_name,
+ # which falls back to _get_bot_name; stub the entry point so these tests stay
+ # about payload decoding and not name resolution.
+ svc._get_observer_name = lambda: "TestBot" # type: ignore[method-assign]
if decode_payloads:
svc.channel_key_store = ChannelKeyStore()
svc.channel_key_store.add_secret(BOT_KEY, "#bot")
--
2.43.0