From 6b694e3bd2e81c74bdad47cb277494a6a918319c Mon Sep 17 00:00:00 2001 From: Jean-Pierre Martineau Date: Fri, 25 Sep 2026 03:07:11 -0400 Subject: [PATCH] Packet classes take shorter names, and the class column narrows to 9 dir messg, chan text, chan data and anon req replace direct message, channel text, channel data and anon request, so the longest class (telemetry, chan text, multipart) is 9 cells and the live feed's class lane gives 5 of its 14 back to the row. The dashboard's traffic tallies and the viewer's headline read the same names from the same table. Co-Authored-By: Claude Opus 5.5 (1M context) --- meshterm/ui/livefeed_screen.py | 6 ++++-- meshterm/ui/packet_viewer.py | 10 +++++----- tests/test_dashboard.py | 4 ++-- tests/test_livefeed.py | 2 +- tests/test_packet_viewer.py | 6 +++--- tests/test_scope_display.py | 4 ++-- 6 files changed, 17 insertions(+), 15 deletions(-) diff --git a/meshterm/ui/livefeed_screen.py b/meshterm/ui/livefeed_screen.py index 7e7c2e5..2a32524 100644 --- a/meshterm/ui/livefeed_screen.py +++ b/meshterm/ui/livefeed_screen.py @@ -127,8 +127,10 @@ _FEED_SEED_FLOOR = datetime.min.replace(tzinfo=timezone.utc) _FEED_SUBJECT_WIDTH = 18 #: The class lane's fixed width — wide enough for the longest class the app files a -#: packet under (``direct message``), so every label reads whole and the lanes hold. -_FEED_CLASS_WIDTH = 14 +#: packet under (``telemetry``, ``chan text``, ``multipart``), so every label reads whole. +#: The names are kept short on purpose (``dir messg``, ``anon req`` — JP, 2026-09-25): the +#: lane never collapses, so every cell it spends is one the row's readings scroll off for. +_FEED_CLASS_WIDTH = 9 # The remaining lanes, as the row and its column header both measure them — one set of # numbers so a header label can never drift off the values it names, and so a lane a diff --git a/meshterm/ui/packet_viewer.py b/meshterm/ui/packet_viewer.py index d75238a..c106dc0 100644 --- a/meshterm/ui/packet_viewer.py +++ b/meshterm/ui/packet_viewer.py @@ -104,12 +104,12 @@ _BODY_CACHE_MAX = 8 _PAYLOAD_GLOSS = { "REQ": "request", "RESPONSE": "response", - "TEXT_MSG": "direct message", + "TEXT_MSG": "dir messg", "ACK": "ack", "ADVERT": "advert", - "GRP_TXT": "channel text", - "GRP_DATA": "channel data", - "ANON_REQ": "anon request", + "GRP_TXT": "chan text", + "GRP_DATA": "chan data", + "ANON_REQ": "anon req", "PATH": "path", "TRACE": "trace", "MULTIPART": "multipart", @@ -256,7 +256,7 @@ def payload_class(raw: dict | None) -> str | None: Maps the frame's ``payload_typename`` (``GRP_TXT``, ``TRACE``, …) through :data:`_PAYLOAD_GLOSS` — the one identifying thing a relayed flood carries when it - names no origin node, so a packet list can read "channel text" / "trace" instead of a + names no origin node, so a packet list can read "chan text" / "trace" instead of a bare ``?``. """ if not isinstance(raw, dict): diff --git a/tests/test_dashboard.py b/tests/test_dashboard.py index 948e96d..7032251 100644 --- a/tests/test_dashboard.py +++ b/tests/test_dashboard.py @@ -146,12 +146,12 @@ def test_dashboard_traffic_breaks_packets_out_by_payload_class() -> None: kinds={"advert": 4, "packet:GRP_TXT": 3, "packet:TRACE": 2, "packet": 1}, ) body = _plain(screen.render_body(100)) - assert "channel text" in body and "trace" in body # glossed, not raw typenames + assert "chan text" in body and "trace" in body # glossed, not raw typenames assert "GRP_TXT" not in body # The class-less remainder keeps a plain "packet" row alongside the classed ones. assert "packet" in body # Decoded families before the raw classes, class-less packet closing the block. - assert body.index("advert") < body.index("channel text") < body.index("trace") + assert body.index("advert") < body.index("chan text") < body.index("trace") def test_dashboard_traffic_disambiguates_raw_advert_and_ack_rows() -> None: diff --git a/tests/test_livefeed.py b/tests/test_livefeed.py index 246370d..43a4280 100644 --- a/tests/test_livefeed.py +++ b/tests/test_livefeed.py @@ -215,7 +215,7 @@ def test_livefeed_addressed_frame_is_about_its_two_ends() -> None: raw = {"payload_typename": "TEXT_MSG", "dest_hash": "c0", "src_hash": "a1"} screen.on_event(MeshEvent.observation_event(_obs(node="", kind="packet", raw=raw))) row = _rows(screen, 100)[0] - assert "📩 direct message" in row + assert "📩 dir messg" in row # …including us, when a frame is addressed to us — as the app-wide ★, which is the one # endpoint the reader never has to be told and the cells the other end's name needs. assert "Alice → ★" in row diff --git a/tests/test_packet_viewer.py b/tests/test_packet_viewer.py index dd53471..1e9a520 100644 --- a/tests/test_packet_viewer.py +++ b/tests/test_packet_viewer.py @@ -46,7 +46,7 @@ def test_packet_viewer_shows_class_and_route() -> None: """A raw packet's parsed payload class headlines the card; the route is a row.""" entry = _grp_txt_entry({"chan_hash": "ff", "cipher_mac": "0000", "crypted": "00" * 16}) body = _plain(_viewer(entry).render_body(80)) - assert "📻 CHANNEL TEXT" in body + assert "📻 CHAN TEXT" in body assert "flood" in body @@ -54,7 +54,7 @@ def test_packet_viewer_class_row_leads_the_card() -> None: """The class headline is the first row — above heard/from — for every kind.""" packet = _grp_txt_entry({"chan_hash": "ff", "cipher_mac": "0000", "crypted": "00" * 16}) body = _plain(_viewer(packet).render_body(80)) - assert body.index("CHANNEL TEXT") < body.index("heard") + assert body.index("CHAN TEXT") < body.index("heard") advert = PacketEntry(when=utcnow(), kind="advert", node="aa") body = _plain(_viewer(advert).render_body(80)) @@ -440,7 +440,7 @@ def test_packet_viewer_names_a_channel_datagram_by_its_confirmed_channel() -> No }, ) body = _plain(_viewer(entry, channels=[("Public", secret)]).render_body(80)) - assert "💽 CHANNEL DATA" in body and "Public" in body + assert "💽 CHAN DATA" in body and "Public" in body unknown = _plain(_viewer(entry).render_body(80)) # no keys held: named by fingerprint only assert "unknown" in unknown and "Public" not in unknown diff --git a/tests/test_scope_display.py b/tests/test_scope_display.py index c58d737..0f4106e 100644 --- a/tests/test_scope_display.py +++ b/tests/test_scope_display.py @@ -203,7 +203,7 @@ def test_the_feed_never_collapses_a_lane() -> None: screen = _feed(_scoped("harbour")) for width in (68, 72, 80, 100): header, row = _stripped(screen.render_body(width))[:2] - assert "CLASS" in header and "channel text" in row, width + assert "CLASS" in header and "chan text" in row, width assert _col(header, "SCOPE") == _col(row, "harbour"), width screen._selected = 0 # noqa: SLF001 screen.render_body(68) @@ -219,7 +219,7 @@ def test_the_picocalc_feed_names_the_class_without_an_icon() -> None: screen = _feed(_scoped("harbour")) header, row = _stripped(screen.render_body(53))[:2] assert header.split()[:2] == ["TIME", "CLASS"] - assert _col(header, "CLASS") == _col(row, "channel text") + assert _col(header, "CLASS") == _col(row, "chan text") finally: set_platform(REGULAR)