From 8dbb5c086f9378e0a09f9c9e8f960aec794eb988 Mon Sep 17 00:00:00 2001 From: PHS <192581158+tesseractAZ@users.noreply.github.com> Date: Fri, 27 Nov 2026 17:51:07 -0700 Subject: [PATCH] v0.80.0 candidate: what the engine knows reaches the screen where it is looked for MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From the class A–E gap re-check (the worth-doing set): an Overview CRIT field; ENGINE ranks tracked nodes alarm-first, gives a down driver link its own cause and cost rows, and lists confirming episodes first with their arm kept at 60 and 80 columns; Detail labels its probe ratio as lifetime, shows page/end keys and says "RF health nominal" only at 80 or more; REMEDY counts nodes too quiet to rate timeouts, keeps a learning arm's harm warning, and renders tallies, evidence, titles, headlines, caveats and empty states as whole forms; LOG names an unverifiable closure's subtype beside its verdict and says when a manual ping was answered. Co-Authored-By: Claude Opus 5.5 --- README.md | 2 +- docs/CHANGELOG-history.md | 186 ++++++++ docs/screenshots/detail.svg | 4 +- docs/screenshots/overview.svg | 2 +- docs/screenshots/remedy.svg | 46 +- zwave_tui/CHANGELOG.md | 368 ++++++++------- zwave_tui/DOCS.md | 58 ++- zwave_tui/config.yaml | 2 +- zwave_tui/server/package-lock.json | 4 +- zwave_tui/server/package.json | 2 +- zwave_tui/server/scripts/mutation-check.mjs | 426 +++++++++++++++--- zwave_tui/server/src/telnet/actionsCatalog.ts | 2 +- zwave_tui/server/src/telnet/chrome.ts | 5 +- zwave_tui/server/src/telnet/screens/detail.ts | 43 +- zwave_tui/server/src/telnet/screens/engine.ts | 82 +++- .../server/src/telnet/screens/overview.ts | 10 + zwave_tui/server/src/telnet/screens/remedy.ts | 302 ++++++++++--- zwave_tui/server/src/telnet/session.ts | 9 +- zwave_tui/server/src/zwave/autoPing.ts | 10 + zwave_tui/server/src/zwave/planner.ts | 19 +- zwave_tui/server/src/zwave/zwaveData.ts | 14 +- zwave_tui/server/test/actionsCatalog.test.ts | 24 +- zwave_tui/server/test/autoPing.test.ts | 30 ++ zwave_tui/server/test/chrome.test.ts | 12 + zwave_tui/server/test/detailScreen.test.ts | 52 ++- zwave_tui/server/test/engineScreen.test.ts | 125 +++++ zwave_tui/server/test/overviewScreen.test.ts | 24 + zwave_tui/server/test/remedyScreen.test.ts | 210 +++++++++ zwave_tui/server/test/sessionActions.test.ts | 21 + zwave_tui/server/test/zwaveDataChurn.test.ts | 61 ++- 30 files changed, 1760 insertions(+), 395 deletions(-) diff --git a/README.md b/README.md index 3312b72..b7bdefc 100644 --- a/README.md +++ b/README.md @@ -56,7 +56,7 @@ health endpoint. | --- | --- | | Server | about 32,000 lines of TypeScript; 9 screens; SSH, browser and Home Assistant entity interfaces | | Detection | 14 per-node detectors, 2 cross-node correlations, controller serial-link health | -| Verification | 1,995 tests; a mutation-testing harness of 2,114 hand-written mutants (19 labelled equivalent), run in full on each release | +| Verification | 2,018 tests; a mutation-testing harness of 2,194 hand-written mutants (19 labelled equivalent), run in full on each release | | Integration | Home Assistant Core WebSocket (roster, statistics, gated actions) plus a read-only Z-Wave JS driver WebSocket (noise floor, capabilities, log stream) | ![The Overview screen: a live node table sorted worst-health-first, with per-node health scores, SNR margin, RTT, timeout rate, hop count, data rate and triage flags](docs/screenshots/overview.svg) diff --git a/docs/CHANGELOG-history.md b/docs/CHANGELOG-history.md index 0ab5963..322dbb1 100644 --- a/docs/CHANGELOG-history.md +++ b/docs/CHANGELOG-history.md @@ -3,6 +3,192 @@ Releases older than the ones in zwave_tui/CHANGELOG.md, newest first. The shipped changelog keeps only the newest releases so Home Assistant can render it. +## 0.79.7 + +A subscribe Home Assistant answers after the add-on's 10-second timeout is +released on its socket instead of staying live with no handle, an activity +feed the statistics rebuild could not make is subscribed again a minute on +instead of staying dark until the next rebuild, and a status event read +together with a roster poll's answer is no longer replaced by the poll's older +reading. Nothing stored on disk changes. + +### Fixed — a subscribe Home Assistant answered after the client's timeout stayed live with no handle + +- Home Assistant handles one connection's commands in order, with no cancel, + and registers a subscription while it handles the subscribe. A subscribe the + client gave up on at its 10 s reply timeout therefore still registered when + Home Assistant reached it, under an id the client no longer routed, for the + life of the socket: a node's statistics or status listener (in 0.79.6 beside + the one the 60 s retry then made), a second controller feed beside the next + rebuild's, a `state_changed` feed of the whole house, or a + `zwave_js_notification` feed. The client now sends `unsubscribe_events` for + it in the turn the timeout passes, on the same socket, where Home Assistant + reaches it after the subscribe (`not_found` when the subscribe failed); + events sent under the id before it lands reach no handler, and a socket that + has closed, or is closing, takes the subscription with it. Other commands + are unchanged: an action Home Assistant has not answered in time still reads + as an unknown outcome. + +### Fixed — an activity feed a rebuild could not make stayed dark until the next rebuild (0.8.0) + +- A rebuild of the statistics feeds whose `state_changed` subscribe failed (no + answer within the client's 10-second timeout, or a connection closed under + it) kept its controller and node feeds and logged the failure, and nothing + made the feed before a Home Assistant reconnect, the self-heal or a re-arm: + no value or notification rows on the Log screen, Detail's LIVE ENTITIES and + the device menu's `now:` from the 10-minute full state read, and the pause + toggle turned on in Home Assistant read only there. The + `zwave_js_notification` subscribe, in the same try, was not sent, and one + that failed on its own was dropped without a line while the log named it + subscribed. Each activity feed is now a try of its own, and one a rebuild + could not make is subscribed after the first roster poll that succeeds a + minute after the attempt (on the host's uptime): only the feeds not made, + one attempt at a time, and again a minute after each that fails; the attempt + that makes the state feed reads the states again. Each handle it makes is + kept with the feed set's as it is made, so a re-arm releases it, one begun + while its second subscribe is out included; one answered after another + rebuild began, or while a re-arm releases the feed set, is released and not + kept. It stands aside while a rebuild runs or the feed set is down, but not + for a re-arm an entry reload latched, which leaves the activity feeds as + they are. The Log screen reads `activity feed down — its state_changed + subscribe failed; retried after a minute` until it is made, and the add-on + log names each failed feed (`activity subscribe failed (state_changed): …`). + A failure on a connection that is down adds no row, and the feeds after it + are not tried: the reconnect's rebuild makes them and adds the row. +- A failed activity subscribe does not fail the rebuild: failed, the rebuild + would run again at every roster poll, making the controller's feed and every + node's two again each time. + +### Fixed — a status event read together with a roster poll's answer was taken as older than the poll's reading (0.79.6) + +- Over uncompressed frames the client can hand a status event Home Assistant + sent right after a `network_status` answer to its handler before the poll + that awaited the answer resumes, so the poll acted on its older reading + after the event. A revival read that way, after a poll that reads the node + Dead, re-subscribed its feeds for nothing; a death read with the first poll + since the node's status feed answered gave way to that poll's reading, which + left the death queued when the node revived before the next poll, or had + the next poll re-subscribe the node for nothing when it stayed dead. Each + alive, dead, sleep or wake up event now takes an order mark: a node whose + live status feed heard one after both the poll and the feed were sent is + neither judged by that poll nor given its reading as a baseline, and every + other poll's reading is the live feed's baseline (0.79.6: only the first + poll sent after the feed answered). With permessage-deflate, which the + client offers, Home Assistant's and the Supervisor's sockets compress every + frame (inferred from the aiohttp sources), and the poll acted first there. +- A status a node's old status feed hears while the node's own re-subscribe + releases it (the statistics feed goes first, unless the 60 s retry made it + after the status feed) is counted once and kept as the newer: through + 0.79.6 a poll that read such a death before the new status feed answered + counted it again, and the new feed was seeded with the older reading, which + left the death queued when it heard the revival. +- A status a feed a re-arm is still releasing sets on a node whose rebuild + status subscribe fails no longer seeds the status feed the 60 s retry makes + once a roster poll has read the node since: in 0.79.6 the retry's feed kept + it, and a death it then heard first was not counted. + +### Tests + +- 1,951 tests, 57 new: 25 in `nodeFeeds.test.ts`, 10 of them pins that pass + on 0.79.6 too; 16 in `activityFeeds.test.ts`, a model of Home Assistant's + core event bus; 8 in `haWsClientLateSubscribe.test.ts`, a model of its + per-connection command order; 3 in `realClient.lateSubscribe.test.ts`, the + data layer over the real client and a mock Core with node objects + (`_realHa.ts`, `_realRun.ts`); 2 in `statusOrderRealClient.test.ts` and 2 + in `statusReleaseRealClient.test.ts`, the real client with frames + uncompressed and compressed; and 1 in `activityFeedsLate.test.ts`. 2,061 + mutation-harness entries (19 labelled equivalent): 56 new, 8 re-anchored, + and 3 removed with the code they pinned, one of them labelled equivalent. + +## 0.79.6 + +A node replaced with `replace_failed_node`, or included on a freed id, has its +statistics and status feeds made again on its new node object in Home +Assistant, and the 60-second retry of a failed node subscribe now subscribes. +A driver server on another network leaves the driver link stopped, not +reading live, and a stick swap no longer stops the driver link for the rest of +the run as a driver server on another network. Nothing stored on disk changes. + +### Fixed — a replaced node's feeds stayed on the failed node until the next rebuild + +- Home Assistant binds each node's statistics and status feed to the node + object it resolves at subscribe time, and a node replaced (by the same + product or another) or included on a freed id is a new object there, which + no earlier feed hears. Through 0.79.5 the new device had no statistics feed + and its Dead/Alive crossings were counted by neither the feed nor the roster + fallback until a Home Assistant reconnect, the self-heal or a re-arm, while + Detail's EVIDENCE badges read its feeds live. A node's two feeds are now + released and made again on their own after the roster poll that reads it not + ready after it read ready, shows a status change its status feed did not + deliver (the replacement of a failed node that read not ready; a new status + feed's baseline is the first poll sent after it answered), shows its device + changed, or lists it again after a poll found it off the roster (an id back + with no device as last loaded asks for a registry load). A re-interview of + the same node is re-subscribed too, as Home Assistant's websocket does not + tell the two apart: one release and subscribe more. +- A node included after the feed set was built, or an evicted id back on the + roster, had no feeds until a rebuild either: it is subscribed after the poll + that lists it. An evicted node's feeds are released at the eviction, and + feeds a re-arm released are not released again. +- A driver restart costs no per-node re-subscribe: the nodes wait for the + re-arm its entry reload latches, and a status feed made since the previous + poll is not judged by a change it may have missed, so a replacement by the + same product of a failed node that read not ready, landing between the + node's two subscribes, leaves its statistics feed on the removed node until + a later interview start, absence or swap re-subscribes it, or the feed set + is rebuilt. A per-node subscribe that resolves after a re-arm began, or on + another connection, is released and not kept. Neither a node's own + re-subscribe nor the retry runs beside a reconnect's rebuild, and a rebuild + it superseded that fails on the new connection no longer lets a roster poll + start a second one beside it. Feeds a node's own re-subscribe or the retry + makes never stamp the fleet's liveness clock, so the dead-feed watchdog and + `binary_sensor.zwave_tui_degraded` still see the rest of the feed set, the + controller's included, fall silent. + +### Fixed — a failed node subscribe was never retried (0.26.0) + +- The 60 s retry passed no list for the handles, and the optional-chained push + skipped the subscribe with it: a node whose subscribe failed was marked + subscribed with no feed made, its EVIDENCE badges reading live. The retry + now subscribes, by the node's device as last loaded, keeps the handles where + a re-arm releases them, stands aside while a rebuild runs, the feed set is + down or a node's own re-subscribe is out, and drops from its queue a node + the roster has shown gone (it is subscribed once it is back) or one with no + device as last loaded, such as one queued by an old network's device the + boot load admitted (it is subscribed once a load gives it one). + +### Fixed — a driver server on another network could leave the driver link reading live after it was stopped + +- When the homeId cross-check proved a mismatch inside the driver's state + dump (Home Assistant's home id already known when the dump landed, as after + a home-id change), it stopped the driver client, and the rest of the dump + then declared the stopped client live: DRIVER LINK read `live` with no + connection under it, the S2 lane read `refused` (`s2_lane` too), and + nothing reconnected it until the next home-id change or restart. The + client now stays `stopped`, beside the homeId mismatch row, and a dump cut + short by a stop hands on no further node and is not logged as processed. A + stop from the handshake's home-id callback ends the handshake the same way; + nothing in the add-on stops the client there today. + +### Fixed — a stick swap could stop the driver link for the rest of the run + +- A home-id change cycles the driver client, and kept the previous server's + home id until the new handshake: a read of the cross-check in between (the + sleeper watch reads it on every call) compared it with the new id, purged + the driver telemetry and stopped the client for the rest of the run, though + the driver server had moved to the new network too. The cycle forgets it now. + A driver link back on the new network before Home Assistant reports the new + home id still reads as one on another network, telemetry purged and client + stopped, until the roster poll that reads the new id runs the cycle. + +### Tests + +- 1,894 tests, 41 new: 34 in `nodeFeeds.test.ts`, a model of Home + Assistant's node feeds bound to zwave-js-server-python node objects, 4 in + `driverWsClient.test.ts`, 2 in `zwaveDataChurn.test.ts` and 1 in + `deviceSwapSim.test.ts`; 2,008 mutation-harness entries (20 labelled + equivalent, 2 of them new): 66 new, 2 re-anchored. + ## 0.79.5 A forward clock step no longer makes a real outage a 90-minute start death, a diff --git a/docs/screenshots/detail.svg b/docs/screenshots/detail.svg index fbac0a7..9939e60 100644 --- a/docs/screenshots/detail.svg +++ b/docs/screenshots/detail.svg @@ -39,12 +39,12 @@ Feeds ● status · ● stats Watched 12d Samples 4180 · fresh 3930 (94% lifetime) History 12d span · 1 bucket(s) Long RF -70…-55 dBm · mean -62 · worst rate 100k - Probes 81/84 answered (96%) · 22 self-proven + Probes 81/84 answered (96%, lifetime) · 22 self-proven Frame all NoOp pings: answered = reached on a stored route — lifetime tally; pre-v0.40.2 counts blend probe lanes and boot credits — before v0.64.4 a sweep that knocked the node Dead could count as answered Normal -62 dBm ±3 dB · 12d · this time-of-day band RF health nominal -[↑↓] SCROLL [< >] NODE [A] ACTIONS [1-9] SCREENS [Q] BACK +[↑↓] SCROLL [␣/b] PAGE [G] END [< >] NODE [A] ACTIONS [1-9] SCREENS [Q] BACK diff --git a/docs/screenshots/overview.svg b/docs/screenshots/overview.svg index 2fa576b..736744c 100644 --- a/docs/screenshots/overview.svg +++ b/docs/screenshots/overview.svg @@ -4,7 +4,7 @@ ZWAVE·JS MESH DIAGNOSTICS ● ONLINE 2026-05-14 02:41:00 HOME 3237998081 ── OVERVIEW ──────────────────────────────────────────────────────────────────────────────────────────── -NODES 16 ONLINE 15 DEAD 1 ASLEEP 0 FLAKY 2 NOISE -101 dBm MESH ███████░ 81% +NODES 16 ONLINE 15 DEAD 1 CRIT 2 ASLEEP 0 FLAKY 2 NOISE -101 dBm MESH ███████░ 81% ID ST NODE SCR MARGIN RTT TMO HOP RATE SEEN BATT FLAGS TREND 83 ✕ Utility Closet Switch — — — 0.2% — — 3h AC D! ██▇▅▄▂▁▁ diff --git a/docs/screenshots/remedy.svg b/docs/screenshots/remedy.svg index e996a62..2be42ea 100644 --- a/docs/screenshots/remedy.svg +++ b/docs/screenshots/remedy.svg @@ -8,33 +8,25 @@ ▶ CRIT ◆ dead-flap #83 Utility Closet Switch 2h measured ○ 3 past episodes of this kind could not be scored — too few readings to judge recovery - Alive↔Dead 6× in 2 h; currently dead for 3 h. - ▎ Reachability runbook — a rebuild cannot repair an unreachable node - ▸ Ping the node (reachability request) [safe · source] - Sends a ping request. HA does not return the result, so watch the node's status/last-seen right - ✓ helped 71% (n≈7.0 · 3 nodes) vs 22% self-heal - · Power-cycle the device, then exclude/re-include if it persists [physical · lore] - CRIT ◆ return-path-degraded #70 Basement Leak Sensor 5h - measured - Reply-timeout rate 8.2% vs a 0.9% baseline for this time of day, sustained 5 h. - ▎ Improve the RF path — a repeater or relocation, not a rebuild - · Add/relocate a repeater on an interior path [physical · lore] - A device far from the controller or behind an RF-hostile wall (metal, foil, stucco-over-lath) is - ▸ Refresh values (re-poll, non-mutating) [safe · source] - ▸ Rebuild routes — NOT recommended here [disruptive · source] ⊘ no topology change — won’t help - also deletes any manually-set priority routes. Only use it after devices were physically … - ⚠ ledger measured 64% here (n≈11.0 · 3 nodes) vs 19% self-heal — the block above still applies - WARN ◆ weak-signal #61 Patio String Lights 26h - measured - ⚠ this detector has been refused as a misdiagnosis 2× — weigh the evidence above before acting - SNR margin +12 dB over the live noise floor — two hops, both marginal. - ▎ Improve the RF path — a repeater or relocation, not a rebuild - · Add/relocate a repeater on an interior path [physical · lore] - A device far from the controller or behind an RF-hostile wall (metal, foil, stucco-over-lath) is - ▸ Refresh values (re-poll, non-mutating) [safe · source] - ▸ Rebuild routes — NOT recommended here [disruptive · source] ⊘ no topology change — won’t help - also deletes any manually-set priority routes. Only use it after devices were physically … - ⚠ ledger measured 64% here (n≈11.0 · 3 nodes) vs 19% self-heal — the block above still applies + ○ auto-ping off — any score must come from other traffic + Alive↔Dead 6× in 2 h; currently dead for 3 h. + ▎ Reachability runbook — a rebuild cannot repair an unreachable node + ▸ Ping the node (reachability request) [safe · source] + Sends a ping request. HA does not return the result, so watch the node's status/last-seen … + ✓ helped 71% (n≈7.0 · 3 nodes) vs 22% self-heal + · Power-cycle the device, then exclude/re-include if it persists [physical · lore] + CRIT ◆ return-path-degraded #70 Basement Leak Sensor 5h + measured + ○ auto-ping off — any score must come from other traffic + Reply-timeout rate 8.2% vs a 0.9% baseline for this time of day, sustained 5 h. + ▎ Improve the RF path — a repeater or relocation, not a rebuild + · Add/relocate a repeater on an interior path [physical · lore] + A device far from the controller or behind an RF-hostile wall (metal, foil, stucco-over-lath) … + ▸ Refresh values (re-poll, non-mutating) [safe · source] + ▸ Rebuild routes — NOT recommended here [disruptive · source] ⊘ no topology change — won’t help + … it also deletes any manually-set priority routes. + ⚠ ledger measured 64% here (n≈11.0 · 3 nodes) vs 19% self-heal — the block above still applies + ▾ 1 more symptom not shown — actionable first, then worst; ↑↓ to reach them [↑↓] SYMPTOM [A] ACTIONS [1-9] SCREENS [Q] BACK diff --git a/zwave_tui/CHANGELOG.md b/zwave_tui/CHANGELOG.md index c1e0cc3..a841074 100644 --- a/zwave_tui/CHANGELOG.md +++ b/zwave_tui/CHANGELOG.md @@ -1,5 +1,187 @@ # Changelog +## 0.80.0 + +What the engine already knows reaches the screen where an operator looks for +it, ordered by urgency and whole at 80 columns. The Overview strip counts +critical symptoms; ENGINE ranks its tracked nodes alarm-first, gives a down +driver link's cause and cost rows of their own, and lists confirming episodes +first with their arm kept at 80 columns. Detail labels its probe ratio as +lifetime, shows its page and end keys, and says "RF health nominal" only at a +score of 80 or more. REMEDY counts the nodes too quiet to rate timeouts, says a +learning arm made things worse even with no measured control arm, and renders +its tallies, evidence, titles, headlines and caveats as whole forms. LOG names +an unverifiable closure's subtype beside its verdict and says when a manual +ping was answered. The stored files keep their format. + +### Changed — the Overview strip counts critical symptoms + +- The roster's `!` mark is per row, so with the default health sort a crit on + an A-scored node sat below the fold at 80x24 and 120x40 and nothing else on + the home screen said one existed. The strip carries a red `CRIT N` right + after `DEAD` while any symptom is critical — the count REMEDY's summary calls + `N critical`, mesh-wide symptoms included. Inserted, not appended: + `fieldStrip` sheds from the end, and an appended field was the one dropped + at 80 columns. Absent at zero, so a healthy strip is unchanged. + +### Changed — ENGINE ranks its tracked nodes alarm-first before the 8-row cap + +- The auto-ping snapshot lists nodes in id order and ENGINE shows 8. Six + low-id nodes holding a 24 h own-probe kill and two Dead ones filled the + list, and a high-id `GAVE UP — needs a human` row fell into `○ 1 more + tracked node(s)` at every terminal size. The rows are ranked first: a + give-up (`GAVE UP` or `CANNOT SEND`), then a node Dead now, then a miss + streak, then the rest, node id breaking ties. + +### Changed — a driver link that is not live names its cause and cost on rows of their own + +- The client's prose was the label row's second bit, so at 80 columns a link + that went dormant mid-run read `DRIVER LINK dormant · +1`. Outside `live`, + `connecting` and `handshake` the prose has its own row, clipped to whole + words, and a `dormant`, `backoff` or `stopped` link adds `background RSSI, + S2-desync and duplicate-frame watches are off`, in shorter whole forms + where the row is narrow. + +### Changed — LEDGER — LIVE lists confirming episodes first and keeps their arm at 80 columns + +- Episodes rendered oldest first, six rows: seven chronic episodes hid the one + in its confirmation window — the one an action now would confound — behind + a bare `○ 2 more open episode(s)`. Confirming episodes come first, in ledger + order within each group, and the overflow line counts how many it hides are + confirming: `○ 2 more open episodes (1 confirming)`. +- The 36-column `confirming — symptom absent, scoring` made the arm bit the one + shed at 80 columns, so a confounded episode and a clean control point both + read `· +3`. The long form is used only where the arm bit still fits after + it; otherwise `confirming` or `degraded` carries the row: `#12 + return-path-degraded degraded · confounded — neither arm · open 15m · +1`. +- At 60 to about 71 columns, behind a long node id and kind name, the one-word + form still shed the arm. There the arm takes shorter words — `confounded`, + `control arm`, and for an action `action: X`, then `X`, then `action` — so + the rows read apart: `#12 return-path-degraded degraded · confounded · +2`, + `#14 chronic-return-path confirming · control arm · +2` and `#41 + return-path-degraded confirming · healNode · +2`. + +### Changed — Detail labels its probe ratio as lifetime, shows its page and end keys, and says "nominal" only at 80 or more + +- The Probes ratio is cumulative, and the only word that said so was the + pre-0.40.2 caveat three rows below, which retires for a node first seen + after the epoch. The window rides on the value: `84/98 answered (86%, + lifetime) · 31 self-proven`, `84/98 (86%, lifetime) +1` at 40 columns. +- Space/b page and `G` jumps to the end, where EVIDENCE sits below the fold at + 80x24 for every device shape, and the bar named only the one-row scroll. It + reads `[↑↓] SCROLL [␣/b] PAGE [G] END [< >] NODE [A] ACTIONS [1-9] SCREENS + [Q] BACK` at 80; narrower, the two are the first caps shed, with `+2`. +- No flag means no lane crossed its own flag threshold, and an unflagged 66/D + read `RF health nominal` under `SCORE 66 (D)`. Below 80 the legend reads + `no flag threshold crossed — the score is lost in sub-threshold lanes (see + RTT/Margin/Timeouts/LWR)`, or a shorter whole form: the route lane's hop + count and data rate are on the LWR row. + +### Changed — REMEDY counts the nodes too quiet to rate timeouts in the learning and partial states + +- Both return-path detectors skip a node whose 10-minute window holds under + 20 sends, and the partial state's `timeouts 33/39` read as 33 nodes judged: + the screen was byte-identical with 0 and with 39 such nodes. In the + learning and partial states the counts carry `unmeasured N` after + `timeouts`, and a line after the paragraph says `timeout: N too quiet in 10 + min to rate — the return-path detectors skip them.`, in shorter whole forms + where the row is narrow. + +### Fixed — a learning arm's harm warning was silent with no measured control arm (0.44.0) + +- `efficacyNote` returned nothing whenever the kind's self-heal rate was + unmeasured, before it looked at the attempts or the below-readiness harm + warning, so an arm tried 2.9 times with every attempt worse read the same + silence as one never tried. It renders `≈ still learning this action (n≈2.9 + of 4) — self-heal not yet measured — ⚠ every attempt so far made it WORSE + (too few to be sure)`; nothing only with no attempts and no base rate. +- In both learning ladders the hedge is shed before the warning: at 80 + columns the note reads `≈ still learning this action (n≈2.9 of 4) — ⚠ every + try made it WORSE` where it read the readiness fraction alone. Where that + does not fit, a rung that keeps the warning comes ahead of the bare + fraction: `≈ still learning — ⚠ every try made it WORSE` at 60 columns, and + `≈ ⚠ every try made it WORSE` at 40. A partial harm sheds the same way, as + `⚠ n≈1.5 made it worse`. + +### Changed — REMEDY's tallies, evidence, titles, headlines and caveats are whole at 80 columns + +- Each tally line was one sentence and a blind truncate, ending `weigh the + evidence a`, `too few readings to ju` and `probe re-` at 80. Each takes the + longest whole form that fits, clipWords as the floor, and none wraps: the + screen does not scroll, and a taller card pushes the plan off the frame. The + owed-probe and cannot-be-probed lines do the same. +- The evidence row was one join and a truncate: weak-signal's `failed + deliveries 13 …` lost its window, and rtt-degraded's restart allowance + stopped mid-word. Each measurement is a `shedLine` token, dropped whole with + `+N`, and carried to continuation rows only where not even the first fits. + The tokens keep the row's ` · `, wider than the ` · ` some values carry + inside themselves (`baseline 38±6ms · capped at 300ms`): `shedLine` takes + its separator as an argument, and every other caller keeps ` · `. +- Four candidate titles are 70–80 columns before an 8-column indent, so the + head overflowed and the `+1` disclosing the shed tag went with it — the RF + survey row ended `measurement needed to` with `[physical · inference]` + silently gone. Those candidates carry a short title (`Survey the RF + environment — measurement needed [physical · inference]` at 80), and the + floor clips the short title to whole words with `+1`. The plan headline + takes a short form where the planner gives one (edge-cluster's `… check the + common relay`), with clipWords as the floor. +- The caveat below a candidate is chosen by sentence, not by wrapped line: the + sentence naming priority routes first, its clause where the sentence is too + wide, clipWords at `W − 8` as the floor. A wrap had split "priority" from + "routes" (`…deletes any manually-set priority …` at 80) and the indent ate + the ` …` at 120; every rebuild card names priority routes at 80 and 120. +- Every empty state's paragraph — disabled, no nodes, learning, partial, and + the all-clear's `Every node has a graduated timeout and rtt baseline` pair — + and the two-line ceiling note are kept line for line where they fit and + re-flowed to whole words where they do not. At 40 columns the all-clear's + first line read `Every node has a graduated timeout a`; at 60 the disabled + and no-nodes paragraphs were cut, and the ceiling note ended `slowdown is + …`. The rssi note takes the longest whole form that fits, and the ✓ + headline sheds to `✓ All clear — N learned, no symptoms.` and then `✓ All + clear — no symptoms.`, with clipWords as the floor. + +### Changed — LOG names an unverifiable closure's subtype beside its verdict + +- The ring line carried no subtype — only the container's stdout line tagged a + transient or undersampled closure — so a structural, by-design or + cadence-limited closure all read `closed unverifiable (no action)`; and the + confounded tag sat at the end of the line, where the 80-column list row cut + it. The qualifier follows the verdict word: `rtt-degraded closed + unverifiable: transient (no action)`, `: undersampled`, `: unprobeable`, and + ` (confounded)` on a scored verdict credited to neither arm. + +### Changed — LOG says when the operator's ping was answered + +- A miss on a manual ping reached LOG and the ENGINE streak; an answer reached + only the debug log, so `p` reported the ping sent and then nothing. The judge + books `node N answered your ping (lastSeen advanced)` at info, for the + manual lane only. With a runner the `p` notice reads `auto-ping judges + whether it answered — see LOG (e)`, and without one `HA does not return the + answer — watch its Status / Last-seen`. The Actions-menu CONFIRM note says + `Where auto-ping runs it judges the answer in LOG; otherwise watch the + node's Status / Last-seen.`, and the whole note wraps to 6 lines at 80 + columns and 7 at 60, so the box keeps its `type CONFIRM to arm` prompt and + `Esc = cancel` at 80x16 and 60x18. + +### Tests + +- 2,018 tests, 23 new: 9 in `remedyScreen.test.ts`, 5 in + `engineScreen.test.ts`, 3 in `detailScreen.test.ts`, and one each in + `actionsCatalog.test.ts`, `chrome.test.ts`, `overviewScreen.test.ts`, + `zwaveDataChurn.test.ts`, `autoPing.test.ts` and `sessionActions.test.ts`; + 2 Probes-row assertions in `detailScreen.test.ts` now expect the lifetime + label, and the 0.71.0 Ping-note assertion in `actionsCatalog.test.ts` + expects the shorter note. 2,194 mutation-harness entries (19 labelled + equivalent): 80 new, and 15 re-anchored to the moved text: + `engine-confirming-is-labelled`, `engine-confound-outranks-action`, + `engine-shows-driver-link`, `detail-probes-honest`, + `baseline-counts-not-clipped`, `caveat-grounded-off-index`, + `caveat-not-every-candidate`, `remedy-tag-is-all-or-nothing`, + `confounded-row-names-reroute`, `confounded-row-verdict-first`, + `remedy-ceiling-note-partial`, `remedy-ceiling-note-learning`, + `remedy-learning-names-learned-detectors`, `remedy-may-go-unflagged` and + `remedy-gave-up-whole-forms`. + ## 0.79.9 Screens no longer state what the engine never measured. With no auto-ping @@ -239,192 +421,6 @@ waits on a connection that is down. Nothing stored on disk changes. they had pinned the old ones. 2,067 mutation-harness entries (19 labelled equivalent): 25 new, 5 re-anchored, and 19 removed with the code they pinned. -## 0.79.7 - -A subscribe Home Assistant answers after the add-on's 10-second timeout is -released on its socket instead of staying live with no handle, an activity -feed the statistics rebuild could not make is subscribed again a minute on -instead of staying dark until the next rebuild, and a status event read -together with a roster poll's answer is no longer replaced by the poll's older -reading. Nothing stored on disk changes. - -### Fixed — a subscribe Home Assistant answered after the client's timeout stayed live with no handle - -- Home Assistant handles one connection's commands in order, with no cancel, - and registers a subscription while it handles the subscribe. A subscribe the - client gave up on at its 10 s reply timeout therefore still registered when - Home Assistant reached it, under an id the client no longer routed, for the - life of the socket: a node's statistics or status listener (in 0.79.6 beside - the one the 60 s retry then made), a second controller feed beside the next - rebuild's, a `state_changed` feed of the whole house, or a - `zwave_js_notification` feed. The client now sends `unsubscribe_events` for - it in the turn the timeout passes, on the same socket, where Home Assistant - reaches it after the subscribe (`not_found` when the subscribe failed); - events sent under the id before it lands reach no handler, and a socket that - has closed, or is closing, takes the subscription with it. Other commands - are unchanged: an action Home Assistant has not answered in time still reads - as an unknown outcome. - -### Fixed — an activity feed a rebuild could not make stayed dark until the next rebuild (0.8.0) - -- A rebuild of the statistics feeds whose `state_changed` subscribe failed (no - answer within the client's 10-second timeout, or a connection closed under - it) kept its controller and node feeds and logged the failure, and nothing - made the feed before a Home Assistant reconnect, the self-heal or a re-arm: - no value or notification rows on the Log screen, Detail's LIVE ENTITIES and - the device menu's `now:` from the 10-minute full state read, and the pause - toggle turned on in Home Assistant read only there. The - `zwave_js_notification` subscribe, in the same try, was not sent, and one - that failed on its own was dropped without a line while the log named it - subscribed. Each activity feed is now a try of its own, and one a rebuild - could not make is subscribed after the first roster poll that succeeds a - minute after the attempt (on the host's uptime): only the feeds not made, - one attempt at a time, and again a minute after each that fails; the attempt - that makes the state feed reads the states again. Each handle it makes is - kept with the feed set's as it is made, so a re-arm releases it, one begun - while its second subscribe is out included; one answered after another - rebuild began, or while a re-arm releases the feed set, is released and not - kept. It stands aside while a rebuild runs or the feed set is down, but not - for a re-arm an entry reload latched, which leaves the activity feeds as - they are. The Log screen reads `activity feed down — its state_changed - subscribe failed; retried after a minute` until it is made, and the add-on - log names each failed feed (`activity subscribe failed (state_changed): …`). - A failure on a connection that is down adds no row, and the feeds after it - are not tried: the reconnect's rebuild makes them and adds the row. -- A failed activity subscribe does not fail the rebuild: failed, the rebuild - would run again at every roster poll, making the controller's feed and every - node's two again each time. - -### Fixed — a status event read together with a roster poll's answer was taken as older than the poll's reading (0.79.6) - -- Over uncompressed frames the client can hand a status event Home Assistant - sent right after a `network_status` answer to its handler before the poll - that awaited the answer resumes, so the poll acted on its older reading - after the event. A revival read that way, after a poll that reads the node - Dead, re-subscribed its feeds for nothing; a death read with the first poll - since the node's status feed answered gave way to that poll's reading, which - left the death queued when the node revived before the next poll, or had - the next poll re-subscribe the node for nothing when it stayed dead. Each - alive, dead, sleep or wake up event now takes an order mark: a node whose - live status feed heard one after both the poll and the feed were sent is - neither judged by that poll nor given its reading as a baseline, and every - other poll's reading is the live feed's baseline (0.79.6: only the first - poll sent after the feed answered). With permessage-deflate, which the - client offers, Home Assistant's and the Supervisor's sockets compress every - frame (inferred from the aiohttp sources), and the poll acted first there. -- A status a node's old status feed hears while the node's own re-subscribe - releases it (the statistics feed goes first, unless the 60 s retry made it - after the status feed) is counted once and kept as the newer: through - 0.79.6 a poll that read such a death before the new status feed answered - counted it again, and the new feed was seeded with the older reading, which - left the death queued when it heard the revival. -- A status a feed a re-arm is still releasing sets on a node whose rebuild - status subscribe fails no longer seeds the status feed the 60 s retry makes - once a roster poll has read the node since: in 0.79.6 the retry's feed kept - it, and a death it then heard first was not counted. - -### Tests - -- 1,951 tests, 57 new: 25 in `nodeFeeds.test.ts`, 10 of them pins that pass - on 0.79.6 too; 16 in `activityFeeds.test.ts`, a model of Home Assistant's - core event bus; 8 in `haWsClientLateSubscribe.test.ts`, a model of its - per-connection command order; 3 in `realClient.lateSubscribe.test.ts`, the - data layer over the real client and a mock Core with node objects - (`_realHa.ts`, `_realRun.ts`); 2 in `statusOrderRealClient.test.ts` and 2 - in `statusReleaseRealClient.test.ts`, the real client with frames - uncompressed and compressed; and 1 in `activityFeedsLate.test.ts`. 2,061 - mutation-harness entries (19 labelled equivalent): 56 new, 8 re-anchored, - and 3 removed with the code they pinned, one of them labelled equivalent. - -## 0.79.6 - -A node replaced with `replace_failed_node`, or included on a freed id, has its -statistics and status feeds made again on its new node object in Home -Assistant, and the 60-second retry of a failed node subscribe now subscribes. -A driver server on another network leaves the driver link stopped, not -reading live, and a stick swap no longer stops the driver link for the rest of -the run as a driver server on another network. Nothing stored on disk changes. - -### Fixed — a replaced node's feeds stayed on the failed node until the next rebuild - -- Home Assistant binds each node's statistics and status feed to the node - object it resolves at subscribe time, and a node replaced (by the same - product or another) or included on a freed id is a new object there, which - no earlier feed hears. Through 0.79.5 the new device had no statistics feed - and its Dead/Alive crossings were counted by neither the feed nor the roster - fallback until a Home Assistant reconnect, the self-heal or a re-arm, while - Detail's EVIDENCE badges read its feeds live. A node's two feeds are now - released and made again on their own after the roster poll that reads it not - ready after it read ready, shows a status change its status feed did not - deliver (the replacement of a failed node that read not ready; a new status - feed's baseline is the first poll sent after it answered), shows its device - changed, or lists it again after a poll found it off the roster (an id back - with no device as last loaded asks for a registry load). A re-interview of - the same node is re-subscribed too, as Home Assistant's websocket does not - tell the two apart: one release and subscribe more. -- A node included after the feed set was built, or an evicted id back on the - roster, had no feeds until a rebuild either: it is subscribed after the poll - that lists it. An evicted node's feeds are released at the eviction, and - feeds a re-arm released are not released again. -- A driver restart costs no per-node re-subscribe: the nodes wait for the - re-arm its entry reload latches, and a status feed made since the previous - poll is not judged by a change it may have missed, so a replacement by the - same product of a failed node that read not ready, landing between the - node's two subscribes, leaves its statistics feed on the removed node until - a later interview start, absence or swap re-subscribes it, or the feed set - is rebuilt. A per-node subscribe that resolves after a re-arm began, or on - another connection, is released and not kept. Neither a node's own - re-subscribe nor the retry runs beside a reconnect's rebuild, and a rebuild - it superseded that fails on the new connection no longer lets a roster poll - start a second one beside it. Feeds a node's own re-subscribe or the retry - makes never stamp the fleet's liveness clock, so the dead-feed watchdog and - `binary_sensor.zwave_tui_degraded` still see the rest of the feed set, the - controller's included, fall silent. - -### Fixed — a failed node subscribe was never retried (0.26.0) - -- The 60 s retry passed no list for the handles, and the optional-chained push - skipped the subscribe with it: a node whose subscribe failed was marked - subscribed with no feed made, its EVIDENCE badges reading live. The retry - now subscribes, by the node's device as last loaded, keeps the handles where - a re-arm releases them, stands aside while a rebuild runs, the feed set is - down or a node's own re-subscribe is out, and drops from its queue a node - the roster has shown gone (it is subscribed once it is back) or one with no - device as last loaded, such as one queued by an old network's device the - boot load admitted (it is subscribed once a load gives it one). - -### Fixed — a driver server on another network could leave the driver link reading live after it was stopped - -- When the homeId cross-check proved a mismatch inside the driver's state - dump (Home Assistant's home id already known when the dump landed, as after - a home-id change), it stopped the driver client, and the rest of the dump - then declared the stopped client live: DRIVER LINK read `live` with no - connection under it, the S2 lane read `refused` (`s2_lane` too), and - nothing reconnected it until the next home-id change or restart. The - client now stays `stopped`, beside the homeId mismatch row, and a dump cut - short by a stop hands on no further node and is not logged as processed. A - stop from the handshake's home-id callback ends the handshake the same way; - nothing in the add-on stops the client there today. - -### Fixed — a stick swap could stop the driver link for the rest of the run - -- A home-id change cycles the driver client, and kept the previous server's - home id until the new handshake: a read of the cross-check in between (the - sleeper watch reads it on every call) compared it with the new id, purged - the driver telemetry and stopped the client for the rest of the run, though - the driver server had moved to the new network too. The cycle forgets it now. - A driver link back on the new network before Home Assistant reports the new - home id still reads as one on another network, telemetry purged and client - stopped, until the roster poll that reads the new id runs the cycle. - -### Tests - -- 1,894 tests, 41 new: 34 in `nodeFeeds.test.ts`, a model of Home - Assistant's node feeds bound to zwave-js-server-python node objects, 4 in - `driverWsClient.test.ts`, 2 in `zwaveDataChurn.test.ts` and 1 in - `deviceSwapSim.test.ts`; 2,008 mutation-harness entries (20 labelled - equivalent, 2 of them new): 66 new, 2 re-anchored. - ## Older releases Earlier releases are in the full changelog history on GitHub: diff --git a/zwave_tui/DOCS.md b/zwave_tui/DOCS.md index 16419fd..4755268 100644 --- a/zwave_tui/DOCS.md +++ b/zwave_tui/DOCS.md @@ -929,7 +929,7 @@ The SSH transport's parser (`server.ts`, `parseInput`; it also stripped telnet I **The Log screen's private navigation** (`applyLogKey` in `input.ts`) runs a second cursor (`view.logCursor`) over the date/severity-filtered event list: `j/k` or arrows move one row, `space`/`b` page (page size = `logLayout(rows).listRows - 1`), `g` jumps to newest and resumes follow-tail, `G` to oldest, `Enter` opens the associated node's Detail, `o` toggles errors-only, `m`/`M` acknowledges the selected error (releases its bold-red latch for every session, v0.33 — §3.7), `d` cycles `LOG_RANGE_ORDER` (`all → hour → 24h → today → yesterday → 7d`). The cursor is anchored by the event's stable `seq` (`syncLogCursor`), so new events prepending to the newest-first ring never drift the highlight. -**The Detail screen's private navigation** (`applyDetailKey` in `input.ts`, v0.22) owns the dossier scroll (`view.detailScroll`, the first visible body row) because the per-node dossier is now taller than a terminal: `↑`/`↓`/`j`/`k` scroll one row, `space`/`b` page (≈ `rows − 4`), `g`/`G` jump to top/bottom. Because scrolling claims `j/k`, **node stepping moves to `<`/`>`** (with unshifted `,`/`.` aliases), which advances/retreats `view.selected` and resets `detailScroll` to `0` so a new node opens at its header. Every Detail entry path — `Enter`, the Log-screen jump, `<`/`>`, and the `2` screen key — resets `detailScroll` to `0`. The renderer clamps `detailScroll` to the real content height and **writes the clamped value back** into the view each frame (the same sticky-window pattern the Log screen uses for `logScroll`), so the input layer never needs to know how tall the dossier is; the current window rides as an `a–b/N` token in the title rule. +**The Detail screen's private navigation** (`applyDetailKey` in `input.ts`, v0.22) owns the dossier scroll (`view.detailScroll`, the first visible body row) because the per-node dossier is now taller than a terminal: `↑`/`↓`/`j`/`k` scroll one row, `space`/`b` page (≈ `rows − 4`), `g`/`G` jump to top/bottom. The command bar names `[␣/b] PAGE` and `[G] END` beside `[↑↓] SCROLL` (v0.80.0) — EVIDENCE is below the fold at 80x24 for every device shape, and the bar named only the one-row scroll; at 80 columns all caps fit, and narrower these two are the first shed, with `+2`. Because scrolling claims `j/k`, **node stepping moves to `<`/`>`** (with unshifted `,`/`.` aliases), which advances/retreats `view.selected` and resets `detailScroll` to `0` so a new node opens at its header. Every Detail entry path — `Enter`, the Log-screen jump, `<`/`>`, and the `2` screen key — resets `detailScroll` to `0`. The renderer clamps `detailScroll` to the real content height and **writes the clamped value back** into the view each frame (the same sticky-window pattern the Log screen uses for `logScroll`), so the input layer never needs to know how tall the dossier is; the current window rides as an `a–b/N` token in the title rule. ### 3.3 The shared frame() contract @@ -1020,7 +1020,7 @@ The breakpoints are `NARROW_COLS = 75` (below it RATE · SEEN · BATT drop so th **Column semantics worth noting:** the **TMO** column is `responseTimeoutPct(stats)` = `timeoutResponse / max(commandsTX, MIN_TX_FOR_RATE)` — the real RF-reliability signal — **not** `commandsDroppedTX`, which stays near-zero on RF ACK loss (a lost link marks a node *dead* while the drop counter never moves; RESEARCH.md §0). `RATE` maps `protocolDataRate` via `{1:'9.6k', 2:'40k', 3:'100k', 4:'LR'}`. `ROUTE`/`HOP` read the LWR repeater chain; Long-Range nodes show `·LR` / `direct·LR`. -**Summary telemetry strip** (`telemetryStrip`): `NODES / ONLINE / DEAD / ASLEEP / FLAKY` counts, an `UNKNOWN` count when any node's status is Unknown, a `NOISE` field (`-95 dBm assumed` in grey when `hasRealNoise()` is false — the assumed floor is named, not hidden), a `FAILING` count when any node not already counted as dead, flaky or unknown grades F (v0.52.0), and a `MESH ████░░ NN%` meter where `meshFrac = (total − dead − flaky − unknown − failing) / total`. **Right-status** (`rightStatus`) prioritizes: a live `/` filter capture → link-lost/roster-stale warning → an animated `⠋ REBUILDING ROUTES 3m12s` token (a braille spinner, plus the elapsed time when the rebuild's start is known) while `controller.isRebuildingRoutes` → a committed filter token → empty. +**Summary telemetry strip** (`telemetryStrip`): `NODES / ONLINE / DEAD / ASLEEP / FLAKY` counts, a red `CRIT` count right after `DEAD` while any symptom is critical (v0.80.0 — the count REMEDY's summary line calls `N critical`, mesh-wide symptoms included; the roster's `!` mark is per row, so with the default health sort a crit on an A-scored node sat below the fold at 80x24 and 120x40 with nothing else on the frame naming it, and `fieldStrip` sheds from the end, so an appended field was the one dropped at 80 columns; absent at zero, so a healthy strip is unchanged), an `UNKNOWN` count when any node's status is Unknown, a `NOISE` field (`-95 dBm assumed` in grey when `hasRealNoise()` is false — the assumed floor is named, not hidden), a `FAILING` count when any node not already counted as dead, flaky or unknown grades F (v0.52.0), and a `MESH ████░░ NN%` meter where `meshFrac = (total − dead − flaky − unknown − failing) / total`. **Right-status** (`rightStatus`) prioritizes: a live `/` filter capture → link-lost/roster-stale warning → an animated `⠋ REBUILDING ROUTES 3m12s` token (a braille spinner, plus the elapsed time when the rebuild's start is known) while `controller.isRebuildingRoutes` → a committed filter token → empty. **Scrolling.** `windowStart(selected, scroll, total, cap)` (exported and reused by the Log screen) computes the first visible index so the cursor stays in view: it clamps `scroll`, pulls the window up if `selected < start`, pushes it down if `selected ≥ start + cap`, and bounds it to `max(0, total − cap)`. Overview's body cap is `max(1, H − 5)` (4 chrome rows + command bar); a `(first–last/total)` position counter (e.g. `(12–28/39)`) is appended after the command bar only while the roster overflows; the bar reserves its columns, dropping whole keycaps to make room, and the row is re-truncated to width. Empty/loading states route to `centeredNotice()`, a framed `BOX` card that also backs the other screens' notices. @@ -1030,7 +1030,7 @@ The breakpoints are `NARROW_COLS = 75` (below it RATE · SEEN · BATT drop so th Each overlay reuses `frame()`, `centeredNotice()`, the `c.*` palette and the gauges, and each guards its own height so real data survives a short terminal. -- **Detail** (`detail.ts`) — a **scrollable eight-section per-node dossier** (IDENTITY / LIVE LINK / **LIVE ENTITIES** / **CONFIG PARAMETERS** / ROUTES / TRAFFIC / **EVIDENCE** + a pinned flag legend). As of v0.22 the dossier is taller than a terminal, so the body scrolls (`view.detailScroll`, §3.2) instead of shedding graphics: the health/battery gauges, SNR meter, and RSSI/RTT/coarse trend sparklines are all kept as scrollable rows (a graphic still returns `null` and is skipped when it can't fit its *columns*). **LIVE ENTITIES** joins the HA entities in the node's entity list (§2.3: not every device filed under the node id contributes to it) with their current state via `data.entityStates(nodeId)`, formatted per-domain by the pure `formatEntityState()` — a light's `on · 72%`, a sensor's value + unit, a `binary_sensor` read through its `device_class` (motion → *detected*, door → *open*), climate mode + setpoint/current temp, cover open/closed + position, lock state, firmware-update availability, and a button/event's last-fired age. **CONFIG PARAMETERS** lazily fetches the device's Z-Wave configuration via `data.requestConfigParams(nodeId)` / `data.configParams(nodeId)` (see §2.3) and lists each parameter's label · value + unit · enum meaning, marking read-only params `(ro)`; it shows an honest *loading / unavailable / none* line while resolving. **EVIDENCE** (v0.35) is the section about the *engine* rather than the node: everything above it is what the device reported, and this is whether anyone was listening. It reads `DataProvider.evidenceCoverage(nodeId)` (§5.7) for the cumulative sample count, the **fresh** share, and a live/down badge per feed; `evidenceCoarse(nodeId)` for the persisted history span; and `rssiNormal(nodeId)` for the engine's own learned yardstick. Since v0.71.0 the sweep's **Probes** row is followed by a **Frame** row — `all NoOp pings: answered = reached on a stored route`, `all routed reads: answered = reached by any route`, or the lifetime tally split `read k/a (p%, any route) · ping k/a (q%, stored routes)` with each rate toned on its own, the longest whole form that fits — and, above zero, a **Rerouted** row counting sweep reads that failed over from a stored route (§11.12). Three honesty rules govern it. (1) A node whose status **and** stats feeds are both down is named a **MONITORING HOLE** in red — silence from an unwatched node is not health, and every quiet verdict elsewhere on the dossier silently depends on the opposite. (2) The fresh share is labelled **lifetime** and toned by band (≥80 % green, ≥40 % yellow, below that red) — the counters are cumulative since first sight, so this is a *chronic* share that cannot move fast; a node that went stale yesterday still shows last month's green here, and the label says so rather than implying a now-reading (v0.35 review). Zero samples renders a dash, never a confident `0 %`. Since v0.74.1 the Probes, Samples and Frame rows print shares through `honestPct`: `100%` only when every one counted, `0%` only when none did, and a share that merely rounds to either end reads `>99%` or `<1%` (474 of 475 used to print `100%`). (3) An **un-graduated** baseline says `still learning · Nd so far — not yet a yardstick` rather than quoting a median (for RTT, since v0.79.0, `— held to the 300 ms ceiling meanwhile` where the ceiling judges the node, followed by the coarse tier's count of route changes; `no normal yet — held to the 300 ms ceiling meanwhile` for a node the store has never folded; a capped learned line ends `· line capped at 300 ms`): quoting one is indistinguishable on screen from a learned band and is actionable exactly when it must not be. A graduated band is suffixed `· this time-of-day band` — the store keeps a separate normal per 4-hour band and the row answers for the band containing *now*, so the same node legitimately shows a different yardstick at 3 am and 3 pm; unlabelled, that read as the baseline contradicting itself. The `History` figure is labelled a **span** (first persisted bucket to now), not coverage — an observation gap lives inside it. And the feed badges mean *subscription AND socket*: the idempotency sets survive a disconnect, so unguarded they would glow green through the largest monitoring hole there is — an HA-socket outage — which is exactly when the MONITORING HOLE line must be able to fire. IDENTITY additionally carries the **HA device id** (v0.35) — the string a `device_id:` automation target needs, omitted rather than blanked when the registry join failed. TMO here is the same `responseTimeoutPct`; the raw `commandsDroppedTX/RX` counters live honestly in TRAFFIC. Long-Range nodes show `direct to controller (Long-Range star)` instead of a mesh route. The Detail screen itself is **read-only** — it surfaces state + configuration but changes nothing; *acting* on a device (turning it on/off, unlocking a lock, writing a config parameter) is done from the **Actions Menu** (`a`), behind the write-actions + type-CONFIRM gate (v0.23, §2.8). +- **Detail** (`detail.ts`) — a **scrollable eight-section per-node dossier** (IDENTITY / LIVE LINK / **LIVE ENTITIES** / **CONFIG PARAMETERS** / ROUTES / TRAFFIC / **EVIDENCE** + a pinned flag legend, which reads `RF health nominal` for an unflagged node only when its score is 80 or more — below that, `no flag threshold crossed — the score is lost in sub-threshold lanes (see RTT/Margin/Timeouts/LWR)` or a shorter whole form, since no flag means no lane crossed its own threshold, not that nothing is wrong, and an unflagged 66/D read *nominal* under `SCORE 66 (D)`; the route lane's hop count and data rate are on the LWR row; v0.80.0). As of v0.22 the dossier is taller than a terminal, so the body scrolls (`view.detailScroll`, §3.2) instead of shedding graphics: the health/battery gauges, SNR meter, and RSSI/RTT/coarse trend sparklines are all kept as scrollable rows (a graphic still returns `null` and is skipped when it can't fit its *columns*). **LIVE ENTITIES** joins the HA entities in the node's entity list (§2.3: not every device filed under the node id contributes to it) with their current state via `data.entityStates(nodeId)`, formatted per-domain by the pure `formatEntityState()` — a light's `on · 72%`, a sensor's value + unit, a `binary_sensor` read through its `device_class` (motion → *detected*, door → *open*), climate mode + setpoint/current temp, cover open/closed + position, lock state, firmware-update availability, and a button/event's last-fired age. **CONFIG PARAMETERS** lazily fetches the device's Z-Wave configuration via `data.requestConfigParams(nodeId)` / `data.configParams(nodeId)` (see §2.3) and lists each parameter's label · value + unit · enum meaning, marking read-only params `(ro)`; it shows an honest *loading / unavailable / none* line while resolving. **EVIDENCE** (v0.35) is the section about the *engine* rather than the node: everything above it is what the device reported, and this is whether anyone was listening. It reads `DataProvider.evidenceCoverage(nodeId)` (§5.7) for the cumulative sample count, the **fresh** share, and a live/down badge per feed; `evidenceCoarse(nodeId)` for the persisted history span; and `rssiNormal(nodeId)` for the engine's own learned yardstick. Since v0.71.0 the sweep's **Probes** row is followed by a **Frame** row — `all NoOp pings: answered = reached on a stored route`, `all routed reads: answered = reached by any route`, or the lifetime tally split `read k/a (p%, any route) · ping k/a (q%, stored routes)` with each rate toned on its own, the longest whole form that fits — and, above zero, a **Rerouted** row counting sweep reads that failed over from a stored route (§11.12). Three honesty rules govern it. (1) A node whose status **and** stats feeds are both down is named a **MONITORING HOLE** in red — silence from an unwatched node is not health, and every quiet verdict elsewhere on the dossier silently depends on the opposite. (2) The fresh share is labelled **lifetime** and toned by band (≥80 % green, ≥40 % yellow, below that red) — the counters are cumulative since first sight, so this is a *chronic* share that cannot move fast; a node that went stale yesterday still shows last month's green here, and the label says so rather than implying a now-reading (v0.35 review). Zero samples renders a dash, never a confident `0 %`. Since v0.80.0 the Probes row carries its window on the value — `84/98 answered (86%, lifetime) · 31 self-proven` — because the counters are cumulative and the only word that said so was the pre-v0.40.2 caveat three rows below, which retires for a node first seen after the epoch; it takes the longest whole form that fits (`84/98 (86%, lifetime)` at 40 columns) and sheds the self-proven count with `+1`. Since v0.74.1 the Probes, Samples and Frame rows print shares through `honestPct`: `100%` only when every one counted, `0%` only when none did, and a share that merely rounds to either end reads `>99%` or `<1%` (474 of 475 used to print `100%`). (3) An **un-graduated** baseline says `still learning · Nd so far — not yet a yardstick` rather than quoting a median (for RTT, since v0.79.0, `— held to the 300 ms ceiling meanwhile` where the ceiling judges the node, followed by the coarse tier's count of route changes; `no normal yet — held to the 300 ms ceiling meanwhile` for a node the store has never folded; a capped learned line ends `· line capped at 300 ms`): quoting one is indistinguishable on screen from a learned band and is actionable exactly when it must not be. A graduated band is suffixed `· this time-of-day band` — the store keeps a separate normal per 4-hour band and the row answers for the band containing *now*, so the same node legitimately shows a different yardstick at 3 am and 3 pm; unlabelled, that read as the baseline contradicting itself. The `History` figure is labelled a **span** (first persisted bucket to now), not coverage — an observation gap lives inside it. And the feed badges mean *subscription AND socket*: the idempotency sets survive a disconnect, so unguarded they would glow green through the largest monitoring hole there is — an HA-socket outage — which is exactly when the MONITORING HOLE line must be able to fire. IDENTITY additionally carries the **HA device id** (v0.35) — the string a `device_id:` automation target needs, omitted rather than blanked when the registry join failed. TMO here is the same `responseTimeoutPct`; the raw `commandsDroppedTX/RX` counters live honestly in TRAFFIC. Long-Range nodes show `direct to controller (Long-Range star)` instead of a mesh route. The Detail screen itself is **read-only** — it surfaces state + configuration but changes nothing; *acting* on a device (turning it on/off, unlocking a lock, writing a config parameter) is done from the **Actions Menu** (`a`), behind the write-actions + type-CONFIRM gate (v0.23, §2.8). - **Controller** (`controller.ts`) — node 1 plus a mesh roll-up: IDENTITY (home id in hex+dec, RF region, fw/SDK, primary/SUC/SIS roles), a **rebuild-routes banner present only while rebuilding** (honest elapsed time + an indeterminate sweep bar — HA exposes only the boolean, never a fake %), a **CONTROLLER FRAMES (host↔stick)** counter grid whose reliability gauge fills with the SUCCESS rate (v0.24 — it previously filled with the error fraction, so a flawless link drained the bar to empty) and counts only true serial faults (dropped TX/RX, NAK, CAN, timeout ACK, timeout callback); `timeoutResponse` is a NODE reply timeout and is shown separately rather than charged to the serial link, matching interference.ts's serial band. BACKGROUND RSSI (an empty per-channel row reads `not reported by HA` with the driver link's state beside it as one whole token, shed with `+1` where the row has no room: `driver-WS client not configured`, `driver link retrying (see ENGINE)`, `homeId mismatch (see ENGINE)`, or `driver link live (see INTERFERENCE)` — a live link is only named there, because that row is also empty when a reading lacks channel 0; the head's whole short form `per-channel floor: not from HA` is taken where only it carries the token, or where the long one leaves no room for the `+1`, as at 40 columns; v0.79.9), and a NETWORK HEALTH A–F grade histogram with alive/dead/asleep and direct/routed/LR tallies. The rebuild block being conditional keeps the frame hash static (no flicker) when idle. **v0.28** adds two surplus-funded blocks drawn only when rows are genuinely spare: **RECENT RATES (per hour)** reads `interference().serial` — which this screen never touched — because the counter grid above is *lifetime* and "63 reply timeouts" cannot distinguish a link failing now from a month of healthy operation that accumulated them; a rate the window is too short to divide renders `—`, never `0`. **ACTIVE MESH EVENTS** lists the engine's **network-scoped** symptoms (`nodeId === null`) only — per-node findings belong on REMEDY, and duplicating them would put one finding in two places with two row budgets — each carrying its `basis`, so an *inferred* correlation never reads as a measurement. A healthy mesh gets one honest line, not an empty panel. The surplus baseline counts the **conditional** rebuild block, so an addition can never evict the NETWORK HEALTH tallies during a route rebuild. - **Topology** (`topology.ts`) — end nodes grouped by exact LWR hop count (Direct to controller, 1 hop, 2 hops, 3 hops, …, plus Long-Range and route-pending groups), an optional hop-distribution histogram whose last bar folds 3 or more hops into `3+` (shown only when `bodyCap ≥ 15 && W ≥ 64`), per-node route `signalBars` (only when `W ≥ 72`), and a pinned **Repeater-load panel** where a *full* bar is *bad* (a repeater carrying many nodes is a single point of failure, coloured by load not fill). The route tree **scrolls** (v0.24 — `↑↓`/`j`/`k`, `space`/`b`, `g`/`G`) with a footer reading `▴N ▾M more · ↑↓ scroll · X–Y/Z`; the repeater panel is always kept. A second, **leftover-funded Route-stability panel** (v0.34) reports what the routing has actually DONE over days: `DataProvider.routeStability(nodeId)` sums the same `dRouteChanges` accumulator the `route-churn` detector reads (§7.2.4) across the persisted coarse tier, and carries the measured span so the claim cannot outrun its window. Its purpose is epistemic as much as visual — route-churn has never fired on the reference mesh, and this panel is what separates *the mesh is stable* from *the detector cannot see*. **Zero is a finding, not an empty state:** it renders as one line (`every path held — N node(s), Xd measured, zero re-routes`) rather than N rows each restating `0`; when paths HAVE moved it ranks them worst-first BY that per-**day** rate — the same number each row shows — since stores of different ages are not comparable by raw count and the detector's own threshold is a rate. The reported span is the SHORTEST node window, never the longest: it sits beside a count of ALL nodes, so it must be the window every one of them actually has. An **empty** measurement (`hours: 0`) renders nothing at all — a confident zero over no data is precisely the fabrication the collapse-method discipline forbids. It spends only rows the tree would have left blank, so a scrolling tree never loses a row to it. It previously windowed from index 0 under a `…N more (taller terminal shows all)` note that was false: the tree is ordered shallowest-first, so overflow always cut the deep-hop, Long-Range and route-pending groups — the anomalies the screen exists to show — and 39 nodes need roughly 45 lines. A third **Route-failures panel** (v0.35) draws the persisted `routeFailedBetween` history (§5.7) — the one quantity on this screen that names a **link** rather than a node. It tallies by the **pair, not the reporter**: one marginal hop that six nodes all witnessed is one row reading `n12 ⇢ n44 Hall Dimmer → Shed Lock 6 failures · last 4m12s ago`, not six rows each reading `1`. The panel is empty and costs nothing on a healthy mesh. Since v0.43.0 it is **guaranteed**, not leftover-funded: when a link has failed it takes up to `FAIL_GUARANTEE` (4) rows from the tree, or half the spare pad (floor 3) when more is free, and it is drawn when the tree scrolls too. Under strict leftover funding it never rendered on the 39-node reference mesh, whose tree fills the body. Stability keeps the leftover-only rule (drawn with ≥ 3 spare rows, its unshown rows counted in its own `+N more`); when it has something to say but no room, the title rule carries `RS⇕` (v0.60.0). ### Per-hop route readings, and why the gutter was the target (v0.29) @@ -1146,7 +1146,7 @@ The residual gutter on a *direct* node's row is not waste — a direct route has no intermediate hop to report, so there is nothing honest to put there. - **Heatmap** (`heatmap.ts`) — nodes grouped by HA area, each drawn as `heatCell`s shaded by SNR margin against `MARGIN_FULL = 25 dB`, areas stacked worst-first. Cell marks (v0.24): a graded shade for a **direct** reading, grey `▒` for a node reached **via a repeater** (its `stats.rssi` is that repeater's last-hop ACK, so it is drawn but never grades the node or the area), grey `○` for **unknown** (never contacted — distinct from dead, and the fallback whenever HA omits a status), red `✕` for **dead**, and grey `·` for asleep / sentinel RSSI. Cells rank worst-state-first so the `✕`/`○` marks survive an overflow truncation rather than being the first discarded. Areas are sorted with **all-unreachable first** (≥1 confirmed-dead node and nothing DIRECTLY GRADED (a repeater-only area is not hoisted)) — a purely-unknown area is *not* hoisted, since never-contacted nodes are not evidence of failure. The count reads `4/12n` when only some nodes contributed a direct reading, so the grade's denominator is visible. Each row also carries a mean-margin meter, the worst node, and that count, with widgets dropped outermost-first while ≥ `MIN_CELLS = 3` of heat strip survives. The legend fits itself to the terminal by dropping **whole keys** and shrinking the ramp, preferring to keep every key; its ramp is coloured by the same `marginColor` bands as the cells it explains. -- **Log** (`log.ts`) — the live activity stream. `logLayout(rows)` splits the frame into a list and an optional detail pane: the detail pane (`LOG_DETAIL_ROWS = 9`) appears only when `rows ≥ LOG_MIN_ROWS_FOR_DETAIL = 22`. Rows are `cursor · time · 3-letter kind tag · #node name · text`, coloured by severity. Errors latch **bold-red until acknowledged**: `M` (v0.33) releases the selected error's latch to plain red via `DataProvider.ackEvent(seq)` — keyed by `seq` so the head-inserting ring cannot drift the target, error-only and once-only by refusal, and SHARED (the ring is one control-room log, so an ack means *a human has seen it*, not *this terminal has*). Not a mesh write, so it sits outside the `write_actions_enabled` gate. The list window uses the shared `windowStart`, and navigation/window math live together in `input.ts` so cursor and viewport can never disagree. The detail pane's **Entity** row leads with the entity's friendly `name` and keeps the `entity_id` as the secondary (v0.35) — but only when the id still fits beside it. `field()` truncates blindly from the right, so on an 80-column frame a leading name pushed the id past the cut, clipping `sensor.node_27_illumina…` into a different, plausible id (v0.35 review). The id is the one part that must never be mangled — it is what you type into HA — so when both cannot fit, the id wins and the name is dropped, which is exactly the pre-v0.35 row. The name itself was captured on every value event by `mapStateChanged` and discarded at the render, so a pane whose entire job is *which thing did this?* answered with a slug while `Back Porch Motion` sat unread on the same object. +- **Log** (`log.ts`) — the live activity stream. `logLayout(rows)` splits the frame into a list and an optional detail pane: the detail pane (`LOG_DETAIL_ROWS = 9`) appears only when `rows ≥ LOG_MIN_ROWS_FOR_DETAIL = 22`. Rows are `cursor · time · 3-letter kind tag · #node name · text`, coloured by severity. At 80 columns a row keeps about 46 columns of text, cut on a whole word with ` …`, so an episode closure puts its qualifier right after the verdict word (`rtt-degraded closed unverifiable: transient (no action)`, `route-churn closed improved (confounded) after ping (you)`; v0.80.0, §9.3) and the row keeps it wherever the kind and verdict leave room; the detail pane prints the whole line. An answered manual ping is a line of its own (`node 7 answered your ping (lastSeen advanced)`, v0.80.0, §11.12). Errors latch **bold-red until acknowledged**: `M` (v0.33) releases the selected error's latch to plain red via `DataProvider.ackEvent(seq)` — keyed by `seq` so the head-inserting ring cannot drift the target, error-only and once-only by refusal, and SHARED (the ring is one control-room log, so an ack means *a human has seen it*, not *this terminal has*). Not a mesh write, so it sits outside the `write_actions_enabled` gate. The list window uses the shared `windowStart`, and navigation/window math live together in `input.ts` so cursor and viewport can never disagree. The detail pane's **Entity** row leads with the entity's friendly `name` and keeps the `entity_id` as the secondary (v0.35) — but only when the id still fits beside it. `field()` truncates blindly from the right, so on an 80-column frame a leading name pushed the id past the cut, clipping `sensor.node_27_illumina…` into a different, plausible id (v0.35 review). The id is the one part that must never be mangled — it is what you type into HA — so when both cannot fit, the id wins and the name is dropped, which is exactly the pre-v0.35 row. The name itself was captured on every value event by `mapStateChanged` and discarded at the render, so a pane whose entire job is *which thing did this?* answered with a slug while `Back Porch Motion` sat unread on the same object. ### 3.8 The anti-flicker 1 Hz draw loop @@ -1544,6 +1544,36 @@ members are pinned across the production bridge in `driverWsClient.test.ts`: a screen reading an optional provider member the bridge forgot to wire renders a silent blank, which is the v0.33 dead-`M`-key defect in a new costume. +**Ordered by urgency, whole at 80 columns (v0.80.0).** Three blocks held rows +the engine had computed behind ones that matter less: + +- **AUTO-PING's tracked rows** are ranked before the 8-row cap: a give-up + (`GAVE UP` or `CANNOT SEND`) first, then a node Dead now, then a miss streak, + then the rest (a 24 h own-probe kill, a probe hold), with node id breaking + ties. The snapshot is in node-id order, and six low-id nodes holding a probe + kill plus two Dead ones filled the list, so a high-id `GAVE UP — needs a + human` row fell into `○ 1 more tracked node(s)` at every terminal size. +- **DRIVER LINK** keeps the client's prose as a bit only while the link is + `live`, `connecting` or `handshake`. In any other state the prose has a row of + its own under the label (clipped to whole words), and for `dormant`, `backoff` + and `stopped` a second row says what that costs — `background RSSI, + S2-desync and duplicate-frame watches are off`. As the second bit the prose was + shed at 80 columns, so a link that went dormant mid-run read `dormant · +1`. +- **LEDGER — LIVE** lists episodes in their confirmation window first (a stable + sort, ledger order inside each group), and the overflow line counts how many + of the hidden episodes are confirming (`○ 2 more open episodes (1 confirming)`). + The lifecycle bit's long form (`confirming — symptom absent, scoring`, 36 + columns) is used only where the arm bit still fits after it; otherwise the + one-word `confirming` or `degraded` carries the row, so `confounded — neither + arm`, `action: X` and `no action — control arm` survive 80 columns. Where + even that sheds the arm — from 60 to about 71 columns, behind a long node id + and kind name — the arm steps down through shorter words: `confounded`, `control arm`, and for an action + `action: X`, then the action's name alone, then `action`. The rows still read + apart: `#12 return-path-degraded degraded · confounded · +2`, `#14 + chronic-return-path confirming · control arm · +2`, `#41 + return-path-degraded confirming · healNode · +2`. Only where no rung fits — + narrower than the session allows — is the arm shed with the count. + **Provenance (v0.41).** `LogEvent.source` gained a third value, `engine`. Auto-ping logged through `logAction` — the OPERATOR's sink — so the Log screen rendered every autonomous probe and every "STILL DEAD" give-up as `operator`, @@ -3158,21 +3188,21 @@ The REMEDY render enforces the same rule inline (§8.8): a subsumed symptom's ro **Severity sort.** Symptoms are sorted by `bySeverity`: plan-owners first — a subsumed symptom renders without a plan, so it never displaces the event that owns its remedy (v0.24.0) — then worst-first by `SEV_RANK = { crit: 0, warn: 1, watch: 2 }`, with newest-breaching (`b.sinceMs - a.sinceMs`) as the tiebreak. This guarantees "a low-severity watch can never bury a critical off the bottom." The right-hand status and a `summaryLine` (`N critical · N warning · N watch — the engine only recommends; you run the actions`, or with an auto-ping runner `… — the engine can also write on its own; see ENGINE`, v0.79.9; either tail shed whole where the row is narrow) head the body. -**Per-symptom block (`symptomBlock`).** Each symptom renders as: a header line (`SEV_TAG` + a compact basis **glyph** + kind + who + dwell age), an evidence line (leading with the full `measured`/`inferred` word, then `label value` pairs), one wrapped narrative line, then the plan. The basis glyph — `◆` green for `measured`, `◇` yellow for `inferred` — is placed immediately after the severity tag precisely so it survives truncation even on the narrowest terminal (the session clamps width to 60 columns, §11.10); it is "the only measured-vs-inferred guardrail and must never be clipped off the row." +**Per-symptom block (`symptomBlock`).** Each symptom renders as: a header line (`SEV_TAG` + a compact basis **glyph** + kind + who + dwell age), an evidence line (leading with the full `measured`/`inferred` word, then one `label value` token per measurement, composed by `shedLine` since v0.80.0 so a measurement that does not fit is dropped whole with `+N` — at 80 columns the old join was cut mid-value: weak-signal's `failed deliveries 13 …` lost its window, rtt-degraded's restart allowance stopped at `restart al` — and carried to continuation rows only where not even the first fits beside the basis word; the tokens are set apart by ` · `, wider than the ` · ` some values carry inside themselves, as in `baseline 38±6ms · capped at 300ms`), the ledger's tally lines (each the longest whole form that fits, clipWords as the floor, never wrapped — the screen does not scroll, and five tallies already take most of an 80x24 card; v0.80.0), one wrapped narrative line, then the plan. The basis glyph — `◆` green for `measured`, `◇` yellow for `inferred` — is placed immediately after the severity tag precisely so it survives truncation even on the narrowest terminal (the session clamps width to 60 columns, §11.10); it is "the only measured-vs-inferred guardrail and must never be clipped off the row." **The plan rows.** Only for a non-subsumed symptom (`sym.subsumedBy == null`), `symptomBlock` calls `planFor` and renders the headline plus up to **three** candidates (`plan.candidates.slice(0, 3)`), each on one line: - A **marker** encodes runnability: `runnable = cand.action != null && cand.blocked == null`. A runnable executable gets a green `▸`; a blocked executable gets a grey `▸`; physical guidance (`action: null`) gets a grey `·`. -- A `[cost · basis]` tag is appended via `costTag` (§8.3) + the raw basis word. +- A `[cost · basis]` tag is appended via `costTag` (§8.3) + the raw basis word. A title too long to keep its tag has a `short` form on the candidate (v0.80.0: the RF survey, the USB-2 stick, the Long-Range distance and the chatty re-include titles, 70–80 columns before an 8-column indent); the row takes the title with its tag, then the short title with its tag, then either with `+1`, and at the floor the short title clipped to whole words with `+1`. Before, an overflowing head was clipped by `shedLine` and the `+1` disclosing the shed tag went with it. The plan headline takes its own words, then a `headlineShort` where the planner gives one (edge-cluster's), with clipWords as the floor. - When `cand.blocked` is set, the reason is appended inline as ` ⊘ ` in grey. -- **The top candidate (`i === 0`) carries a wrapped rationale line**, with a trailing "…" signalling more detail exists — so a screenful of symptoms stays scannable. A rationale line naming an irreversible side effect or a known failure mode (`CAVEAT`: deletes, discards, priority route, half-interviewed, comes back, re-churn) renders at any rank, and is the line the top candidate shows when it has one (v0.45.0). -- The M5 efficacy note is rendered on **every candidate with an action** — blocked or not (v0.35; before that, runnable only). Below readiness it is not silent (v0.44.0): with a measured control arm it renders grey `≈ still learning this action (n≈… of 4) — Y% self-heal`, or `≈ never tried here — this kind self-heals Y%` for an arm never run, and nothing only when no self-heal rate is measured either. Once `e.ready` it picks its **voice** from whether the candidate is blocked: +- **The top candidate (`i === 0`) carries a rationale line**, its first words clipped with a trailing "…" signalling more detail exists — so a screenful of symptoms stays scannable. A rationale sentence naming an irreversible side effect or a known failure mode (`CAVEAT`: deletes, discards, priority route, half-interviewed, comes back, re-churn) renders at any rank, and is the line the top candidate shows when it has one (v0.45.0). Since v0.80.0 it is chosen by **sentence**, not by wrapped line (`caveatText`): the sentence that names priority routes first, then any other `CAVEAT` sentence; one wider than its row gives way to the clause inside it that carries the caveat, marked `… `, and clipWords at `W − 8` is the floor, so the marker always fits. A wrap had split *priority* from *routes* (`…deletes any manually-set priority …` at 80), and the 8-space indent ate the ` …` at 120. +- The M5 efficacy note is rendered on **every candidate with an action** — blocked or not (v0.35; before that, runnable only). Below readiness it is not silent (v0.44.0): with a measured control arm it renders grey `≈ still learning this action (n≈… of 4) — Y% self-heal`, or `≈ never tried here — this kind self-heals Y%` for an arm never run; with no measured control arm an arm with attempts renders `≈ still learning this action (n≈… of 4) — self-heal not yet measured`, harm warning included (v0.80.0 — the early return on an unmeasured self-heal rate ran before the attempt count and the warning, so an arm whose 2.9 attempts all made it worse read the same silence as one never tried), and nothing only when the arm has no attempts and no self-heal rate is measured. Where the hedged warning does not fit, `— ⚠ every try made it WORSE` keeps its place beside the readiness fraction; where that does not fit either, `≈ still learning — ⚠ every try made it WORSE` comes before the fraction alone (60 columns), and below the fraction `≈ ⚠ every try made it WORSE` (40 columns) — a partial harm sheds the same way, as `⚠ n≈1.5 made it worse`. Once `e.ready` it picks its **voice** from whether the candidate is blocked: | | runnable | blocked | |---|---|---| | beat the control arm | green `✓ helped X% (n≈… · N nodes) vs Y% self-heal` | yellow `⚠ ledger measured X% here (n≈… · N nodes) … — the block above still applies` | | ready, not distinguishable | grey `≈ n≈… · N nodes: not distinguishable from self-healing` | grey `≈ n≈… · N nodes: measured — not distinguishable from self-healing` | - | still learning | grey `≈ still learning this action (n≈… of 4) — Y% self-heal`, with a `⚠ … made it worse` clause when attempts so far regressed; grey `≈ never tried here — this kind self-heals Y%` at n = 0; *(nothing)* with no measured control rate | same as runnable | + | still learning | grey `≈ still learning this action (n≈… of 4) — Y% self-heal`, with a `⚠ … made it worse` clause when attempts so far regressed; grey `≈ never tried here — this kind self-heals Y%` at n = 0; grey `≈ still learning this action (n≈… of 4) — self-heal not yet measured` with no measured control rate (v0.80.0); *(nothing)* with neither | same as runnable | The blocked voice deliberately does NOT characterize the block. `blocked` is one string carrying three different kinds of gate — a planner-authored @@ -3193,7 +3223,7 @@ The REMEDY render enforces the same rule inline (§8.8): a subsumed symptom's ro **The Log carries a symptom's whole life (v0.45.0).** `diffSymptomLog` (exported from `zwaveData.ts`, pure, because the tick that owned the loop is unreachable from tests) diffs the live symptom set against what the log has already said and returns three transitions: **onset** (severity crit→error, warn→warn, watch→info), **escalation** (upward only), and **clearance** (always `info`, never the symptom's old severity — a red line saying a problem ENDED reads as a fault). A de-escalation updates the stored severity silently: "it got less bad" is not news, and logging it would double the volume on a flapping node. A mesh-identity change clears the map without emitting clearances — the old network's symptoms did not end; the add-on stopped being able to see them. -**Five distinct empty states (v0.46.0).** When `symptoms.length === 0`, the screen never renders a generic "all clear." It reads `data.engineStatus()` and distinguishes: **engine disabled** (`● Engine disabled` — no baselines store configured, nothing is being diagnosed), **no nodes yet** (`◷ No nodes yet` — the engine is running against an empty roster, the state in the first seconds after a restart), **still learning** (`◷ Learning — no detector has a learned yardstick yet for the 12:00–16:00 band:` followed by per-series counts — deliberately silent about symptoms, because with no learned detector able to fire "no symptoms" would describe the instrument; where the fixed RTT ceiling judges any node, it says so and that only the learned detectors wait), **partial coverage** (`◑ No symptoms — partial detector coverage`, naming the series with no learned yardstick and the node count each lacks it on), and **genuinely healthy** (`✓ All clear — N nodes learned, no symptoms detected`, then that every node has a graduated timeout and rtt baseline for the band *"and no symptom is firing"* — what the branch checked; it read "none is currently anomalous" through v0.79.8, a judgment no detector makes on a node whose 10-minute window is too thin — and, when `timeoutWindowBlind > 0`, a count with no verdict word beside the ✓: `(N of T: too little traffic in 10 min to rate timeouts.)`; v0.79.9). Rendering these identically would let "learning" masquerade as "healthy," so they are kept separate. Since v0.79.0 the counts carry `ceiling-only N` beside `rtt N/T` when any node is judged against the fixed RTT ceiling alone (§7.2.4), and both the learning and the partial state say how many: such a node is neither blind nor learned, so the partial text reads *a degradation on those nodes may go unflagged* where it read *would not be flagged*. +**Five distinct empty states (v0.46.0).** When `symptoms.length === 0`, the screen never renders a generic "all clear." It reads `data.engineStatus()` and distinguishes: **engine disabled** (`● Engine disabled` — no baselines store configured, nothing is being diagnosed), **no nodes yet** (`◷ No nodes yet` — the engine is running against an empty roster, the state in the first seconds after a restart), **still learning** (`◷ Learning — no detector has a learned yardstick yet for the 12:00–16:00 band:` followed by per-series counts — deliberately silent about symptoms, because with no learned detector able to fire "no symptoms" would describe the instrument; where the fixed RTT ceiling judges any node, it says so and that only the learned detectors wait), **partial coverage** (`◑ No symptoms — partial detector coverage`, naming the series with no learned yardstick and the node count each lacks it on), and **genuinely healthy** (`✓ All clear — N nodes learned, no symptoms detected`, then that every node has a graduated timeout and rtt baseline for the band *"and no symptom is firing"* — what the branch checked; it read "none is currently anomalous" through v0.79.8, a judgment no detector makes on a node whose 10-minute window is too thin — and, when `timeoutWindowBlind > 0`, a count with no verdict word beside the ✓: `(N of T: too little traffic in 10 min to rate timeouts.)`; v0.79.9). Rendering these identically would let "learning" masquerade as "healthy," so they are kept separate. Since v0.80.0 the counts carry `unmeasured N` beside `timeouts N/T` while any node's 10-minute window is too thin to rate timeouts, and the learning and partial states say what it means, on a line after their paragraph — `timeout: N too quiet in 10 min to rate — the return-path detectors skip them.` — in the longest whole form that fits: `timeouts 33/39` alone read as 33 nodes judged, and the screen was byte-identical for 0 and 39 such nodes. Each empty state's paragraph is kept line for line where every line fits and re-flowed to whole words where it does not, so at 40 columns none is cut blind (v0.80.0). The ceiling note's two lines are one such paragraph, and the ✓ headline sheds to `✓ All clear — N learned, no symptoms.` and then `✓ All clear — no symptoms.`, with clipWords as the floor. Since v0.79.0 the counts carry `ceiling-only N` beside `rtt N/T` when any node is judged against the fixed RTT ceiling alone (§7.2.4), and both the learning and the partial state say how many: such a node is neither blind nor learned, so the partial text reads *a degradation on those nodes may go unflagged* where it read *would not be flagged*. **An unseen route is not a moved route (v0.47.0).** `baselines.observe()` compared route keys with a bare `!==` over a nullable value, and the driver reports statistics with no `lwr` at all (`routeKeyOfLwr` returns null for those). A node routed via `r4` whose next sample omitted the route saw `null !== 'r4'` and had **all six rssi and rtt bands wiped**, obs and days rings included — then wiped again on reappearance. Two full resets for zero re-routing. This is the same hazard `isRouteChange()` was written and tested to prevent for the route-churn detector (*"a route we cannot see has not moved; we have merely stopped watching it"*), applied there and not to the far more destructive consumer here. Measured attribution: the wipe explains 13 of 13 blocked nodes in a busy band and 13 of 21 in a quiet one, the remainder being genuine fresh-sample starvation. A wipe victim is blocked in EVERY band at once (a shared per-node day-clock); a starved node has 6-10 distinct days and fails only where traffic is thin. @@ -3211,7 +3241,7 @@ The REMEDY render enforces the same rule inline (§8.8): a subsumed symptom's ro **Why partial coverage needs its own state (v0.46.0).** The green all-clear requires timeout and rtt graduated fleet-wide in the current band (all three series at v0.46.0), and on a mesh with routed nodes that is unreachable: `baselines.observe()` resets rssi/rtt across all six bands on any route change, and both fold only on FRESH samples — measured here at ~410-922 of 363,586 lifetime (~1.5-3.3 per band per day) against `MIN_OBS` 20, so a repeater-routed node must hold one route ~2 weeks to graduate a single band. Measured 2026-08-31 the ceiling is 23 of 38 — the direct-routed subset. Rendering that as "Learning" forever implied a convergence that never arrives. The open-episode disclosure (v0.43.1) sat only in the green branch and was therefore structurally unreachable in production; it now belongs to every no-symptom state, which is the actual unblocking — without it the fourth state would merely relocate the trap. -**What "learned" is scoped to (v0.43.1).** `engineStatus()` returns `{enabled, ready, total, timeoutReady, timeoutWindowBlind, rttReady, rttCeiling, rssiReady, band, bands}`. `rttCeiling` (v0.79.0) counts the nodes with no graduated RTT band in this band that `rtt-degraded` still judges against its fixed ceiling — `rttYardstick` returns `ceiling` for them, the detector's own rule — and is published as `rtt_ceiling_only`; `total − rttReady − rttCeiling` are not judged on RTT at all. `timeoutWindowBlind` (v0.67.0) is not band-scoped: it counts nodes whose 10-minute window holds fewer than `MIN_WINDOW_TX` sends — unmeasured, not clear — and is published as `detectors_unmeasured` and counted under REMEDY's all-clear (v0.79.9). The counts are **per series** and **per time-of-day band**: `bandOf()` divides the day into `N_BANDS = 6` four-hour bands, and a graduation count is only true for the band containing now. Before v0.43.1 the whole predicate was one line — nodes whose *timeout* baseline had graduated in the current band — and REMEDY rendered it as "Every node has a graduated baseline." A fleet with a full timeout baseline and an empty RSSI baseline read as fully learned, and the same fleet could read learned at 03:00 and unlearned at 15:00 with nothing having changed. Timeout and rtt, the two series that arm a detector, must be graduated fleet-wide in the named band before the green all-clear renders (all three until v0.47.0; a short rssi baseline is now noted beneath it without blocking it), `total === 0` gets its own state rather than passing every `0 < 0` comparison, and both the learning and all-clear branches name the band. On a narrow terminal the band is kept in a compact form (`12–16h`) rather than truncated away, and the counts go through `fieldStrip` so one is **dropped whole** rather than clipped to a plausible wrong number (`rssi 1` where the truth was `12/39`). +**What "learned" is scoped to (v0.43.1).** `engineStatus()` returns `{enabled, ready, total, timeoutReady, timeoutWindowBlind, rttReady, rttCeiling, rssiReady, band, bands}`. `rttCeiling` (v0.79.0) counts the nodes with no graduated RTT band in this band that `rtt-degraded` still judges against its fixed ceiling — `rttYardstick` returns `ceiling` for them, the detector's own rule — and is published as `rtt_ceiling_only`; `total − rttReady − rttCeiling` are not judged on RTT at all. `timeoutWindowBlind` (v0.67.0) is not band-scoped: it counts nodes whose 10-minute window holds fewer than `MIN_WINDOW_TX` sends — unmeasured, not clear — and is published as `detectors_unmeasured`, counted under REMEDY's all-clear (v0.79.9), and in the learning and partial states' counts and on a line of its own in each (v0.80.0). The counts are **per series** and **per time-of-day band**: `bandOf()` divides the day into `N_BANDS = 6` four-hour bands, and a graduation count is only true for the band containing now. Before v0.43.1 the whole predicate was one line — nodes whose *timeout* baseline had graduated in the current band — and REMEDY rendered it as "Every node has a graduated baseline." A fleet with a full timeout baseline and an empty RSSI baseline read as fully learned, and the same fleet could read learned at 03:00 and unlearned at 15:00 with nothing having changed. Timeout and rtt, the two series that arm a detector, must be graduated fleet-wide in the named band before the green all-clear renders (all three until v0.47.0; a short rssi baseline is now noted beneath it without blocking it), `total === 0` gets its own state rather than passing every `0 < 0` comparison, and both the learning and all-clear branches name the band. On a narrow terminal the band is kept in a compact form (`12–16h`) rather than truncated away, and the counts go through `fieldStrip` so one is **dropped whole** rather than clipped to a plausible wrong number (`rssi 1` where the truth was `12/39`). **Harm is as hard to claim as help (v0.44.0).** `scoreRecovery` distinguishes `worse` from `no-change` at seven sites, one per metric it scores — a rising timeout rate, new flaps, fresh S2 resyncs, more route changes, lost margin, slower RTT, a dropped negotiated rate — and until v0.44.0 the tally discarded that distinction, so an action that harmed and one that did nothing rendered identically. Both arms now carry a decayed regression count. The warning is gated the same way the benefit claim is: the Wilson lower bound on the action's regression rate must clear the **control arm's own** regression rate by the effect size, across at least two distinct nodes. Comparing against the control's *improvement* rate would compare two different quantities; requiring only a point ratio let one regression on one node accuse a remedy, with the outcome depending on where in the sequence that regression fell. A harm finding is **appended** to a granted efficacy claim, never substituted for it — an action can genuinely help most of the time and hurt some of the time, and returning early on harm hid a claim ENGINE was rendering in green from the same ledger row. @@ -3387,7 +3417,7 @@ The action arm was never operator-only: the dead-node ladder's pings feed it too - **Windows open at the launch (v0.72.0 review).** The runner reports every learned verb's launch before the await (`onLaunch`) and its settle after (`onSettled`; an *outcome unknown* settles at its reply bound). The ledger keeps one record per launch per node, opening at the launch and closing `KILLED_AFTER_MS` after the settle; a death or a breach is judged against an action the node was Alive for whose window covers it — one still RUNNING at that moment first (the earliest-launched of those), otherwise the latest-launched — so a death during a twenty-minute heal is the heal's even if a quick ping ran and settled meanwhile, and a later ladder ping to the now-Dead node does not erase the heal's window. A launch that never left the add-on (the settle's effect is `none`: no device, socket not open) opens no window, holds nothing and cannot overlap. While an action runs on a node — or the controller reports a mesh-wide route rebuild — that node's episodes are held open (`planEpisodeLifecycle`'s `holdUntil`), and their confirmation window restarts at the settle: the after-window that scores them is a settled one, not the action's own last minutes, and an after-window check burst sent before an action settled — however quick the action — is sent again in it. A mesh-wide rebuild also confounds every open episode. A symptom is treated as already recovering only if it went absent before the action was sent. - **Live span.** Every closure is bucketed by how long its symptom was live — from `dwellStartMs` to the first tick it was seen absent, the clock the transient split uses — into `[0,10) [10,30) [30,60) [60,∞)` minutes, split scored (improved / no-change / worse, not confounded) from unscored, in a 30-day ring of daily slots. ENGINE's `live ≥10m: a/b scored since MM-DD` bit is the revisit condition of DESIGN §3.5: only episodes live that long could ever be evidence for an automatic action. It counts episodes, not nodes: one chronically degraded node whose episode re-arms every half hour adds a closure each time — on the reference mesh one node once supplied 8 of 12 new closures; since v0.79.1 an `rtt-degraded` breach on a sweep-only node is held instead (§7.2.4) — which is why the refresh trial (§11.14) caps each node at one trial decision a day in either arm. Since v0.75.1 the ring also keeps the scored ≥ 10 min closures **per node**, and the count moves to its own row — before the first attributed closure too, so the tallies before it cannot crowd it out — that names them in the same breath, in the longest of four forms that fits the width (every form keeps `from k nodes`, so the count is never shown unattributed, and down to the narrowest session width of 60 columns): `live ≥10m: 37/45 scored since 09-12 from 4 nodes (node 23: 22)` — how many nodes, and which: the only one (`from 1 node (node 23)`), or, with several, the one with the most closures when it has two or more. Per-node counts begin with v0.75.1, so until they cover every closure in the window the bit says how many they do cover, and since when — to the minute, from the first closure it attributed (`nodesSince`, persisted per kind), because every counted closure after that one is attributed and a day boundary would not be exact: `… · 5 since 10-12 14:03 from 2 nodes (node 23: 4)`. With no recorded start none is guessed (`… · 5 of them from 2 nodes`). A day from an older ledger file loads without them. Trial closures still count here. -The closure line names the actor and the live span (`improved after healNode (you) live=12m`), prints the confounded tag on an attributed closure too, and adds `(node went Dead ≤15m after the action)` when that was counted. All new ledger fields are optional in `/data/outcomes.json`, which stays `v: 1`; a `reset()` (identity *start fresh*) and `loadJSON` clear every one of them. +The closure line names the actor and the live span (`improved after healNode (you) live=12m`), prints the confounded tag on an attributed closure too, and adds `(node went Dead ≤15m after the action)` when that was counted. The LOG ring's closure event (kind `symptom`, source `engine`, `worse` at warn; v0.44.0) is ` closed after ()` or `… (no action)`, then `(went Dead ≤15m after it)` where counted. Since v0.80.0 the qualifier sits right after the verdict word: an `unverifiable` verdict names its subtype — `: unprobeable`, `: transient` or `: undersampled`, in the ledger's own precedence — and a scored verdict credited to neither arm reads ` (confounded)`. Before, the ring line carried no subtype — it reached the container's stdout line only — so a by-design blink and a fixable evidence gap both read `closed unverifiable (no action)`; and the confounded tag sat at the end of the line, where the 80-column list row cut it. All new ledger fields are optional in `/data/outcomes.json`, which stays `v: 1`; a `reset()` (identity *start fresh*) and `loadJSON` clear every one of them. ### 9.4 The verdict and the statistical-honesty guards @@ -3520,7 +3550,7 @@ efficacyFor(kind, act): ``` !e → (nothing) -!e.ready → grey "≈ still learning this action (n≈2.0 of 4) — 40% self-heal" // (nothing) only with no control rate (v0.44.0) +!e.ready → grey "≈ still learning this action (n≈2.0 of 4) — 40% self-heal" // "— self-heal not yet measured" with no control rate (v0.80.0); (nothing) only at n = 0 with none e.expectedEfficacy != null → green "✓ helped 82% (n≈6.4 · 7 nodes) vs 40% self-heal" // yellow when blocked ("⚠ ledger measured 82% here …") or a harm finding is appended harm gate cleared (ready) → yellow "⚠ made it WORSE in 60% of n≈6.4 · 3 nodes — leaving it alone: 10% worse" otherwise (ready) → grey "≈ n≈8.0 · 3 nodes: not distinguishable from self-healing" @@ -4395,6 +4425,8 @@ The echo label is routed by attribution alone, never by the staleness threshold > - **Home Assistant logs a failed one.** A `refresh_value` whose Get fails is logged by HA as `Error while refreshing value …` at ERROR — so it appears at the reference install's WARNING log level — though a race with the node going Dead can hide it. The per-call `Refreshing primary value` line is INFO and does not appear unless the zwave_js logger is raised. > - **It leaves no `button.*_ping` state change in the recorder.** The 67-day kill attribution above was built from those; from v0.71.0 the add-on log is where each sweep and verification probe's time is recorded. +> **An answered manual ping is said (v0.80.0).** A miss on the operator's `p` reached LOG and the ENGINE streak; an answer reached only the debug log, so the ping reported *sent* and then nothing on any screen. The judge now books `node N answered your ping (lastSeen advanced)` at info on the ring and the container log, for the manual lane only — the sweep's answered probes stay at debug, one per probe on every healthy node. With a runner the `p` result notice reads `auto-ping judges whether it answered — see LOG (e)` (a paused runner judges answers too); with none, `HA does not return the answer — watch its Status / Last-seen`. The Actions-menu CONFIRM note carries the same split in one sentence, `Where auto-ping runs it judges the answer in LOG; otherwise watch the node's Status / Last-seen.` The whole note wraps to 6 lines at 80 columns and wider and 7 at 60, so the box keeps its `type CONFIRM to arm` prompt and `Esc = cancel` at 80x16 and 60x18: `centeredNotice` cuts the box at the terminal's height, and the session allows 16 rows. + > **A manual ping is dated from its launch (v0.64.5).** An operator's `p` is judged by the same `judgeProbeAnswers` as an engine probe (v0.47.0), but its pending entry was stamped by `notePending` when the data layer heard the outcome — after Home Assistant's `button.press` call had returned. HA's zwave_js ping button starts the driver's ping as a background task (`hass.async_create_task`) and returns without waiting for it, so that stamp usually precedes the answer: in five dead-ladder probes on the reference mesh, the driver logged the revived node alive 54–197 ms after the add-on logged the probe. Usually is not always. The node's answer and HA's reply race, and when the reply loses — a busy Home Assistant event loop, or a node that answers in a few tens of milliseconds — the stamp post-dated the answer, `lastSeen >= at` failed, and an answered manual ping was logged *did NOT answer* after the 90 s grace, with a miss on the node's consecutive-miss streak; the same test in `settleProbeDeath` could book it as the probe a later, unrelated death happened on. No instance has been observed, because no manual ping has been: over the 50.5 h of log reviewed for this release Home Assistant recorded 1,081 ping-button presses, and every one was the engine's. `zwaveActions.run()` now reads the clock before it awaits the call and passes it as `sentAt` through `onOutcome` → `recordActionOutcome` → the probe hook → `notePending(nodeId, 'manual', at)`. The runner's `now` and auto-ping's both default to `Date.now`, the wall clock `lastSeen` is compared against. The stamp now precedes the send, as every engine lane's does, so a frame the node happens to send between launch and transmission counts as the answer. That interval is the HA round trip and the driver's send queue, plus up to 10 s while the HA WebSocket is re-authenticating (`waitReady`) — the tolerance the sweep has always had, applied to the operator's lane. One ordering consequence: a manual entry registers after any engine probe pended during its call while pre-dating it, so across lanes a node's pending list is in registration order rather than strict send order. For `settleProbeDeath`'s newest-decides rule that selects the manual entry, which keeps the dwell. The persisted reply rate and the ledger's action arm are unchanged. Manual kills still keep the dwell; the loose stamp is no longer a reason, and two remain. No manual kill has been observed (the same 1,081 presses). And `probeDeath` discards traffic heard before the death: the give-up notice tells an operator to operate the device and then ping it, and if that command clears the Dead flag and a tick sees the node Alive before the ping, the ping's NOP makes a fresh watched death — for a device that ignores NOPs (v0.42.0), the exemption would trade its Dead-but-talking notice for an immediate retry of the frame it ignores. Everything else in this reference is advisory: the engine detects, explains, and recommends, and a human presses the key. **Auto-ping breaks that rule on purpose and narrowly, so the rule stays meaningful everywhere else.** It and the opt-in refresh trial (§11.14: off by default, deciding only while auto-ping's last pass was unsuppressed) are the only code paths in the shipped build from a detector to a WS command with no human in the loop. diff --git a/zwave_tui/config.yaml b/zwave_tui/config.yaml index ec8e71c..0860a4d 100644 --- a/zwave_tui/config.yaml +++ b/zwave_tui/config.yaml @@ -1,5 +1,5 @@ name: "Z-Wave TUI" -version: "0.79.9" +version: "0.80.0" slug: zwave_tui description: "Z-Wave mesh observability and remediation engine — live link measurement, learned baselines, 14 fault detectors and ranked, outcome-scored fixes; SSH + sidebar console and HA entities" url: https://github.com/tesseractAZ/zwave diff --git a/zwave_tui/server/package-lock.json b/zwave_tui/server/package-lock.json index f4643b2..ac9eb80 100644 --- a/zwave_tui/server/package-lock.json +++ b/zwave_tui/server/package-lock.json @@ -1,12 +1,12 @@ { "name": "zwave-tui-server", - "version": "0.79.9", + "version": "0.80.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "zwave-tui-server", - "version": "0.79.9", + "version": "0.80.0", "license": "MIT", "dependencies": { "@fastify/compress": "^9", diff --git a/zwave_tui/server/package.json b/zwave_tui/server/package.json index e0b4635..c72c6be 100644 --- a/zwave_tui/server/package.json +++ b/zwave_tui/server/package.json @@ -1,6 +1,6 @@ { "name": "zwave-tui-server", - "version": "0.79.9", + "version": "0.80.0", "engines": { "node": ">=22.0.0 <23.0.0" }, diff --git a/zwave_tui/server/scripts/mutation-check.mjs b/zwave_tui/server/scripts/mutation-check.mjs index 1c894da..f894fd0 100644 --- a/zwave_tui/server/scripts/mutation-check.mjs +++ b/zwave_tui/server/scripts/mutation-check.mjs @@ -2753,24 +2753,20 @@ const MUTANTS = [ find: ' if (open == null) {', repl: ' if (open == null || open.length === 0) {', what: 'an idle ledger is distinguished from an absent one' }, - { id: 'engine-confirming-is-labelled', file: 'src/telnet/screens/engine.ts', tests: ['engineScreen'], - // A node in its confirmation window reads as currently degraded, which is - // the opposite of true: it has already recovered and is being scored. - find: " bits.push(ep.confirming\n ? c.green('confirming — symptom absent, scoring')\n : c.yellow('degraded — symptom live'));", - repl: " bits.push(c.yellow('degraded — symptom live'));", - what: 'an episode in its confirmation window is not shown as degraded' }, + { id: "engine-confirming-is-labelled", file: "src/telnet/screens/engine.ts", tests: ["engineScreen"], + find: "ep.confirming ? c.green('confirming — symptom absent, scoring') : c.yellow('degraded — symptom live')", + repl: "c.yellow('degraded — symptom live')", + what: "an episode in its confirmation window is not shown as degraded" }, { id: 'engine-baserate-carries-its-n', file: 'src/telnet/screens/engine.ts', tests: ['engineScreen'], // The bare rate again — the exact class-D defect the gap analysis raised: // a self-heal rate without its n invites overtrust in one episode. find: " c.grey(` (${weight(arm.n)}${provenance(arm.nodes)}${armHarm})`));", repl: " '');", what: 'the self-heal base rate always renders with its n' }, - { id: 'engine-confound-outranks-action', file: 'src/telnet/screens/engine.ts', tests: ['engineScreen'], - // Pushes `confounded` behind the action, where truncation eats it — a - // clipped confound reads as a clean control point. - find: " if (ep.confounded) bits.push(c.grey('confounded \u2014 neither arm'));", - repl: " if (false) bits.push(c.grey('confounded \u2014 neither arm'));", - what: 'a confounded episode says so before it says which action it carried' }, + { id: "engine-confound-outranks-action", file: "src/telnet/screens/engine.ts", tests: ["engineScreen"], + find: " const arm = ep.confounded ? c.grey('confounded — neither arm')\n", + repl: " const arm = (false as boolean) ? c.grey('confounded — neither arm')\n", + what: "a confounded episode says so before it says which action it carried" }, { id: 'bridge-forwards-autoping-state', file: 'src/telnet/dataProvider.ts', tests: ['driverWsClient'], find: ' autoPingState: () => zd.autoPingState(),', repl: ' autoPingState: () => null,', @@ -2922,13 +2918,10 @@ const MUTANTS = [ repl: ' void 0;', what: 'ENGINE shows a node whose Dead flag its own traffic contradicts' }, /* ── v0.43.0: contracts that lied, and a dead accessor ─────────────────── */ - { id: 'engine-shows-driver-link', file: 'src/telnet/screens/engine.ts', tests: ['engineScreen'], - // Back to the dead accessor: the driver socket that feeds bgRSSI, S2 - // resync detection and the real lastSeen degrades with no surface saying so. - // Anchor updated in v0.62.0 when the S2-lane token joined the row. - find: " [tone(st), c.grey(ws), ...(s2 ? [c.yellowB(`S2 lane ${s2}`)] : [])], view.cols));", + { id: "engine-shows-driver-link", file: "src/telnet/screens/engine.ts", tests: ["engineScreen"], + find: " [tone(st), ...(down ? [] : [c.grey(ws)]), ...(s2 ? [c.yellowB(`S2 lane ${s2}`)] : [])], view.cols));", repl: " [], view.cols));", - what: 'ENGINE renders the driver-WS lifecycle instead of hiding it' }, + what: "ENGINE renders the driver-WS lifecycle instead of hiding it" }, { id: 'driver-link-degraded-stands-out', file: 'src/telnet/screens/engine.ts', tests: ['engineScreen'], find: " const tone = st === 'live' ? c.grey : st === 'connecting' || st === 'handshake' ? c.grey : c.yellow;", repl: ' const tone = c.grey;', @@ -3108,13 +3101,10 @@ const MUTANTS = [ find: ' } else if (eng.total === 0) {', repl: ' } else if (eng.total < 0) {', what: 'an empty roster gets its own state, never an all-clear over nothing' }, - { id: 'baseline-counts-not-clipped', file: 'src/telnet/screens/remedy.ts', tests: ['remedyScreen'], - // Back to the fixed-width string: at 40 cols `rssi 12/39` clipped to - // `rssi 1` — a plausible, wrong measurement, which chrome.ts calls a bigger - // lie than a disclosed drop. - find: " const counts = (): string[] => [\n c.grey(` timeouts ${eng.timeoutReady}/${eng.total}`),\n c.grey(`rtt ${eng.rttReady}/${eng.total}`),\n // v0.79.0: rtt nodes with no learned band whom the fixed ceiling still\n // judges. Its own field, so the rtt count keeps meaning \"learned\".\n ...(eng.rttCeiling > 0 ? [c.grey(`ceiling-only ${eng.rttCeiling}`)] : []),\n c.grey(`rssi ${eng.rssiReady}/${eng.total}`),\n ];", + { id: "baseline-counts-not-clipped", file: "src/telnet/screens/remedy.ts", tests: ["remedyScreen"], + find: " const counts = (): string[] => [\n c.grey(` timeouts ${eng.timeoutReady}/${eng.total}`),\n // v0.80.0: nodes whose 10-minute window is too thin to RATE timeouts —\n // the return-path detectors skip them, so `timeouts 33/39` alone read\n // as 33 nodes judged. Its own field beside the series it qualifies.\n ...(eng.timeoutWindowBlind > 0 ? [c.grey(`unmeasured ${eng.timeoutWindowBlind}`)] : []),\n c.grey(`rtt ${eng.rttReady}/${eng.total}`),\n // v0.79.0: rtt nodes with no learned band whom the fixed ceiling still\n // judges. Its own field, so the rtt count keeps meaning \"learned\".\n ...(eng.rttCeiling > 0 ? [c.grey(`ceiling-only ${eng.rttCeiling}`)] : []),\n c.grey(`rssi ${eng.rssiReady}/${eng.total}`),\n ];", repl: " const counts = (): string[] => [\n c.grey(` timeouts ${eng.timeoutReady}/${eng.total} rtt ${eng.rttReady}/${eng.total} rssi ${eng.rssiReady}/${eng.total}`),\n ];", - what: 'a count that does not fit is DROPPED whole, never clipped mid-number' }, + what: "a count that does not fit is DROPPED whole, never clipped mid-number" }, { id: 'engine-band-is-measured-not-assumed', file: 'src/zwave/zwaveData.ts', tests: ['zwaveDataChurn'], // The screen would permanently name the 00:00–04:00 band whatever the // clock says — the headline claim of the widening, silently false. @@ -3322,19 +3312,14 @@ const MUTANTS = [ find: ' /* wrapTail */ true,', repl: ' /* wrapTail */ false,', what: 'a blocked reason that will not fit inline moves to a continuation row' }, - { id: 'caveat-grounded-off-index', file: 'src/telnet/screens/remedy.ts', tests: ['remedyScreen'], - // Back to the index gate: a destructive caveat on a second-ranked candidate - // renders at NO terminal size, and widening never helps. - find: ' if (i === 0 || caveatLine != null) {', - repl: ' if (i === 0) {', - what: 'a destructive caveat is grounded wherever its candidate ranks' }, - { id: 'caveat-not-every-candidate', file: 'src/telnet/screens/remedy.ts', tests: ['remedyScreen'], - // The over-broad form the spec warned against: planner blocks EVERY - // executable when write actions are off, so this grounds all three - // candidates on every card and blows the row budget. - find: ' const caveatLine = rl.find((l) => CAVEAT.test(l));', - repl: ' const caveatLine = rl[0];', - what: 'only a CAVEAT earns a grounding line below the top candidate' }, + { id: "caveat-grounded-off-index", file: "src/telnet/screens/remedy.ts", tests: ["remedyScreen"], + find: " const ground = caveat ?? (i === 0 ? clipWords(cand.rationale, W - 8) : null);", + repl: " const ground = i === 0 ? (caveat ?? clipWords(cand.rationale, W - 8)) : null;", + what: "a destructive caveat is grounded wherever its candidate ranks" }, + { id: "caveat-not-every-candidate", file: "src/telnet/screens/remedy.ts", tests: ["remedyScreen"], + find: " const ground = caveat ?? (i === 0 ? clipWords(cand.rationale, W - 8) : null);", + repl: " const ground = caveat ?? clipWords(cand.rationale, W - 8);", + what: "only a CAVEAT earns a grounding line below the top candidate" }, { id: 'members-row-renders', file: 'src/telnet/screens/remedy.ts', tests: ['remedyScreen'], find: ' if (sym.members?.length) {', repl: ' if (sym.members?.length === -1) {', @@ -5443,8 +5428,8 @@ const MUTANTS = [ repl: "", what: "a share just over 0% reads <1%" }, { id: "detail-probes-honest", file: "src/telnet/screens/detail.ts", tests: ["detailScreen"], - find: "answered (${honestPct(cov.probesAnswered, cov.probesAsked)})", - repl: "answered (${pct}%)", + find: " const p = honestPct(a, k);\n", + repl: " const p = `${pct}%`;\n", what: "the Probes row never rounds a miss away" }, { id: "detail-fresh-honest", file: "src/telnet/screens/detail.ts", tests: ["detailScreen"], find: "(${honestPct(cov.freshSamples, cov.samples)} lifetime)", @@ -6585,11 +6570,9 @@ const MUTANTS = [ find: " for (const line of wrap(iv.correlated.narrative, W - 4)) push(' ' + c.grey(line));", repl: " for (const line of wrap(iv.correlated.narrative, W - 4).slice(0, 2)) push(' ' + c.grey(line));", what: "an inferred symptom's hedge survives the modal terminal" }, - { id: 'remedy-tag-is-all-or-nothing', file: 'src/telnet/screens/remedy.ts', tests: ['remedyScreen'], - // shedLine's HEAD has no whole-token path, so the tag came back `[physical` - // — an unbalanced bracket that silently dropped the candidate's provenance. - find: " visLen(' ' + tagged) <= W ? tagged : headBase + c.grey(' +1'),", - repl: ' tagged,', + { id: "remedy-tag-is-all-or-nothing", file: "src/telnet/screens/remedy.ts", tests: ["remedyScreen"], + find: " const head = titles.map((t) => `${headOf(t)} ${tags}`).find(fits)\n", + repl: " const head = titles.map((t) => `${headOf(t)} ${tags}`).find(() => true)\n", what: "a candidate's [cost · basis] tag is whole or shed, never half" }, { id: 'result-modal-wraps', file: 'src/telnet/session.ts', tests: ['sessionActions'], // Three semantically OPPOSITE ZW0360 verdicts rendered as the same @@ -7535,13 +7518,13 @@ const MUTANTS = [ find: "A ping is one ACK-only attempt on the stored routes, so on a marginal link it can itself mark the node Dead; with auto-ping\u2019s liveness sweep on, every mains node is already asked on a cadence, by a routed read where the node has a switch/light value.", repl: "It can mark a truly-marginal node dead, so it is not run automatically.", what: "the quiet-node card no longer claims pings never run automatically" }, - { id: 'confounded-row-names-reroute', file: 'src/telnet/screens/remedy.ts', tests: ["remedyScreen"], - find: "(a death, remediation or probe re-route ` +", - repl: "(a death or remediation ` +", + { id: "confounded-row-names-reroute", file: "src/telnet/screens/remedy.ts", tests: ["remedyScreen"], + find: "credited to neither arm (a death, remediation or probe re-route during or just before the episode)`,", + repl: "credited to neither arm (a death or remediation during or just before the episode)`,", what: "REMEDY names the new confound cause" }, - { id: 'confounded-row-verdict-first', file: 'src/telnet/screens/remedy.ts', tests: ["remedyScreen"], - find: "c.grey(`\u25cb ${conf} confounded \u2014 credited to neither arm (a death, remediation or probe re-route ` +\n 'during or just before the episode)')", - repl: "c.grey(`\u25cb ${conf} confounded (a death, remediation or probe re-route ` +\n 'during or just before the episode) \u2014 credited to neither arm')", + { id: "confounded-row-verdict-first", file: "src/telnet/screens/remedy.ts", tests: ["remedyScreen"], + find: "`○ ${conf} confounded — credited to neither arm (a death, remediation or probe re-route during or just before the episode)`,", + repl: "`○ ${conf} confounded (a death, remediation or probe re-route during or just before the episode) — credited to neither arm`,", what: "REMEDY's confounded row leads with its verdict, so a narrow terminal keeps it" }, /* ── v0.71.0 review: between-tick attribution, our frame's own TX report ── */ { id: 'between-tick-needs-unanswered', file: 'src/zwave/autoPing.ts', tests: ["autoPing"], @@ -7892,24 +7875,24 @@ const MUTANTS = [ repl: "", what: "REMEDY counts the ceiling-only nodes apart from the learned ones" }, { id: "remedy-ceiling-note-partial", file: "src/telnet/screens/remedy.ts", tests: ["remedyScreen"], - find: " body.push(c.grey(' change, so routed nodes may never graduate.'));\n body.push(...ceilingNote());\n", - repl: " body.push(c.grey(' change, so routed nodes may never graduate.'));\n", + find: " body.push(...unmeasuredNote());\n body.push(...ceilingNote());\n body.push(...rssiNote());\n", + repl: " body.push(...unmeasuredNote());\n body.push(...rssiNote());\n", what: "partial coverage says which ungraduated nodes the ceiling still judges" }, { id: "remedy-ceiling-note-learning", file: "src/telnet/screens/remedy.ts", tests: ["remedyScreen"], - find: " : ' detectors may fire. Nothing here is a health claim yet.'));\n body.push(...ceilingNote());\n", - repl: " : ' detectors may fire. Nothing here is a health claim yet.'));\n", + find: " body.push(...unmeasuredNote());\n body.push(...ceilingNote());\n } else if (blind.length > 0) {", + repl: " body.push(...unmeasuredNote());\n } else if (blind.length > 0) {", what: "the learning state says the ceiling judges too" }, { id: "remedy-learning-names-learned-detectors", file: "src/telnet/screens/remedy.ts", tests: ["remedyScreen"], - find: " body.push(c.grey(eng.rttCeiling > 0\n ? ' learned detectors may fire.", - repl: " body.push(c.grey((false as boolean)\n ? ' learned detectors may fire.", + find: " eng.rttCeiling > 0\n ? ' learned detectors may fire.", + repl: " (false as boolean)\n ? ' learned detectors may fire.", what: "with the ceiling judging, the learning state says only the LEARNED detectors wait" }, { id: "remedy-ceiling-note-gated", file: "src/telnet/screens/remedy.ts", tests: ["remedyScreen"], find: " const ceilingNote = (): string[] => (eng.rttCeiling > 0", repl: " const ceilingNote = (): string[] => (eng.rttCeiling >= 0", what: "no ceiling sentence when the ceiling judges nobody" }, { id: "remedy-may-go-unflagged", file: "src/telnet/screens/remedy.ts", tests: ["remedyScreen"], - find: " body.push(c.grey(eng.rttCeiling > 0\n ? ' A degradation on those nodes may go unflagged", - repl: " body.push(c.grey(eng.rttCeiling < 0\n ? ' A degradation on those nodes may go unflagged", + find: " eng.rttCeiling > 0\n ? ' A degradation on those nodes may go unflagged", + repl: " eng.rttCeiling < 0\n ? ' A degradation on those nodes may go unflagged", what: "\"would not be flagged\" is not said of nodes the ceiling judges" }, { id: "detail-rtt-held-to-the-ceiling", file: "src/telnet/screens/detail.ts", tests: ["detailScreen"], find: " : c.yellow('still learning') + c.grey(ry?.basis === 'ceiling'", @@ -9832,8 +9815,8 @@ const MUTANTS = [ repl: "", what: "the n≈ legend is a whole form at 40 columns, not the short form cut to 'nodes cumula'" }, { id: "remedy-gave-up-whole-forms", file: "src/telnet/screens/remedy.ts", tests: ["remedyScreen"], - find: "clipWords(spentForms.find((f) => visLen(f) <= W - 6) ?? spentForms[spentForms.length - 1], W - 6)", - repl: "clipWords(spentForms[0], W - 6)", + find: "clipWords(headForms.find((f) => visLen(f) <= W - 6) ?? headForms[headForms.length - 1], W - 6)", + repl: "clipWords(headForms[0], W - 6)", what: "the give-up headline is one whole form at 40, 60 and 80 columns, never the sensor's words clipped mid-claim" }, { id: "remedy-gave-up-not-tested-only-at-zero", file: "src/telnet/screens/remedy.ts", tests: ["remedyScreen"], find: " ? (tried === 0\n", @@ -9855,6 +9838,329 @@ const MUTANTS = [ find: "advice[1].split(' — ').flatMap((clause) => wrapWords(clause, W - 6))", repl: "wrapWords(advice[1], W - 6)", what: "the fault wraps at its own ' — ', cause on the warning row and what it did below it" }, + // v0.80.0: what the engine already knows reaches the screen — the Overview CRIT count, ENGINE's alarm-first tracked rows, the down driver link's own rows and LEDGER — LIVE's confirming-first order and arm bit, Detail's lifetime ratio, keycaps and legend, REMEDY's unmeasured count, harm warning, whole tally, evidence, title, headline and caveat forms, LOG's closure subtype and the answered manual ping. + { id: "overview-crit-field-shown", file: "src/telnet/screens/overview.ts", tests: ["overviewScreen"], + find: " ...(crit > 0 ? [field('CRIT', String(crit), c.redB)] : []),\n", + repl: "", + what: "the Overview strip counts critical symptoms, so a crit below the fold is on the home screen" }, + { id: "overview-crit-after-dead", file: "src/telnet/screens/overview.ts", tests: ["overviewScreen"], + find: " ...(crit > 0 ? [field('CRIT', String(crit), c.redB)] : []),\n field('ASLEEP', String(asleep), asleep > 0 ? c.cyan : c.grey),\n field('FLAKY', String(flaky), flaky > 0 ? c.yellow : c.grey),\n ...(unknown > 0 ? [field('UNKNOWN', String(unknown), c.yellow)] : []),\n // Showing '—' hid the fact that the MARGIN column is still being computed\n // — against the assumed floor. Name the assumption instead of hiding it.\n // ROUND for display, and band the DISPLAYED value (the RTT rule): the\n // driver's channel median is fractional (-95.062 on the live mesh), so\n // this field spelt the same floor differently from the Interference\n // screen's rounded copy — one reading, two representations.\n field(\n 'NOISE',\n data.hasRealNoise() ? `${Math.round(noise)} dBm` : `${Math.round(noise)} dBm assumed`,\n data.hasRealNoise() ? noiseColor(Math.round(noise)) : c.grey,\n ),\n // PROVENANCE for the term the meter just subtracted — a percentage the\n // operator cannot reconcile against any field on the strip is its own defect.\n ...(failing > 0 ? [field('FAILING', String(failing), c.redB)] : []),\n c.grey('MESH ') + meter(meshFrac, 8) + c.grey(` ${Math.round(meshFrac * 100)}%`),\n", + repl: " field('ASLEEP', String(asleep), asleep > 0 ? c.cyan : c.grey),\n field('FLAKY', String(flaky), flaky > 0 ? c.yellow : c.grey),\n ...(unknown > 0 ? [field('UNKNOWN', String(unknown), c.yellow)] : []),\n // Showing '—' hid the fact that the MARGIN column is still being computed\n // — against the assumed floor. Name the assumption instead of hiding it.\n // ROUND for display, and band the DISPLAYED value (the RTT rule): the\n // driver's channel median is fractional (-95.062 on the live mesh), so\n // this field spelt the same floor differently from the Interference\n // screen's rounded copy — one reading, two representations.\n field(\n 'NOISE',\n data.hasRealNoise() ? `${Math.round(noise)} dBm` : `${Math.round(noise)} dBm assumed`,\n data.hasRealNoise() ? noiseColor(Math.round(noise)) : c.grey,\n ),\n // PROVENANCE for the term the meter just subtracted — a percentage the\n // operator cannot reconcile against any field on the strip is its own defect.\n ...(failing > 0 ? [field('FAILING', String(failing), c.redB)] : []),\n c.grey('MESH ') + meter(meshFrac, 8) + c.grey(` ${Math.round(meshFrac * 100)}%`),\n ...(crit > 0 ? [field('CRIT', String(crit), c.redB)] : []),\n", + what: "the CRIT field sits right after DEAD: appended, fieldStrip sheds it at 80 columns" }, + { id: "overview-crit-counts-crit-only", file: "src/telnet/screens/overview.ts", tests: ["overviewScreen"], + find: " const crit = data.symptoms().filter((s) => s.severity === 'crit').length;", + repl: " const crit = data.symptoms().filter(() => true).length;", + what: "a warning or watch symptom is not counted as CRIT" }, + { id: "overview-crit-counts-mesh", file: "src/telnet/screens/overview.ts", tests: ["overviewScreen"], + find: " const crit = data.symptoms().filter((s) => s.severity === 'crit').length;", + repl: " const crit = data.symptoms().filter((s) => s.severity === 'crit' && s.nodeId != null).length;", + what: "a mesh-wide crit is counted too, as REMEDY's own N critical counts it" }, + { id: "engine-tracked-alarm-first", file: "src/telnet/screens/engine.ts", tests: ["engineScreen"], + find: " tracked.sort((a, b) => rank(a) - rank(b) || a.nodeId - b.nodeId);\n", + repl: "", + what: "tracked nodes are ranked alarm-first before the 8-row cap, so a high-id GAVE UP row survives it" }, + { id: "engine-tracked-rank-launch-gave-up", file: "src/telnet/screens/engine.ts", tests: ["engineScreen"], + find: " n.gaveUp || n.launchGaveUp ? 0 :", + repl: " n.gaveUp ? 0 :", + what: "a node whose probes could not be sent ranks with a give-up" }, + { id: "engine-tracked-rank-dead", file: "src/telnet/screens/engine.ts", tests: ["engineScreen"], + find: " : n.deadSinceMs != null ? 1 :", + repl: " : (false as boolean) ? 1 :", + what: "a node Dead now ranks above a miss streak" }, + { id: "engine-tracked-rank-misses", file: "src/telnet/screens/engine.ts", tests: ["engineScreen"], + find: " : n.missStreak > 0 ? 2 : 3;", + repl: " : (false as boolean) ? 2 : 3;", + what: "a miss streak ranks above a probe-kill or hold" }, + { id: "engine-tracked-id-tiebreak", file: "src/telnet/screens/engine.ts", tests: ["engineScreen"], + find: "rank(a) - rank(b) || a.nodeId - b.nodeId", + repl: "rank(a) - rank(b) || b.nodeId - a.nodeId", + what: "node id breaks ties, ascending" }, + { id: "engine-driver-prose-own-row", file: "src/telnet/screens/engine.ts", tests: ["engineScreen"], + find: " if (down) {\n push(' ' + tone(clipWords(ws, view.cols - 4)));", + repl: " if ((false as boolean) && down) {\n push(' ' + tone(clipWords(ws, view.cols - 4)));", + what: "a link that is not live puts its prose on its own row, so the cause survives 80 columns" }, + { id: "engine-driver-prose-bit-when-up", file: "src/telnet/screens/engine.ts", tests: ["engineScreen"], + find: "...(down ? [] : [c.grey(ws)])", + repl: "...([] as string[])", + what: "a live, connecting or handshake link keeps its prose as a bit beside the state" }, + { id: "engine-driver-down-states", file: "src/telnet/screens/engine.ts", tests: ["engineScreen"], + find: " const down = st !== 'live' && st !== 'connecting' && st !== 'handshake';", + repl: " const down = st !== 'live';", + what: "connecting and handshake are not a link that is down" }, + { id: "engine-driver-consequence-shown", file: "src/telnet/screens/engine.ts", tests: ["engineScreen"], + find: " if (st === 'dormant' || st === 'backoff' || st === 'stopped') {", + repl: " if ((false as boolean)) {", + what: "a dormant, backoff or stopped link says which watches are off" }, + { id: "engine-driver-consequence-not-disabled", file: "src/telnet/screens/engine.ts", tests: ["engineScreen"], + find: " if (st === 'dormant' || st === 'backoff' || st === 'stopped') {", + repl: " if ((true as boolean)) {", + what: "a disabled link, which had no URL to reach, gets no consequence row" }, + { id: "engine-ledger-confirming-first", file: "src/telnet/screens/engine.ts", tests: ["engineScreen"], + find: " const ranked = [...open].sort((a, b) => (b.confirming ? 1 : 0) - (a.confirming ? 1 : 0));", + repl: " const ranked = [...open];", + what: "LEDGER — LIVE lists confirming episodes before the six-row cap" }, + { id: "engine-ledger-overflow-confirming", file: "src/telnet/screens/engine.ts", tests: ["engineScreen"], + find: " const k = hiddenConfirming > 0 ? ` (${hiddenConfirming} confirming)` : '';", + repl: " const k = '';", + what: "the overflow line counts the confirming episodes it hides" }, + { id: "engine-ledger-overflow-counts-hidden", file: "src/telnet/screens/engine.ts", tests: ["engineScreen"], + find: " const hiddenConfirming = ranked.slice(6).filter((e) => e.confirming).length;", + repl: " const hiddenConfirming = ranked.filter((e) => e.confirming).length;", + what: "the overflow count is of the hidden episodes, not all of them" }, + { id: "engine-ledger-lifecycle-by-fit", file: "src/telnet/screens/engine.ts", tests: ["engineScreen"], + find: " push(long.includes(arm) ? long\n", + repl: " push((true as boolean) ? long\n", + what: "the long lifecycle form is used only where the arm bit still fits after it" }, + { id: "engine-ledger-short-confirming", file: "src/telnet/screens/engine.ts", tests: ["engineScreen"], + find: " const life = ep.confirming ? c.green('confirming') : c.yellow('degraded');", + repl: " const life = c.yellow('degraded');", + what: "the one-word form still says confirming" }, + { id: "detail-probes-lifetime", file: "src/telnet/screens/detail.ts", tests: ["detailScreen"], + find: " const forms = [`${a}/${k} answered (${p}, lifetime)`, `${a}/${k} (${p}, lifetime)`, `${a}/${k} lifetime`];", + repl: " const forms = [`${a}/${k} answered (${p})`, `${a}/${k} (${p})`, `${a}/${k}`];", + what: "the Probes ratio carries its lifetime window on the value" }, + { id: "detail-probes-whole-forms", file: "src/telnet/screens/detail.ts", tests: ["detailScreen"], + find: " const ratio = forms.find((f) => f.length <= room) ?? forms[forms.length - 1];", + repl: " const ratio = forms[0];", + what: "the Probes ratio is a whole form at 40 columns, never cut by kv" }, + { id: "detail-probes-self-sheds", file: "src/telnet/screens/detail.ts", tests: ["detailScreen"], + find: "visLen(ratio) + visLen(self) <= room ? self : c.grey(' +1')", + repl: "self", + what: "a self-proven count that does not fit is shed with +1, not silently" }, + { id: "detail-keycaps-page-end", file: "src/telnet/screens/detail.ts", tests: ["detailScreen"], + find: " ['␣/b', 'PAGE', 3],\n ['G', 'END', 3],\n", + repl: "", + what: "Detail's command bar shows the page and end keys at 80x24" }, + { id: "detail-legend-nominal-gate", file: "src/telnet/screens/detail.ts", tests: ["detailScreen"], + find: " if (score != null && score < 80) {", + repl: " if ((false as boolean) && score != null) {", + what: "an unflagged node below 80 is not called RF health nominal" }, + { id: "detail-legend-nominal-boundary", file: "src/telnet/screens/detail.ts", tests: ["detailScreen"], + find: " if (score != null && score < 80) {", + repl: " if (score != null && score <= 80) {", + what: "a score of 80 is still nominal" }, + { id: "detail-legend-forms-fit", file: "src/telnet/screens/detail.ts", tests: ["detailScreen"], + find: " return c.grey(clipWords(forms.find((f) => f.length <= W) ?? forms[forms.length - 1], W));", + repl: " return c.grey(clipWords(forms[0], W));", + what: "the sub-threshold legend is the longest whole form that fits" }, + { id: "remedy-unmeasured-token", file: "src/telnet/screens/remedy.ts", tests: ["remedyScreen"], + find: " ...(eng.timeoutWindowBlind > 0 ? [c.grey(`unmeasured ${eng.timeoutWindowBlind}`)] : []),\n", + repl: "", + what: "REMEDY's counts name the nodes too quiet to rate timeouts" }, + { id: "remedy-unmeasured-token-gated", file: "src/telnet/screens/remedy.ts", tests: ["remedyScreen"], + find: "...(eng.timeoutWindowBlind > 0 ? [c.grey(`unmeasured", + repl: "...(eng.timeoutWindowBlind >= 0 ? [c.grey(`unmeasured", + what: "no unmeasured token with no thin window" }, + { id: "remedy-unmeasured-line", file: "src/telnet/screens/remedy.ts", tests: ["remedyScreen"], + find: " body.push(...unmeasuredNote());\n body.push(...ceilingNote());\n body.push(...rssiNote());\n", + repl: " body.push(...ceilingNote());\n body.push(...rssiNote());\n", + what: "the partial state says the return-path detectors skip the quiet nodes" }, + { id: "remedy-unmeasured-line-gated", file: "src/telnet/screens/remedy.ts", tests: ["remedyScreen"], + find: " const unmeasuredNote = (): string[] => (eng.timeoutWindowBlind > 0", + repl: " const unmeasuredNote = (): string[] => (eng.timeoutWindowBlind >= 0", + what: "no unmeasured line with no thin window" }, + { id: "remedy-fit-form-ladder", file: "src/telnet/screens/remedy.ts", tests: ["remedyScreen"], + find: " ' ' + clipWords((forms.find((f) => visLen(f) <= W) ?? forms[forms.length - 1]).slice(4), W - 4);", + repl: " ' ' + clipWords(forms[0].slice(4), W - 4);", + what: "the rssi and unmeasured notes are the longest whole form that fits" }, + { id: "remedy-para-reflows", file: "src/telnet/screens/remedy.ts", tests: ["remedyScreen"], + find: " const para = (lines: string[]): string[] => (lines.every((l) => visLen(l) <= W)", + repl: " const para = (lines: string[]): string[] => ((true as boolean)", + what: "a paragraph hard-wrapped for 80 columns is re-flowed where it does not fit, never cut blind at 40" }, + { id: "remedy-learning-no-base-speaks", file: "src/telnet/screens/remedy.ts", tests: ["remedyScreen"], + find: " if (heal == null) {\n if (e.n <= 0) return null;\n", + repl: " if (heal == null) {\n return null;\n", + what: "a below-readiness arm with no measured control arm still renders, harm warning included" }, + { id: "remedy-learning-no-base-null-at-zero", file: "src/telnet/screens/remedy.ts", tests: ["remedyScreen"], + find: " if (e.n <= 0) return null;\n", + repl: " if ((false as boolean)) return null;\n", + what: "an arm never tried with no control arm still renders nothing" }, + { id: "remedy-learning-no-base-warning-rung", file: "src/telnet/screens/remedy.ts", tests: ["remedyScreen"], + find: "self-heal not yet measured${early}`,\n `${lead}${early}`,\n `${lead}${earlyShort}`,\n", + repl: "self-heal not yet measured${early}`,\n `${lead}${early}`,\n", + what: "at 80 columns the harm warning outlasts the clauses beside the readiness fraction" }, + { id: "remedy-learning-warning-rung", file: "src/telnet/screens/remedy.ts", tests: ["remedyScreen"], + find: " `${lead} — ${heal}${early}`,\n `${lead}${early}`,\n `${lead}${earlyShort}`,\n", + repl: " `${lead} — ${heal}${early}`,\n `${lead}${early}`,\n", + what: "with a measured control arm too, the harm warning outlasts the clauses at 80 columns" }, + { id: "remedy-tally-whole-forms", file: "src/telnet/screens/remedy.ts", tests: ["remedyScreen"], + find: " ' ' + tone(clipWords(forms.find((f) => visLen(f) <= W - 4) ?? forms[forms.length - 1], W - 4));", + repl: " ' ' + tone(truncate(forms[0], W - 4));", + what: "each tally line is the longest whole form that fits, never a blind cut" }, + { id: "remedy-evidence-row-sheds", file: "src/telnet/screens/remedy.ts", tests: ["remedyScreen"], + find: " rows.push(...shedLine(' ', basisWord, sym.evidence.map((e) => `${c.label(e.label)} ${c.white(e.value)}`), W, /* wrapTail */ true, c.grey(' · ')));", + repl: " rows.push(truncate(' ' + [basisWord, ...sym.evidence.map((e) => `${c.label(e.label)} ${c.white(e.value)}`)].join(c.grey(' · ')), W));", + what: "the evidence row sheds whole measurements with +N, never one cut mid-value" }, + { id: "remedy-title-short-form", file: "src/telnet/screens/remedy.ts", tests: ["remedyScreen"], + find: " const titles = [cand.title, ...(cand.short ? [cand.short] : [])];", + repl: " const titles = [cand.title];", + what: "an over-80 candidate title keeps its tag through its short form" }, + { id: "remedy-title-floor-clipwords", file: "src/telnet/screens/remedy.ts", tests: ["remedyScreen"], + find: " ?? headOf(clipWords(titles[titles.length - 1], Math.max(1, W - 6 - 2 - 3))) + c.grey(' +1');", + repl: " ?? headOf(titles[titles.length - 1]) + c.grey(' +1');", + what: "where no title fits with +1, the short one is clipped to whole words and keeps its +1" }, + { id: "remedy-headline-short-form", file: "src/telnet/screens/remedy.ts", tests: ["remedyScreen"], + find: "[plan.headline, ...(plan.headlineShort ? [plan.headlineShort] : [])]", + repl: "[plan.headline]", + what: "the plan headline uses its short form where its own words do not fit" }, + { id: "remedy-headline-clipwords", file: "src/telnet/screens/remedy.ts", tests: ["remedyScreen"], + find: " rows.push(' ' + c.label('▎ ') + c.white(clipWords(headForms.find((f) => visLen(f) <= W - 6) ?? headForms[headForms.length - 1], W - 6)));", + repl: " rows.push(' ' + c.label('▎ ') + c.white(headForms.find((f) => visLen(f) <= W - 6) ?? headForms[headForms.length - 1]));", + what: "the plan headline ends on a whole word at 40 columns, never a blind truncate" }, + { id: "remedy-caveat-by-sentence", file: "src/telnet/screens/remedy.ts", tests: ["remedyScreen"], + find: " const caveat = caveatText(cand.rationale, W - 8);", + repl: " const caveat = null as string | null;", + what: "a rebuild candidate at any rank shows the caveat that names priority routes" }, + { id: "remedy-caveat-priority-first", file: "src/telnet/screens/remedy.ts", tests: ["remedyScreen"], + find: " const hit = sentences.find((x) => PRIORITY.test(x)) ?? sentences.find((x) => CAVEAT.test(x));", + repl: " const hit = sentences.find((x) => CAVEAT.test(x));", + what: "the sentence naming priority routes outranks any other caveat sentence" }, + { id: "remedy-caveat-clause-fallback", file: "src/telnet/screens/remedy.ts", tests: ["remedyScreen"], + find: " const clause = hit.split(/;\\s+|\\s+—\\s+|,\\s+(?=and |but )/).find((x) => re.test(x)) ?? hit;", + repl: " const clause = hit;", + what: "a caveat sentence too wide for its row gives way to the clause that carries it" }, + { id: "remedy-caveat-clipwords-floor", file: "src/telnet/screens/remedy.ts", tests: ["remedyScreen"], + find: " return clipWords(clause === hit ? hit : `… ${clause}`, width);", + repl: " return clause === hit ? hit : `… ${clause}`;", + what: "a caveat clause still too wide ends on a whole word with its marker" }, + { id: "planner-survey-short-title", file: "src/zwave/planner.ts", tests: ["remedyScreen"], + find: ", short: 'Survey the RF environment — measurement needed'", + repl: "", + what: "the RF-survey candidate carries a short title for 80 columns" }, + { id: "planner-edge-cluster-short-headline", file: "src/zwave/planner.ts", tests: ["remedyScreen"], + find: " headlineShort = 'Correlated cluster on a shared route — check the common relay';\n", + repl: "", + what: "edge-cluster's headline has a short form that fits 80 columns" }, + { id: "ring-closure-subtype", file: "src/zwave/zwaveData.ts", tests: ["zwaveDataChurn"], + find: " ? (ep.unprobeable ? ': unprobeable' : ep.transient ? ': transient' : ep.undersampled ? ': undersampled' : '')\n", + repl: " ? ''\n", + what: "an unverifiable closure names its subtype right after the verdict word" }, + { id: "ring-closure-unprobeable", file: "src/zwave/zwaveData.ts", tests: ["zwaveDataChurn"], + find: "(ep.unprobeable ? ': unprobeable' : ", + repl: "((false as boolean) ? ': unprobeable' : ", + what: "a closure on a node that cannot be probed says unprobeable" }, + { id: "ring-closure-transient", file: "src/zwave/zwaveData.ts", tests: ["zwaveDataChurn"], + find: " : ep.transient ? ': transient' : ", + repl: " : (false as boolean) ? ': transient' : ", + what: "a blink says transient" }, + { id: "ring-closure-undersampled", file: "src/zwave/zwaveData.ts", tests: ["zwaveDataChurn"], + find: " : ep.undersampled ? ': undersampled' : '')", + repl: " : '')", + what: "a closure limited by the device's own cadence says undersampled" }, + { id: "manual-ping-answer-logged", file: "src/zwave/autoPing.ts", tests: ["autoPing"], + find: " if (lane === 'manual') {\n", + repl: " if ((false as boolean)) {\n", + what: "an answered manual ping reaches the event ring" }, + { id: "manual-ping-answer-manual-only", file: "src/zwave/autoPing.ts", tests: ["autoPing"], + find: " if (lane === 'manual') {\n", + repl: " if ((true as boolean)) {\n", + what: "an answered sweep probe stays at debug" }, + { id: "session-ping-note-runner", file: "src/telnet/session.ts", tests: ["sessionActions"], + find: " ? (this.data.autoPingState?.() != null ? 'auto-ping judges", + repl: " ? (this.data.autoPingState?.() == null ? 'auto-ping judges", + what: "the ping notice names the LOG verdict only where a runner judges it" }, + { id: "session-ping-note-shown", file: "src/telnet/session.ts", tests: ["sessionActions"], + find: " const note = [res.ok ? res.message.split(' — ').slice(1).join(' — ') : '', pingNote].filter(Boolean).join(' · ');", + repl: " const note = [res.ok ? res.message.split(' — ').slice(1).join(' — ') : ''].filter(Boolean).join(' · ');", + what: "a manual ping notice carries where its answer is judged" }, + { id: "catalog-ping-note-names-log", file: "src/telnet/actionsCatalog.ts", tests: ["sessionActions","actionsCatalog"], + find: "Where auto-ping runs it judges the answer in LOG; otherwise watch", + repl: "Watch", + what: "the Actions-menu ping note says auto-ping's verdict is on LOG" }, + // v0.80.0 (checker round): the 60/40-column harm rungs, the ping note's CONFIRM fit, para() across every empty state, the LWR legend, the LEDGER short arm, the unmeasured line in learning, and the evidence separator. + { id: "remedy-learning-no-base-warning-rung-60", file: "src/telnet/screens/remedy.ts", tests: ["remedyScreen"], + find: "\n ...(early ? [`≈ still learning${earlyShort}`] : []),\n", + repl: "\n", + what: "with no control arm, the harm warning outlasts the readiness fraction at 60 columns" }, + { id: "remedy-learning-warning-rung-60", file: "src/telnet/screens/remedy.ts", tests: ["remedyScreen"], + find: "\n ...(early ? [`≈ still learning${earlyShort}`] : []),\n", + repl: "\n", + what: "with a measured control arm, the harm warning outlasts the readiness fraction at 60 columns" }, + { id: "remedy-learning-no-base-warning-rung-40", file: "src/telnet/screens/remedy.ts", tests: ["remedyScreen"], + find: "\n ...(early ? [`≈${earlyShort.slice(2)}`] : []),\n", + repl: "\n", + what: "with no control arm, the harm warning stands alone after the ≈ at 40 columns" }, + { id: "remedy-learning-warning-rung-40", file: "src/telnet/screens/remedy.ts", tests: ["remedyScreen"], + find: "\n ...(early ? [`≈${earlyShort.slice(2)}`] : []),\n", + repl: "\n", + what: "with a measured control arm, the harm warning stands alone after the ≈ at 40 columns" }, + { id: "remedy-learning-no-base-warning-rung-40-gated", file: "src/telnet/screens/remedy.ts", tests: ["remedyScreen"], + find: "\n ...(early ? [`≈${earlyShort.slice(2)}`] : []),", + repl: "\n ...((true as boolean) ? [`≈${earlyShort.slice(2)}`] : []),", + what: "no bare ≈ rung without a warning, no control arm" }, + { id: "remedy-learning-warning-rung-40-gated", file: "src/telnet/screens/remedy.ts", tests: ["remedyScreen"], + find: "\n ...(early ? [`≈${earlyShort.slice(2)}`] : []),", + repl: "\n ...((true as boolean) ? [`≈${earlyShort.slice(2)}`] : []),", + what: "no bare ≈ rung without a warning, measured control arm" }, + { id: "catalog-ping-note-keeps-confirm-box", file: "src/telnet/actionsCatalog.ts", tests: ["actionsCatalog"], + find: "so a success means the request was SENT. Where auto-ping runs it judges the answer in LOG; otherwise watch the node's Status / Last-seen.\"", + repl: "so a success here means the request was SENT, not that the node answered. With auto-ping running, it judges the answer and LOG shows the verdict; without it, watch the node's Status / Last-seen right after to see if it replied.\"", + what: "the ping note wraps short enough that the CONFIRM box keeps its prompt and Esc = cancel at 80x16 and 60x18" }, + { id: "remedy-disabled-para", file: "src/telnet/screens/remedy.ts", tests: ["remedyScreen"], + find: " body.push(...para([\n ' The symptom engine is not running", + repl: " body.push(...([\n ' The symptom engine is not running", + what: "the disabled paragraph re-flows to whole words at 60 and 40 columns" }, + { id: "remedy-no-nodes-para", file: "src/telnet/screens/remedy.ts", tests: ["remedyScreen"], + find: " body.push(...para([\n ' The engine is running but the roster", + repl: " body.push(...([\n ' The engine is running but the roster", + what: "the no-nodes paragraph re-flows to whole words at 60 and 40 columns" }, + { id: "remedy-ceiling-note-para", file: "src/telnet/screens/remedy.ts", tests: ["remedyScreen"], + find: " ? para([\n ` rtt: ${eng.rttCeiling} with no learned normal", + repl: " ? ([\n ` rtt: ${eng.rttCeiling} with no learned normal", + what: "the ceiling note re-flows to whole words where its two lines do not fit" }, + { id: "remedy-clear-headline-ladder", file: "src/telnet/screens/remedy.ts", tests: ["remedyScreen"], + find: " body.push(c.green(clipWords(clearForms.find((f) => visLen(f) <= W) ?? clearForms[clearForms.length - 1], W)));", + repl: " body.push(c.green(clipWords(clearForms[0], W)));", + what: "the all-clear headline is the longest whole form that fits" }, + { id: "remedy-clear-headline-middle", file: "src/telnet/screens/remedy.ts", tests: ["remedyScreen"], + find: " ` ✓ All clear — ${eng.total} learned, no symptoms.`,\n", + repl: "", + what: "the all-clear headline keeps its node count where the full form does not fit" }, + { id: "remedy-unmeasured-line-learning", file: "src/telnet/screens/remedy.ts", tests: ["remedyScreen"], + find: " // that says what it means follows the paragraph, as in the partial state.\n body.push(...unmeasuredNote());\n", + repl: " // that says what it means follows the paragraph, as in the partial state.\n", + what: "the learning state says what its unmeasured count means" }, + { id: "detail-legend-names-lwr", file: "src/telnet/screens/detail.ts", tests: ["detailScreen"], + find: "sub-threshold lanes (see RTT/Margin/Timeouts/LWR)',", + repl: "sub-threshold lanes (see RTT/Margin/Timeouts)',", + what: "the sub-threshold legend points at the route row too" }, + { id: "engine-ledger-short-arm", file: "src/telnet/screens/engine.ts", tests: ["engineScreen"], + find: " : short.includes(arm) ? short\n", + repl: " : (true as boolean) ? short\n", + what: "at 60 columns the arm takes its short words rather than being shed" }, + { id: "engine-ledger-short-arm-confounded", file: "src/telnet/screens/engine.ts", tests: ["engineScreen"], + find: " const armShort = ep.confounded ? [c.grey('confounded')]", + repl: " const armShort = (false as boolean) ? [c.grey('confounded')]", + what: "a confounded episode's short arm says confounded" }, + { id: "engine-ledger-short-arm-control", file: "src/telnet/screens/engine.ts", tests: ["engineScreen"], + find: " : [c.grey('control arm')];", + repl: " : [arm];", + what: "a control-arm episode's short arm says control arm" }, + { id: "remedy-evidence-row-sep", file: "src/telnet/screens/remedy.ts", tests: ["remedyScreen"], + find: "W, /* wrapTail */ true, c.grey(' · ')));", + repl: "W, /* wrapTail */ true));", + what: "the evidence row sets measurements apart with the two-space mark" }, + { id: "shedline-sep-param", file: "src/telnet/chrome.ts", tests: ["chrome","remedyScreen"], + find: " sep: string = c.grey(' · '),\n): string[] {\n", + repl: " _sep: string = c.grey(' · '),\n): string[] {\n const sep = c.grey(' · ');\n", + what: "shedLine uses the separator its caller passes" }, + { id: "shedline-default-sep", file: "src/telnet/chrome.ts", tests: ["chrome"], + find: " sep: string = c.grey(' · '),\n", + repl: " sep: string = c.grey(' · '),\n", + what: "shedLine's default separator is unchanged for every other caller" }, + // v0.80.0 (delta round): an action arm's 60-column rungs. + { id: "engine-ledger-action-kind-rung", file: "src/telnet/screens/engine.ts", tests: ["engineScreen"], + find: ", c.white(ep.actionKind), c.white('action')]", + repl: ", c.white('action')]", + what: "an action arm that sheds `action: X` at 60 steps down to its name first" }, + { id: "engine-ledger-action-word-rung", file: "src/telnet/screens/engine.ts", tests: ["engineScreen"], + find: "c.white(ep.actionKind), c.white('action')]", + repl: "c.white(ep.actionKind)]", + what: "an action name too long for 60 still leaves the word action" }, + { id: "engine-ledger-arm-first-rung", file: "src/telnet/screens/engine.ts", tests: ["engineScreen"], + find: " : fitted[k < 0 ? fitted.length - 1 : k]);", + repl: " : fitted[fitted.length - 1]);", + what: "the first arm rung that survives is the one used" }, ]; const only = process.argv.find((a) => a.startsWith('--only='))?.slice('--only='.length); diff --git a/zwave_tui/server/src/telnet/actionsCatalog.ts b/zwave_tui/server/src/telnet/actionsCatalog.ts index 19a18e1..367c047 100644 --- a/zwave_tui/server/src/telnet/actionsCatalog.ts +++ b/zwave_tui/server/src/telnet/actionsCatalog.ts @@ -106,7 +106,7 @@ export const ACTION_CATALOG: ActionDescriptor[] = [ scope: 'device', impact: 'safe', desc: 'Send a reachability ping request to the node.', - impactNote: "No data change, but a ping is ONE ACK-only attempt on the stored routes: if it goes unanswered the driver marks the node Dead — even a working one — until something reaches it. HA does not return the ping's result, so a success here means the request was SENT, not that the node answered — watch the node's Status / Last-seen right after to see if it replied.", + impactNote: "No data change, but a ping is ONE ACK-only attempt on the stored routes: if it goes unanswered the driver marks the node Dead — even a working one — until something reaches it. HA does not return the ping's result, so a success means the request was SENT. Where auto-ping runs it judges the answer in LOG; otherwise watch the node's Status / Last-seen.", needsNode: true, }, { diff --git a/zwave_tui/server/src/telnet/chrome.ts b/zwave_tui/server/src/telnet/chrome.ts index e0e8c7f..60dc86c 100644 --- a/zwave_tui/server/src/telnet/chrome.ts +++ b/zwave_tui/server/src/telnet/chrome.ts @@ -159,6 +159,9 @@ export function field(label: string, value: string, color: (s: string) => string * the row, emit it on continuation rows at the same indent instead of * dropping it — used for the blocked-reason chip, which is the one thing on a * "NOT recommended" row an operator must read. + * @param sep the mark between tail tokens (v0.80.0). REMEDY's evidence row + * passes the wider ` · `, because several evidence values carry a ` · ` + * inside themselves and a qualifier must not read as a measurement of its own. */ export function shedLine( indent: string, @@ -166,8 +169,8 @@ export function shedLine( tail: string[], cols: number, wrapTail = false, + sep: string = c.grey(' · '), ): string[] { - const sep = c.grey(' · '); const headRow = indent + head; // (a) The head is never shed. If it alone overflows there is nothing to // compose — clip it and say nothing further, rather than emitting a diff --git a/zwave_tui/server/src/telnet/screens/detail.ts b/zwave_tui/server/src/telnet/screens/detail.ts index 66a58e1..baad8c7 100644 --- a/zwave_tui/server/src/telnet/screens/detail.ts +++ b/zwave_tui/server/src/telnet/screens/detail.ts @@ -25,7 +25,7 @@ */ import { honestPct } from '../ledgerText'; -import { c, lr, padEnd, truncate, visLen } from '../ansi'; +import { c, clipWords, lr, padEnd, truncate, visLen } from '../ansi'; import { gauge, meter, signalBars, sparkline } from '../gauges'; import { NodeStatus, @@ -494,7 +494,21 @@ export function renderDetail(ctx: ScreenCtx): string[] { const caveat = preEpoch ? c.grey(inner - KV_GUTTER >= caveatLong.trim().length ? caveatLong : caveatShort) : ''; - body.push(kv('Probes', tone(`${cov.probesAnswered}/${cov.probesAsked} answered (${honestPct(cov.probesAnswered, cov.probesAsked)})`) + self, inner)); + // THE WINDOW RIDES ON THE VALUE (v0.80.0). The ratio is cumulative over + // the add-on's life, and the only word that said so was the pre-v0.40.2 + // caveat three rows below — which retires for a node first seen after + // the epoch, leaving a bare ratio that reads as a recent rate. Each form + // is whole, longest first; the self-proven count is shed with `+1`. + { + const a = cov.probesAnswered; + const k = cov.probesAsked; + const p = honestPct(a, k); + const room = inner - KV_GUTTER; + const forms = [`${a}/${k} answered (${p}, lifetime)`, `${a}/${k} (${p}, lifetime)`, `${a}/${k} lifetime`]; + const ratio = forms.find((f) => f.length <= room) ?? forms[forms.length - 1]; + const tail = self === '' ? '' : visLen(ratio) + visLen(self) <= room ? self : c.grey(' +1'); + body.push(kv('Probes', tone(ratio) + (visLen(ratio) + visLen(tail) <= room ? tail : ''), inner)); + } // THE FRAME (v0.71.0). The sweep sends a routed read wherever the node // has a switch/light value, and an answered read is a different fact // from an answered ping: the ping could use only the stored routes, the @@ -753,7 +767,7 @@ export function renderDetail(ctx: ScreenCtx): string[] { const windowRows = rows.slice(scroll, scroll + contentRows); while (windowRows.length < contentRows) windowRows.push(''); - windowRows.push(flagLegend(health.flags, W, health.state)); + windowRows.push(flagLegend(health.flags, W, health.state, health.score)); const st = statusColor(n.status)(n.statusLabel.toUpperCase()); const sc = dead(n) ? c.grey('—') : scoreColor(health.score)(`${health.score} (${health.grade})`); @@ -764,8 +778,14 @@ export function renderDetail(ctx: ScreenCtx): string[] { ? c.grey(' · ') + c.cyan(`${scroll > 0 ? '▲' : ' '}${scroll < maxScroll ? '▼' : ' '} ${scroll + 1}–${Math.min(total, scroll + contentRows)}/${total}`) : ''; + // THE ONE-KEYSTROKE JUMPS, ADVERTISED (v0.80.0). Space/b page and G jumps + // to the end — where EVIDENCE sits, below the fold at 80x24 for every device + // shape — and the bar named only the one-row scroll. They are the first caps + // shed, with `+2`, where the bar does not fit them. const keys: Keycap[] = [ ['↑↓', 'SCROLL'], + ['␣/b', 'PAGE', 3], + ['G', 'END', 3], ['< >', 'NODE', 2], ['A', 'ACTIONS', 1], ['1-9', 'SCREENS'], @@ -786,13 +806,28 @@ function feedTag(name: string, live: boolean): string { } /** Per-node flag legend, pinned at the bottom of the Detail body. */ -function flagLegend(flags: string[], W: number, state?: string): string { +function flagLegend(flags: string[], W: number, state?: string, score?: number): string { if (!flags.length) { // A node the controller has never contacted raises NO flags — it has no // measurements to raise them from — so "nominal" asserted health from an // absence, directly under a title rule reading UNKNOWN · SCORE —. if (state === 'unknown') return c.grey(' no measurements yet — nothing to assess'); if (state === 'dead') return c.grey(' unreachable — the readings above are its last, not current'); + // NOMINAL ONLY WHERE THE SCORE SAYS SO (v0.80.0). No flag means no lane + // crossed its own flag threshold, not that nothing is wrong: an unflagged + // 66/D read "RF health nominal" directly under `SCORE 66 (D)`. Below 80 the + // legend names where the points went instead — the route lane's hop count + // and data rate included, which the LWR row shows. + if (score != null && score < 80) { + const forms = [ + ' no flag threshold crossed — the score is lost in sub-threshold lanes (see RTT/Margin/Timeouts/LWR)', + ' no flag threshold crossed — the score is lost in sub-threshold lanes', + ' no flag crossed — the score is lost in sub-threshold lanes', + ' no flag crossed — score lost below the thresholds', + ' no flag crossed — lost below thresholds', + ]; + return c.grey(clipWords(forms.find((f) => f.length <= W) ?? forms[forms.length - 1], W)); + } return c.grey(' RF health nominal'); } const meanings = flags.map((f) => flagColor([f])(f) + c.grey(' ' + (FLAG_MEANING[f] ?? '?'))).join(c.grey(' · ')); diff --git a/zwave_tui/server/src/telnet/screens/engine.ts b/zwave_tui/server/src/telnet/screens/engine.ts index 5d9c107..c7b6d38 100644 --- a/zwave_tui/server/src/telnet/screens/engine.ts +++ b/zwave_tui/server/src/telnet/screens/engine.ts @@ -33,7 +33,7 @@ import { UNWATCHED_TEXT, type UnwatchedReason } from '../../zwave/missedReport'; import { ADMISSION_SUMMARY } from '../../zwave/admission'; import { PAUSE_ENTITY } from '../../zwave/autonomyPause'; -import { c, truncate, visLen } from '../ansi'; +import { c, clipWords, truncate, visLen } from '../ansi'; import { provenance, weight, unscoreableReason } from '../ledgerText'; import { REFUSAL_INDICTS } from '../../zwave/planner'; import { frame } from '../chrome'; @@ -270,6 +270,15 @@ export function renderEngine(ctx: ScreenCtx): string[] { push(' ' + c.yellow('flag dump is the only source. This is a MONITORING gap, not a healthy mesh.')); } } else { + // ALARM RANK BEFORE THE CAP (v0.80.0). The snapshot lists nodes in id + // order and the cap is a fixed 8, so on a bad day eight low-id nodes + // holding a 24 h own-probe kill filled the list and a high-id GAVE UP row + // fell into the "more tracked" count at every terminal size. The rows + // that ask for a human come first, then a node Dead now, then a miss + // streak, then the rest; node id breaks ties. `tracked` is a fresh array. + const rank = (n: (typeof tracked)[number]): number => + n.gaveUp || n.launchGaveUp ? 0 : n.deadSinceMs != null ? 1 : n.missStreak > 0 ? 2 : 3; + tracked.sort((a, b) => rank(a) - rank(b) || a.nodeId - b.nodeId); for (const n of tracked.slice(0, 8)) { const name = data.nodeById?.(n.nodeId)?.name ?? `node ${n.nodeId}`; // ALARMS FIRST. These two are the only rows that ask for a human, so @@ -394,8 +403,26 @@ export function renderEngine(ctx: ScreenCtx): string[] { // `s2LaneLive` collapsed four causes into one boolean whose callers record // `null`, so "nothing to report" and "cannot report" were the same value. const s2 = data.s2LaneFault?.() ?? null; + // THE PROSE ON ITS OWN ROW WHEN THE LINK IS DOWN (v0.80.0). As the second + // bit it was shed at 80 columns, so a link that went dormant mid-run read + // `dormant · +1`: the cause ("schema mismatch …") and what it costs were on + // no row an operator at the modal size could see. Live, connecting and + // handshake keep the prose as a bit — it is status there, not a cause. + const down = st !== 'live' && st !== 'connecting' && st !== 'handshake'; push(fitBits(c.label('DRIVER LINK') + ' ', - [tone(st), c.grey(ws), ...(s2 ? [c.yellowB(`S2 lane ${s2}`)] : [])], view.cols)); + [tone(st), ...(down ? [] : [c.grey(ws)]), ...(s2 ? [c.yellowB(`S2 lane ${s2}`)] : [])], view.cols)); + if (down) { + push(' ' + tone(clipWords(ws, view.cols - 4))); + // What a link that is not live costs, for the states that had a URL to + // reach. `disabled` has none, and its row above already says so. + if (st === 'dormant' || st === 'backoff' || st === 'stopped') { + push(' ' + c.grey(clipWords(pick(view.cols - 4, [ + 'background RSSI, S2-desync and duplicate-frame watches are off', + 'bgRSSI, S2-desync and duplicate-frame watches off', + 'bgRSSI, S2 and dup-frame watches off', + ]), view.cols - 4))); + } + } if (s2) { const resumeAt = data.s2LaneResumeAt?.() ?? null; push(' ' + c.yellow(s2 === 'storm-paused' @@ -450,24 +477,51 @@ export function renderEngine(ctx: ScreenCtx): string[] { '○ no open episodes.', ]))); } else { - for (const ep of open.slice(0, 6)) { + // CONFIRMING FIRST (v0.80.0). The ledger lists episodes oldest first, so a + // chronic kind's old episodes filled the six rows and the one in its + // confirmation window — the episode an action now would confound — was + // hidden behind a bare count. A stable sort keeps the age order inside + // each group, and the overflow line says how many it hides are confirming. + const ranked = [...open].sort((a, b) => (b.confirming ? 1 : 0) - (a.confirming ? 1 : 0)); + for (const ep of ranked.slice(0, 6)) { const who = ep.nodeId == null ? c.blue('MESH') : c.cyan(`#${ep.nodeId}`); // Ordered by what an operator loses least by having truncated: the // lifecycle state and the arm this episode will (or will not) feed come // FIRST, because a clipped "confounded" reads as a clean control point — // the v0.35 lesson about the basis glyph, applied to the ledger. - const bits: string[] = []; - bits.push(ep.confirming - ? c.green('confirming — symptom absent, scoring') - : c.yellow('degraded — symptom live')); - if (ep.confounded) bits.push(c.grey('confounded — neither arm')); - else if (ep.actionKind) bits.push(c.white(`action: ${ep.actionKind}`)); - else bits.push(c.grey('no action — control arm')); - bits.push(c.grey(`open ${age(now - ep.onsetMs)}`)); - if (ep.beforeFreshN != null) bits.push(c.grey(`fresh=${ep.beforeFreshN}`)); - push(fitBits(' ' + who + ' ' + c.white(ep.kind) + ' ', bits, view.cols)); + const arm = ep.confounded ? c.grey('confounded — neither arm') + : ep.actionKind ? c.white(`action: ${ep.actionKind}`) + : c.grey('no action — control arm'); + const rest = [c.grey(`open ${age(now - ep.onsetMs)}`), ...(ep.beforeFreshN != null ? [c.grey(`fresh=${ep.beforeFreshN}`)] : [])]; + const head = ' ' + who + ' ' + c.white(ep.kind) + ' '; + // THE LIFECYCLE FORM IS CHOSEN BY FIT (v0.80.0). The long form is 36 + // columns, so at 80 fitBits shed the ARM bit behind it — a confounded + // episode and a clean control point both read `confirming — symptom + // absent, scoring · +3`. The long form is used only where the arm bit + // still fits after it; otherwise the one-word state carries the row. + // Where even that sheds the arm — 60 columns, behind a long kind name — + // the arm itself steps down through shorter words, so a confounded + // episode, a control point and an action arm still read apart: + // `confounded`, `control arm`, and `action: X` → `X` → `action`. The + // first rung that survives is used; the last is shed like any bit. + const life = ep.confirming ? c.green('confirming') : c.yellow('degraded'); + const long = fitBits(head, [ep.confirming ? c.green('confirming — symptom absent, scoring') : c.yellow('degraded — symptom live'), arm, ...rest], view.cols); + const short = fitBits(head, [life, arm, ...rest], view.cols); + const armShort = ep.confounded ? [c.grey('confounded')] + : ep.actionKind ? [c.white(`action: ${ep.actionKind}`), c.white(ep.actionKind), c.white('action')] + : [c.grey('control arm')]; + const fitted = armShort.map((a) => fitBits(head, [life, a, ...rest], view.cols)); + const k = fitted.findIndex((r, i) => r.includes(armShort[i])); + push(long.includes(arm) ? long + : short.includes(arm) ? short + : fitted[k < 0 ? fitted.length - 1 : k]); + } + if (open.length > 6) { + const more = open.length - 6; + const hiddenConfirming = ranked.slice(6).filter((e) => e.confirming).length; + const k = hiddenConfirming > 0 ? ` (${hiddenConfirming} confirming)` : ''; + push(' ' + c.grey(pick(view.cols - 2, [`○ ${more} more open episode${more === 1 ? '' : 's'}${k}`, `○ ${more} more${k}`]))); } - if (open.length > 6) push(' ' + c.grey(`○ ${open.length - 6} more open episode(s)`)); } /* ── LEDGER: LEARNED ───────────────────────────────────────────────────── */ diff --git a/zwave_tui/server/src/telnet/screens/overview.ts b/zwave_tui/server/src/telnet/screens/overview.ts index f429167..8cc53d6 100644 --- a/zwave_tui/server/src/telnet/screens/overview.ts +++ b/zwave_tui/server/src/telnet/screens/overview.ts @@ -309,10 +309,20 @@ function telemetryStrip(ctx: ScreenCtx): string { ? Math.max(0, all.length - dead - flaky - unknown - failing) / all.length : 0; + // THE ENGINE'S CRITICAL FINDINGS, COUNTED ON THE HOME SCREEN (v0.80.0). The + // roster's `!` mark is per row, so with the default health sort a crit on an + // A-scored node sat below the fold at 80x24 and 120x40 and nothing on the + // frame said one existed. The count is REMEDY's own `N critical`, mesh-wide + // symptoms included. Inserted right after DEAD, not appended: fieldStrip + // sheds from the END, and an appended field is dropped at exactly the 80 + // columns that need it. Absent when there is none, so a healthy strip is + // unchanged. + const crit = data.symptoms().filter((s) => s.severity === 'crit').length; const fields = [ field('NODES', String(all.length), c.whiteB), field('ONLINE', String(online), c.green), field('DEAD', String(dead), dead > 0 ? c.redB : c.grey), + ...(crit > 0 ? [field('CRIT', String(crit), c.redB)] : []), field('ASLEEP', String(asleep), asleep > 0 ? c.cyan : c.grey), field('FLAKY', String(flaky), flaky > 0 ? c.yellow : c.grey), ...(unknown > 0 ? [field('UNKNOWN', String(unknown), c.yellow)] : []), diff --git a/zwave_tui/server/src/telnet/screens/remedy.ts b/zwave_tui/server/src/telnet/screens/remedy.ts index 55ab458..aa2caa9 100644 --- a/zwave_tui/server/src/telnet/screens/remedy.ts +++ b/zwave_tui/server/src/telnet/screens/remedy.ts @@ -11,7 +11,7 @@ import type { ScreenCtx, Symptom, NodeSnapshot, SymptomKind, ActionKind, Efficacy } from '../../types'; import { provenance, weight, unscoreableReason, subsumptionLabel } from '../ledgerText'; import { c, clipWords, truncate, visLen } from '../ansi'; -import { frame, fieldStrip, shedLine } from '../chrome'; +import { frame, fieldStrip, shedLine, wrapWords } from '../chrome'; import { planFor, type PlanCandidate } from '../../zwave/planner'; import { summonsHeadline } from '../../zwave/recommendation'; import type { AutoPingNodeState } from '../../zwave/autoPing'; @@ -76,7 +76,40 @@ function efficacyNote(e: Efficacy | null | undefined, blocked = false, width = I // symptom may be fully measured. The self-heal rate is the operator's // actual decision input here: if this kind clears itself 80% of the time, // that is worth knowing precisely BECAUSE the action is unproven. - if (heal == null) return null; + // A below-readiness arm whose attempts have ONLY made things worse is the + // arm an operator most needs warned about, and the readiness gate is + // exactly what was silencing it. Said, hedged honestly as too few. + const early = e.harmed >= 1 && e.harmed >= e.n - 1e-9 + ? ' — ⚠ every attempt so far made it WORSE (too few to be sure)' + : e.harmed >= 0.5 ? ` — ⚠ ${weight(e.harmed)} of those made it worse` : ''; + // The warning without its hedge (v0.80.0), so it outlasts the readiness + // fraction at 80 columns: the fraction beside it already says "too few". + // Where even that does not fit, a rung that keeps the warning comes ahead + // of the bare fraction: `≈ still learning — ⚠ every try made it WORSE` at + // 60 columns, and below the fraction the warning alone after the `≈`, which + // fits 40. + const earlyShort = e.harmed >= 1 && e.harmed >= e.n - 1e-9 + ? ' — ⚠ every try made it WORSE' + : e.harmed >= 0.5 ? ` — ⚠ ${weight(e.harmed)} made it worse` : ''; + const lead = `≈ still learning this action (${weight(e.n)} of ${e.minN})`; + // NO CONTROL ARM IS NOT NO ATTEMPTS (v0.80.0). This returned null whenever + // the kind's self-heal rate was unmeasured, before `n` or the harm warning + // above were looked at — so an arm tried 2.9 times, every one of them + // making it worse, rendered the same silence as one never tried at all. + // Only an arm with no attempts and no base rate has nothing to say. + if (heal == null) { + if (e.n <= 0) return null; + return c.grey(pick([ + `${lead} — self-heal not yet measured${early}`, + `${lead}${early}`, + `${lead}${earlyShort}`, + ...(early ? [`≈ still learning${earlyShort}`] : []), + lead, + ...(early ? [`≈${earlyShort.slice(2)}`] : []), + `≈ still learning${early}`, + '≈ still learning', + ])); + } // An arm nobody has ever run is not "still learning" — there is nothing to // learn from. Say what IS known: how the kind behaves untouched. if (e.n <= 0) { @@ -86,13 +119,6 @@ function efficacyNote(e: Efficacy | null | undefined, blocked = false, width = I '≈ never tried here', ])); } - // A below-readiness arm whose attempts have ONLY made things worse is the - // arm an operator most needs warned about, and the readiness gate is - // exactly what was silencing it. Said, hedged honestly as too few. - const early = e.harmed >= 1 && e.harmed >= e.n - 1e-9 - ? ' — ⚠ every attempt so far made it WORSE (too few to be sure)' - : e.harmed >= 0.5 ? ` — ⚠ ${weight(e.harmed)} of those made it worse` : ''; - const lead = `≈ still learning this action (${weight(e.n)} of ${e.minN})`; // `lead` itself is 38 columns before the 8-column indent, so it does NOT // fit a 40-column terminal — the shortest form must drop the readiness // fraction rather than let it be clipped to "n≈2". @@ -100,7 +126,10 @@ function efficacyNote(e: Efficacy | null | undefined, blocked = false, width = I `${lead} — ${heal}${healProv}${early}`, `${lead} — ${heal}${early}`, `${lead}${early}`, + `${lead}${earlyShort}`, + ...(early ? [`≈ still learning${earlyShort}`] : []), lead, + ...(early ? [`≈${earlyShort.slice(2)}`] : []), `≈ still learning${early}`, '≈ still learning', ])); @@ -283,6 +312,26 @@ interface Ledger { * survives. */ const CAVEAT = /deletes|discards|priority route|half-interviewed|comes back|re-churn/i; +const PRIORITY = /priority route/i; + +/** + * The caveat a candidate must show, whole, in `width` columns (v0.80.0), or + * null when its rationale carries none. The sentence naming priority routes + * comes first — it is the side effect an operator cannot undo — then any other + * CAVEAT sentence. A sentence that does not fit gives way to the clause inside + * it that carries the caveat, marked `… ` as part of a longer sentence; past + * that, clipWords of the clause. + */ +function caveatText(rationale: string, width: number): string | null { + if (width <= 0) return null; + const sentences = rationale.split(/(?<=[.!?])\s+/); + const hit = sentences.find((x) => PRIORITY.test(x)) ?? sentences.find((x) => CAVEAT.test(x)); + if (hit == null) return null; + if (visLen(hit) <= width) return hit; + const re = PRIORITY.test(hit) ? PRIORITY : CAVEAT; + const clause = hit.split(/;\s+|\s+—\s+|,\s+(?=and |but )/).find((x) => re.test(x)) ?? hit; + return clipWords(clause === hit ? hit : `… ${clause}`, width); +} function symptomBlock(sym: Symptom, now: number, W: number, nameOf: (id: number) => string, writeActions: boolean, nodeOf: (id: number) => NodeSnapshot | undefined, ledger: Ledger, selected = false): string[] { const { efficacyFor } = ledger; @@ -307,10 +356,17 @@ function symptomBlock(sym: Symptom, now: number, W: number, nameOf: (id: number) ); // Evidence line — leads with the full basis word (measured/inferred), then the // grey label = value pairs. + // One TOKEN per measurement (v0.80.0). This row was one join and a blind + // truncate, so at 80 columns weak-signal's `failed deliveries 13 …` lost its + // window and rtt-degraded's restart allowance stopped mid-word. shedLine + // drops whole measurements with a `+N`, and carries them to continuation + // rows only where not even the first one fits beside the basis word. { const basisWord = sym.basis === 'measured' ? c.green('measured') : c.yellow('inferred'); - const parts = [basisWord, ...sym.evidence.map((e) => `${c.label(e.label)} ${c.white(e.value)}`)]; - rows.push(truncate(' ' + parts.join(c.grey(' · ')), W)); + // The two-space separator the row always used (v0.80.0): several values + // carry a ` · ` of their own (`38±6ms · capped at 300ms`), and a qualifier + // set off by the same mark reads as a separate measurement. + rows.push(...shedLine(' ', basisWord, sym.evidence.map((e) => `${c.label(e.label)} ${c.white(e.value)}`), W, /* wrapTail */ true, c.grey(' · '))); } // MEMBERS, as atomic tokens (v0.45.0). `Symptom.members` was populated by the // edge-cluster detector and read by NOTHING; the ids survived only inside an @@ -325,12 +381,23 @@ function symptomBlock(sym: Symptom, now: number, W: number, nameOf: (id: number) // and no screen showed it — a strange omission for an ADVISORY engine, since // this is the one number that argues against the card it sits on. Shown only // when non-zero: a clean detector says nothing rather than boasting. + // WHOLE FORMS, NEVER A BLIND CUT (v0.80.0). Each tally line below was one + // sentence and a `truncate`, so at 80 columns they ended `weigh the evidence + // a`, `too few readings to ju`, `probe re-` — the count survived and the + // clause explaining it stopped mid-word. Each now picks the longest whole + // form that fits, with clipWords as the floor. No line wraps: the screen + // does not scroll, and a taller card would push the plan off the frame. + const tally = (forms: string[], tone: (x: string) => string = c.grey): string => + ' ' + tone(clipWords(forms.find((f) => visLen(f) <= W - 4) ?? forms[forms.length - 1], W - 4)); { const fp = ledger.falsePositives(sym.kind); if (fp > 0) { - rows.push(truncate( - ' ' + c.yellow(`⚠ this detector has been refused as a misdiagnosis ${fp}\u00d7`) + - c.grey(' — weigh the evidence above before acting'), W)); + rows.push(tally([ + `⚠ this detector has been refused as a misdiagnosis ${fp}\u00d7 — weigh the evidence above before acting`, + `⚠ this detector has been refused as a misdiagnosis ${fp}\u00d7 — weigh the evidence`, + `⚠ refused as a misdiagnosis ${fp}\u00d7 — weigh the evidence`, + `⚠ refused as misdiagnosis ${fp}\u00d7`, + ], c.yellow)); } // What the ledger could not SCORE (v0.36). An empty efficacy table reads // exactly like a patient one, so a kind whose episodes all close @@ -345,33 +412,52 @@ function symptomBlock(sym: Symptom, now: number, W: number, nameOf: (id: number) // silently drained the meaning from the fixable one. const unver = ledger.unverifiable(sym.kind); if (unver > 0) { - rows.push(truncate( - ' ' + c.grey(`○ ${unver} past episode${unver === 1 ? '' : 's'} of this kind could not be scored — ` + - 'too few readings to judge recovery'), W)); + const eps = `past episode${unver === 1 ? '' : 's'}`; + rows.push(tally([ + `○ ${unver} ${eps} of this kind could not be scored — too few readings to judge recovery`, + `○ ${unver} ${eps} could not be scored — too few readings to judge recovery`, + `○ ${unver} ${eps} could not be scored — too few readings`, + `○ ${unver} unscoreable — too few readings`, + `○ ${unver} unscoreable`, + ])); } const unprobe = ledger.unverifiableUnprobeable(sym.kind); if (unprobe > 0) { - rows.push(truncate( - ' ' + c.grey(`○ ${unprobe} more on sleeping device${unprobe === 1 ? '' : 's'} that cannot be probed — ` + - 'unscoreable by design, not a gap'), W)); + const dev = `sleeping device${unprobe === 1 ? '' : 's'}`; + rows.push(tally([ + `○ ${unprobe} more on ${dev} that cannot be probed — unscoreable by design, not a gap`, + `○ ${unprobe} more on ${dev} that cannot be probed — by design`, + `○ ${unprobe} unprobeable — unscoreable by design`, + `○ ${unprobe} unprobeable — by design`, + ])); } const transient = ledger.unverifiableTransient(sym.kind); if (transient > 0) { - rows.push(truncate( - ' ' + c.grey(`○ ${transient} transient blink${transient === 1 ? '' : 's'} — over before the evidence floor filled; ` + - 'unscoreable by design, not a gap'), W)); + const blinks = `transient blink${transient === 1 ? '' : 's'}`; + rows.push(tally([ + `○ ${transient} ${blinks} — over before the evidence floor filled; unscoreable by design, not a gap`, + `○ ${transient} ${blinks} — over before the evidence floor filled`, + `○ ${transient} ${blinks} — unscoreable by design`, + `○ ${transient} ${blinks}`, + ])); } const under = ledger.unverifiableUndersampled(sym.kind); if (under > 0) { - rows.push(truncate( - ' ' + c.grey(`○ ${under} could not be scored at this device's reporting rate — ` + - 'it had the time, never the readings'), W)); + rows.push(tally([ + `○ ${under} could not be scored at this device's reporting rate — it had the time, never the readings`, + `○ ${under} could not be scored at this device's reporting rate`, + `○ ${under} undersampled — the device reports too rarely`, + `○ ${under} undersampled`, + ])); } const conf = ledger.confounded(sym.kind); if (conf > 0) { - rows.push(truncate( - ' ' + c.grey(`○ ${conf} confounded — credited to neither arm (a death, remediation or probe re-route ` + - 'during or just before the episode)'), W)); + rows.push(tally([ + `○ ${conf} confounded — credited to neither arm (a death, remediation or probe re-route during or just before the episode)`, + `○ ${conf} confounded — credited to neither arm (a death, remediation or probe re-route)`, + `○ ${conf} confounded — credited to neither arm`, + `○ ${conf} confounded`, + ])); } } // WHY there are no ledger rows at all, for kinds where that is permanent @@ -389,9 +475,12 @@ function symptomBlock(sym: Symptom, now: number, W: number, nameOf: (id: number) const canProbe = ledger.probeable(sym.nodeId); const owed = ledger.verifyOwedFor(sym.nodeId); if (canProbe === false) { - rows.push(truncate(' ' + c.grey( - '○ this device cannot be probed (sleeping/FLiRS) — its evidence windows ' + - 'can never be filled, so outcomes here stay unscoreable'), W)); + rows.push(tally([ + '○ this device cannot be probed (sleeping/FLiRS) — its evidence windows can never be filled, so outcomes here stay unscoreable', + '○ this device cannot be probed (sleeping/FLiRS) — outcomes here stay unscoreable', + '○ cannot be probed (sleeping/FLiRS) — unscoreable here', + '○ cannot be probed — unscoreable', + ])); } else if (!ledger.laneLive && unscoreableReason(sym.kind) == null && metricOf(sym.kind) !== 'none') { // NO RUNNER, NO VERIFICATION LANE (v0.79.9): index.ts starts both // together. Each kind's evidence floor counts readings of its own signal @@ -407,8 +496,12 @@ function symptomBlock(sym: Symptom, now: number, W: number, nameOf: (id: number) ]; rows.push(c.grey(clipWords(forms.find((f) => visLen(f) <= W) ?? forms[forms.length - 1], W))); } else if (owed > 0) { - rows.push(truncate(' ' + c.grey( - `○ ${owed} verification probe${owed === 1 ? '' : 's'} still owed — the score is pending, not absent`), W)); + const probes = `verification probe${owed === 1 ? '' : 's'}`; + rows.push(tally([ + `○ ${owed} ${probes} still owed — the score is pending, not absent`, + `○ ${owed} ${probes} still owed — score pending`, + `○ ${owed} verify probe${owed === 1 ? '' : 's'} owed — pending`, + ])); } } const noScore = unscoreableReason(sym.kind); @@ -456,9 +549,11 @@ function symptomBlock(sym: Symptom, now: number, W: number, nameOf: (id: number) `Node is DOWN — auto-ping gave up after ${tried} attempt${tried === 1 ? '' : 's'}`, `DOWN — auto-ping gave up (${tried} ${tried === 1 ? 'try' : 'tries'})`, 'DOWN — auto-ping gave up']; - rows.push(spent - ? ' ' + c.label('▎ ') + c.white(clipWords(spentForms.find((f) => visLen(f) <= W - 6) ?? spentForms[spentForms.length - 1], W - 6)) - : truncate(' ' + c.label('▎ ') + c.white(plan.headline), W)); + // The planner's headline the same way (v0.80.0): its own words, then its + // short form where it has one, clipWords as the floor — edge-cluster's + // ended `not each no` at 80 under a blind truncate. + const headForms = spent ? spentForms : [plan.headline, ...(plan.headlineShort ? [plan.headlineShort] : [])]; + rows.push(' ' + c.label('▎ ') + c.white(clipWords(headForms.find((f) => visLen(f) <= W - 6) ?? headForms[headForms.length - 1], W - 6))); plan.candidates.slice(0, 3).forEach((cand, i) => { const runnable = cand.action != null && cand.blocked == null; const marker = cand.action != null ? (runnable ? c.green('▸') : c.grey('▸')) : c.grey('·'); @@ -477,11 +572,22 @@ function symptomBlock(sym: Symptom, now: number, W: number, nameOf: (id: number) // folklore". Shed it whole with `+1` instead, the same convention // detail.ts uses. Measured over a 750-scenario sweep: 474 clipped rows to // 0, with no card lost at 80x24 and none at 40 either. - const headBase = `${marker} ${c.white(cand.title)}`; - const tagged = `${headBase} ${tags}`; + // A SHORT TITLE BEFORE A SHED TAG (v0.80.0). Four titles are 70-80 + // columns, so with the 8-column indent they overflowed 80 on their own: + // shedLine clipped the head and the `+1` that discloses the shed tag went + // with it — mesh-interference's survey row ended `measurement needed to` + // with its `[physical · inference]` silently gone. The order: the title + // with its tag, the short title with its tag, either with `+1`, and the + // short title clipped to whole words with `+1` as the floor. + const titles = [cand.title, ...(cand.short ? [cand.short] : [])]; + const fits = (h: string): boolean => visLen(' ' + h) <= W; + const headOf = (t: string): string => `${marker} ${c.white(t)}`; + const head = titles.map((t) => `${headOf(t)} ${tags}`).find(fits) + ?? titles.map((t) => headOf(t) + c.grey(' +1')).find(fits) + ?? headOf(clipWords(titles[titles.length - 1], Math.max(1, W - 6 - 2 - 3))) + c.grey(' +1'); rows.push(...shedLine( ' ', - visLen(' ' + tagged) <= W ? tagged : headBase + c.grey(' +1'), + head, cand.blocked ? [c.grey('⊘ ' + cand.blocked)] : [], W, /* wrapTail */ true, @@ -496,12 +602,15 @@ function symptomBlock(sym: Symptom, now: number, W: number, nameOf: (id: number) // EVERY executable when write actions are off, so on a read-only install // that form would ground all three candidates on every card and blow the // row budget. - const rl = wrap(cand.rationale, W - 8); - const caveatLine = rl.find((l) => CAVEAT.test(l)); - if (i === 0 || caveatLine != null) { - const pick = i === 0 ? (caveatLine ?? rl[0]) : caveatLine; - if (pick != null) rows.push(truncate(' ' + c.grey(pick + (rl.length > 1 ? ' …' : '')), W)); - } + // THE CAVEAT IS CHOSEN BY SENTENCE (v0.80.0), not by wrapped line. A + // wrap can split "priority" from "routes", and the line picked then lost + // its object — healNode read `…deletes any manually-set priority …` at 80 + // — while the 8-space indent ate the ` …` at 120. The sentence that names + // priority routes wins; one too wide gives way to its own clause, and + // clipWords at W-8 is the floor, so the marker always fits. + const caveat = caveatText(cand.rationale, W - 8); + const ground = caveat ?? (i === 0 ? clipWords(cand.rationale, W - 8) : null); + if (ground != null && ground !== '') rows.push(' ' + c.grey(ground)); // M5: the learned efficacy note. Every candidate the ledger can have an // opinion about gets one — i.e. every candidate with an action, blocked or // not. efficacyNote() carries the blocked framing so a "NOT recommended" @@ -666,12 +775,24 @@ export function renderRemedy(ctx: ScreenCtx): string[] { // learning vs genuinely all-healthy — never rendered identically. const eng = data.engineStatus(); body.push(''); + // A paragraph hard-wrapped for 80 columns, re-flowed where it is wider + // than the terminal (v0.80.0): kept line for line where every line fits, + // so the familiar text is unchanged, and word-wrapped otherwise — at 40 + // columns the all-clear's first line was cut blind, and at 60 the + // disabled and no-nodes paragraphs were. Each of the five empty states' + // paragraphs goes through it, and the two-line ceiling note; the one-line + // notes pick from ladders of their own. + const para = (lines: string[]): string[] => (lines.every((l) => visLen(l) <= W) + ? lines + : wrapWords(lines.map((l) => l.trim()).join(' '), Math.max(8, W - 4)).map((l) => ' ' + l)); if (!eng.enabled) { empty = 'disabled'; body.push(c.yellow(' ● Engine disabled.')); body.push(''); - body.push(c.grey(' The symptom engine is not running on this install (no baselines')); - body.push(c.grey(' store configured), so nothing is being diagnosed.')); + body.push(...para([ + ' The symptom engine is not running on this install (no baselines', + ' store configured), so nothing is being diagnosed.', + ]).map((l) => c.grey(l))); } else if (eng.total === 0) { // The engine is on and has nothing to be on ABOUT (v0.43.1). Every count // below is 0/0, which passes all three "fully graduated" comparisons — @@ -681,9 +802,11 @@ export function renderRemedy(ctx: ScreenCtx): string[] { empty = 'no-nodes'; body.push(c.cyan(' ◷ No nodes yet.')); body.push(''); - body.push(c.grey(' The engine is running but the roster is empty — nothing has been')); - body.push(c.grey(' measured, so nothing can be diagnosed or cleared. This is normal')); - body.push(c.grey(' for the first seconds after a restart.')); + body.push(...para([ + ' The engine is running but the roster is empty — nothing has been', + ' measured, so nothing can be diagnosed or cleared. This is normal', + ' for the first seconds after a restart.', + ]).map((l) => c.grey(l))); } else { // Which DETECTORS cannot judge every node in THIS band, and on how many. // @@ -712,8 +835,15 @@ export function renderRemedy(ctx: ScreenCtx): string[] { for (const f of forms) if (visLen(f) <= W) return f; return forms[forms.length - 1]; }; + // The longest whole form that fits, clipWords as the floor (v0.80.0). + const fitForm = (forms: string[]): string => + ' ' + clipWords((forms.find((f) => visLen(f) <= W) ?? forms[forms.length - 1]).slice(4), W - 4); const counts = (): string[] => [ c.grey(` timeouts ${eng.timeoutReady}/${eng.total}`), + // v0.80.0: nodes whose 10-minute window is too thin to RATE timeouts — + // the return-path detectors skip them, so `timeouts 33/39` alone read + // as 33 nodes judged. Its own field beside the series it qualifies. + ...(eng.timeoutWindowBlind > 0 ? [c.grey(`unmeasured ${eng.timeoutWindowBlind}`)] : []), c.grey(`rtt ${eng.rttReady}/${eng.total}`), // v0.79.0: rtt nodes with no learned band whom the fixed ceiling still // judges. Its own field, so the rtt count keeps meaning "learned". @@ -725,8 +855,10 @@ export function renderRemedy(ctx: ScreenCtx): string[] { // "would not be flagged" stopped being true of it — but only a severe // slowdown clears that ceiling, so it is not covered either. const ceilingNote = (): string[] => (eng.rttCeiling > 0 - ? [c.grey(clipWords(` rtt: ${eng.rttCeiling} with no learned normal are held to a fixed ${RTT_CEILING_MS} ms`, W)), - c.grey(clipWords(' ceiling meanwhile, so only a severe slowdown is flagged there.', W))] + ? para([ + ` rtt: ${eng.rttCeiling} with no learned normal are held to a fixed ${RTT_CEILING_MS} ms`, + ' ceiling meanwhile, so only a severe slowdown is flagged there.', + ]).map((l) => c.grey(l)) : []); // The ledger's open episodes belong to EVERY no-symptom state, not just // the green one (v0.46.0). An episode in its confirmation window has no @@ -739,7 +871,24 @@ export function renderRemedy(ctx: ScreenCtx): string[] { // as under partial coverage — "everything is graduated" would otherwise be // read as covering it. const rssiNote = (): string[] => (rssiShort > 0 - ? [truncate(c.grey(` (rssi is short on ${rssiShort} — a dossier yardstick only, it arms no detector.)`), W)] + ? [c.grey(fitForm([ + ` (rssi is short on ${rssiShort} — a dossier yardstick only, it arms no detector.)`, + ` (rssi short on ${rssiShort} — a dossier yardstick, arms no detector.)`, + ` (rssi short on ${rssiShort}: arms no detector.)`, + ` (rssi short on ${rssiShort}: dossier only.)`, + ]))] + : []); + // The thin windows, in the partial and learning states too (v0.80.0). + // The all-clear has counted them since v0.79.9; the partial state is the + // one a routed mesh sits in, and its counts said nothing about them. + const unmeasuredNote = (): string[] => (eng.timeoutWindowBlind > 0 + ? [c.grey(fitForm([ + ` timeout: ${eng.timeoutWindowBlind} too quiet in 10 min to rate — the return-path detectors skip them.`, + ` timeout: ${eng.timeoutWindowBlind} too quiet in 10 min to rate — return-path detectors skip them.`, + ` timeout: ${eng.timeoutWindowBlind} too quiet to rate; return-path skips them.`, + ` timeout: ${eng.timeoutWindowBlind} too quiet in 10 min to rate.`, + ` timeout: ${eng.timeoutWindowBlind} too quiet to rate.`, + ]))] : []); const episodeLine = (): string[] => { const openEps = data.openEpisodes() ?? []; @@ -781,11 +930,16 @@ export function renderRemedy(ctx: ScreenCtx): string[] { body.push(''); body.push(fieldStrip(view, counts())); body.push(''); - body.push(c.grey(' Each node’s normal is learned per series and per time-of-day band,')); - body.push(c.grey(' from the evidence stream across several distinct days, before its')); - body.push(c.grey(eng.rttCeiling > 0 - ? ' learned detectors may fire. Nothing here is a health claim yet.' - : ' detectors may fire. Nothing here is a health claim yet.')); + body.push(...para([ + ' Each node’s normal is learned per series and per time-of-day band,', + ' from the evidence stream across several distinct days, before its', + eng.rttCeiling > 0 + ? ' learned detectors may fire. Nothing here is a health claim yet.' + : ' detectors may fire. Nothing here is a health claim yet.', + ]).map((l) => c.grey(l))); + // The counts above carry `unmeasured N` here too (v0.80.0), so the line + // that says what it means follows the paragraph, as in the partial state. + body.push(...unmeasuredNote()); body.push(...ceilingNote()); } else if (blind.length > 0) { empty = 'partial'; @@ -814,12 +968,15 @@ export function renderRemedy(ctx: ScreenCtx): string[] { body.push(fieldStrip(view, counts())); body.push(''); const which = blind.map(([name, n]) => `${name} (${n})`).join(', '); - body.push(truncate(c.grey(` No learned yardstick in this band: ${which} of ${eng.total} nodes.`), W)); - body.push(c.grey(eng.rttCeiling > 0 - ? ' A degradation on those nodes may go unflagged, so this is a' - : ' A degradation on those nodes would not be flagged, so this is a')); - body.push(c.grey(' statement about COVERAGE, not health. Baselines reset on a route')); - body.push(c.grey(' change, so routed nodes may never graduate.')); + body.push(...para([ + ` No learned yardstick in this band: ${which} of ${eng.total} nodes.`, + eng.rttCeiling > 0 + ? ' A degradation on those nodes may go unflagged, so this is a' + : ' A degradation on those nodes would not be flagged, so this is a', + ' statement about COVERAGE, not health. Baselines reset on a route', + ' change, so routed nodes may never graduate.', + ]).map((l) => c.grey(l))); + body.push(...unmeasuredNote()); body.push(...ceilingNote()); body.push(...rssiNote()); body.push(...episodeLine()); @@ -827,10 +984,19 @@ export function renderRemedy(ctx: ScreenCtx): string[] { // FULL coverage in this band. "All clear" is a claim about the WHOLE // engine, and this screen only knows about live symptoms (v0.43.1). empty = 'clear'; - body.push(c.green(` ✓ All clear — ${eng.total} nodes learned, no symptoms detected.`)); + // A whole headline at every width (v0.80.0): at 40 columns the one + // form was cut mid-word. clipWords is the floor below the ladder. + const clearForms = [ + ` ✓ All clear — ${eng.total} nodes learned, no symptoms detected.`, + ` ✓ All clear — ${eng.total} learned, no symptoms.`, + ' ✓ All clear — no symptoms.', + ]; + body.push(c.green(clipWords(clearForms.find((f) => visLen(f) <= W) ?? clearForms[clearForms.length - 1], W))); body.push(''); - body.push(truncate(c.grey(' Every node has a graduated timeout and rtt baseline — the two'), W)); - body.push(truncate(c.grey(' that arm a detector —'), W)); + body.push(...para([ + ' Every node has a graduated timeout and rtt baseline — the two', + ' that arm a detector —', + ]).map((l) => c.grey(l))); // WHAT THE BRANCH CHECKED (v0.79.9): `symptoms.length === 0`, so no // symptom is firing. "None is currently anomalous" claimed a judgment // the engine cannot make on a node whose 10-minute window is too thin. diff --git a/zwave_tui/server/src/telnet/session.ts b/zwave_tui/server/src/telnet/session.ts index eefb1ae..1b7ceb0 100644 --- a/zwave_tui/server/src/telnet/session.ts +++ b/zwave_tui/server/src/telnet/session.ts @@ -1166,7 +1166,14 @@ export class TuiSession { // What the reply said (v0.72.0 review): a success can carry a note — a // heal's unreported return-route step, a config write queued for a // sleeper's wake-up — and an UNKNOWN outcome is not a failure. - const note = res.ok ? res.message.split(' — ').slice(1).join(' — ') : ''; + // A PING'S ANSWER HAS A HOME WHERE A RUNNER EXISTS (v0.80.0): the manual + // ping is pended on auto-ping's answer check, which books an answer or a + // miss as a LOG line. With no runner nothing judges it, and the notice + // keeps HA's own caveat: the request was sent, the answer is not known. + const pingNote = res.ok && action.kind === 'ping' + ? (this.data.autoPingState?.() != null ? 'auto-ping judges whether it answered — see LOG (e)' : 'HA does not return the answer — watch its Status / Last-seen') + : ''; + const note = [res.ok ? res.message.split(' — ').slice(1).join(' — ') : '', pingNote].filter(Boolean).join(' · '); this.actionNotice = res.ok ? `✓ ${action.label}` : res.unknown ? `◷ ${res.message}` : `✗ ${res.message}`; this.actionNoticeDetail = [note, this.pauseAckText()].filter(Boolean).join(' · ') || null; this.pauseAckPending = false; diff --git a/zwave_tui/server/src/zwave/autoPing.ts b/zwave_tui/server/src/zwave/autoPing.ts index 43e9201..5783038 100644 --- a/zwave_tui/server/src/zwave/autoPing.ts +++ b/zwave_tui/server/src/zwave/autoPing.ts @@ -2141,6 +2141,16 @@ export function startAutoPing(o: AutoPingRunnerOptions): { if (answered) { // Only the fixed-cadence sweep feeds the persisted reply rate (v0.40.2). if (lane === 'sweep') o.onProbeResult?.(nodeId, true, cls, frame); + // THE OPERATOR'S OWN PING IS ANSWERED ON SCREEN (v0.80.0). A miss + // reached LOG and the ENGINE streak; an answer reached only debug, so + // `p` reported "sent" and then said nothing. One line per key a person + // pressed, so it is not the per-probe noise of the sweep below. + if (lane === 'manual') { + const m = `node ${nodeId} answered your ping (lastSeen advanced)`; + o.log('info', nodeId, m); + o.log2?.(`auto-ping: ${m}`); + continue; + } o.log2?.debug?.(`auto-ping: node ${nodeId} answered its probe`); continue; } diff --git a/zwave_tui/server/src/zwave/planner.ts b/zwave_tui/server/src/zwave/planner.ts index 12e3ed4..3fba659 100644 --- a/zwave_tui/server/src/zwave/planner.ts +++ b/zwave_tui/server/src/zwave/planner.ts @@ -38,6 +38,9 @@ export interface PlanCandidate { action: ActionKind | null; /** Short recommendation label. */ title: string; + /** A shorter whole form of `title` (v0.80.0), for a title that cannot keep + * its [cost · basis] tag at 80 columns; REMEDY prefers it to a shed tag. */ + short?: string; /** Grounded explanation — NO numeric dB claims (RESEARCH §1.7). */ rationale: string; basis: Basis; @@ -54,6 +57,8 @@ export interface Plan { nodeId: number | null; /** One-line headline recommendation. */ headline: string; + /** A shorter whole form of `headline` (v0.80.0), for one over 74 columns. */ + headlineShort?: string; /** Ranked candidates (best first). */ candidates: PlanCandidate[]; } @@ -132,6 +137,7 @@ export function planFor(symptom: Symptom, node: NodeSnapshot | undefined, ctx: P const lr = isLR(node, nodeId); const candidates: PlanCandidate[] = []; let headline = ''; + let headlineShort: string | undefined; switch (symptom.kind) { case 'return-path-degraded': @@ -188,7 +194,7 @@ export function planFor(symptom: Symptom, node: NodeSnapshot | undefined, ctx: P // exist there (same guard the route-churn card carries). const s2LR = isLR(node, symptom.nodeId); // shared helper: fails closed on a roster miss candidates.push(s2LR - ? { action: null, title: 'Close the distance or clear the obstruction (Long-Range is a direct link)', rationale: 'S2 keeps a rolling nonce (SPAN) in step between controller and device. A storm of resyncs means frames are being lost faster than the sync recovers — the encryption is working, the radio link under it is not. This node is Long-Range: it holds a single direct link to the controller with no intermediate hop to strengthen, so the fix is distance, obstruction, or antenna placement at one end or the other.', basis: 'source', cost: 'physical', blocked: null } + ? { action: null, title: 'Close the distance or clear the obstruction (Long-Range is a direct link)', short: 'Close the distance or clear the obstruction', rationale: 'S2 keeps a rolling nonce (SPAN) in step between controller and device. A storm of resyncs means frames are being lost faster than the sync recovers — the encryption is working, the radio link under it is not. This node is Long-Range: it holds a single direct link to the controller with no intermediate hop to strengthen, so the fix is distance, obstruction, or antenna placement at one end or the other.', basis: 'source', cost: 'physical', blocked: null } : { action: null, title: 'Improve the RF path (distance, obstruction, interference)', rationale: 'S2 keeps a rolling nonce (SPAN) in step between controller and device. Resynchronisation is normal after an occasional missed frame, but a storm of resyncs means frames are being lost faster than the sync can recover — the encryption is working as designed, the radio link underneath it is not. Move the device or add a mains repeater on its path.', basis: 'source', cost: 'physical', blocked: null }); candidates.push({ action: null, title: 'Check whether the device is rebooting', rationale: 'A device that keeps power-cycling loses its nonce state on every boot and produces the same resync pattern. If its other telemetry also restarts (uptime, battery, config reverting), treat it as a power/hardware fault rather than an RF one.', basis: 'lore', cost: 'physical', blocked: null }); candidates.push({ action: 'reInterview', title: 'Re-interview — NOT a fix for nonce desync', rationale: 'Re-interviewing re-reads capabilities over the SAME degraded link; it neither re-keys the device nor repairs SPAN sync, and on a marginal link it often fails part-way and leaves the node half-interviewed. Fix the RF path first.', basis: 'source', cost: 'caution', blocked: 'RF-link symptom — will not repair it' }); @@ -224,7 +230,7 @@ export function planFor(symptom: Symptom, node: NodeSnapshot | undefined, ctx: P const rfLR = isLR(node, symptom.nodeId); // Long-Range is a direct link: no repeater or route can help it (review). candidates.push(rfLR - ? { action: null, title: 'Close the distance or clear the obstruction (Long-Range is a direct link)', rationale: 'The node keeps repeating its frames because the controller\'s acknowledgements do not reach it. A Long-Range node talks to the controller directly, so only distance, obstruction or the antenna placement can change that: move the device or the controller, or clear what sits between them.', basis: 'lore', cost: 'physical', blocked: null } + ? { action: null, title: 'Close the distance or clear the obstruction (Long-Range is a direct link)', short: 'Close the distance or clear the obstruction', rationale: 'The node keeps repeating its frames because the controller\'s acknowledgements do not reach it. A Long-Range node talks to the controller directly, so only distance, obstruction or the antenna placement can change that: move the device or the controller, or clear what sits between them.', basis: 'lore', cost: 'physical', blocked: null } : { action: null, title: 'Check what sits between it and the controller', rationale: 'The node keeps repeating its frames because the controller\'s acknowledgements do not reach it: the link works one way. A repeater on the way that is often switched off, a metal box, or distance does this. A mains device placed between this node and the controller strengthens the return path.', basis: 'lore', cost: 'physical', blocked: null }); if (!rfLR) { // Offered only to say when it can help (RESEARCH §4.1): a rebuild does @@ -243,7 +249,7 @@ export function planFor(symptom: Symptom, node: NodeSnapshot | undefined, ctx: P case 'chatty-device': { headline = 'Tune the device’s reporting — it is flooding the mesh'; - candidates.push({ action: null, title: 'Reduce its reporting (change-based, not timed) or re-include without S0', rationale: 'A device sending orders of magnitude more reports than the mesh median degrades everyone. Fix the cause: raise its reporting thresholds, prefer change-based over timed reports, and avoid S0 security on sensors (it triples the airtime). These are device-config changes, done in the Z-Wave JS UI.', basis: 'source', cost: 'physical', blocked: null }); + candidates.push({ action: null, title: 'Reduce its reporting (change-based, not timed) or re-include without S0', short: 'Reduce its reporting or re-include without S0', rationale: 'A device sending orders of magnitude more reports than the mesh median degrades everyone. Fix the cause: raise its reporting thresholds, prefer change-based over timed reports, and avoid S0 security on sensors (it triples the airtime). These are device-config changes, done in the Z-Wave JS UI.', basis: 'source', cost: 'physical', blocked: null }); candidates.push({ action: 'reInterview', title: 'Re-interview (after changing its config)', rationale: 'Re-reads the device’s capabilities and config — useful after you change its reporting parameters, not a fix on its own.', basis: 'source', cost: 'caution', blocked: gateExecutable(node, ctx) }); break; } @@ -257,7 +263,7 @@ export function planFor(symptom: Symptom, node: NodeSnapshot | undefined, ctx: P case 'controller-degraded': { headline = 'Controller serial link is struggling — fix the stick side'; - candidates.push({ action: null, title: 'USB-2 port + a short passive extension, away from USB-3; relocate the stick', rationale: 'Rising serial NAK/CAN/timeouts are a host↔stick problem, not a per-node RF fault. Z-Wave sticks are prone to USB-3 broadband interference — move it to a USB-2 port on a short passive extension cable, away from USB-3 ports and metal, ideally central.', basis: 'source', cost: 'physical', blocked: null }); + candidates.push({ action: null, title: 'USB-2 port + a short passive extension, away from USB-3; relocate the stick', short: 'USB-2 port + a short extension, away from USB-3', rationale: 'Rising serial NAK/CAN/timeouts are a host↔stick problem, not a per-node RF fault. Z-Wave sticks are prone to USB-3 broadband interference — move it to a USB-2 port on a short passive extension cable, away from USB-3 ports and metal, ideally central.', basis: 'source', cost: 'physical', blocked: null }); break; } @@ -266,7 +272,7 @@ export function planFor(symptom: Symptom, node: NodeSnapshot | undefined, ctx: P ? 'Correlated mesh degradation — likely RF interference (unconfirmed)' : 'Correlated mesh degradation — a flooding device is the likely cause'; if (symptom.basis === 'inferred') { - candidates.push({ action: null, title: 'Survey the RF environment (900 MHz interferers) — measurement needed to confirm', rationale: 'Many nodes degraded together with no controller-serial or flooding cause points to an RF-environment event. Common 900 MHz interferers: a utility smart meter, older cordless phones/baby monitors, LoRa/Sidewalk. Confirming this needs a noise-floor reading; treat this as a lead, not a verdict.', basis: 'inference', cost: 'physical', blocked: null }); + candidates.push({ action: null, title: 'Survey the RF environment (900 MHz interferers) — measurement needed to confirm', short: 'Survey the RF environment — measurement needed', rationale: 'Many nodes degraded together with no controller-serial or flooding cause points to an RF-environment event. Common 900 MHz interferers: a utility smart meter, older cordless phones/baby monitors, LoRa/Sidewalk. Confirming this needs a noise-floor reading; treat this as a lead, not a verdict.', basis: 'inference', cost: 'physical', blocked: null }); } else { candidates.push({ action: null, title: 'Fix the flooding device first (see its chatty-device card)', rationale: 'The correlated degradation coincides with a device flooding the mesh — that traffic is the likely cause, not RF interference. Tune the offender’s reporting before looking further.', basis: 'source', cost: 'physical', blocked: null }); } @@ -280,6 +286,7 @@ export function planFor(symptom: Symptom, node: NodeSnapshot | undefined, ctx: P // (an edge-cluster head is never LR, but the guard must hold regardless). const shared = nodeId != null ? `#${nodeId}${node ? ' ' + node.name : ''}` : 'the shared node'; headline = 'Correlated cluster on a shared route — check the common relay, not each node'; + headlineShort = 'Correlated cluster on a shared route — check the common relay'; candidates.push({ action: null, title: `Inspect the shared upstream node (${shared})`, @@ -309,7 +316,7 @@ export function planFor(symptom: Symptom, node: NodeSnapshot | undefined, ctx: P if (c.action != null) c.efficacy = ctx.efficacyFor(symptom.kind, c.action); } } - return { kind: symptom.kind, nodeId, headline, candidates }; + return { kind: symptom.kind, nodeId, headline, ...(headlineShort ? { headlineShort } : {}), candidates }; } /** Build plans for a list of symptoms (skips ones subsumed under a mesh event — diff --git a/zwave_tui/server/src/zwave/zwaveData.ts b/zwave_tui/server/src/zwave/zwaveData.ts index dd4744e..72ab3d7 100644 --- a/zwave_tui/server/src/zwave/zwaveData.ts +++ b/zwave_tui/server/src/zwave/zwaveData.ts @@ -2119,9 +2119,19 @@ class ZwaveDataImpl implements ZwaveData { // `worse` lifts to warn. A regression logged at info is a regression // nobody sees. Deliberately NOT 'error': the errorsOnly filter is for // things that FAILED, and a closure verdict is a measurement. + // THE QUALIFIER SITS ON THE VERDICT (v0.80.0). An unverifiable verdict + // carries which kind it is — a structural one (unprobeable), a blink + // (transient), or the device's own cadence (undersampled) — and a + // confounded one says so, right after the verdict word. This line + // carried no subtype before: only the outcomes stdout line did, so on + // the ring a by-design blink read the same as a fixable evidence gap. + // The confounded tag sat at the END, and the Log list row, which keeps + // about 46 columns of text at 80, cut it. + const sub = ep.verdict === 'unverifiable' + ? (ep.unprobeable ? ': unprobeable' : ep.transient ? ': transient' : ep.undersampled ? ': undersampled' : '') + : ep.confounded && ep.verdict !== 'refused-misdiagnosis' ? ' (confounded)' : ''; this.pushEvent('engine', ep.verdict === 'worse' ? 'warn' : 'info', 'symptom', ep.nodeId, - `${ep.kind} closed ${ep.verdict}${ep.action ? ` after ${ep.action.kind} (${ep.action.origin ?? 'you'})` : ' (no action)'}` + - (ep.confounded && ep.verdict !== 'unverifiable' && ep.verdict !== 'refused-misdiagnosis' ? ' (confounded)' : '') + + `${ep.kind} closed ${ep.verdict}${sub}${ep.action ? ` after ${ep.action.kind} (${ep.action.origin ?? 'you'})` : ' (no action)'}` + (ep.killedAfter ? ` (went Dead ≤${KILLED_AFTER_MS / 60_000}m after it)` : '')); } } diff --git a/zwave_tui/server/test/actionsCatalog.test.ts b/zwave_tui/server/test/actionsCatalog.test.ts index 0d76d15..806736f 100644 --- a/zwave_tui/server/test/actionsCatalog.test.ts +++ b/zwave_tui/server/test/actionsCatalog.test.ts @@ -274,7 +274,29 @@ test('the Ping node note says an unanswered ping marks the node Dead — never " assert.ok(ping, 'ping is in the catalog'); assert.doesNotMatch(ping.impactNote, /harmless/i); assert.match(ping.impactNote, /ONE ACK-only attempt on the stored routes: if it goes unanswered the driver marks the node Dead — even a working one/); - assert.match(ping.impactNote, /request was SENT, not that the node answered/, 'and it keeps the result caveat'); + assert.match(ping.impactNote, /HA does not return the ping's result, so a success means the request was SENT\./, 'and it keeps the result caveat'); +}); + +test('the Ping node CONFIRM box keeps its prompt and Esc = cancel at 60x18, 80x16 and 120x16 (v0.80.0)', () => { + // `centeredNotice` ends in out.slice(0, H), and the session clamps rows to 16 + // or more. A ping note that wrapped to 7 lines at noteW 64 (9 at 52) pushed + // `Esc = cancel` off the bottom at 80x16 and 120x16, and at 60x18 too. + const strip = (x: string) => x.replace(/\x1b\[[0-9;?]*[a-zA-Z]/g, ''); + const ping = describeAction('ping')!; + const box = (cols: number, rows: number): string[] => renderTypeConfirm({ cols, rows } as ViewState, { + label: ping.label, target: '#16 Kitchen Lights', impact: ping.impact, + desc: ping.desc, impactNote: ping.impactNote, buffer: '', + } as never).map(strip); + for (const [cols, rows] of [[60, 18], [80, 16], [120, 16]] as const) { + const lines = box(cols, rows); + assert.equal(lines.length, rows, `${cols}x${rows}: the frame is exactly the terminal`); + assert.ok(lines.some((l) => /type CONFIRM to arm/.test(l)), `${cols}x${rows}: the arming prompt:\n${lines.join('\n')}`); + assert.ok(lines.some((l) => /Esc = cancel/.test(l)), `${cols}x${rows}: the way out:\n${lines.join('\n')}`); + } + // One row taller, the whole box fits, bottom border included. + for (const [cols, rows] of [[60, 18], [80, 17]] as const) { + assert.ok(box(cols, rows).some((l) => /╚═+╝/.test(l)), `${cols}x${rows}: the box closes:\n${box(cols, rows).join('\n')}`); + } }); test('the local-decision predicate covers the identity AND autonomy kinds, and no mesh action (v0.72.0)', () => { diff --git a/zwave_tui/server/test/autoPing.test.ts b/zwave_tui/server/test/autoPing.test.ts index c7678f3..6d5280c 100644 --- a/zwave_tui/server/test/autoPing.test.ts +++ b/zwave_tui/server/test/autoPing.test.ts @@ -3810,3 +3810,33 @@ test('a sweep or verification probe is PLANNED at its slot when it is pended, so assert.deepEqual(R.of('sent').map((c) => c.id), [50, 100, 101]); R.h.stop(); }); + +test("an ANSWERED manual ping reaches the event ring, in the operator's words (v0.80.0)", async () => { + // A miss reached LOG and the ENGINE streak; an answer reached only debug, + // so `p` reported "sent" and then said nothing on any screen. + const { startAutoPing } = await import('../src/zwave/autoPing'); + let clock = T; + const ring: { sev: string; id: number | null; text: string }[] = []; + const server: string[] = []; + const debugged: string[] = []; + const log2 = Object.assign((m: string) => { server.push(m); }, { debug: (m: string) => { debugged.push(m); } }); + const answered = { stats: { lastSeen: T + 40 } as never }; + const nodes = mesh(20, [node(7, answered), node(8, answered)]); + const h = startAutoPing({ + nodes: () => nodes, controller: () => null, ready: () => true, + ping: async () => {}, log: (sev, id, text) => { ring.push({ sev, id, text }); }, log2, + config: cfg(), tickMs: 1_000_000, now: () => clock, + }); + try { + h.notePending(7, 'manual', T); // the operator's ping + h.notePending(8, 'sweep', T); // control: our own probe, answered the same way + clock = T + 2 * MIN; // past the answer grace + h.tick(); + const mine = ring.filter((r) => /answered your ping/.test(r.text)); + assert.deepEqual(mine, [{ sev: 'info', id: 7, text: 'node 7 answered your ping (lastSeen advanced)' }], + `exactly the manual one, at info: ${JSON.stringify(ring)}`); + assert.ok(server.some((l) => /node 7 answered your ping/.test(l)), 'and the container log'); + assert.ok(!ring.some((r) => /node 8/.test(r.text)), 'an answered sweep probe stays off the ring'); + assert.ok(debugged.some((l) => /node 8 answered its probe/.test(l)), 'at debug, as before'); + } finally { h.stop(); } +}); diff --git a/zwave_tui/server/test/chrome.test.ts b/zwave_tui/server/test/chrome.test.ts index b57412a..5b8fc7d 100644 --- a/zwave_tui/server/test/chrome.test.ts +++ b/zwave_tui/server/test/chrome.test.ts @@ -132,6 +132,18 @@ test('shedLine with no tail is just the head', () => { assert.deepEqual(shedLine(' ', 'bare', [], 40).map(strip), [' bare']); }); +test('shedLine takes the mark between tail tokens as an argument, and its default is unchanged (v0.80.0)', () => { + // REMEDY's evidence row passes ` · `: several values carry a ` · ` inside + // themselves, and the same mark between measurements made a qualifier read + // as a measurement of its own. Every other caller keeps ` · `. + const ids = ['#4', '#17', '#23']; + assert.equal(strip(shedLine(' ', 'downstream', ids, 200)[0]), ' downstream #4 · #17 · #23'); + assert.equal(strip(shedLine(' ', 'downstream', ids, 200, false, ' · ')[0]), ' downstream #4 · #17 · #23'); + // The wider mark is measured too: at 26 columns one token fewer fits. + assert.equal(strip(shedLine(' ', 'downstream', ids, 26)[0]), ' downstream #4 · #17 +1'); + assert.equal(strip(shedLine(' ', 'downstream', ids, 26, false, ' · ')[0]), ' downstream #4 +2'); +}); + /* ── v0.47.0: the standing auto-ping suppression chip ─────────────────────── */ test('a SUPPRESSED sweep shows a standing chip; a running one shows nothing', () => { diff --git a/zwave_tui/server/test/detailScreen.test.ts b/zwave_tui/server/test/detailScreen.test.ts index 33ef893..7b88339 100644 --- a/zwave_tui/server/test/detailScreen.test.ts +++ b/zwave_tui/server/test/detailScreen.test.ts @@ -432,14 +432,14 @@ test('the probe reply rate reaches the screen — a rate collected and never sho const out = evidenceLines(withProbes({ probesAsked: 84, probesAnswered: 81, probesSelfProven: 22, probesEchoOnly: 0, probesAttribUnknown: 0, probesUnheard: 0 })); const row = out.find((l) => /^\s*Probes/.test(l)); assert.ok(row, 'the Probes row must render'); - assert.match(row!, /81\/84 answered \(96%\)/); + assert.match(row!, /81\/84 answered \(96%, lifetime\)/); assert.match(row!, /22 self-proven/, 'and how many the node had already answered for itself'); }); test('one unanswered probe is never "100%", and a sliver of fresh samples is never "0%" (v0.74.1)', () => { const out = evidenceLines(withProbes({ samples: 638906, freshSamples: 748, probesAsked: 475, probesAnswered: 474, probesSelfProven: 35, probesEchoOnly: 0, probesAttribUnknown: 0, probesUnheard: 0 })); const probes = out.find((l) => /^\s*Probes/.test(l)) ?? ''; - assert.match(probes, /474\/475 answered \(>99%\)/, probes); + assert.match(probes, /474\/475 answered \(>99%, lifetime\)/, probes); const samples = out.find((l) => /^\s*Samples/.test(l)) ?? ''; assert.match(samples, /fresh 748 \(<1% lifetime\)/, samples); }); @@ -1081,3 +1081,51 @@ test('the all-NoOp and all-read Frame forms fit whole, 60 to 200 columns (v0.71. assert.deepEqual([...seen].sort(), ['long', 'short'], 'fixture guard: both forms are exercised'); } }); + +/* ── v0.80.0 ──────────────────────────────────────────────────────────────── */ + +test('the Probes ratio carries its window on the value, so a post-epoch node still reads it as lifetime (v0.80.0)', () => { + // The only word saying the ratio is cumulative was the pre-v0.40.2 caveat + // three rows down, and that caveat retires for a node first seen after the + // epoch — leaving `84/98 answered (86%)`, which reads as a recent rate. + const post = withProbes({ probesAsked: 98, probesAnswered: 84, probesSelfProven: 31, firstSeenAt: 5_000, laneEpoch: 1_000, creditEpoch: 1_000 } as never); + const out = evidenceLines(post); + const row = out.find((l) => /^\s*Probes/.test(l)) ?? ''; + assert.match(row, /84\/98 answered \(86%, lifetime\) · 31 self-proven/, row); + assert.ok(!out.some((l) => /lifetime tally/.test(l)), 'fixture: the caveat has retired for this node'); + // Whole at every width: a shorter form of the ratio, the self-proven count shed with +1. + const at = (W: number): string => renderDetail(ctx(mkView(W, 80), post.data, post.nodes)).map(strip).find((l) => /^\s*Probes/.test(l)) ?? ''; + assert.equal(at(40), ' Probes 84/98 (86%, lifetime) +1'); + assert.equal(at(60), ' Probes 84/98 answered (86%, lifetime) · 31 self-proven'); + assert.equal(at(80), ' Probes 84/98 answered (86%, lifetime) · 31 self-proven'); +}); + +test("Detail's command bar shows the page and end keys at 80x24 (v0.80.0)", () => { + // Space/b page and G jumps to EVIDENCE, the section below the fold at 80x24, + // and the bar named only the one-row scroll. + const { data, nodes } = mkData(); + const bar = (W: number): string => strip(renderDetail(ctx(mkView(W, 24), data, nodes)).at(-1) ?? ''); + assert.match(bar(80), /\[␣\/b\] PAGE .*\[G\] END/, bar(80)); + assert.match(bar(80), /\[Q\] BACK/, 'the way out stays'); + // Narrower, they are the first caps shed, and the shed is counted. + assert.doesNotMatch(bar(60), /PAGE|END/); + assert.match(bar(60), /\+\d/, bar(60)); +}); + +test('the flag legend says "RF health nominal" only when the score is 80 or more (v0.80.0)', () => { + // An unflagged 66/D read "RF health nominal" under `SCORE 66 (D)`: no lane + // crossed its own flag threshold, and the points were lost below them. + const legend = (score: number, grade: string, W = 80): string => { + const d = mkData(); + d.data.scoreFor = () => ({ score, grade, state: 'ok', flags: [] }); + const lines = renderDetail(ctx(mkView(W, 24), d.data, d.nodes)).map(strip); + return lines[lines.length - 2]; + }; + assert.equal(legend(66, 'D'), ' no flag threshold crossed — the score is lost in sub-threshold lanes'); + assert.equal(legend(66, 'D', 120), ' no flag threshold crossed — the score is lost in sub-threshold lanes (see RTT/Margin/Timeouts/LWR)'); + assert.equal(legend(66, 'D', 40), ' no flag crossed — lost below thresholds'); + assert.equal(legend(79, 'C'), ' no flag threshold crossed — the score is lost in sub-threshold lanes'); + // Control: at 80 and above nothing changes. + assert.equal(legend(80, 'B'), ' RF health nominal'); + assert.equal(legend(95, 'A'), ' RF health nominal'); +}); diff --git a/zwave_tui/server/test/engineScreen.test.ts b/zwave_tui/server/test/engineScreen.test.ts index 96fa07a..ad9c04b 100644 --- a/zwave_tui/server/test/engineScreen.test.ts +++ b/zwave_tui/server/test/engineScreen.test.ts @@ -836,3 +836,128 @@ test('the n≈ legend needs a weight on screen: a refusal-only or tallies-only L assert.ok(forms.includes(row.trim()), `${cols}: "${row}" is a whole legend form`); } }); + +/* ── v0.80.0: what the engine already knows, ordered by urgency at 80x24 ── */ + +const apNode = (nodeId: number, over: Partial = {}): AutoPingSnapshot['nodes'][number] => ({ + nodeId, deadSinceMs: null, attempts: 0, nextEligibleMs: null, missStreak: 0, launchFailures: 0, pending: 0, + gaveUp: false, launchGaveUp: false, talkingWhileDead: false, reads: 0, readOwed: false, readRevivals24h: 0, + probeKills24h: 0, probeHeldUntilMs: null, ...over, +}); + +test('ENGINE ranks the tracked nodes alarm-first before its 8-row cap (v0.80.0)', () => { + // The snapshot is in node-id order and the cap is a fixed 8: six low-id + // nodes holding a 24 h own-probe kill, plus two Dead ones, filled the list, + // and the highest-id node — the one that GAVE UP — fell into "1 more". + const ns = [ + ...[2, 3, 4, 5, 6, 8].map((id) => apNode(id, { probeKills24h: 1 })), + apNode(9, { missStreak: 2 }), + apNode(10, { deadSinceMs: NOW - 25 * 60_000, attempts: 2 }), + apNode(38, { gaveUp: true, attempts: 3, deadSinceMs: NOW - 3_600_000 }), + apNode(39, { launchGaveUp: true }), + ]; + const lines = plain(renderEngine(ctx(80, 24, { autoPingState: () => AP({ nodes: ns }) }))).split('\n'); + const rows = lines.filter((l) => /^ {2}#\d+ /.test(l)).map((l) => Number(/#(\d+)/.exec(l)![1])); + assert.deepEqual(rows, [38, 39, 10, 9, 2, 3, 4, 5], + `give-ups first, then Dead, then a miss streak, then the rest by id: ${JSON.stringify(rows)}`); + assert.ok(lines.some((l) => /#38 .*GAVE UP — needs a human/.test(l)), 'the summons row survives the cap at 80x24'); + assert.ok(lines.some((l) => /○ 2 more tracked node\(s\)/.test(l)), 'and the two it hides are counted'); + // Control: with no alarm row the order is plain node id, as before. + const calm = plain(renderEngine(ctx(80, 24, { autoPingState: () => AP({ nodes: [5, 3, 4].map((id) => apNode(id, { probeKills24h: 1 })) }) }))) + .split('\n').filter((l) => /^ {2}#\d+ /.test(l)).map((l) => Number(/#(\d+)/.exec(l)![1])); + assert.deepEqual(calm, [3, 4, 5]); +}); + +test('a dormant driver link names its cause and what it costs on rows of their own at 80x24 (v0.80.0)', () => { + // As the second bit the prose was shed at 80: `DRIVER LINK dormant · +1`, + // with the schema mismatch and the watches it turned off on no row at all. + const prose = 'schema mismatch (server 20..31, tested 32..41) — driver telemetry dormant'; + for (const st of ['dormant', 'backoff', 'stopped'] as const) { + const joined = plain(renderEngine(ctx(80, 24, { driverWsState: () => st, driverWsStatus: () => prose }))); + const at = joined.split('\n').findIndex((l) => /DRIVER LINK/.test(l)); + const rows = joined.split('\n').slice(at, at + 3); + assert.match(rows[0], new RegExp(`DRIVER LINK\\s+${st}$`), `the label row names the state alone: ${JSON.stringify(rows)}`); + assert.match(rows[1], /schema mismatch \(server 20\.\.31, tested 32\.\.41\)/, `the cause is on its own row: ${JSON.stringify(rows)}`); + assert.match(rows[2], /background RSSI, S2-desync and duplicate-frame watches are off/, `and what it costs: ${JSON.stringify(rows)}`); + } + // Disabled: the prose row, no consequence — the link was never configured. + const off = plain(renderEngine(ctx(80, 24, { driverWsState: () => 'disabled', driverWsStatus: () => 'disabled (no driver_ws_url)' }))); + assert.match(off, /\n {4}disabled \(no driver_ws_url\)/); + assert.doesNotMatch(off, /watches are off/); + // Live, connecting and handshake keep the prose as a bit beside the state. + const live = plain(renderEngine(ctx(80, 24, { driverWsState: () => 'live', driverWsStatus: () => 'live (schema 41)' }))); + assert.match(live, /DRIVER LINK\s+live · live \(schema 41\)/); + assert.doesNotMatch(live, /watches are off/); + for (const st of ['connecting', 'handshake'] as const) { + const up = plain(renderEngine(ctx(80, 24, { driverWsState: () => st, driverWsStatus: () => 'connecting to ws://core:3000' }))); + assert.match(up, new RegExp(`DRIVER LINK\\s+${st} · connecting to ws://core:3000`), up); + } +}); + +const ep = (nodeId: number, kind: SymptomKind, over: Partial = {}): OpenEpisodeSummary => + ({ key: `${nodeId}:${kind}`, nodeId, kind, onsetMs: NOW - 15 * 60_000, actionKind: null, confounded: false, beforeFreshN: 4, confirming: false, ...over }); + +test('LEDGER — LIVE keeps the arm bit at 80 columns by shortening the lifecycle word (v0.80.0)', () => { + // The 36-column long form made fitBits shed the ARM bit at 80, so a + // confounded episode and a clean control point both read + // `confirming — symptom absent, scoring · +3`. + const eps = [ + ep(12, 'return-path-degraded', { confounded: true }), + ep(14, 'chronic-return-path', { confirming: true }), + ep(23, 'route-churn', { confirming: true, confounded: true }), + ]; + const lines = plain(renderEngine(ctx(80, 24, { openEpisodes: () => eps }))).split('\n'); + const row = (id: number): string => lines.find((l) => l.startsWith(` #${id} `)) ?? ''; + assert.match(row(12), /return-path-degraded\s+degraded · confounded — neither arm/, row(12)); + assert.match(row(14), /chronic-return-path\s+confirming · no action — control arm/, row(14)); + assert.match(row(23), /route-churn\s+confirming · confounded — neither arm/, row(23)); + // Where the arm bit fits after it, the long form stays. + const wide = plain(renderEngine(ctx(200, 24, { openEpisodes: () => eps }))); + assert.match(wide, /#14 chronic-return-path\s+confirming — symptom absent, scoring · no action — control arm/); +}); + +test('LEDGER — LIVE keeps a short arm word at 60 columns, so a confounded episode, a control point and an action arm read apart (v0.80.0)', () => { + // At 60, the session's minimum, even the one-word lifecycle form shed the + // arm behind a long kind name: both rows read `· +3`. + const eps = [ + ep(12, 'return-path-degraded', { confounded: true }), + ep(14, 'chronic-return-path', { confirming: true }), + ep(23, 'route-churn', { confirming: true, confounded: true }), + ep(31, 'chronic-return-path', { actionKind: 'healNode' }), + ep(41, 'return-path-degraded', { confirming: true, actionKind: 'healNode' }), + ep(4000, 'return-path-degraded', { confirming: true, actionKind: 'refreshValues' }), + ]; + const lines = plain(renderEngine(ctx(60, 24, { openEpisodes: () => eps }))).split('\n'); + const row = (id: number): string => lines.find((l) => l.startsWith(` #${id} `)) ?? ''; + assert.equal(row(12), ' #12 return-path-degraded degraded · confounded · +2'); + assert.equal(row(14), ' #14 chronic-return-path confirming · control arm · +2'); + assert.notEqual(row(12).replace(/^ {2}#\d+ \S+\s+\S+/, ''), row(14).replace(/^ {2}#\d+ \S+\s+\S+/, ''), 'the two arms read differently'); + assert.match(row(23), /^ {2}#23 route-churn {2}confirming · confounded · open 15m · \+1$/, row(23)); + // An action arm that fits keeps its words, `action: healNode`. + assert.match(row(31), /degraded · action: healNode/, row(31)); + // One that does not steps down to its kind, then to `action` — never the + // bare count a confounded row or a control point could also show. + assert.equal(row(41), ' #41 return-path-degraded confirming · healNode · +2'); + // A Long Range id and the longest kind leave room only for the word. + assert.equal(row(4000), ' #4000 return-path-degraded confirming · action · +2'); + for (const l of lines) assert.ok(l.length <= 60, `fits 60: "${l}"`); + // Control: at 80 the full arm words stay. + const wide = plain(renderEngine(ctx(80, 24, { openEpisodes: () => eps }))); + assert.match(wide, /#12 return-path-degraded\s+degraded · confounded — neither arm/); + assert.match(wide, /#14 chronic-return-path\s+confirming · no action — control arm/); +}); + +test('LEDGER — LIVE lists confirming episodes first and counts the confirming ones it hides (v0.80.0)', () => { + // Oldest first, six rows: seven chronic episodes hid the one in its + // confirmation window, behind a bare `○ 2 more open episode(s)`. + const old = Array.from({ length: 7 }, (_, i) => ep(30 + i, 'chronic-return-path', { onsetMs: NOW - (90 - i) * 60_000 })); + const eps = [...old, ep(9, 'rtt-degraded', { confirming: true })]; + const lines = plain(renderEngine(ctx(80, 24, { openEpisodes: () => eps }))).split('\n'); + const ids = lines.filter((l) => /^ {2}#\d+ /.test(l)).map((l) => Number(/#(\d+)/.exec(l)![1])); + assert.deepEqual(ids, [9, 30, 31, 32, 33, 34], `the confirming one first, then the rest in ledger order: ${JSON.stringify(ids)}`); + assert.ok(lines.some((l) => /○ 2 more open episodes$/.test(l)), 'none of the hidden two is confirming'); + // Eight confirming: the overflow line says how many of the hidden are. + const many = [...eps, ...Array.from({ length: 7 }, (_, i) => ep(50 + i, 'route-churn', { confirming: true }))]; + const more = plain(renderEngine(ctx(80, 24, { openEpisodes: () => many }))); + assert.match(more, /○ 9 more open episodes \(2 confirming\)/); +}); diff --git a/zwave_tui/server/test/overviewScreen.test.ts b/zwave_tui/server/test/overviewScreen.test.ts index 4fc092d..665c81e 100644 --- a/zwave_tui/server/test/overviewScreen.test.ts +++ b/zwave_tui/server/test/overviewScreen.test.ts @@ -281,3 +281,27 @@ test('OVERVIEW shows the PAUSED chip too — it builds its masthead with the sha const top = renderOverview({ view: mkView(120, 20, 0), data: d, visibleNodes: nodes, filtering: false, actionsEnabled: true }).map(strip)[0]; assert.match(top, /⚠ AUTO-PING PAUSED 2h/); }); + +test('a critical symptom is counted on the strip at 80x24 even when its row is below the fold (v0.80.0)', () => { + // The roster's `!` is per row. With 39 nodes and the default health sort a + // crit on an A-scored node sits below the fold at 80x24, and nothing else on + // the frame said a crit existed. The count sits right after DEAD: fieldStrip + // sheds from the END, so an appended field was dropped at exactly this size. + const crit = { kind: 'dead-flap', nodeId: 38, severity: 'crit', sinceMs: now - 60_000, narrative: 'x', basis: 'measured', evidence: [] }; + const warn = { kind: 'route-churn', nodeId: 20, severity: 'warn', sinceMs: now - 60_000, narrative: 'x', basis: 'measured', evidence: [] }; + const mesh = { kind: 'mesh-interference', nodeId: null, severity: 'crit', sinceMs: now - 60_000, narrative: 'x', basis: 'inferred', evidence: [] }; + const v = { ...mkView(80, 24, 0), sortKey: 'health' } as ViewState; + const render = (syms: unknown[]): string[] => { + const d: DataProvider = { ...data, symptoms: () => syms as never }; + return renderOverview({ view: { ...v }, data: d, visibleNodes: visibleNodesFor(d, v), filtering: false, actionsEnabled: true }); + }; + const lines = render([crit, warn]).map(strip); + assert.ok(!lines.some((l) => /Node 38 With/.test(l)), 'fixture: the crit node is below the fold'); + const s = lines.find((l) => /NODES\s+\d+/.test(l)) ?? ''; + assert.match(s, /DEAD\s+0\s+CRIT\s+1\b/, `the crit count follows DEAD and survives 80 columns: "${s}"`); + // A warning is not counted, and a mesh-wide crit is (REMEDY's own `N critical`). + assert.match(render([crit, warn, mesh]).map(strip).find((l) => /NODES/.test(l)) ?? '', /CRIT\s+2\b/); + // Healthy: the strip is byte-identical to one rendered with no symptoms at all. + assert.deepEqual(render([warn]), render([]), 'no crit symptom ⇒ no CRIT field and nothing else changes'); + assert.doesNotMatch(render([]).map(strip).join('\n'), /CRIT/); +}); diff --git a/zwave_tui/server/test/remedyScreen.test.ts b/zwave_tui/server/test/remedyScreen.test.ts index 97cc900..4f0f097 100644 --- a/zwave_tui/server/test/remedyScreen.test.ts +++ b/zwave_tui/server/test/remedyScreen.test.ts @@ -1324,3 +1324,213 @@ test('the quiet-node card grounds itself on what the detector checked, not on tr assert.match(row, /The node hasn’t communicated in a while, yet it is not marked Dead/, `${cols}: "${row}"`); } }); + +/* ── v0.80.0: what the engine knows, whole at 80 columns ─────────────────── */ + +const PARTIAL = { enabled: true as const, ready: 33, total: 39, timeoutReady: 33, timeoutWindowBlind: 0, rttReady: 23, rttCeiling: 9, rssiReady: 30, band: 3, bands: 6 }; + +test('partial coverage counts the nodes too quiet to rate timeouts, beside the timeout count (v0.80.0)', () => { + // `timeouts 33/39` read as 33 nodes judged while the two return-path + // detectors skip every node whose 10-minute window holds under 20 sends — + // and the output was byte-identical for timeoutWindowBlind 0 and 39. + const quiet = plain(renderRemedy(engCtx(80, 24, { ...PARTIAL, timeoutWindowBlind: 38 }))); + assert.match(quiet, /timeouts 33\/39\s+unmeasured 38\s+rtt 23\/39/, `the token follows the series it qualifies: ${quiet}`); + assert.match(quiet, /timeout: 38 too quiet in 10 min to rate — return-path detectors skip them\./, quiet); + assert.match(plain(renderRemedy(engCtx(120, 24, { ...PARTIAL, timeoutWindowBlind: 38 }))), /— the return-path detectors skip them\./); + const none = plain(renderRemedy(engCtx(80, 24, PARTIAL))); + assert.doesNotMatch(none, /unmeasured|too quiet/, 'no thin window ⇒ neither the token nor the line'); + assert.notEqual(quiet, none, 'the screen changes with timeoutWindowBlind'); +}); + +test('a below-readiness arm with NO measured control arm still speaks — its harm warning included (v0.80.0)', () => { + // `if (heal == null) return null` ran before the n check and the harm + // warning: n≈2.9 with every attempt worse rendered the same silence as n=0. + const harmed = (): Eff => ({ expectedEfficacy: null, n: 2.9, baseRate: null, nodes: 2, ready: false, + lowerBound: null, bar: null, minN: 4, baseN: 1, baseNodes: 1, harmed: 2.9, baseHarmed: 0 }); + const joined = plain(renderRemedy(ctx(200, 40, [sym()], harmed))); + assert.match(joined, /still learning this action \(n≈2\.9 of 4\) — self-heal not yet measured — ⚠ every attempt so far made it WORSE/, joined); + // At 80 the clauses go before the warning does: it keeps its place beside the readiness fraction. + assert.match(plain(renderRemedy(ctx(80, 40, [sym()], harmed))), /still learning this action \(n≈2\.9 of 4\) — ⚠ every try made it WORSE\n/); + // The measured-control branch sheds the same way. + const withBase = (): Eff => ({ ...harmed()!, baseRate: 0.6, baseN: 6, baseNodes: 3 }); + assert.match(plain(renderRemedy(ctx(80, 40, [sym()], withBase))), /still learning this action \(n≈2\.9 of 4\) — ⚠ every try made it WORSE\n/); + // At 60, the session's minimum, neither branch falls back to the bare + // fraction: the warning outlasts it. At 40 the warning stands alone after `≈`. + const note = (W: number, e: () => Eff): string => + plain(renderRemedy(ctx(W, 40, [sym()], e))).split('\n').find((l) => /^ {8}≈ /.test(l)) ?? ''; + for (const e of [harmed, withBase]) { + assert.match(note(60, e), /WORSE|made it worse/, `60: "${note(60, e)}"`); + assert.equal(note(60, e), ' ≈ still learning — ⚠ every try made it WORSE'); + assert.equal(note(40, e), ' ≈ ⚠ every try made it WORSE'); + } + // A partial harm sheds the same way: its count stays with the warning. + const some = (): Eff => ({ ...harmed()!, harmed: 1.5 }); + const someBase = (): Eff => ({ ...withBase()!, harmed: 1.5 }); + for (const e of [some, someBase]) { + assert.equal(note(60, e), ' ≈ still learning — ⚠ n≈1.5 made it worse'); + assert.equal(note(40, e), ' ≈ ⚠ n≈1.5 made it worse'); + } + // Control: with no harm the 60-column note is the readiness fraction, unchanged, + // and at 40 the bare `≈ still learning` — no warning rung without a warning. + const clean = (): Eff => ({ ...withBase()!, harmed: 0 }); + assert.equal(note(60, clean), ' ≈ still learning this action (n≈2.9 of 4)'); + assert.equal(note(40, clean), ' ≈ still learning'); + assert.equal(note(40, (): Eff => ({ ...harmed()!, harmed: 0 })), ' ≈ still learning'); + // Control: no attempts and no base rate is still no note. + const never = (): Eff => ({ ...harmed()!, n: 0, harmed: 0, nodes: 0 }); + assert.doesNotMatch(plain(renderRemedy(ctx(120, 40, [sym()], never))), /≈ still learning|never tried/); +}); + +test('REMEDY tally lines end on whole words at 80x24, and the plan still renders under five of them (v0.80.0)', () => { + // Each was one sentence and a blind truncate: `weigh the evidence a`, + // `too few readings to ju`, `probe re-`. + const d: DataProvider = { ...data([sym({ kind: 'rtt-degraded', evidence: [{ label: 'RTT', value: '412ms' }] })]), + falsePositives: () => 2, unverifiableCount: () => 3, unverifiableUnprobeableCount: () => 1, + unverifiableTransientCount: () => 4, unverifiableUndersampledCount: () => 5, confoundedCount: () => 6 }; + const lines = renderRemedy({ view: mkView(80, 24), data: d, visibleNodes: nodes, filtering: false, actionsEnabled: true }) + .map((l) => l.replace(/\x1b\[[0-9;]*m/g, '')); + const tallies = lines.filter((l) => /^ {4}(⚠ |○ \d)/.test(l)); + assert.equal(tallies.length, 6, `all six tallies render: ${JSON.stringify(tallies)}`); + const ends = [/acting$|evidence$|misdiagnosis 2×$/, /recovery$|readings$|unscoreable$/, /not a gap$|by design$/, + /not a gap$|floor filled$|by design$|blinks$/, /readings$|reporting rate$|too rarely$|undersampled$/, /episode\)$|re-route\)$|neither arm$|confounded$/]; + tallies.forEach((t, i) => assert.match(t.trimEnd(), ends[i], `tally ${i} must end on a whole clause: "${t}"`)); + assert.ok(lines.some((l) => /▎ /.test(l)), 'the plan headline still renders'); + assert.ok(lines.some((l) => /^ {6}[▸·] /.test(l)), 'and at least one candidate'); +}); + +test('every empty state, its ceiling note and the all-clear headline are whole at 40 and 60 columns (v0.80.0)', () => { + // `Every node has a graduated timeout a` at 40: the first of two hard-wrapped + // lines was cut blind, and the rssi note likewise. The disabled and no-nodes + // paragraphs were cut at 60, the session's minimum, the ceiling note's second + // line ended `slowdown is …`, and the ✓ headline stopped mid-word at 40. + const words = (W: number, eng: ReturnType): { lines: string[]; text: string } => { + const lines = renderRemedy(engCtx(W, 30, eng)).map((l) => l.replace(/\x1b\[[0-9;]*m/g, '')); + fits(lines, W, `${W}`); + for (const l of lines) assert.doesNotMatch(l, / …$/, `${W}: no paragraph line is clipped: "${l}"`); + return { lines, text: lines.slice(3, -1).map((l) => l.trim()).filter(Boolean).join(' ') }; + }; + const OFF = { ...ENG, enabled: false, total: 0, ready: 0, timeoutReady: 0, rttReady: 0, rssiReady: 0 }; + const NONE = { ...ENG, total: 0, ready: 0, timeoutReady: 0, rttReady: 0, rssiReady: 0 }; + const LEARN = { ...ENG, total: 39, ready: 0, timeoutReady: 0, rttReady: 0, rttCeiling: 9, rssiReady: 0 }; + const CEILING = /rtt: 9 with no learned normal are held to a fixed 300 ms ceiling meanwhile, so only a severe slowdown is flagged there\./; + for (const W of [40, 60]) { + const clear = words(W, { ...ENG, rssiReady: 1 }); + assert.match(clear.text, /Every node has a graduated timeout and rtt baseline — the two that arm a detector —/, `${W}: ${clear.text}`); + assert.match(clear.text, /\(rssi (is )?short on 2[:—]/, `${W}: the rssi note is a whole form: ${clear.text}`); + for (const l of clear.lines) assert.doesNotMatch(l, /graduated timeout a$|rtt bas$|— th$/, `${W}: no line ends mid-word: "${l}"`); + assert.match(words(W, OFF).text, /The symptom engine is not running on this install \(no baselines store configured\), so nothing is being diagnosed\./, `${W}: disabled`); + assert.match(words(W, NONE).text, /The engine is running but the roster is empty — nothing has been measured, so nothing can be diagnosed or cleared\. This is normal for the first seconds after a restart\./, `${W}: no nodes`); + assert.match(words(W, LEARN).text, CEILING, `${W}: learning`); + assert.match(words(W, PARTIAL).text, CEILING, `${W}: partial`); + } + // The ✓ headline: its own words where they fit, then shorter whole forms. + const head = (W: number, total: number): string => words(W, { ...ENG, total, ready: total, timeoutReady: total, rttReady: total, rssiReady: total }) + .lines.find((l) => /✓ All clear/.test(l)) ?? ''; + assert.equal(head(60, 39), ' ✓ All clear — 39 nodes learned, no symptoms detected.'); + assert.equal(head(50, 39), ' ✓ All clear — 39 learned, no symptoms.'); + assert.equal(head(40, 39), ' ✓ All clear — no symptoms.'); + // At 80 the familiar lines are unchanged. + const wide = plain(renderRemedy(engCtx(80, 30, ENG))); + assert.match(wide, /\n {4}✓ All clear — 3 nodes learned, no symptoms detected\.\n/); + assert.match(wide, /\n {4}Every node has a graduated timeout and rtt baseline — the two\n {4}that arm a detector —\n/); + assert.match(plain(renderRemedy(engCtx(80, 30, OFF))), /\n {4}The symptom engine is not running on this install \(no baselines\n {4}store configured\), so nothing is being diagnosed\.\n/); + assert.match(plain(renderRemedy(engCtx(80, 30, LEARN))), /\n {4}rtt: 9 with no learned normal are held to a fixed 300 ms\n {4}ceiling meanwhile, so only a severe slowdown is flagged there\.\n/); +}); + +test('the learning state says what its `unmeasured N` means, on a line of its own (v0.80.0)', () => { + // The counts strip carried `unmeasured 38` in the learning state too, and + // only the partial state had the line explaining it. + const LEARN = { ...ENG, total: 39, ready: 0, timeoutReady: 0, rttReady: 0, rttCeiling: 0, rssiReady: 0 }; + const quiet = plain(renderRemedy(engCtx(80, 24, { ...LEARN, timeoutWindowBlind: 38 }))); + assert.match(quiet, /◷ Learning/, 'fixture guard: the learning branch'); + assert.match(quiet, /timeouts 0\/39\s+unmeasured 38/, quiet); + assert.match(quiet, /\n {4}timeout: 38 too quiet in 10 min to rate — return-path detectors skip them\.\n/, quiet); + assert.match(plain(renderRemedy(engCtx(120, 24, { ...LEARN, timeoutWindowBlind: 38 }))), /— the return-path detectors skip them\./); + // It follows the paragraph, and comes before the ceiling note. + const both = plain(renderRemedy(engCtx(80, 24, { ...LEARN, timeoutWindowBlind: 38, rttCeiling: 9 }))).split('\n'); + const para = both.findIndex((l) => /Nothing here is a health claim yet/.test(l)); + const line = both.findIndex((l) => /too quiet in 10 min to rate/.test(l)); + const ceil = both.findIndex((l) => /^ {4}rtt: 9 with no learned normal/.test(l)); + assert.ok(para >= 0 && line === para + 1 && ceil === line + 1, `order: ${para}, ${line}, ${ceil}`); + // Control: no thin window, neither the token nor the line. + assert.doesNotMatch(plain(renderRemedy(engCtx(80, 24, LEARN))), /unmeasured|too quiet/); +}); + +test('the evidence row sheds whole measurements, never one cut mid-value (v0.80.0)', () => { + const rtt = sym({ kind: 'rtt-degraded', evidence: [ + { label: 'RTT', value: '412ms' }, + { label: 'baseline', value: '38±6ms · capped at 300ms' }, + { label: 'restart allowance', value: '41ms (212 tx since driver start)' }, + { label: 'newest round trips', value: '380, 402, 455ms' }, + ] }); + const weak = sym({ kind: 'weak-signal', evidence: [ + { label: 'SNR margin', value: '4dB' }, + { label: 'failed deliveries', value: '13 in 30m (too few sends for a rate)' }, + ] }); + for (const s of [rtt, weak]) { + const lines = plain(renderRemedy(ctx(80, 30, [s]))).split('\n'); + const row = lines.find((l) => /^ {4}measured /.test(l)) ?? ''; + // Every label printed is followed by its WHOLE value. + for (const e of s.evidence) { + if (row.includes(e.label + ' ')) assert.ok(row.includes(`${e.label} ${e.value}`), `"${e.label}" is whole or absent: "${row}"`); + } + assert.ok(row.includes(`${s.evidence[0].label} ${s.evidence[0].value}`), `the first measurement leads: "${row}"`); + const shown = s.evidence.filter((e) => row.includes(`${e.label} ${e.value}`)).length; + if (shown < s.evidence.length) assert.match(row, new RegExp(`\\+${s.evidence.length - shown}$`), `a shed one is counted: "${row}"`); + } + // At 40 the first measurement still fits beside the basis word; the rest is counted. + const narrow = plain(renderRemedy(ctx(40, 30, [weak]))).split('\n').find((l) => /^ {4}measured/.test(l)) ?? ''; + assert.equal(narrow, ' measured SNR margin 4dB +1'); +}); + +test('the evidence row sets its measurements apart with ` · `, never the ` · ` a value carries inside itself (v0.80.0)', () => { + // `baseline 38±6ms · capped at 300ms` is ONE measurement; with shedLine's + // ` · ` between tokens too, `capped at 300ms` read as a measurement of its own. + const rtt = sym({ kind: 'rtt-degraded', evidence: [ + { label: 'RTT', value: '412ms' }, + { label: 'baseline', value: '38±6ms · capped at 300ms' }, + { label: 'newest round trips', value: '380, 402, 455ms' }, + ] }); + const row = (W: number): string => plain(renderRemedy(ctx(W, 30, [rtt]))).split('\n').find((l) => /^ {4}measured /.test(l)) ?? ''; + assert.equal(row(120), ' measured RTT 412ms · baseline 38±6ms · capped at 300ms · newest round trips 380, 402, 455ms'); + // The wider mark is counted when it sheds: at 80 the third measurement goes, whole, with +1. + assert.equal(row(80), ' measured RTT 412ms · baseline 38±6ms · capped at 300ms +1'); +}); + +test('an over-80 candidate title keeps its [cost · basis] tag through a short form (v0.80.0)', () => { + // The survey row was 87 columns with its indent: shedLine clipped the head + // at `measurement needed to` and the `+1` disclosing the tag went with it. + const mesh = sym({ kind: 'mesh-interference', nodeId: null, basis: 'inferred', evidence: [{ label: 'active nodes degraded', value: '9/30 in the same window' }] }); + const at80 = plain(renderRemedy(ctx(80, 30, [mesh]))); + assert.match(at80, /· Survey the RF environment — measurement needed \[physical · inference\]/, at80); + const at120 = plain(renderRemedy(ctx(120, 30, [mesh]))); + assert.match(at120, /Survey the RF environment \(900 MHz interferers\) — measurement needed to confirm \[physical · inference\]/); + // At 40 even the short form cannot keep its tag: whole words and a `+1`. + const at40 = plain(renderRemedy(ctx(40, 30, [mesh]))).split('\n'); + assert.match(at40.find((l) => /Survey/.test(l)) ?? '', /^ {6}· Survey the RF .*\+1$/); + // The plan headline the same way: its short form at 80, whole words at 40. + assert.match(at40.find((l) => /▎ /.test(l)) ?? '', /^ {4}▎ Correlated mesh degradation — …$/); + const edge = sym({ kind: 'edge-cluster', members: [7] }); + const head80 = plain(renderRemedy(ctx(80, 30, [edge]))).split('\n').find((l) => /▎ /.test(l)) ?? ''; + assert.equal(head80, ' ▎ Correlated cluster on a shared route — check the common relay'); + assert.match(plain(renderRemedy(ctx(120, 30, [edge]))), /▎ Correlated cluster on a shared route — check the common relay, not each node\n/); +}); + +test('every rebuild (healNode) candidate on REMEDY names priority routes at 80 and 120 columns (v0.80.0)', () => { + // Picked by wrapped line, the caveat lost its object — `…deletes any + // manually-set priority …` at 80 — and route-churn's never named it at all. + const kinds: SymptomKind[] = ['route-churn', 'rate-fallback', 'return-path-degraded', 'chronic-return-path', 'weak-signal', 'rtt-degraded']; + for (const W of [80, 120]) { + for (const kind of kinds) { + const lines = plain(renderRemedy(ctx(W, 40, [sym({ kind })]))).split('\n'); + const at = lines.findIndex((l) => /▸ Rebuild routes/.test(l)); + if (at < 0) continue; + const below = lines.slice(at + 1, at + 4); + const row = below.find((l) => /priority route/i.test(l)); + assert.ok(row, `${kind} at ${W}: the rebuild's caveat names priority routes:\n${lines.slice(at, at + 4).join('\n')}`); + assert.match(row!, /[.)]$| …$/, `${kind} at ${W}: and ends whole: "${row}"`); + } + } + const seen = kinds.filter((kind) => plain(renderRemedy(ctx(120, 40, [sym({ kind })]))).includes('▸ Rebuild routes')); + assert.ok(seen.length >= 4, `fixture: most of these kinds carry a rebuild candidate: ${seen.join(', ')}`); +}); diff --git a/zwave_tui/server/test/sessionActions.test.ts b/zwave_tui/server/test/sessionActions.test.ts index 46f612a..ae5ed0c 100644 --- a/zwave_tui/server/test/sessionActions.test.ts +++ b/zwave_tui/server/test/sessionActions.test.ts @@ -1015,3 +1015,24 @@ test('the pause acknowledgement is drawn from the pause\'s current state, shows s.feed([esc]); s.draw(); assert.doesNotMatch(strip(last()), /automatic writes paused since/, 'a stale ack is never shown'); }); + +test('a manual ping says where its answer will be judged when a runner exists, and HA\'s caveat when none does (v0.80.0)', async () => { + // With a runner the ping is pended on auto-ping's answer check, which books + // an answer or a miss as a LOG line; the notice said only "✓ Ping node". + const detail = async (d: DataProvider): Promise => { + const { runner } = mkActions(true); + const { s } = mkSession(runner, d); + s.feed([key('p')]); + await flush(); await flush(); + return (s as never as { actionNoticeDetail: string | null }).actionNoticeDetail; + }; + const ap = { lastTickMs: 0, suppressed: 'paused', listening: 1, deadListening: 0, capabilityUnknown: 0, staleDue: null, stalestMs: null, verifyOwed: null, + config: { enabled: true, writeActions: true, afterMs: 600_000, maxAttempts: 3, staleMs: 0 }, nodes: [] }; + assert.equal(await detail({ ...mkData(), autoPingState: () => ap as never }), 'auto-ping judges whether it answered — see LOG (e)', + 'a paused runner still judges answers'); + assert.equal(await detail(mkData()), 'HA does not return the answer — watch its Status / Last-seen'); + // The Actions-menu path carries the same split in its CONFIRM-box note. + const { ACTION_CATALOG } = await import('../src/telnet/actionsCatalog'); + const ping = ACTION_CATALOG.find((x) => x.kind === 'ping')!; + assert.match(ping.impactNote, /Where auto-ping runs it judges the answer in LOG; otherwise watch the node's Status \/ Last-seen\./); +}); diff --git a/zwave_tui/server/test/zwaveDataChurn.test.ts b/zwave_tui/server/test/zwaveDataChurn.test.ts index eaa970a..d8883db 100644 --- a/zwave_tui/server/test/zwaveDataChurn.test.ts +++ b/zwave_tui/server/test/zwaveDataChurn.test.ts @@ -25,7 +25,7 @@ import { createEvidenceStore, COARSE_BUCKET_MS } from '../src/zwave/evidenceStor import { renderRemedy } from '../src/telnet/screens/remedy'; import { renderDetail } from '../src/telnet/screens/detail'; import { renderEngine } from '../src/telnet/screens/engine'; -import { mockData, mkView } from './_logHelpers'; +import { mockData, mkView, mkNode } from './_logHelpers'; import type { DataProvider, Symptom } from '../src/types'; import type { AutoPingSnapshot } from '../src/zwave/autoPing'; @@ -4315,3 +4315,62 @@ test('a home-id change the driver server made too: a cross-check read before the await srv.close(); } }); + +test('an unverifiable closure names its subtype right after the verdict, and LOG keeps it at 80 columns (v0.80.0)', async () => { + // The ring line read `closed unverifiable (no action)` for a by-design blink + // and a fixable evidence gap alike; the subtype was computed and reached + // stdout only. Placed after the verdict word, it survives the ~46 columns of + // text a Log list row keeps at 80, where a tag at the end did not. + const { renderLog } = await import('../src/telnet/screens/log'); + const W = (tx: number) => ({ tx, rx: tx, timeouts: 1, rate: 1 / tx, samples: 6, + freshN: 6, flaps: 0, s2: 0, s2Known: 6, routeChanges: 0, routeKnown: 6, + rssiMedian: null, rssiN: 0, rttMedian: null, rttN: 0, rateKbpsMin: null }); + const closeOne = async (liveMin: number, unprobeableAtClose = false): Promise => { + const ha = fakeHa(); + const dir = mkdtempSync(join(tmpdir(), 'zwtui-subtype-')); + const zd = await bootedZwaveData(ha, { + refreshMs: 80, routePollMs: 120, evidenceSampleMs: 80, + evidencePath: join(dir, 'evidence.json'), baselinesPath: join(dir, 'baselines.json'), + outcomesPath: join(dir, 'outcomes.json'), driverWsUrl: null, + }); + try { + const real = zd.snapshot(); + const asListening = real.map((n) => (n.nodeId === 7 ? { ...n, isListening: true } : n)); + const shadow = zd as unknown as { + snapshot: () => NodeSnapshot[]; updateEpisodes: (s: unknown[], now: number) => void; + nodeWindow: (id: number | null, now: number) => unknown; degradedWindow: (id: number | null, since: number, now: number) => unknown; + }; + shadow.snapshot = () => asListening; + // BEFORE: 2 sends, under the timeout floor. AFTER: 100 sends, over it. + shadow.degradedWindow = () => W(2); + shadow.nodeWindow = () => W(100); + const t0 = 1_800_000_000_000; + const symptom = { kind: 'return-path-degraded', nodeId: 7, severity: 'warn', sinceMs: t0 - liveMin * 60_000 + 60_000, + basis: 'measured', evidence: [], narrative: 'n' }; + shadow.updateEpisodes([symptom], t0); + shadow.updateEpisodes([], t0 + 60_000); + // A node that stopped listening before the close cannot be probed. + if (unprobeableAtClose) shadow.snapshot = () => real.map((n) => (n.nodeId === 7 ? { ...n, isListening: false } : n)); + shadow.updateEpisodes([], t0 + 12 * 60_000); + return zd.events().find((e) => /closed/.test(e.text))?.text ?? ''; + } finally { + zd.stop(); + rmSync(dir, { recursive: true, force: true }); + } + }; + const blink = await closeOne(3); + assert.equal(blink, 'return-path-degraded closed unverifiable: transient (no action)', blink); + const slow = await closeOne(30); + assert.equal(slow, 'return-path-degraded closed unverifiable: undersampled (no action)', slow); + const asleep = await closeOne(3, true); + assert.equal(asleep, 'return-path-degraded closed unverifiable: unprobeable (no action)', asleep); + // On the 80-column list row, behind a long node name, the subtype is kept. + for (const [kind, sub] of [['rtt-degraded', 'transient'], ['quiet-node', 'undersampled']] as const) { + const ev = { seq: 1, ts: Date.now(), source: 'engine' as const, severity: 'info' as const, kind: 'symptom' as const, nodeId: 7, + text: `${kind} closed unverifiable: ${sub} (no action)` }; + const n7 = mkNode({ nodeId: 7, name: 'Back Porch Motion Sensor Long Name' }); + const rows = renderLog({ view: mkView({ screen: 'log', cols: 80, rows: 24 }), data: mockData({ events: [ev], nodes: [n7] }), + visibleNodes: [n7], filtering: false, actionsEnabled: true }).map((l) => l.replace(/\x1b\[[0-9;]*m/g, '')); + assert.ok(rows.some((l) => l.includes(`${kind} closed unverifiable: ${sub}`)), `${kind}: the subtype survives 80 columns:\n${rows.slice(2, 5).join('\n')}`); + } +});