From f19c7932b2bbc705aaad7cbd610edee5548536e0 Mon Sep 17 00:00:00 2001 From: Ola Lie Date: Thu, 14 May 2026 18:58:07 +0200 Subject: [PATCH] fix: remove dead established state check --- src/tapmap/model/model.py | 6 ++++++ src/tapmap/ui/modal_view.py | 6 ++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/tapmap/model/model.py b/src/tapmap/model/model.py index ba1a3ef..9f31af1 100644 --- a/src/tapmap/model/model.py +++ b/src/tapmap/model/model.py @@ -244,9 +244,11 @@ def _build_open_port(self, conn: dict[str, Any], *, proto: str) -> OpenPort | No local_address = self._format_local_address(l_ip, l_port) process_status = conn.get("process_status") or "Unavailable" + # Raw OS process name if available. process_name = conn.get("process_name") or None exe = conn.get("exe") or None + # User-facing display label with fallback semantics. if process_name: process_label = process_name elif process_status == "No process": @@ -305,6 +307,10 @@ def _build_remote_endpoint_item(self, conn: dict[str, Any], *, proto: str) -> Ca "lat": lat_value, "lon": lon_value, "pid": conn.get("pid"), + # CacheItem.process_name intentionally stores the display-oriented + # process label, not the raw backend process name. Cache items are + # used for UI aggregation, grouping, and summaries where fallback + # labels such as "System" are required. "process_name": conn.get("process_label"), "exe": conn.get("exe"), "cmdline": conn.get("cmdline"), diff --git a/src/tapmap/ui/modal_view.py b/src/tapmap/ui/modal_view.py index 1fbe5f1..fc77027 100644 --- a/src/tapmap/ui/modal_view.py +++ b/src/tapmap/ui/modal_view.py @@ -450,10 +450,8 @@ def _render_lan_local(cls, snapshot: Any | None) -> list[Any]: cleaned: list[dict[str, Any]] = [r for r in rows if isinstance(r, dict)] def is_established_tcp(row: dict[str, Any]) -> bool: - state = row.get("state") - if isinstance(state, str) and state.strip() and state.strip().upper() != "ESTABLISHED": - return False - + # CacheItem rows only contain ESTABLISHED TCP or remote UDP endpoints. + # The model pre-filters all other TCP states, so no explicit state check is needed here. proto = row.get("proto") return not (isinstance(proto, str) and proto.strip() and proto.strip().lower() != "tcp")