Mesh walk: the atlas is a walk, everywhere it's named
"Atlas" named a book of maps — a thing you leaf through — and this screen has never been that. It holds one node in focus, fans its neighbourhood, and moves when you press Enter. The trail across the top is a walk, the list heading says Enter walks, the tests call the helper walk_to. Only the name disagreed. So the name goes: the tool is `walk` / "Mesh walk", the screen is WalkScreen in ui/walk_screen.py behind open_walk, and every prose mention follows — the README feature table, the node-vs-contact boundary in CLAUDE.md, the windowed-list pattern note that cites this screen as its origin, pathline's separator example, topology's whole-graph view and its prefix-coalescing rationale, and the purge-test-data skill that warns about fake nodes showing up here. No behaviour moves. The tool keeps its 🌐 icon, its Mesh category and its order beside Map — the logical shape next to the geographic one. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
b76f50d6f4
commit
722c8f0e4f
15 files changed
+85
-85
No files matched your search
@@ -1,6 +1,6 @@
|
||||
---
|
||||
name: purge-test-data
|
||||
description: Purge simulator/mock node pollution from the default MeshTerm database. Run after any --mock CLI session or simulator test drive, and whenever fake nodes (Alice, Yagi-Repeater, hub-1, hopN hashes, a1b2c3d4… keys) show up in the atlas, dashboard, or trace history.
|
||||
description: Purge simulator/mock node pollution from the default MeshTerm database. Run after any --mock CLI session or simulator test drive, and whenever fake nodes (Alice, Yagi-Repeater, hub-1, hopN hashes, a1b2c3d4… keys) show up in the mesh walk, dashboard, or trace history.
|
||||
model: haiku
|
||||
---
|
||||
|
||||
@@ -8,7 +8,7 @@ model: haiku
|
||||
|
||||
`meshterm --mock` and simulator test drives write to the **real** default
|
||||
database (`~/.meshterm/meshterm.db`), polluting the history that feeds the
|
||||
atlas, dashboard, and trace suggestions. This skill removes exactly the rows
|
||||
mesh walk, dashboard, and trace suggestions. This skill removes exactly the rows
|
||||
carrying the simulator's fingerprints and nothing else.
|
||||
|
||||
## Run
|
||||
@@ -47,5 +47,5 @@ stray narrow mock hop left behind is better than a purged real row.
|
||||
|
||||
After **any** work that launched `meshterm --mock` (the verify skill's first
|
||||
stop) or exercised `MockDevice` against the default database. Do it in the
|
||||
same session, before handing back to the user — fake nodes in the atlas on
|
||||
same session, before handing back to the user — fake nodes in the mesh walk on
|
||||
real hardware are exactly what this prevents.
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
``meshterm --mock`` (and headless test drives against the simulator) write to the
|
||||
same ``~/.meshterm/meshterm.db`` as real radio sessions, so mock nodes leak into
|
||||
the history that powers the atlas, the dashboard, and the trace suggestions. This
|
||||
the history that powers the mesh walk, the dashboard, and the trace suggestions. This
|
||||
script removes exactly the rows carrying the simulator's fingerprints — the
|
||||
:class:`MockDevice` identities in ``meshterm/core/connection.py`` — and nothing
|
||||
else. Real rows never match: the fingerprints are fixed synthetic keys, the
|
||||
|
||||
@@ -43,7 +43,7 @@ them instead of hand-rolling:
|
||||
| Quit | leave the app (main menu, device splash) — nowhere else |
|
||||
|
||||
Node vs contact — the boundary: **node** is the hardware/participant sense — the map,
|
||||
atlas, heard-nodes, relay hops, graph vertices, and node *types* (client/repeater/room/
|
||||
mesh walk, heard-nodes, relay hops, graph vertices, and node *types* (client/repeater/room/
|
||||
sensor) all speak "node". **Contact** is the saved-identity sense — the Contacts screen,
|
||||
the courier recipient, anything you *address*. The reception/persistence layer
|
||||
(`observations.node`, `HeardNode`, `heard_nodes()`, `trace_hops.node`) stays "node"; the
|
||||
|
||||
@@ -89,7 +89,7 @@ with its scripted equivalent, where one exists.
|
||||
| **📊 Dashboard** | The live mesh overview: a two-hour all-packet activity chart with a pulse line, session traffic tallies by packet class, and window RF health beside the radio's own live numbers. Repaints every second. | — |
|
||||
| **📡 Live feed** | Every packet as it arrives, newest first: time, what the frame *is* (its parsed payload class), and what it is *about* — the node for an advert, the channel for a channel text, sender → recipient for a direct message or a request, the tag for a trace — with reception quality beside it. Enter opens any row in the packet viewer, route graph and all. | — |
|
||||
| **🌍 Map** | Located nodes plotted over a real OpenStreetMap street basemap rendered as Unicode braille (streets, rivers, place names). Pannable and zoomable; repeaters highlighted and drawn on top. Falls back to a blank grid offline. | `meshterm map` (one-shot render) |
|
||||
| **🌐 Mesh atlas** | The mesh's *observed shape*, walked one node at a time: an evidence graph built from trace walks, firmware routes, overheard relay chains, and repeater neighbour tables. SNR-coloured braille edges, quality bars, Enter to walk, ⌫ to backtrack, type to find any node. The map answers *where*; the atlas answers *how it hangs together*. | — |
|
||||
| **🌐 Mesh walk** | The mesh's *observed shape*, walked one node at a time: an evidence graph built from trace walks, firmware routes, overheard relay chains, and repeater neighbour tables. SNR-coloured braille edges, quality bars, Enter to walk, ⌫ to backtrack, type to find any node. The map answers *where*; the walk answers *how it hangs together*. | — |
|
||||
| **🚨 Watchtower** | A passive sentinel over the nodes you star: silence alarms when a watched node goes quiet, SNR-sag warnings when reception degrades, recovery notes when it returns, and a heads-up when a never-before-seen node appears. Runs in the background all session; unacked alerts show as a header badge. | — |
|
||||
| **📡 Send advert** | Announce this node to the mesh — a zero-hop or flood advertisement, or share this node's contact card as a QR code. | `meshterm config advert` / `config share` |
|
||||
|
||||
|
||||
@@ -375,7 +375,7 @@ class MeshTopology:
|
||||
only when the prefix names *exactly one* contact — but the mesh holds two nodes
|
||||
whose keys both open ``27`` (``27d4…`` and ``27e4…``), so the bare ``27`` hop
|
||||
stays short and stands beside the wide ``27d4396a2967`` as a phantom second node.
|
||||
Left alone that doubles the node on every surface the graph feeds — the atlas
|
||||
Left alone that doubles the node on every surface the graph feeds — the mesh walk
|
||||
draws it twice, the route graph fans two lanes to one repeater, and the scenario
|
||||
ranker offers a redundant weaker route through the stub.
|
||||
|
||||
@@ -469,7 +469,7 @@ class MeshTopology:
|
||||
def links(self) -> list[Link]:
|
||||
"""Every link the graph holds evidence for (no particular order).
|
||||
|
||||
The whole-graph view the Mesh Atlas draws; path queries should prefer
|
||||
The whole-graph view the Mesh walk draws; path queries should prefer
|
||||
:meth:`next_hops` / :meth:`scenarios`, which rank and filter.
|
||||
"""
|
||||
return list(self._links.values())
|
||||
|
||||
@@ -151,7 +151,7 @@ _REGISTRY: dict[str, Tool] = {}
|
||||
|
||||
#: Explicit menu ordering for tool categories. Messaging leads because it holds the
|
||||
#: first-class, everyday features (chat, channels, the courier); Mesh follows with
|
||||
#: the views over the mesh itself (dashboard, nodes, map, atlas, watchtower,
|
||||
#: the views over the mesh itself (dashboard, nodes, map, walk, watchtower,
|
||||
#: adverts); the rest in a natural workflow order. Categories not listed here sort
|
||||
#: last, alphabetically, so a new category still appears.
|
||||
_CATEGORY_ORDER = ["Messaging", "Mesh", "Device management", "Tools"]
|
||||
|
||||
@@ -39,7 +39,7 @@ class TrophyCaseTool(Tool):
|
||||
"""Open the browser; returning ``None`` completes the invocation with no run row.
|
||||
|
||||
The screen reads stored records and transmits nothing (and logs no rows of its
|
||||
own), so it lives in :meth:`prompt_params` and needs no logged run — the atlas /
|
||||
own), so it lives in :meth:`prompt_params` and needs no logged run — the mesh walk /
|
||||
dashboard pattern.
|
||||
|
||||
Args:
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
"""The ``atlas`` tool: the mesh's observed shape, explored one node at a time.
|
||||
"""The ``walk`` tool: the mesh's observed shape, explored one node at a time.
|
||||
|
||||
Opens the full-screen Mesh atlas (see :mod:`meshterm.ui.atlas_screen`): a walkable
|
||||
Opens the full-screen Mesh walk (see :mod:`meshterm.ui.walk_screen`): a walkable
|
||||
browser over the evidence graph — trace walks, firmware routes, overheard relay
|
||||
chains, repeater neighbour tables. One node holds the focus, its neighbourhood draws
|
||||
as SNR-coloured braille edges on a small clean canvas, and its links list beneath as
|
||||
rows with quality bars and evidence; Enter walks the graph, ⌫ backtracks along the
|
||||
breadcrumb trail, and typing finds any node (islands included). The geographic map
|
||||
answers *where* the mesh is; the atlas answers *how it hangs together*.
|
||||
answers *where* the mesh is; the walk answers *how it hangs together*.
|
||||
|
||||
Menu-only: the atlas is an interactive reading of stored evidence (and transmits
|
||||
Menu-only: the walk is an interactive reading of stored evidence (and transmits
|
||||
nothing), so there is no scripted one-shot to register — ``trace``-family commands
|
||||
already print path evidence in scripted runs.
|
||||
"""
|
||||
@@ -24,11 +24,11 @@ from .base import Tool, ToolResult, register
|
||||
|
||||
|
||||
@register
|
||||
class AtlasTool(Tool):
|
||||
class WalkTool(Tool):
|
||||
"""See how the mesh hangs together: the observed link graph, walkable."""
|
||||
|
||||
name = "atlas"
|
||||
title = "Mesh atlas"
|
||||
name = "walk"
|
||||
title = "Mesh walk"
|
||||
# A single-codepoint emoji (like every other tool icon), not a VS16 sequence: the
|
||||
# emoji-width calibration strips VS16 on terminals that render it narrow, which would
|
||||
# measure a 🕸️ one cell short of how it paints and drift this row's help text right of
|
||||
@@ -40,7 +40,7 @@ class AtlasTool(Tool):
|
||||
order = 32 # beside Map: the logical shape next to the geographic one
|
||||
|
||||
async def prompt_params(self, ctx: AppContext) -> Optional[dict[str, Any]]:
|
||||
"""Run the atlas; there are never parameters to collect.
|
||||
"""Run the walk; there are never parameters to collect.
|
||||
|
||||
The screen presents everything itself and returns when dismissed, so
|
||||
returning ``None`` tells the menu the invocation is complete (the same
|
||||
@@ -52,13 +52,13 @@ class AtlasTool(Tool):
|
||||
Returns:
|
||||
Always ``None``.
|
||||
"""
|
||||
from ..ui.atlas_screen import open_atlas
|
||||
from ..ui.walk_screen import open_walk
|
||||
|
||||
await open_atlas(ctx)
|
||||
await open_walk(ctx)
|
||||
return None
|
||||
|
||||
async def run(self, ctx: AppContext, params: dict[str, Any]) -> ToolResult:
|
||||
"""Nothing runs here: the atlas lives inside :meth:`prompt_params`.
|
||||
"""Nothing runs here: the walk lives inside :meth:`prompt_params`.
|
||||
|
||||
Args:
|
||||
ctx: Shared application context.
|
||||
@@ -70,7 +70,7 @@ class AtlasTool(Tool):
|
||||
return ToolResult(summary={})
|
||||
|
||||
def register_cli(self, app: typer.Typer) -> None:
|
||||
"""Register no CLI command — the atlas is an interactive, menu-only screen.
|
||||
"""Register no CLI command — the walk is an interactive, menu-only screen.
|
||||
|
||||
Args:
|
||||
app: The Typer application (untouched).
|
||||
@@ -101,7 +101,7 @@ from .widgets import (
|
||||
if TYPE_CHECKING: # pragma: no cover - typing only
|
||||
from ..context import AppContext
|
||||
|
||||
#: Our own node's marker glyph and hue, matching the map/atlas star.
|
||||
#: Our own node's marker glyph and hue, matching the map/mesh-walk star.
|
||||
_SELF_GLYPH = ("★", "#facc15")
|
||||
|
||||
#: The inline location preview's row bounds: it grows into whatever the Info tab's
|
||||
|
||||
@@ -188,7 +188,7 @@ class PathLine:
|
||||
mode: ``"auto"`` (powerline when the terminal can draw it — the default),
|
||||
``"powerline"``, or ``"plain"``.
|
||||
separator: The plain-mode joiner. Defaults to the app-wide ``" → "``; a
|
||||
surface with its own convention (the atlas trail's ``" › "``) may pass
|
||||
surface with its own convention (the mesh walk trail's ``" › "``) may pass
|
||||
it. Ignored by powerline mode.
|
||||
empty: The muted text a hopless path reads as (``"direct"``).
|
||||
"""
|
||||
|
||||
@@ -272,7 +272,7 @@ class Screen:
|
||||
class ListWindow:
|
||||
"""Scroll state for a list that scrolls *inside* a fixed screen.
|
||||
|
||||
The app-wide windowed-list pattern (established by the atlas's link list): the
|
||||
The app-wide windowed-list pattern (established by the mesh walk's link list): the
|
||||
screen sizes its fixed chrome — headings, charts, action rows — to the frame's
|
||||
viewport (see :meth:`Screen.note_viewport`; the frame records it before
|
||||
``render_body`` runs) and hands the leftover rows here; only the list's rows
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
"""The Mesh atlas: walk the mesh's observed shape one node at a time.
|
||||
"""The Mesh walk: walk the mesh's observed shape one node at a time.
|
||||
|
||||
The interactive face of the ``atlas`` tool. The trace path composer already distills
|
||||
The interactive face of the ``walk`` tool. The trace path composer already distills
|
||||
every fragment of topology we ever received — trace walks, firmware routes, RX-logged
|
||||
relay chains, repeater neighbour tables — into one evidence graph
|
||||
(:mod:`~meshterm.services.topology`); this screen is that graph made explorable. Nothing
|
||||
here transmits: the atlas is a reading of what the radio has already heard.
|
||||
here transmits: the walk is a reading of what the radio has already heard.
|
||||
|
||||
Rather than plotting the whole mesh at once (which reads as a hairball the moment the
|
||||
graph grows), the atlas keeps one node *in focus* — our own, to begin with — and shows
|
||||
graph grows), the walk keeps one node *in focus* — our own, to begin with — and shows
|
||||
only its immediate neighbourhood:
|
||||
|
||||
* the **canvas** — the majority of the screen, so the shape stays legible — anchors the
|
||||
@@ -78,7 +78,7 @@ if TYPE_CHECKING:
|
||||
|
||||
#: Horizontal / vertical dot-space margins the neighbour fan keeps clear of the canvas
|
||||
#: edge. The east margin holds a fan node's rightward label (see
|
||||
#: :meth:`AtlasScreen._label_right`); it is deliberately roomy — pulling the whole fan a
|
||||
#: :meth:`WalkScreen._label_right`); it is deliberately roomy — pulling the whole fan a
|
||||
#: little west of the edge — so even the tightest (due-east) marker has cells to name
|
||||
#: itself in full rather than clipping a long contact name, which the labels' room-to-edge
|
||||
#: clamp then spends wherever the fan leaves it.
|
||||
@@ -136,14 +136,14 @@ _MORE = "\x00more"
|
||||
_MAX_MATCHES = 10
|
||||
|
||||
#: The narrowest the neighbour/match list's name lane shrinks to. The lane is content-sized
|
||||
#: and flexes up to whatever the fixed lanes leave (see :meth:`AtlasScreen._lane_widths`),
|
||||
#: and flexes up to whatever the fixed lanes leave (see :meth:`WalkScreen._lane_widths`),
|
||||
#: so as much of a long name shows as the row can spare.
|
||||
_LIST_NAME_MIN = 10
|
||||
|
||||
#: The *widest* the key lane spans — the whole 12-hex canonical id, addressed prefix lit in
|
||||
#: the node's hue (see :func:`highlighted_hash`). The lane flexes down from here on a byte
|
||||
#: boundary to hand a long name more room, but never below its lit hash (see
|
||||
#: :meth:`AtlasScreen._lane_widths`): the name loses letters before the hash does.
|
||||
#: :meth:`WalkScreen._lane_widths`): the name loses letters before the hash does.
|
||||
_LIST_HASH_W = 12
|
||||
|
||||
#: Cells a link row spends *outside* its two flexing lanes (name and key), so those two can
|
||||
@@ -205,8 +205,8 @@ def _freshness(last_seen: Optional[datetime], now: datetime) -> float:
|
||||
return 0.5
|
||||
|
||||
|
||||
class AtlasScreen(Screen):
|
||||
"""The full-screen atlas walker: a focus neighbourhood canvas over a link list."""
|
||||
class WalkScreen(Screen):
|
||||
"""The full-screen mesh walker: a focus neighbourhood canvas over a link list."""
|
||||
|
||||
floating = False
|
||||
|
||||
@@ -219,7 +219,7 @@ class AtlasScreen(Screen):
|
||||
self_label: str,
|
||||
prefix_bytes: int = 0,
|
||||
) -> None:
|
||||
"""Create the atlas over a built topology snapshot.
|
||||
"""Create the walk over a built topology snapshot.
|
||||
|
||||
Args:
|
||||
session: The running TUI session (repaints).
|
||||
@@ -447,8 +447,8 @@ class AtlasScreen(Screen):
|
||||
return max(4, height)
|
||||
|
||||
def _compose_title(self, links: list[Link]) -> str:
|
||||
"""``Mesh atlas — focus`` plus the graph's status atoms."""
|
||||
title = f"Mesh atlas — {self._label(self._focus)}"
|
||||
"""``Mesh walk — focus`` plus the graph's status atoms."""
|
||||
title = f"Mesh walk — {self._label(self._focus)}"
|
||||
title += f" · {len(self._all_nodes())} nodes · {len(links)} links"
|
||||
if self._filter:
|
||||
matches = self._matches()
|
||||
@@ -1002,7 +1002,7 @@ class AtlasScreen(Screen):
|
||||
def _marker_rgb(self, node: str) -> RGB:
|
||||
"""The marker colour for a node: its key-derived hue, ours white, a keyless id grey.
|
||||
|
||||
The atlas colours every marker by *identity* — the app-wide per-node hue
|
||||
The walk colours every marker by *identity* — the app-wide per-node hue
|
||||
(:func:`~meshterm.ui.theme.node_style`, keyed on the node's own key) — rather than
|
||||
by node *type*; the glyph *shape* (see :meth:`_glyph`) is what carries the type. Our
|
||||
own node keeps the pure-white ``you`` convention, and a non-hex placeholder id (our
|
||||
@@ -1049,7 +1049,7 @@ class AtlasScreen(Screen):
|
||||
"""A friendly explanation while the evidence graph is still empty."""
|
||||
lines = [
|
||||
Text(),
|
||||
Text("The atlas has no evidence to draw yet.", style="accent"),
|
||||
Text("This walk has no evidence to draw yet.", style="accent"),
|
||||
Text(),
|
||||
Text("Topology accrues passively as the mesh talks:", style="muted"),
|
||||
Text(" · every successful trace maps each link it walked", style="muted"),
|
||||
@@ -1078,8 +1078,8 @@ class AtlasScreen(Screen):
|
||||
return self._topo.display_name(node) or node[:8]
|
||||
|
||||
|
||||
async def open_atlas(ctx: "AppContext") -> None:
|
||||
"""Build the evidence graph and run the full-screen atlas until dismissed.
|
||||
async def open_walk(ctx: "AppContext") -> None:
|
||||
"""Build the evidence graph and run the full-screen mesh walk until dismissed.
|
||||
|
||||
Contacts and our own identity come from the device when one is reachable
|
||||
(best-effort — the stored evidence draws fine without them, just with hashes for
|
||||
@@ -1097,7 +1097,7 @@ async def open_atlas(ctx: "AppContext") -> None:
|
||||
from .timemachine_screen import _routing_prefix_bytes
|
||||
|
||||
if not isinstance(ctx.ui, TuiUi): # pragma: no cover - guarded by the menu-only caller
|
||||
raise RuntimeError("the atlas is only available in the menu")
|
||||
raise RuntimeError("the mesh walk is only available in the menu")
|
||||
session = ctx.ui.session
|
||||
|
||||
contacts: list[Contact] = []
|
||||
@@ -1126,7 +1126,7 @@ async def open_atlas(ctx: "AppContext") -> None:
|
||||
if canonical:
|
||||
by_id[canonical] = contact
|
||||
|
||||
screen = AtlasScreen(
|
||||
screen = WalkScreen(
|
||||
session=session,
|
||||
topo=topo,
|
||||
contacts=by_id,
|
||||
@@ -1,6 +1,6 @@
|
||||
"""Message-paths dialog tests: the graph-over-rows view behind the chat's ^P.
|
||||
|
||||
Driven headless like the atlas tests: render_body is pure lines-out, handle() pure
|
||||
Driven headless like the mesh walk tests: render_body is pure lines-out, handle() pure
|
||||
state, so the selection cursor, the horizontal line scroll, and the selected-path
|
||||
labelling are all assertable without a terminal.
|
||||
"""
|
||||
|
||||
@@ -61,7 +61,7 @@ def test_plain_mode_matches_the_app_wide_arrow_presentation() -> None:
|
||||
|
||||
def test_plain_mode_annotation_dim_and_custom_separator() -> None:
|
||||
"""The trace ``(3d)`` note rides muted; a dim hop (and the arrow into it) fades;
|
||||
a surface's own separator — the atlas trail's ``›`` — passes straight through."""
|
||||
a surface's own separator — the mesh walk trail's ``›`` — passes straight through."""
|
||||
line = PathLine(
|
||||
[PathHop("YUL", key="3d", annotation="3d"), PathHop("home", you=True, dim=True)],
|
||||
mode="plain",
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
"""Mesh atlas tests: the focus-and-walk browser over a hand-built topology.
|
||||
"""Mesh walk tests: the focus-and-walk browser over a hand-built topology.
|
||||
|
||||
The screen is driven headless against a fake session, the same approach as the
|
||||
dashboard tests: render_body is pure lines-out, handle() is pure state, so walking,
|
||||
@@ -12,7 +12,7 @@ from datetime import timedelta
|
||||
|
||||
from meshterm.core.models import Contact, utcnow
|
||||
from meshterm.services.topology import MeshTopology
|
||||
from meshterm.ui.atlas_screen import AtlasScreen
|
||||
from meshterm.ui.walk_screen import WalkScreen
|
||||
|
||||
US = "aa" * 6
|
||||
YUL = Contact(name="YUL-Cartierville", public_key="3d" * 32, node_type=2)
|
||||
@@ -40,8 +40,8 @@ def _topo(*, with_island: bool = False) -> MeshTopology:
|
||||
return topo
|
||||
|
||||
|
||||
def _screen(topo: MeshTopology, cell_h: int = 24) -> AtlasScreen:
|
||||
screen = AtlasScreen(
|
||||
def _screen(topo: MeshTopology, cell_h: int = 24) -> WalkScreen:
|
||||
screen = WalkScreen(
|
||||
session=_FakeSession(),
|
||||
topo=topo,
|
||||
contacts={
|
||||
@@ -61,7 +61,7 @@ def _plain(lines: list[str]) -> str:
|
||||
# --- rendering ----------------------------------------------------------------------------
|
||||
|
||||
|
||||
def test_atlas_opens_focused_on_us_with_the_link_list() -> None:
|
||||
def test_walk_opens_focused_on_us_with_the_link_list() -> None:
|
||||
"""The default focus is our own node: canvas, legend, and its links beneath."""
|
||||
screen = _screen(_topo())
|
||||
body = _plain(screen.render_body(80))
|
||||
@@ -69,10 +69,10 @@ def test_atlas_opens_focused_on_us_with_the_link_list() -> None:
|
||||
assert "Links" in body and "strongest observed first" in body
|
||||
assert "YUL-Cartierville" in body # our one neighbour, as a selectable row
|
||||
assert "edge = SNR" in body # the canvas legend
|
||||
assert screen.title == "Mesh atlas — Homestead · 3 nodes · 2 links"
|
||||
assert screen.title == "Mesh walk — Homestead · 3 nodes · 2 links"
|
||||
|
||||
|
||||
def test_atlas_link_rows_carry_snr_evidence_and_onward_count() -> None:
|
||||
def test_walk_link_rows_carry_snr_evidence_and_onward_count() -> None:
|
||||
"""A neighbour row reads SNR, samples, source tags, age, and its onward links."""
|
||||
screen = _screen(_topo())
|
||||
body = _plain(screen.render_body(80))
|
||||
@@ -85,7 +85,7 @@ def test_atlas_link_rows_carry_snr_evidence_and_onward_count() -> None:
|
||||
assert "…" not in row # …and nothing about it elided
|
||||
|
||||
|
||||
def test_atlas_link_row_shrinks_the_key_before_the_name() -> None:
|
||||
def test_walk_link_row_shrinks_the_key_before_the_name() -> None:
|
||||
"""A long name keeps its letters; the key gives ground first, on a byte boundary.
|
||||
|
||||
When the row can't hold both a long name and the full 12-hex id, the key truncates to
|
||||
@@ -98,7 +98,7 @@ def test_atlas_link_row_shrinks_the_key_before_the_name() -> None:
|
||||
topo = MeshTopology(US, contacts=[long_repeater])
|
||||
node = topo.canonical(long_repeater.public_key)
|
||||
topo.add_walk([topo.self_id, node], snrs=[4.0], when=utcnow(), source="trace")
|
||||
screen = AtlasScreen(
|
||||
screen = WalkScreen(
|
||||
session=_FakeSession(),
|
||||
topo=topo,
|
||||
contacts={node: long_repeater},
|
||||
@@ -116,7 +116,7 @@ def test_atlas_link_row_shrinks_the_key_before_the_name() -> None:
|
||||
assert "d4c3b2a1f0e9" not in row # …but not the whole id — it was truncated
|
||||
|
||||
|
||||
def test_atlas_graph_labels_names_in_full_when_the_canvas_has_room() -> None:
|
||||
def test_walk_graph_labels_names_in_full_when_the_canvas_has_room() -> None:
|
||||
"""A neighbour's name is drawn whole on the canvas, not clipped to a flat short cap.
|
||||
|
||||
The fan pulls west of the edge and each label clamps to the room actually there, so a
|
||||
@@ -131,7 +131,7 @@ def test_atlas_graph_labels_names_in_full_when_the_canvas_has_room() -> None:
|
||||
for c, snr in zip(long_names, (8.0, 1.0)):
|
||||
topo.add_walk([topo.self_id, topo.canonical(c.public_key)], snrs=[snr], when=when,
|
||||
source="trace")
|
||||
screen = AtlasScreen(
|
||||
screen = WalkScreen(
|
||||
session=_FakeSession(),
|
||||
topo=topo,
|
||||
contacts={topo.canonical(c.public_key): c for c in long_names},
|
||||
@@ -145,14 +145,14 @@ def test_atlas_graph_labels_names_in_full_when_the_canvas_has_room() -> None:
|
||||
assert "Repeater-Downtown-01" in canvas # 20 chars, whole
|
||||
|
||||
|
||||
def test_atlas_selected_link_lights_the_route_that_reaches_it() -> None:
|
||||
def test_walk_selected_link_lights_the_route_that_reaches_it() -> None:
|
||||
"""Selecting a link draws its edge *and* the approach into the focus at full strength.
|
||||
|
||||
With every link stale (so an un-highlighted edge fades to half), the selected
|
||||
neighbour's edge and the came_from → focus approach are drawn undimmed — the lit
|
||||
route — while an unselected neighbour's edge stays faded.
|
||||
"""
|
||||
from meshterm.ui.atlas_screen import _snr_rgb
|
||||
from meshterm.ui.walk_screen import _snr_rgb
|
||||
|
||||
stale = utcnow() - timedelta(days=10) # older than a week → _freshness 0.5
|
||||
yul = Contact(name="YUL", public_key="3d" * 32, node_type=2)
|
||||
@@ -163,7 +163,7 @@ def test_atlas_selected_link_lights_the_route_that_reaches_it() -> None:
|
||||
topo.add_walk([topo.self_id, y], snrs=[10.0], when=stale, source="trace") # approach: green
|
||||
topo.add_walk([y, topo.canonical(alice.public_key)], snrs=[0.0], when=stale, source="trace") # amber
|
||||
topo.add_walk([y, topo.canonical(bob.public_key)], snrs=[-15.0], when=stale, source="trace") # red
|
||||
screen = AtlasScreen(
|
||||
screen = WalkScreen(
|
||||
session=_FakeSession(),
|
||||
topo=topo,
|
||||
contacts={topo.canonical(c.public_key): c for c in (yul, alice, bob)},
|
||||
@@ -192,8 +192,8 @@ def test_atlas_selected_link_lights_the_route_that_reaches_it() -> None:
|
||||
assert code(_snr_rgb(-15.0)) not in canvas # …and never reaches full strength
|
||||
|
||||
|
||||
def test_atlas_empty_graph_renders_guidance() -> None:
|
||||
"""With no evidence at all the screen explains how the atlas fills up."""
|
||||
def test_walk_empty_graph_renders_guidance() -> None:
|
||||
"""With no evidence at all the screen explains how the walk fills up."""
|
||||
topo = MeshTopology(US, contacts=[])
|
||||
screen = _screen(topo)
|
||||
body = _plain(screen.render_body(80))
|
||||
@@ -204,7 +204,7 @@ def test_atlas_empty_graph_renders_guidance() -> None:
|
||||
# --- walking ------------------------------------------------------------------------------
|
||||
|
||||
|
||||
def test_atlas_enter_walks_and_grows_the_trail() -> None:
|
||||
def test_walk_enter_walks_and_grows_the_trail() -> None:
|
||||
"""Enter focuses the highlighted neighbour; the breadcrumb trail reads the walk."""
|
||||
topo = _topo()
|
||||
screen = _screen(topo)
|
||||
@@ -219,7 +219,7 @@ def test_atlas_enter_walks_and_grows_the_trail() -> None:
|
||||
assert "⌫ back" in body # the row leading home is marked
|
||||
|
||||
|
||||
def test_atlas_backspace_steps_back_along_the_trail() -> None:
|
||||
def test_walk_backspace_steps_back_along_the_trail() -> None:
|
||||
"""⌫ pops the trail one step; at the trail's start it does nothing."""
|
||||
topo = _topo()
|
||||
screen = _screen(topo)
|
||||
@@ -232,7 +232,7 @@ def test_atlas_backspace_steps_back_along_the_trail() -> None:
|
||||
assert screen._trail == [topo.self_id]
|
||||
|
||||
|
||||
def test_atlas_walking_into_the_back_node_pops_instead_of_growing() -> None:
|
||||
def test_walk_walking_into_the_back_node_pops_instead_of_growing() -> None:
|
||||
"""Enter on the trail-back row retraces rather than appending a ping-pong walk."""
|
||||
topo = _topo()
|
||||
screen = _screen(topo)
|
||||
@@ -244,7 +244,7 @@ def test_atlas_walking_into_the_back_node_pops_instead_of_growing() -> None:
|
||||
assert screen._trail == [topo.self_id] # popped, not [us, yul, us]
|
||||
|
||||
|
||||
def test_atlas_walking_to_an_earlier_node_drops_the_loop() -> None:
|
||||
def test_walk_walking_to_an_earlier_node_drops_the_loop() -> None:
|
||||
"""Revisiting a node already on the trail truncates the stack to its first appearance,
|
||||
dropping the circular stretch walked to get back there."""
|
||||
topo = MeshTopology(US, contacts=[YUL, ALICE])
|
||||
@@ -268,7 +268,7 @@ def test_atlas_walking_to_an_earlier_node_drops_the_loop() -> None:
|
||||
assert screen._trail == [topo.self_id, yul]
|
||||
|
||||
|
||||
def test_atlas_trail_drops_the_head_not_the_tail_when_narrow() -> None:
|
||||
def test_walk_trail_drops_the_head_not_the_tail_when_narrow() -> None:
|
||||
"""A trail too long for the line loses its head behind a leading ⋯, snapped right."""
|
||||
screen = _screen(_topo())
|
||||
us = screen._topo.self_id
|
||||
@@ -283,14 +283,14 @@ def test_atlas_trail_drops_the_head_not_the_tail_when_narrow() -> None:
|
||||
assert len(text) == width # the surviving tail snaps flush to the right edge
|
||||
|
||||
|
||||
def test_atlas_trail_sits_left_until_it_overflows() -> None:
|
||||
def test_walk_trail_sits_left_until_it_overflows() -> None:
|
||||
"""A trail that fits is left-aligned; only an elided one snaps to the right edge."""
|
||||
screen = _screen(_topo())
|
||||
screen._trail = [screen._topo.self_id]
|
||||
assert screen._trail_text(40).plain == "Homestead"
|
||||
|
||||
|
||||
def test_atlas_trail_names_carry_their_node_hues() -> None:
|
||||
def test_walk_trail_names_carry_their_node_hues() -> None:
|
||||
"""Trail names take the per-node key hue (ours the white you-style), the focus bold."""
|
||||
from meshterm.ui.theme import node_style
|
||||
|
||||
@@ -307,7 +307,7 @@ def test_atlas_trail_names_carry_their_node_hues() -> None:
|
||||
)
|
||||
|
||||
|
||||
def test_atlas_home_refocuses_us() -> None:
|
||||
def test_walk_home_refocuses_us() -> None:
|
||||
"""Home resets the walk to our own node from anywhere."""
|
||||
topo = _topo()
|
||||
screen = _screen(topo)
|
||||
@@ -317,7 +317,7 @@ def test_atlas_home_refocuses_us() -> None:
|
||||
assert screen._trail == [topo.self_id]
|
||||
|
||||
|
||||
def test_atlas_came_from_anchors_west_and_the_fan_stays_east() -> None:
|
||||
def test_walk_came_from_anchors_west_and_the_fan_stays_east() -> None:
|
||||
"""The trail-back node sits at the far west; every fan node east of the focus."""
|
||||
topo = _topo()
|
||||
screen = _screen(topo)
|
||||
@@ -332,7 +332,7 @@ def test_atlas_came_from_anchors_west_and_the_fan_stays_east() -> None:
|
||||
assert fx <= (80 * 2) // 3 # and the focus itself leans left
|
||||
|
||||
|
||||
def test_atlas_fan_rim_leaves_spread_east_not_curling_back() -> None:
|
||||
def test_walk_fan_rim_leaves_spread_east_not_curling_back() -> None:
|
||||
"""The fan is a flattened arc: the top/bottom leaves reach well east too.
|
||||
|
||||
On the old circular arc only the due-east leaf reached the far side; the rim leaves
|
||||
@@ -365,9 +365,9 @@ def _hub_topo(spokes: int) -> MeshTopology:
|
||||
return topo
|
||||
|
||||
|
||||
def test_atlas_collapses_the_weak_links_into_one_ellipsis_marker() -> None:
|
||||
def test_walk_collapses_the_weak_links_into_one_ellipsis_marker() -> None:
|
||||
"""Beyond the area's capacity, weaker neighbours fold into a single ``…`` node."""
|
||||
screen = AtlasScreen(
|
||||
screen = WalkScreen(
|
||||
session=_FakeSession(), topo=_hub_topo(14), contacts={}, self_label="us"
|
||||
)
|
||||
screen.note_viewport(20)
|
||||
@@ -379,9 +379,9 @@ def test_atlas_collapses_the_weak_links_into_one_ellipsis_marker() -> None:
|
||||
assert len(screen._rows()) == 14
|
||||
|
||||
|
||||
def test_atlas_fan_stays_sparse_and_collapses_the_rest() -> None:
|
||||
def test_walk_fan_stays_sparse_and_collapses_the_rest() -> None:
|
||||
"""The fan is kept deliberately sparse: even a modest hub sheds its weakest links."""
|
||||
screen = AtlasScreen(
|
||||
screen = WalkScreen(
|
||||
session=_FakeSession(), topo=_hub_topo(8), contacts={}, self_label="us"
|
||||
)
|
||||
screen.note_viewport(20)
|
||||
@@ -389,7 +389,7 @@ def test_atlas_fan_stays_sparse_and_collapses_the_rest() -> None:
|
||||
assert "…" in canvas_part and "weaker" in canvas_part # not all eight are drawn
|
||||
|
||||
|
||||
def test_atlas_labels_non_selected_nodes_to_the_right_of_their_icon() -> None:
|
||||
def test_walk_labels_non_selected_nodes_to_the_right_of_their_icon() -> None:
|
||||
"""A fan node is named just to the right of its marker — the walk's reading way."""
|
||||
from meshterm.ui.mapcanvas import MapCanvas
|
||||
|
||||
@@ -402,9 +402,9 @@ def test_atlas_labels_non_selected_nodes_to_the_right_of_their_icon() -> None:
|
||||
assert all(cx > marker_cx for cx, _cy in canvas._label_cells) # every cell east
|
||||
|
||||
|
||||
def test_atlas_selecting_a_collapsed_row_lights_the_ellipsis_with_its_name() -> None:
|
||||
def test_walk_selecting_a_collapsed_row_lights_the_ellipsis_with_its_name() -> None:
|
||||
"""Highlighting a weak (collapsed) row surfaces its name at the ``…`` marker."""
|
||||
screen = AtlasScreen(
|
||||
screen = WalkScreen(
|
||||
session=_FakeSession(), topo=_hub_topo(14), contacts={}, self_label="us"
|
||||
)
|
||||
screen.note_viewport(20)
|
||||
@@ -417,9 +417,9 @@ def test_atlas_selecting_a_collapsed_row_lights_the_ellipsis_with_its_name() ->
|
||||
assert "weaker" not in canvas_part # ...replacing the "+n weaker" count
|
||||
|
||||
|
||||
def test_atlas_body_fits_the_viewport_and_windows_the_list() -> None:
|
||||
def test_walk_body_fits_the_viewport_and_windows_the_list() -> None:
|
||||
"""The screen never outgrows the frame; only the link list scrolls, marked."""
|
||||
screen = AtlasScreen(
|
||||
screen = WalkScreen(
|
||||
session=_FakeSession(), topo=_hub_topo(16), contacts={}, self_label="us"
|
||||
)
|
||||
screen.note_viewport(22)
|
||||
@@ -430,9 +430,9 @@ def test_atlas_body_fits_the_viewport_and_windows_the_list() -> None:
|
||||
assert "Links" in body
|
||||
|
||||
|
||||
def test_atlas_pgdn_pages_the_highlight_by_the_list_window() -> None:
|
||||
def test_walk_pgdn_pages_the_highlight_by_the_list_window() -> None:
|
||||
"""PgUp/PgDn stride by the list window, and the window follows the highlight."""
|
||||
screen = AtlasScreen(
|
||||
screen = WalkScreen(
|
||||
session=_FakeSession(), topo=_hub_topo(16), contacts={}, self_label="us"
|
||||
)
|
||||
screen.note_viewport(22)
|
||||
@@ -451,7 +451,7 @@ def test_atlas_pgdn_pages_the_highlight_by_the_list_window() -> None:
|
||||
# --- find ---------------------------------------------------------------------------------
|
||||
|
||||
|
||||
def test_atlas_find_lists_matches_and_teleports() -> None:
|
||||
def test_walk_find_lists_matches_and_teleports() -> None:
|
||||
"""Typing filters every known node; Enter focuses the match and restarts the trail."""
|
||||
topo = _topo()
|
||||
screen = _screen(topo)
|
||||
@@ -471,7 +471,7 @@ def test_atlas_find_lists_matches_and_teleports() -> None:
|
||||
assert screen._filter == ""
|
||||
|
||||
|
||||
def test_atlas_find_marks_islands() -> None:
|
||||
def test_walk_find_marks_islands() -> None:
|
||||
"""A match with no path to us reads island, and focusing it says why."""
|
||||
screen = _screen(_topo(with_island=True))
|
||||
screen.render_body(80)
|
||||
@@ -484,7 +484,7 @@ def test_atlas_find_marks_islands() -> None:
|
||||
assert "island — no observed path to you" in body
|
||||
|
||||
|
||||
def test_atlas_esc_peels_find_then_dismisses() -> None:
|
||||
def test_walk_esc_peels_find_then_dismisses() -> None:
|
||||
"""Esc clears an active find first; the next Esc leaves the screen."""
|
||||
import asyncio
|
||||
|
||||
Reference in new issue
Block a user