"Sync their clocks…" covers every managed repeater and room

The bulk row now shows whenever the page has a managed repeater or room
server, and it syncs each one whatever its offset: a repeater with no
battery restarts from its build date at each power cycle, and the page
only learns that at its next advert. Managed companions still have no
clock sync command, so they are never included.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
This commit is contained in:
Jean-Pierre MartineauandClaude Haiku 5.5 committed 2026-11-03 02:12:35 -05:00
1 parent 5d20fe49b5
commit e00931bb18
4 files changed
+23 -20

No files matched your search

+1 -1
View File
@@ -28,7 +28,7 @@ This page lists each interactive screen with its scripted equivalent, where one
| **📊 Dashboard** | The live overview of the mesh. It has a two-hour chart of the activity of all packets with a pulse line, the traffic counts of the session for each packet class, and window RF health next to the live numbers of the radio. The screen updates each second. | none |
| **📰 Live feed** | Each packet as it arrives, newest first. A row shows the time, the type of the packet (its parsed payload class), and what the packet is about. For an advert, that is the node. For a channel text, it is the channel. For a direct message or a request, it is sender → recipient. For a trace, it is the tag. The row also shows the reception quality and, for a scoped flood, the region of the flood. Press Enter to open a row in the packet viewer, with its route graph. | none |
| **🚨 Watchtower** | A passive watcher of the nodes that you star. It gives a silence alarm when a watched node goes quiet. It warns you when the SNR of a node gets worse, and it tells you when the node returns. It also tells you when a node is heard for the first time. It runs in the background during the whole session. Alerts that you did not acknowledge show as a badge in the header. | none |
| **🕒 Clock drift** | How far the clock of each node is from yours. A node with a wrong clock puts wrong times on what it sends, and only its owner can set it. The page starts with a histogram of all the offsets, from the clocks behind yours, through the clocks in sync, to the clocks ahead. Then it lists your managed nodes (the nodes whose admin password MeshTerm stores), each one always, because you can set these clocks yourself. When a managed repeater or room server is out of sync, `Sync their clocks…` sets each of them in turn, with a pause between them. Then each other node whose clock is out of sync, the largest offset first. Press Enter to open the node page. In a chat, a message from a wrong clock shows the time when it arrived, with a `?` mark. | `meshterm clocks` |
| **🕒 Clock drift** | How far the clock of each node is from yours. A node with a wrong clock puts wrong times on what it sends, and only its owner can set it. The page starts with a histogram of all the offsets, from the clocks behind yours, through the clocks in sync, to the clocks ahead. Then it lists your managed nodes (the nodes whose admin password MeshTerm stores), each one always, because you can set these clocks yourself. `Sync their clocks…` sets the clock of each managed repeater and room server in turn, with a pause between them, also when its clock looks correct: a repeater with no battery loses its time at each power cycle. Then each other node whose clock is out of sync, the largest offset first. Press Enter to open the node page. In a chat, a message from a wrong clock shows the time when it arrived, with a `?` mark. | `meshterm clocks` |
| **⏳ Time machine** | Everything that the recorder ever heard, as braille charts: reception volume, the median-SNR band, the rhythm of the hours of the day, packets and nodes for each day, and first-ever arrivals. You can switch the time window between 24h, 7d, 30d, and all time. On the PicoCalc, the windows stop at 30d. You can look at one node or at the whole mesh. | none |
| **🎧 Monitor** | The app always records passively. On the command line, this command captures a window of a fixed length in the foreground. It shows each overheard packet as it arrives, and it gives a summary at the end. It transmits nothing. It only listens. | `meshterm monitor --seconds 60` |
+1 -1
View File
@@ -187,7 +187,7 @@ async def _open_page(ctx: AppContext, rows: list[ClockRow], tolerance: float) ->
if chosen == SYNC_ALL:
# The page stays as it is: an offset changes only when a new advert of the
# node arrives, so there is nothing to draw again now.
await sync_clocks(ctx, clocks_to_sync(rows, tolerance))
await sync_clocks(ctx, clocks_to_sync(rows))
continue
# The page opens to look. The verbs that manage a contact belong to the
# Contacts list, and this page is not that list.
+11 -12
View File
@@ -15,10 +15,9 @@ The page reads the clock samples of the last ``clock_report_days`` (refer to
user can set (JP, 2026-11-03). A managed node with no sample in the window shows its
newest offset from all the history, or ``no sample``. A repeater sends no message, so
its adverts are its only samples, and a new install has none yet.
When a managed repeater or room server is out of sync, or has no sample, the section
ends on ``Sync their clocks…``: one confirm, then each clock in turn, with the
transmit cooldown between the nodes (refer to
:func:`~meshterm.ui.repeater_admin.sync_clocks`).
When a managed node is a repeater or a room server, the section ends on ``Sync their
clocks…``, whatever the offsets: one confirm, then each clock in turn, with the transmit
cooldown between the nodes (refer to :func:`~meshterm.ui.repeater_admin.sync_clocks`).
* **Out of sync**: each other node past the tolerance, the largest offset first. Enter
opens the node page.
* **Senders with no key**: the channel senders whose name resolves to no single key. Their
@@ -377,11 +376,12 @@ def clock_drift_screen(rows: Sequence[ClockRow], *, tolerance_s: float) -> Selec
items.append(Separator(_node_header))
items += node_rows(managed)
# The bulk action ends the section, as the maintenance rows end the Contacts list.
# It shows only when a clock needs it. It is a list of its own, with its own icon
# It shows for each page with a managed repeater or room server, whatever the
# offsets, because an offset can be old. It is a list of its own, with its own icon
# column, so a blank seam goes on each side of it: the node rows above and below
# have one-cell type marks, and its clock is two cells. The heading that follows
# adds no second blank line under a blank one.
due = clocks_to_sync(rows, tolerance_s)
due = clocks_to_sync(rows)
if due:
label = marked_label("🕒", "Sync their clocks…", "")
label.append(f" · {len(due)} {'node' if len(due) == 1 else 'nodes'}", "muted")
@@ -415,16 +415,16 @@ def clock_drift_screen(rows: Sequence[ClockRow], *, tolerance_s: float) -> Selec
return SelectScreen(title, items, footer_hint=_HINT)
def clocks_to_sync(rows: Sequence[ClockRow], tolerance_s: float) -> list[Contact]:
def clocks_to_sync(rows: Sequence[ClockRow]) -> list[Contact]:
"""The managed nodes whose clocks the bulk ``Sync their clocks…`` sets.
Only a repeater or a room server has the ``clock sync`` command. Of those, the ones
whose clock is out of sync, or not known (no sample): a correct clock needs no
transmission.
Each managed repeater and room server, whatever its offset (JP, 2026-11-03): only these
have the ``clock sync`` command. An offset that looks correct can be old. A repeater
with no battery and no clock source starts again from its build date at each power
cycle, and the page knows only when its next advert arrives.
Args:
rows: The rows of the page.
tolerance_s: The ``clock_tolerance_s`` preference.
Returns:
The contacts, in the order of the page.
@@ -435,5 +435,4 @@ def clocks_to_sync(rows: Sequence[ClockRow], tolerance_s: float) -> list[Contact
if r.managed
and r.contact is not None
and r.node_type in (NODE_TYPE_REPEATER, NODE_TYPE_ROOM)
and (r.offset is None or r.out_of_sync(tolerance_s))
]
+10 -6
View File
@@ -202,10 +202,12 @@ def _managed(name: str, offset_s: float | None, node_type: int | None = NODE_TYP
return ClockRow(offset, name, key, node_type, True, contact)
def test_the_bulk_row_ends_the_managed_section_when_a_clock_needs_it() -> None:
"""A repeater out of sync and one with no sample are due. A correct clock is not.
def test_the_bulk_row_ends_the_managed_section_for_each_repeater_and_room() -> None:
"""Each managed repeater and room server is due, also with a correct clock.
A managed companion has no ``clock sync`` command, so it is never due.
A repeater with no battery loses its time at each power cycle, and the page learns it
only at its next advert. A managed companion has no ``clock sync`` command, so it is
never due, and a page with only managed companions has no bulk row.
"""
from meshterm.ui.clocks_screen import SYNC_ALL, clocks_to_sync
@@ -215,15 +217,17 @@ def test_the_bulk_row_ends_the_managed_section_when_a_clock_needs_it() -> None:
_managed("Unknown", None),
_managed("Phone", -7200, node_type=None),
]
assert [c.name for c in clocks_to_sync(rows, TOLERANCE)] == ["Behind", "Unknown"]
assert [c.name for c in clocks_to_sync(rows)] == ["Behind", "Fine", "Unknown"]
screen = clock_drift_screen(rows, tolerance_s=TOLERANCE)
text = plain("\n".join(screen.render_body(72)))
assert "Sync their clocks… · 2 nodes" in text
assert "Sync their clocks… · 3 nodes" in text
assert text.index("Sync their clocks") < text.index("Out of sync")
assert any(getattr(item, "value", None) == SYNC_ALL for item in screen._items)
in_sync = clock_drift_screen([_managed("Fine", 10)], tolerance_s=TOLERANCE)
assert "Sync their clocks" not in plain("\n".join(in_sync.render_body(72)))
assert "Sync their clocks… · 1 node" in plain("\n".join(in_sync.render_body(72)))
phones = clock_drift_screen([_managed("Phone", -7200, node_type=None)], tolerance_s=TOLERANCE)
assert "Sync their clocks" not in plain("\n".join(phones.render_body(72)))
class _Ui: