docs(#545): capability signal is caps2 0x80, nothing rides on FIRMWARE_VER_CODE

Owner ruling via AM 1401: FIRMWARE_VER_CODE rolls back to 14 and no
dependency may ride on it. Capability signalling is caps bits.

Closes two of the plan's three open decisions:
- signal is caps2 0x80, not a probe and not a version floor
- no version gate is added anywhere by this plan

caps2 0x80 exhausts caps byte 2, so caps byte 3 lands in this work. Its
offset is 87, verified at MyMesh.cpp:3032-3036: caps2 at 84, then
ui_led_enabled 85 and ui_display_mode 86. Reading byte 3 at 85 would parse
the LED state as a capability mask.

Adds a non-negotiable regression assertion: verCode 14 must not turn any
gate this plan adds to false.

Only decision 1 (first-connect push of existing choices) is still open.

The three shipped gates that DO break at 14 go to #857, inventory commented
there, not started.
pull/1350/head
diffwireauto 4 weeks ago
parent 0e4f02789d
commit 81239feba3

@ -34,16 +34,20 @@ What is true today, with evidence. Every Epic below traces back to a row here.
| 6 | **The exact encoding the ruling specifies already ships and is tested.** | `ChannelTune`: stored byte `0` means no choice, inherit the global; any other value is `id + 1`; keyed by channel **slot index**; the SET reply is a **re-read, not an echo**; local state follows the reply and never the request. `offband_device_ui.dart:292-330`, send path `lib/connector/meshcore_connector.dart:1113-1145`, tests `test/connector/channel_tune_connector_test.dart`. | Per-channel notify is a **copy of a shipped surface**, not a new mechanism. This is the strongest argument for building the ruling as written, and it is why the August design collapsed. |
| 7 | The client stores by **PSK**, the wire is keyed by **slot**. | #839 made the store PSK-keyed deliberately, with no bare-index fallback, because slot indices differ between radios: `app_settings_service.dart:246-258`. `Channel` carries both `index` and `pskHex`: `lib/models/channel.dart:12-24`. | The client must bridge PSK to slot from the **connected radio's own** channel table. A channel whose slot that radio has not reported cannot be pushed, and must not be guessed at. |
| 8 | `caps2` **`0x80` is the last free bit**. | `0x01` scope, `0x02` matrix, `0x04` indicators, `0x08` pkt-hash, `0x10` tunes, `0x20` GPS, `0x40` screen: `lib/connector/meshcore_protocol.dart:592-650`. Firmware agrees on `0x01`-`0x08`: `examples/companion_radio/OffbandConfigProtocol.h:337-351`. | Any new-bit option spends the last bit and forces a caps byte 3 for whatever comes next. |
| 9 | `caps2 0x01` **cannot** identify an Inherit-capable radio. | It is set wherever `PIN_BUZZER` is defined (`meshcore_protocol.dart:586-592`) and is already true on radios that know only all/self/none. The owner's T1000-E is one. | The client needs a signal that is not the scope bit. This is decision 1 in section 9. |
| 10 | `FIRMWARE_VER_CODE` **has drifted and cannot carry the gate**. | `firmware-base` reads `22`, and its own history line stops at #611 / `caps2 0x08`: `examples/companion_radio/MyMesh.h:34`. The client already ships `caps2 0x10`, `0x20` and `0x40` plus sub-codes `0x0B`-`0x17`, none of which appear in that line, and `firmware-base`'s `OffbandConfigProtocol.h` stops at `0x0A`. [verified 2026-11-02 against the `firmware-base` checkout] | A `verCode >= N` gate is **unsafe for this feature**: the number is not advancing with the contract. This rules out the option that would otherwise match the pkt-hash precedent (`meshcore_protocol.dart:651`). |
| 9 | `caps2 0x01` **cannot** identify an Inherit-capable radio. | It is set wherever `PIN_BUZZER` is defined (`MyMesh.cpp:3008-3013`, client side `meshcore_protocol.dart:586-592`) and is already true on radios that know only all/self/none. The owner's T1000-E is one. | Inherit needs a bit of its own. Per row 10b that is `caps2 0x80`. |
| 10 | `FIRMWARE_VER_CODE` **is rolling back to 14 and nothing may ride on it**. | Owner ruling relayed by FuchsiaCreek, Agent Mail 1401: "FIRMWARE_VER_CODE has conflicts to hell with 1.18.0 and needing to roll back to 14. No dependencies can ride on FIRMWARE_VER_CODE for Offband." Corroborated independently before the ruling arrived: `firmware-base` reads `22` while its own history line stops at #611 / `caps2 0x08` (`MyMesh.h:34`), and `caps2 0x10`, `0x20`, `0x40` plus sub-codes `0x0B`-`0x17` appear nowhere in it. [verified 2026-11-02 against the `firmware-base` checkout] | A `verCode >= N` gate is **not available to this feature**, and the pkt-hash precedent (`meshcore_protocol.dart:651`) is itself being retired. Capability signalling is caps bits, full stop. |
| 10b | So the signal is a **caps bit**, and `0x80` is the one left. | `0x01` scope, `0x02` matrix, `0x04` indicators, `0x08` pkt-hash, `0x10` tunes, `0x20` GPS, `0x40` screen (row 8). `0x80` is free. | Inherit takes `caps2 0x80`, which **exhausts caps byte 2**, so caps **byte 3** lands in this same work. No probe, no version floor. |
| 10c | Caps byte 3 goes at device-info offset **87**, not 85. | `MyMesh.cpp:3032-3036`: `offband_caps2` is written at 84, then `ui_led_enabled` at 85 and `ui_display_mode` at 86. [verified 2026-11-03] Read it the way byte 2 is read, length-gated: `frame.length >= 88 ? frame[87] : null` (`meshcore_connector.dart:7862-7863` is the byte-2 pattern). | Putting byte 3 at 85 would make every shipped client read a capability bitmask as the LED state, which is the exact mistake firmware's own comment at `MyMesh.cpp:2995-3000` warns about for byte 2. |
| 10d | The client ignores offsets 85 and 86 **today**, and has no `INDICATORS` constant. | No `uiLed` or `uiDisplay` reader anywhere in `lib/`; `meshcore_protocol.dart` has no `offbandCap2Indicators` for the `0x04` bit firmware sets at `MyMesh.cpp:3024-3026`. | Not this plan's scope, but it is the gap byte 3 gets appended past, so the offsets must be read from firmware's frame builder and not inferred from what the client currently parses. |
| 11 | DMs are **out of inheritance by spec**. | Owner, #544: DMs buzz under All, Self and Inherit; only None silences them. | Inherit changes channel behavior only. No DM path is touched, and a test asserts that. |
| 12 | The refusal path is already per-surface and already explains itself. | `0x7F` carries a reason byte precisely so "this board has no buzzer" and "unknown action" read differently: `offband_device_ui.dart:74-79`. Suppression logging is de-duplicated through `_deviceUiGateOpen`. | A radio that refuses `0x18` or scope `0x03` can say so, which is what makes the probe in decision 1 viable. |
| 12 | The refusal path is already per-surface and already explains itself. | `0x7F` carries a reason byte precisely so "this board has no buzzer" and "unknown action" read differently: `offband_device_ui.dart:74-79`. Suppression logging is de-duplicated through `_deviceUiGateOpen`. | A radio whose `caps2 0x80` is set but which still refuses `0x18` or scope `0x03` can say **why**, so that disagreement surfaces as a firmware bug instead of a dead control. |
| 13 | The August design's **separate global gate byte** is unnecessary. | GUI firmware already has two master switches above the per-channel mode, `notify_on` and `notify_channels` (`MyMesh.cpp:1292`), and the ruling's `0x00` unset value means "inherit the device scope", which the existing `0x01` / `0x02` scope already sets. | No gate byte on the wire. The device scope is the gate, and `0x00` is how a channel defers to it. One of the reasons the August design collapsed. |
## 2. Scope
**In:**
- `DeviceNotifyScope.inherit` (`0x03`) over the existing `0x01` / `0x02`, rendered **only** where the radio accepts it.
- `DeviceNotifyScope.inherit` (`0x03`) over the existing `0x01` / `0x02`, rendered **only** where the radio advertises `caps2 0x80`.
- **`caps2 0x80`** as the capability bit, which exhausts caps byte 2, and therefore **caps byte 3**: a `parseOffbandCaps3` reading `frame.length >= 88 ? frame[87] : null`, length-gated and never version-gated, mirroring `parseOffbandCaps2` (`meshcore_connector.dart:7862-7863`). Absence means no byte-3 capabilities, never an error.
- `0x18` notify GET and `0x19` notify SET, keyed by **channel slot index**, mode **1-based**: `0x00` unset (inherit the device scope), `0x01` all, `0x02` mentions, `0x03` off. SET replies with a re-read, never an echo.
- The device's table becomes the **single source of truth** for the per-channel pref on any radio that answers `0x18`. The client's PSK-keyed store becomes that radio's cache, written only from a device reply.
- Sync on connect once the channel table is known, and on every user change.
@ -54,6 +58,8 @@ What is true today, with evidence. Every Epic below traces back to a row here.
**Out:**
- **The firmware half**, all of it: lifting `channel_notify` out of `#ifdef OFFBAND_GUI`, storing it on non-GUI variants, honoring it in the buzz decision, and answering `0x18` / `0x19`. [meshcore-firmware#606](https://github.com/OffbandMesh/meshcore-firmware/issues/606).
- Any change to DM notification or buzzing.
- **Allocating any bit in caps byte 3.** This plan establishes the byte and its parser only, the way firmware's #508 established byte 2 all-zero. The first byte-3 bit belongs to whatever feature needs it next.
- The three shipped `FIRMWARE_VER_CODE` floors that break at 14 (block, caplog, pkt-hash). Separate fix, [#857](https://github.com/OffbandMesh/meshcore-client/issues/857).
- Per-channel **tune**. Already shipped on `0x0B` / `0x0C` and unrelated to notify.
- **The August design, killed by the ruling and recorded here so it is not re-proposed:** the 4-byte `sha256(psk)` channel key, the width byte, hash-collision escalation, CLEAR-then-repush, and a separate global gate byte. The ruling replaces all of it with the slot index and the 1-based mode byte.
@ -66,14 +72,14 @@ Tasks are 3 to 4 points. Each Epic ends with a verification task and gets one PR
| Task | Pts |
|---|---|
| **A1 · The client ignores the device's table:** a `0x18` reply for slot 1 with mode `0x02` must resolve to Mentions for that slot's PSK; `0x00` must resolve to "follow the device scope"; a reply for a slot with no matching channel must be dropped rather than applied to a guessed PSK. Red today: there is no `0x18` parser. New file `test/connector/channel_notify_connector_test.dart`, shaped on `channel_tune_connector_test.dart`. | 3 |
| **A2 · Inherit does not exist and must not leak:** scope `0x03` parses as Inherit; the scope list offers **three** rows on a radio that has not answered `0x18`, and four only once it has; a DM decision is unchanged under Inherit (row 11). Red today on the first two. Extends `test/connector/offband_device_ui_test.dart` and `test/connector/offband_caps2_test.dart`. | 3 |
| **A2 · Inherit does not exist and must not leak:** scope `0x03` parses as Inherit; the scope list offers **three** rows without `caps2 0x80` and four with it; caps byte 3 reads from offset 87 and is `null` on a frame of 87 bytes or fewer, with 85 and 86 proven **not** to be mistaken for it; a DM decision is unchanged under Inherit (row 11). Red today on all but the DM case. Extends `test/connector/offband_device_ui_test.dart` and `test/connector/offband_caps2_test.dart`. | 4 |
| **A3 · Epic verification** | 1 |
### Epic B: the wire and the sync
| Task | Pts |
|---|---|
| **B1 · The contract:** `offbandUiChannelNotifyGet = 0x18`, `offbandUiChannelNotifySet = 0x19`, a `ChannelNotifyReply`, frame builders reusing `_channelByte`, `DeviceNotifyScope.inherit`, `DeviceUiSurface.channelNotify`. Checked by A1 and A2 going green. | 3 |
| **B1 · The contract:** `offbandUiChannelNotifyGet = 0x18`, `offbandUiChannelNotifySet = 0x19`, a `ChannelNotifyReply`, frame builders reusing `_channelByte`, `DeviceNotifyScope.inherit`, `DeviceUiSurface.channelNotify`, `offbandCap2ChannelNotify = 0x80` with its `firmwareSupports...` predicate taking **no** version argument, and `parseOffbandCaps3` at offset 87 (rows 10b to 10d). Checked by A1 and A2 going green. | 4 |
| **B2 · Connector state:** a per-radio slot to mode map cleared in `_clearDeviceUiState`, `_handleDeviceUiReply` extended to parse once and pass down, suppression logged through `_deviceUiGateOpen`, request and set methods shaped exactly on `requestChannelTune` / `setChannelTune` so state follows the reply and never the request. | 4 |
| **B3 · The bridge and the sync:** PSK to slot from the connected radio's channel table; on connect, GET every populated slot once the table is known; on a user change, SET then take the re-read. A channel with no known slot is **not pushed and is reported**, not silently dropped (row 7). | 4 |
| **B4 · One resolution:** a single function the phone gate and the UI both call, so the device's value wins wherever it exists and the cache stands alone only where it does not. This is the task that makes the two prefs one. | 3 |
@ -83,7 +89,7 @@ Tasks are 3 to 4 points. Each Epic ends with a verification task and gets one PR
| Task | Pts |
|---|---|
| **C1 · The Inherit row:** added to the Button and buzzer pane, filtered by the signal from decision 1 so it never appears on a radio that cannot do it (row 4), with a subtitle that says what it follows. | 3 |
| **C1 · The Inherit row:** added to the Button and buzzer pane, filtered on `caps2 0x80` so it never appears on a radio that cannot do it (rows 4 and 10b), with a subtitle that says what it follows. | 3 |
| **C2 · The channel selector writes through:** the existing 3-way selector on the Channels screen and the channel chat menu set the device when the radio speaks `0x18`, keeping the shipped "not saved until the radio replies" behavior; a refusal shows with `persist: true` rather than a 4-second flash, and the write is refused at the attempt with a reason, not hidden behind a disabled control. | 3 |
| **C3 · The #475 contract note, rewritten:** the device and app vocabularies stay distinct, but the per-channel pref is now **one value the device owns**. Plus the new English strings and the regenerated `untranslated.json`. | 3 |
| **C4 · Epic verification** | 1 |
@ -135,10 +141,12 @@ What merging this plan authorizes, in words:
| Where | Can't tell what | Does |
|---|---|---|
| `0x18` GET sent, nothing back yet | whether this radio speaks it | **stop**: loading row, no Inherit row, no per-channel push. The scope surface already behaves exactly this way (`device_ui_view.dart:180-190`). |
| `caps2 0x80` clear, or caps byte 2 absent entirely | nothing: this is a definite answer | not a can't-tell branch. No Inherit row, no `0x18` traffic, behaviour identical to today. Listed so it is not mistaken for one. |
| `caps2 0x80` set, `0x18` GET sent, nothing back yet | what the radio's table holds | **stop**: loading row, no values shown, no push. The scope surface already behaves exactly this way (`device_ui_view.dart:180-190`). |
| A `0x18` reply names a slot with no matching channel | which channel it means | **stop**: drop the entry and log it. Never apply a mode to a guessed PSK. |
| A stored channel whose slot the connected radio has not reported | which slot to push to | **stop**: do not push; surface it on the channel row. Silent non-delivery is the failure mode #839 was fixed to end. |
| Radio advertises `caps2 0x01` but refuses scope `0x03` with `0x7F` | whether Inherit exists on this unit | **stop**: keep the previous scope, show the refusal persistently, drop the row for this radio for the session. |
| Radio advertises `caps2 0x80` but refuses scope `0x03` or `0x19` with `0x7F` | why the bit and the behaviour disagree | **stop**: keep the previous value, show the refusal persistently, drop the control for this radio for the session. A bit that lies is a firmware bug and must surface as one, not be retried around. |
| Device-info frame is exactly 85, 86 or 87 bytes long | whether byte 3 is present | **stop**: `parseOffbandCaps3` returns `null`, same as byte 2 does on a short frame. Reading 85 or 86 as byte 3 would read the LED or display state as a capability mask (row 10c). |
| Two channels resolve to the same slot (duplicated PSK in the table) | which one is real | **stop**: push neither, report the clash. |
| A channel with **no** device-confirmed mode, on a radio that does not speak `0x18`, when the phone must decide whether to notify | what the user actually chose | **fail-open, needs grant**: resolves to **All** (notify), the already-shipped #839 default (`app_settings_service.dart:254-258`). It proceeds rather than stopping because the phone gate has to return something on every message. The direction is deliberate: All means a possibly unwanted notification, the alternative means a silently missed message. Marked rather than argued away, because it is a real fail-open and the direction is the owner's call. |
@ -154,6 +162,8 @@ C:\Dev\flutter-meshcore\bin\flutter.bat test test/connector/channel_notify_conne
`channel_tune_connector_test.dart` is in the list deliberately: it is the shipped surface this one is copied from, and a regression there means the copy was wrong.
- **Regression assertion, non-negotiable:** a test that sets `firmwareVerCode = 14` and asserts every gate this plan adds still returns `true` with its bit set. Row 10's ruling is only enforced if something fails when it is broken.
- **Acceptance bar:** A1 and A2 fail before Epic B and pass after. The owner's three-channel example in D1 behaves correctly with the phone disconnected, and D2's negative case shows no new UI and sends no new traffic. The bar is not met by green tests alone: the ruling is about there being one pref, so the proof is that changing it in the app changes what the radio does with no phone attached.
## 8. Done when
@ -161,7 +171,9 @@ C:\Dev\flutter-meshcore\bin\flutter.bat test test/connector/channel_notify_conne
- Setting a channel's notify mode in the app changes what the **radio** does, with the phone disconnected.
- The app and the radio cannot hold different values for the same channel on a radio that speaks `0x18`.
- Inherit appears only on radios that accept it, and never on a radio that merely advertises the scope bit.
- A radio that does not speak `0x18` behaves exactly as it does today, with no new UI and no new frames.
- A radio that does not advertise `caps2 0x80` behaves exactly as it does today, with no new UI and no new frames.
- **No gate this plan adds reads `FIRMWARE_VER_CODE`**, and a device reporting 14 behaves identically to one reporting 22.
- Caps byte 3 reads from offset 87, is `null` on any shorter frame, and holds no allocated bits yet.
- DMs behave exactly as before under All, Self and Inherit, and are silenced only by None.
- The #475 "never merge the vocabularies" note says what is actually true now.
@ -169,20 +181,23 @@ C:\Dev\flutter-meshcore\bin\flutter.bat test test/connector/channel_notify_conne
| # | Question | Option A | Option B | Rec. | Your choice |
|---|---|---|---|---|---|
| 1 | How does the client know a radio accepts Inherit and `0x18`? Row 9 rules out the scope bit; row 10 rules out a version-code gate. | **Probe.** Send `0x18` for slot 0 on connect. A real reply means supported, `0x7F` means not, silence means not yet (stop, show nothing). Costs one frame per connect and spends no capability bit. The loading-then-reply state machine it needs is already shipped on every `0xC5` surface. | **Spend `caps2 0x80`.** Unambiguous and needs no probe, but it is the **last free bit** (row 8) and the next capability after it forces a third caps byte. | ⭐ A | |
| 2 | `FIRMWARE_VER_CODE` on `firmware-base` reads 22 while three later `caps2` bits and sub-codes `0x0B`-`0x17` are absent from its history (row 10). | **Leave it.** Do not gate this feature on the number at all, and raise the drift with firmware separately as its own problem. | **Fix it first.** Ask firmware to re-base the number to match the shipped contract, then gate on `verCode >= N` the way pkt-hash does. Blocks this plan on another repo's merge. | ⭐ A | |
| 3 | On the first connect after this ships, a radio's table is empty (`0x00` everywhere) but the app already holds channel choices the user made. | **Push the app's existing choices up once per radio**, restricted to channels whose slot is known **and** whose device value is `0x00`, so a deliberate on-device choice is never overwritten. The user keeps what they configured. | **Take the radio's table as-is** and let the app's old entries fall away. Purest reading of "the radio owns the pref", but the user silently loses choices they already made in the app. | ⭐ A | |
| 1 | On the first connect after this ships, a radio's table is empty (`0x00` everywhere) but the app already holds channel choices the user made. | **Push the app's existing choices up once per radio**, restricted to channels whose slot is known **and** whose device value is `0x00`, so a deliberate on-device choice is never overwritten. The user keeps what they configured. | **Take the radio's table as-is** and let the app's old entries fall away. Purest reading of "the radio owns the pref", but the user silently loses choices they already made in the app. | ⭐ A | |
Option B would be a silent loss of user settings, which is why A is the recommendation even though B is the simpler reading of the ruling.
Decision 3's Option B would be a silent loss of user settings, which is why A is the recommendation even though B is the simpler reading of the ruling.
**Settled, not re-asked.** Three questions were open in the draft of this plan and are now answered, so they are recorded here rather than put to you again:
**Already settled, not re-asked:** when the device and the cache disagree, the device wins. That is #838 sync-is-truth Option A, decided and recorded. This plan implements it; it does not revisit it.
- **The capability signal is `caps2 0x80`**, and caps byte 3 lands in this work at offset 87. Settled by the Agent Mail 1401 ruling: capability signalling is caps bits. The draft had recommended a probe instead, on the reasoning that the version-code route was unsafe; the ruling reaches the same conclusion about the version code and picks the bit, which is better, because a bit needs no round trip and no "haven't heard yet" state.
- **Nothing rides on `FIRMWARE_VER_CODE`.** Same ruling. This plan adds no version floor, and the three shipped gates that already have one are a separate fix under [#857](https://github.com/OffbandMesh/meshcore-client/issues/857).
- **When the device and the cache disagree, the device wins.** That is #838 sync-is-truth Option A, decided and recorded.
## 10. Carried-in work
| Item | Goes to |
|---|---|
| Firmware must lift `channel_notify` out of `#ifdef OFFBAND_GUI` and store it on non-GUI variants (row 2), and answer `0x18` / `0x19`. Per row 2b this is a **move plus two sub-codes**, not a design: the table is already slot-keyed, range-checked, assertion-sized and persisted. | [meshcore-firmware#606](https://github.com/OffbandMesh/meshcore-firmware/issues/606). Named here because Epic D cannot run without it, not as a gate on Epics A to C. |
| `FIRMWARE_VER_CODE` drift on `firmware-base` (row 10). | Its own firmware issue. It is a contract-hygiene problem larger than this feature, and this plan deliberately does not depend on it. |
| The three shipped gates that go false at `verCode = 14`: block `>= 15`, caplog `>= 17`, pkt-hash `>= 22`. Verified inventory, including three more latent readers and the one at zero margin (`observer_config_client.dart:95,127`), is commented on the issue. | [#857](https://github.com/OffbandMesh/meshcore-client/issues/857). Its own build issue, tests and PR. Not folded into this plan, and not started: it changes user-visible behaviour on shipped features. |
| The client parses neither device-info offset 85 nor 86, and has no constant for the `caps2 0x04` indicators bit firmware already sets (row 10d). | Its own issue. Named here only because byte 3 is appended past those offsets. |
| The research/design child #545's four deliverables are discharged by this document: the wire contract (section 2), the decision matrix (sections 2 and 6, with the DM rule in row 11), the #475 note update (task C3), and settling with firmware (the ruling in At a glance). | Close #545 when this merges. |
| Retiring the duplicate GUI array once firmware owns the single pref. | Firmware's call, after #606. The client must not design around the array either way (row 2). |

Loading…
Cancel
Save

Powered by TurnKey Linux.