60e2cd1e2dbf68e850bc352a515c37a282940d13
14
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
92d31a3191 |
Every file is spelled the way the formatter spells it
`ruff format .` across the repo: 153 files, no behaviour change. This is the second gate CONTRIBUTING.md promises, and until now it reported 154 files needing reformat — so a first contributor ran the command the guide told them to run and could not tell their own diff from the background. Landed on its own, with nothing else in it, because a whole-repo reformat is only safe to skip past in blame if it is provably nothing but layout. It was checked that way rather than assumed: every changed file was formatted in memory and compared by full `ast.dump()`, and 152 of 153 come out structurally identical (the one exception was a docstring opening on a quote character, fixed in the commit before this one). The string and comment token streams were diffed separately, so a quote flip or an edited comment could not hide inside a re-layout — five quote-style normalisations and sixteen implicit-concatenation joins, all value-identical, and one commented-out line gaining the space after its `#`. `meshterm specimen` is byte-identical on both platforms, and the suite is 1888 green, gallery gate and `test_theme16` included. What actually changed, in order of how much of the diff it is: wrapped calls and signatures rejoin onto one line where they fit inside the hundred columns; the magic trailing comma expands what it is there to expand; complex slices gain their spaces (`[len(noise) :]`); a few redundant parens go. The tables that are laid out to be read were fenced in the previous commit and are untouched here. The aligned trailing-comment column is gone from about ninety lanes that were not fenced — including the `heat.*` ladder in `MESH_THEME`, which cannot be fenced where it sits. Every comment stays on the entry it describes, so nothing there reads wrong; it just no longer lines up. Add this commit to `.git-blame-ignore-revs`, which follows immediately. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> |
||
|
|
71b16ec7b7 |
The annotations, imports, and dead locals answer to ruff
`ruff check --fix` over the whole tree, ahead of putting the linter in CI: 1977 mechanical fixes, overwhelmingly `Optional[X]` → `X | None` (1186 in the package alone) and the quoted annotations that `from __future__ import annotations` already made unnecessary, plus import sorting and unused imports. Nothing here changes behaviour — the suite is 1885 green before and after. Four findings were real rather than stylistic and are fixed by hand: a dead `cells` range in `MapCanvas`, a dead slot dict in the heat-ladder test, a `ProgressScreen` task handle nobody read, and a tab loop binding a `label` it never used. The two `F821`s were quoted forward references to names imported inside their function bodies — now declared under `TYPE_CHECKING`, which keeps `test_performance`'s local import (it guards the startup import graph) while letting the linter resolve the name. 412 findings remain and are deliberately untouched: they need a decision about the rule, not an edit to the code. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> |
||
|
|
9de428f6ca |
A cursor stops at the end of its list
Down off the last row wrapped to the first on a good third of the app's lists, and the select screen shipped that as its default -- twenty-one call sites had already opted out one at a time, each writing wrap=False for its own reason. The reasons were all the same one, so the flag is gone and clamping is simply what a cursor does. The window follows the highlight, so a roll doesn't move a pointer: it hauls the whole list back to the other end and flips its edge markers, which reads as the screen changing under you rather than as one step. Held-down arrows now settle at an end instead of looping past what you were trying to reach. The hand-rolled cursors came along: the trophy case's, the trace and TX optimize action rows, the reorder list -- where the ungrabbed cursor wrapped while the grabbed one clamped, so the same two keys meant opposite things in the two modes -- a prompt's completion list, and a dialog's buttons. Tab is the exception, and it stays a ring: it has no reverse of its own, so on the last chip it comes round or it dead-ends. Same for the three picocalc F-lane chips that are single-key advancers -- Sort, the node page's tab strip, the Time Machine's window -- where the lane offers no way back. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> |
||
|
|
cef7a764af |
How MeshTerm behaves gets a page of its own
Three kinds of "setting" were tangled into two files and one of them had no screen at all. The radio's settings live on the radio and are edited on Device config. Machine setup -- where the database is, which companion to talk to -- stays in config.toml, a text editor's job. Everything in between was app behaviour: six keys sitting in config.toml with nothing to open them, and a dozen more that were only module constants a reader could never reach. Those are preferences now, and they have a page. core/preferences.py is a PrefSpec registry in the shape of the device-config one -- group, type, bounds, help, and a default -- and the page is built from the same parts as the device editor, deliberately: one grouped lane-aligned list, current -> new staged in warn, Apply/Back appearing only once something is staged, the shared discard confirm on the way out. Two editors that stage values should not be two screens to learn. What it adds is a Defaults section holding one row that stages every changed preference back to its built-in value; it is drawn only while a reset would do something, and it stages rather than writes, so it is as reviewable and as Esc-discardable as any other change and the file is still only ever written by the one action at the bottom. Its rows scroll sideways where the device editor's don't: the explanation is the widest thing on the row and the only part that runs past the edge, so <-> slide it under a pinned setting and value. The file is preferences.yaml and holds only the values you disagree with the code about -- grouped and commented, each entry above its help and its default. That is what lets a later change to a default reach an install that never asked to be exempt; delete a line and the code takes over again. A hand edit gone wrong costs that line, never the session. Every preference is wired to something that reads it. ctx.preferences is the explicit path; preferences.current() is for the render layer, which has no context to reach through, the same reason get_platform() exists. The About pages come along into a This app section, the third scope after this node and other nodes, with Preferences leading it -- the one row there that changes MeshTerm rather than describing it. A section of one would have broken the menu's own no-bucket-of-one rule, and the app's scope is the honest home for both halves anyway. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> |
||
|
|
f2a49c8e2d |
Editors keep their place too: rows change, the reader doesn't move
Six lists rebuilt themselves as a whole new screen every round, because their content is data: an editor's rows carry a staged `current → new` value, its title counts what is staged, the outbox loses the message it just sent, the watchtower's log rewrites the row you acknowledged. Each approximated the cost with `default=cursor`, which recovers only the cursor, and only while the row it names still exists — the typed filter went every time. SelectScreen.replace_items swaps the rows (and optionally the title) in place instead. The place is kept by value, so the highlight lands back on its row wherever that row moved to, and falls back to the same position in the list when the row is gone entirely — which is what you want after deleting the row you were sitting on. The filter rides along. So the config editor, device actions, the channel manager, the courier outbox, the watchtower and the repeater-admin editor all hold one screen for the whole visit now, refreshed after each action. The courier's ticker is started once for the visit rather than per round, and folds a flow's effect in immediately rather than waiting up to a second for the next tick. The admin node picker gains a `stay` form. Repeater admin used to draw a second, identical SelectScreen as a static backdrop so the password prompt had something behind it, then drop the list before the session; the real list stays up through both now — so cancelling the password lands back on the node list rather than bowing out of the flow, and leaving a node's admin session lands there too. Administering two repeaters in a row is an Esc and a pick. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> |
||
|
|
667c0321e4 |
Admin login: silence from a node is not a wrong password
Administering a repeater that happened to be down made MeshTerm forget its admin
password. The node had said nothing at all, and we took the silence as a denial.
`admin_login` returned a bool, and all five callers read `False` as *wrong password* and
dropped the credential. Underneath, they could not have done better: meshcore's
`send_login_sync` waits for LOGIN_SUCCESS and only LOGIN_SUCCESS, so a refusal — which
the firmware does send, as a LOGIN_FAILED frame the library parses and dispatches like
any other event — times out exactly like an unreachable node and comes back as the same
`None`. Our own `etype in (ERROR, LOGIN_FAILED)` branch could never fire.
So the device now watches for that frame itself, subscribed before the request goes out
because the refusal can land the moment the request does, and answers with a three-way
`LoginResult`: ACCEPTED, REFUSED (the node said no), NO_REPLY (nothing came back — which
includes a companion-side error, where the request never even left the radio). It is
truthy only when logged in, so `if not await device.admin_login(...)` still reads "we are
not in"; a caller that acts on the failure has to name which failure.
What that means for the stored password now lives in one place, `AdminStore.record`:
remember on accepted, forget on refused, leave it exactly as it is on silence. It was
five copies of the policy, and every copy was wrong the same way. Each surface still
phrases its own message — the sweep says "sweep again", the CLI says "re-run" — and a
no-reply now says so plainly ("No reply from X — it may be out of reach, asleep, or busy.
The saved password was kept") instead of accusing the operator of a typo. The trace
screen's forget-on-DeviceAuthenticationError goes with it: the credential is settled
where the outcome is known, and an exception there is only a message to show.
A source-level test walks the package's AST and holds the line: anything that calls
`admin_login` records the outcome through the store, and nothing reaches for `forget()`
to decide this on its own.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
||
|
|
63cd4e5f96 |
Performance: SQLite WAL, lighter startup, per-platform tick rates
PicoCalc plan phase P2, driven by measurements taken on the Lyra as a paired A/B (git archive HEAD vs the working tree, run side by side against the same venv). The headline is the database. Every packet the monitor hears is one durable commit, and on the SD card each was costing 33.78 ms of fsync. db._tune() opens in WAL with temp_store=MEMORY: 0.59 ms per commit, a 54x cut. synchronous=NORMAL is requested only once WAL is confirmed engaged - the pragma returns the mode it settled on rather than raising when a filesystem refuses it - because under WAL it risks the last transactions to a power cut, and under the rollback journal it risks the file itself. This device runs on a battery pack. Startup: bleak/dbus-fast were already lazy; the real finds were two cheap *values* dragging heavy subtrees. core/connection.py imports one constant from core/channels.py, which imported PyCryptodome at module level (224 ms of CPU-feature probing per run) - now deferred into the two functions that decrypt. And tools/map.py's register_cli, which runs for every tool at boot, reached into ui/map_screen.py for a --fraction default, dragging the basemap's urllib.request -> http.client -> ssl behind it; DEFAULT_VIEW_FRACTION moves to core/geo.py (pure arithmetic, already on the boot path) and is re-exported so existing importers are untouched. 26 modules and 316 ms of import self-time gone. Per-frame: the corner glow only ever recolours truecolor foregrounds, so on a 16-slot console it scanned every line of every frame to hand back the identical list - skipped outright where effects are off, along with the battery blink and the braille spinner cycle. _has_wide_glyph answers from the platform when no emoji can be drawn instead of scanning the composed frame (6.5-9.1 ms per repaint on its own). The header built its segments twice to measure the compact separator, on exactly the narrow terminals that take that branch every frame; it now builds once and measures arithmetically. Together: 101.2 -> 73.2 ms per frame at 53x26, 151.8 -> 110.4 at 53x40, and 72x24 unregressed at 91.7. That finally gave numbers to set the clocks against. refresh_interval becomes per-platform tick_s (2.0 s on picocalc: a 1 Hz idle tick alone was 7-11% of a core doing nothing, and only the header's per-minute pulse drifts, since screens push their own repaints via invalidate). The 0.12 s spinner was untenable - 84% of a core at 53x26, and at 53x40 it did not fit in its own interval at all. Five duplicate _SPINNER_INTERVAL = 0.12 constants across the UI collapse into one platform-aware spinner_interval() beside the Spinner it paces. The header refactor was verified equivalent over 540 renders, plain text and style spans both. The span check earned its keep: the first cut passed style= to the Text constructor, which makes it the object's base style and blankets everything appended after, so the version string would have rendered brand-under-muted. test_header.py only asserted on .plain and never saw it; it now pins the styling too. tests/test_performance.py pins each contract as behaviour rather than timing, including a subprocess guard that fails if Crypto, the network stack, or the map screen ever creep back onto the startup import graph. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> |
||
|
|
0a41303366 |
Lists: what stays overhead is the section you are in
Two things a grouped list has to keep in view while it scrolls, and neither one was staying: the lane names that read every row, and the heading that says which group a row belongs to. The lanes come first. A column header means the same thing in every section, so it is not a section landmark at all — it pins for the *whole* list, above any heading, once it scrolls off (`Separator(pinned=True)`). It is drawn outside the body slice, so it stays exactly one row: too wide for the terminal it ellipsizes rather than wrapping and stealing a second reserved row from the content. And it can now size itself — a Separator title may be a callable taking the render width — so `column_header`/`Lane` lay each label over its own lane and hand back the shorter form (DESCRIPTION → DESC) only for the lanes that actually overrun, from the right, where the trailing lane is the only one with a cell to give. `lane_header` is that header for `lane_row`'s lanes, shared by the two editors so they head identical lanes identically. The headings were the other half, and they were pinning the wrong row. Every non-pinned separator was a candidate, and the rule takes the last one at or above the scroll — so what pinned was whatever muted line sat lowest under the heading. In the Trophy case that meant a discipline's *description* stuck to the top and the heading itself never did; at the foot of any list, the blank spacer above Back pinned a blank row. So heading-ness is explicit now (`Separator.heading`, conferred by `section_heading`, which is why every hand-rolled `── … ──` in the app — the main menu's categories, the chat picker's Channels/Direct, Trace path's candidate and ranked lists — now goes through it, and why three lanes headers that genuinely *are* their block's only landmark say so). A landmark is also no longer one line but a block: a heading plus the separators written immediately under it, before the section's first row. Prose written there is the section's preamble — the Trophy case's "what this discipline scores" — and it belongs overhead with the heading rather than scrolling away from the rows it explains. The block hands its rows over one at a time as they leave, so the heading pins while its description is still the top content row and the two pin together once both are gone: what is overhead always continues seamlessly into the body. It never takes more than half the viewport, giving rows up from the end, so the row that says *which* section this is is the last one dropped. The frame settles the scroll against however many rows come back rather than assuming one, and re-asks after sliding the window at the bottom — a heading among the dropped lines would otherwise vanish instead of pinning. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> |
||
|
|
310783c6a3 |
Repeater admin: float the login over the node picker, not a blank frame
The admin-login password prompt ran on an empty stack (the picker was popped when it returned), so session.text pushed a blank base and the prompt — and any "wrong password" rejection — floated over an erased background. open_repeater_admin now redraws the node picker as a static backdrop (extracted admin_picker_rows, shared with the live pick so they can't drift) and keeps it pushed across _login, with the picked node highlighted. The password box and the rejection float over the picker, matching the device-picker and trophy-case dialogs. floating=True stays on the prompt as a belt-and-suspenders fallback. Also drop the inert floating=True on tx_optimize._resolve_password: that resolver only runs on the scripted CLI path (PlainUi, no stack), so the flag never did anything — the menu path logs in inside the pushed sweep screen. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> |
||
|
|
59b26ae616 |
Dialogs: float confirms/prompts over their backdrop, never replace the screen
Enforce the UX standard "modal popups over the pushed backdrop" across three flows that were drawing a full-frame replacement instead of a floating popup: - Trophy case: keep the record browser pushed as a static backdrop while its delete-record / delete-discipline / delete-all confirms float over it, and run any trace hand-off after popping. - Device picker: pass the picker's rows through to the removal confirm so it floats over a redraw of the list (backdrop_items/backdrop_default on confirm_startup), with the row being removed left highlighted. - Remote-admin password: add an opt-in floating flag to Ui.text so a mid-flow password prompt draws as a centered popup over a blank base instead of the full frame; apply it to repeater_admin and tx_optimize logins. Tool-entry text prompts (Trace/tx target fallbacks) stay full-frame. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> |
||
|
|
e07ef3b379 |
Device state: cache the picker reads that run before each screen
The session cache fixed the reads screens make on open, but opening the heaviest screens still stalled for seconds — because the pickers and screen-openers that run *in front of* those screens were still reading the radio directly. The menu wraps prompt-gathering and execution in one busy overlay, so a Trace or Chat open pays its picker's slow round-trips before the (already-cached) screen behind it ever builds, which is why caching the screens alone showed no improvement. Route the interactive-open reads through ctx.devstate too: - Chat's conversation picker read the channel-slot probe *and* the contacts table on every open (~5s) — both now come from the cache (channels mapped from the cached slots via the new _channels_from_slots, contacts served cached). The CLI list/send path keeps reading fresh. - Trace and TX-optimize target pickers now read contacts from the cache. - The repeater-admin screen and the channels manager (its slot probe, on a local copy so mutations still re-probe the fresh layout after invalidation) read through the cache. Small, session-stable reads (self-info, build_snapshot's tuning/path-hash) are left as direct reads — they were never the seconds. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> |
||
|
|
d1c8ed73a0 |
Titles speak one language: Sentence case, no emoji, — for subjects
Every screen and dialog title now follows the same three rules. Titles
are sentence-cased ("Trace — YUL-Poly", "Dashboard — mesh overview",
"Nodes"), never bare lowercase ("trace · x", "nodes", "command line ·
x", "path width", "admin login" and a dozen siblings). An em dash
introduces a title's subject or qualifier while middle dots stay for
chained status atoms ("Map · z12 · 34 nodes · 2 km across"), so the two
separators mean different things instead of being used at random. And
no title carries an emoji — the icon belongs to the menu row; a
content-sized floating dialog whose title emoji the terminal draws a
cell narrower than Rich measures leaves the border short (the bug the
Send advert popup already documented), so the Watchtower, Courier,
Time machine, identity-key, reboot, sync, restore, location, factory
reset, and advert dialogs all drop theirs.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
||
|
|
241be536d8 |
One exit language: shared menu chrome in ui/menus.py
Every select list now builds its closing furniture through one module, so the conventions hold by construction instead of by copy-paste: * Back is THE exit word — bare, no arrow, no icon — with exactly one blank separator above it (back_rows). Courier and Watchtower lose their "← Back"; the rules popover's "← Close" becomes Back too. * The staged-changes exit pair (✓ Apply … / ✗ Back — discard) moves to exit_rows, shared by the config editor and repeater admin, along with changes_phrase and one confirm_discard dialog (apply/send verb parametrised). * Label + description rows share menu_rows (cell-padded lanes): Device actions, channel detail, repeater actions, and — converted from the inline "label — description" style — Send advert, Identity key, and the channel manager's Add-a-channel section, whose rows now read as two aligned lanes with the trailing … that marks "opens a prompt". * Grouped-list headings share section_heading (── Label ── in accent): Watchtower, Courier, the Time Machine picker, and the admin picker (which also drops the stray 🔑 inside its heading). * Status marks normalize to ✓/✗ (U+2713/17): Watchtower's ✔ and the ✖ on Cancel-this-message / Stop-watching become err-tinted ✗ rows. * fit_cells replaces the four private _fit copies (channels, dashboard, time machine, chat picker) and measures display cells, so a wide glyph in a name can't skew a lane; empty-state notes drop their parentheses ("no channels configured yet", "no matches"). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> |
||
|
|
aef80d18bb |
Repeater admin: set up remote nodes over the mesh
A new Device management entry for administering repeaters and room servers. The shared credentialed-first picker (extracted from TX optimize) chooses the node, login runs on remembered passwords with a one-time prompt otherwise (forgotten on rejection), and the editor lands in the local device-configuration screen's exact lanes — but speaking the node's text CLI through a new public Device.send_remote_command, which brings the repeater-only knobs the local editor never had: TX delay, Direct TX delay, RX delay, airtime factor, advert intervals, flood max, repeat, guest password. Reads cost one paced mesh round trip each, so the editor never bulk-reads on open: values show what the last read said, age-stamped, from a new per-node remote.json cache; Read settings refreshes them under an abortable progress dialog and Apply sends the staged sets the same way, folding confirmed values back into the cache and keeping refused ones staged. Advert, clock sync, password change, and reboot run as confirmed popups. The Command line is a readline-style screen onto the node's raw CLI: per-node history persisted across sessions (↑↓ recall, adjacent-dupe suppression, capped), Tab completion over the known verbs plus every catalog get/set spelling with ghost-text preview, one command in flight at a time. The simulator grows a full repeater CLI so all of it drives against --mock, and a scripted one-shot (repeater-admin <node> <command…>) covers automation. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> |