From ffd2649a35e437d14cd681143d4ca5816609d5a5 Mon Sep 17 00:00:00 2001 From: Jean-Pierre Martineau Date: Sat, 12 Sep 2026 19:19:45 -0400 Subject: [PATCH] Shared logic sits in the layer that reads it, and the CLI answers --version A pre-release architecture and QA pass, applied as one change because the moves share files and only the whole set was gate-tested (2480 passed, ruff clean). Three new modules pull logic down out of layers that should not own it: core/channel_probe.py (ChannelSlot, read_channel_slots, probe_channel_slots) so services/device_state.py no longer imports a screen; services/markers.py (gather_markers, with MapMarker a core/models dataclass) so two screens stop importing a tool; core/tracing.py (trace_timeout, path_hash_flags) so core/connection.py no longer imports services. The routing-prefix width is DeviceState.routing_prefix_bytes(), replacing five private cross-module imports. One definition per thing: is_path_hash, the NodeResolver/NameKeyResolver aliases, TILE_RETRY_SECONDS, haversine_km, marks.SELF_MARK, MENTION; nine private names that crossed module boundaries got public ones and menus.__all__ lists what other modules import. A preference's default is written once (ALERT_CAP, DONE_CAP, DEFAULT_VIEW_FRACTION read the registry), the stranded PREFERENCES doc comment sits on its subject, and three docstrings stop naming questionary, a library dropped long ago. The command line gains --version (eager, exit 0, documented, tested) and drops the -p short form on trace, trace-path and tx-optimize: the root lifts -p as --profile before a leaf ever sees it, so the leaf's could never work, and a derived test now checks every leaf against every root short option. tx-optimize with a one-hop --path is a usage error, exit 2, because nothing transmitted is not a device failure. Log handlers are closed before they are cleared (197 unclosed-file warnings gone), chat's fire-and-forget tasks keep a reference, coroutines use get_running_loop(), the never-awaited MapScreen._load in a test is awaited, and the CLI sweep passes --no-ble to devices so a test run stops turning on the Bluetooth radio three times (the suite is 40 % faster). The about page lists every dependency, and the release skill bumps the README's download names, which still said 0.2.8. apply_ops stays in tools/: it and its helpers build report blocks and open two screens, so moving it to core/ would invert core over ui. The widgets CLAUDE.md names by their private spellings (_format_age, _NODE_GLYPHS) keep them until CLAUDE.md is edited alongside. Co-Authored-By: Claude Fable 5.1 --- .claude/skills/release/SKILL.md | 18 ++++ docs/cli.md | 18 ++-- meshterm/assets/pages/about.md | 4 +- meshterm/cli.py | 24 +++++ meshterm/core/channel_probe.py | 165 ++++++++++++++++++++++++++++++ meshterm/core/channels.py | 9 +- meshterm/core/connection.py | 11 +- meshterm/core/contact_score.py | 4 +- meshterm/core/courier_store.py | 3 +- meshterm/core/geo.py | 8 +- meshterm/core/models.py | 48 +++++++++ meshterm/core/preferences.py | 24 +++-- meshterm/core/tracing.py | 81 +++++++++++++++ meshterm/core/watch_store.py | 5 +- meshterm/persistence/logging.py | 21 +++- meshterm/services/__init__.py | 7 +- meshterm/services/basemap.py | 8 ++ meshterm/services/device_state.py | 41 ++++++-- meshterm/services/event_hub.py | 2 +- meshterm/services/markers.py | 136 ++++++++++++++++++++++++ meshterm/services/records.py | 4 +- meshterm/services/topology.py | 11 +- meshterm/services/trace_runner.py | 94 +++-------------- meshterm/tools/base.py | 3 +- meshterm/tools/channels.py | 7 +- meshterm/tools/chat.py | 11 +- meshterm/tools/contacts.py | 4 +- meshterm/tools/map.py | 130 +---------------------- meshterm/tools/trace.py | 15 +-- meshterm/tools/tx_optimize.py | 14 ++- meshterm/ui/__init__.py | 2 +- meshterm/ui/channels.py | 149 +-------------------------- meshterm/ui/chat.py | 54 +++++----- meshterm/ui/config_editor.py | 4 +- meshterm/ui/contactlist.py | 4 +- meshterm/ui/contacts_screen.py | 4 +- meshterm/ui/courier_screen.py | 8 +- meshterm/ui/livefeed_screen.py | 3 +- meshterm/ui/map_render.py | 36 +------ meshterm/ui/map_screen.py | 15 +-- meshterm/ui/menus.py | 10 ++ meshterm/ui/minimap.py | 8 +- meshterm/ui/node_detail_screen.py | 31 ++---- meshterm/ui/packet_viewer.py | 6 +- meshterm/ui/path_composer.py | 8 +- meshterm/ui/pathgraph.py | 13 +-- meshterm/ui/purge_screen.py | 4 +- meshterm/ui/records_screen.py | 4 +- meshterm/ui/remote_cli.py | 12 +-- meshterm/ui/repeater_admin.py | 4 +- meshterm/ui/timemachine_screen.py | 18 +--- meshterm/ui/trace_screen.py | 22 ++-- meshterm/ui/tui/prompt.py | 12 +-- meshterm/ui/tui/select.py | 14 +-- meshterm/ui/tx_screen.py | 4 +- meshterm/ui/walk_screen.py | 17 ++- meshterm/ui/widgets.py | 43 ++++---- tests/test_admin_login.py | 25 +++-- tests/test_channel_store.py | 3 +- tests/test_channels.py | 11 +- tests/test_chat.py | 12 +-- tests/test_cli_contract.py | 80 +++++++++++++-- tests/test_config_editor.py | 7 +- tests/test_gallery.py | 6 +- tests/test_map.py | 20 ++-- tests/test_navigation.py | 4 + tests/test_node_detail.py | 4 +- tests/test_theme16.py | 3 +- tests/test_tui.py | 22 ++-- 69 files changed, 924 insertions(+), 712 deletions(-) create mode 100644 meshterm/core/channel_probe.py create mode 100644 meshterm/core/tracing.py create mode 100644 meshterm/services/markers.py diff --git a/.claude/skills/release/SKILL.md b/.claude/skills/release/SKILL.md index 74733e1..f583bfa 100644 --- a/.claude/skills/release/SKILL.md +++ b/.claude/skills/release/SKILL.md @@ -96,6 +96,24 @@ version is written**. `[project] version` in `pyproject.toml` is `dynamic` and h reads the attribute, so the number in a built wheel cannot drift from the number in the source. Do not add a second one. +### Then re-point the README's download commands + +`installers.yml` names each asset `meshterm-${version}-