docs: sync README / MQTT / TWIN / TESTS with v1.3.3

- README /status example adds twin{...}, trunks[X].nodes and muted;
  node-list bullet now mentions twin partner as well as trunk peers.
- docs/MQTT.md documents the nodes/local + nodes/<peer_id> topics
  (retained) that were already being published but absent from the
  docs; the QoS/retain table is extended accordingly.
- docs/TWIN_PROTOCOL.md status line bumped to v1.3.x+twin2 and test
  count updated (8 -> 11) to include the partner-roster test.
- tests/TESTS.md bumps the trunk suite (31 -> 32) and twin suite
  (10 -> 11) counts and adds entries for the two new roster tests.
This commit is contained in:
Audric committed 2026-04-19 00:45:44 +02:00
1 parent 69c993ad77
commit bd31369e5e
4 files changed
+71 -12

No files matched your search

+30 -6
View File
@@ -61,9 +61,12 @@ automatically.
`[TRUNK_x]` section, with a shared filter syntax (exact, `24*` prefix,
`2427-2438` range). Reloadable at runtime via the PTY admin channel
- **Node-list broadcasting** — on local client login / logout / TG change the
reflector debounces (500 ms) and emits a `MsgTrunkNodeList` to every peer
carrying callsign + current TG + optional lat/lon/QTH. Inbound lists are
republished via MQTT under `nodes/<peer_id>`; the local list under
reflector debounces (500 ms) and emits a `MsgTrunkNodeList` to every trunk
peer (and, when configured, the `[TWIN]` partner) carrying callsign +
current TG + optional lat/lon/QTH. Inbound lists from trunk peers or twin
partners are republished via MQTT under `nodes/<peer_id>`, Redis under
`live:peer_node:…`, and surfaced in `/status` under
`trunks[SECTION].nodes` / `twin.nodes`. The local list is published on
`nodes/local`
- **PTY admin channel** — live commands written to `/dev/shm/reflector_ctrl`:
`TRUNK MUTE|UNMUTE <section> <callsign>` (applied on the inbound audio path),
@@ -415,9 +418,28 @@ static configuration in a single response:
"active_talkers": {
"222": "IW1GEU",
"25": "SM0ABC"
}
},
"muted": [],
"nodes": [
{"callsign": "SM0ABC", "tg": 25},
{"callsign": "SM1DEF", "tg": 2}
]
}
},
"twin": {
"host": "reflector-partner.example.com",
"port": 5304,
"connected": true,
"outbound_connected": true,
"outbound_hello": true,
"inbound_connected": true,
"inbound_hello": true,
"local_prefix": "1",
"peer_id": "TWIN",
"nodes": [
{"callsign": "IW1XYZ", "tg": 1234}
]
},
"satellites": {
"my-satellite": {
"id": "my-satellite",
@@ -433,8 +455,10 @@ static configuration in a single response:
```
`active_talkers` lists TGs with an active remote talker at query time (both
prefix-based and cluster TGs). `satellites` and `satellite_server` appear only
when applicable.
prefix-based and cluster TGs). `trunks[SECTION].nodes` carries the roster
received from each trunk peer; `twin.nodes` carries the partner's roster
when a `[TWIN]` section is configured. `twin`, `satellites`, and
`satellite_server` appear only when applicable.
---
+32
View File
@@ -130,6 +130,36 @@ Down payload:
{}
```
### Node lists
Published when the local node roster changes (debounced 500 ms after
client login / logout / TG change) and when a roster arrives from a
remote peer.
```
{TOPIC_PREFIX}/nodes/local # this reflector's connected clients
{TOPIC_PREFIX}/nodes/<peer_id> # roster mirrored from a trunk peer
# or [TWIN] partner
```
Payload:
```json
{
"timestamp": 1712345678,
"nodes": [
{"callsign": "ON4ABC", "tg": 2620, "qth_name": "Brussels",
"lat": 50.85, "lon": 4.35},
{"callsign": "IK1XYZ", "tg": 2221}
]
}
```
`lat`, `lon`, and `qth_name` are omitted when the node has not supplied
them. For trunk peers `<peer_id>` comes from the peer's `PEER_ID` (or
section name as fallback); for `[TWIN]` partners the id is `TWIN`.
Both topics are published with **retain** enabled so late-joining
subscribers see the last-known roster immediately.
### Periodic full status
Published at the configured `STATUS_INTERVAL` (default every 1 second). The
@@ -153,6 +183,8 @@ subscribers immediately receive the last known state.
| `client/.../disconnected` | 0 | No |
| `client/.../rx` | 0 | No |
| `trunk/...` | 0 | No |
| `nodes/local` | 0 | **Yes** |
| `nodes/<peer_id>` | 0 | **Yes** |
| `status` | 0 | **Yes** |
QoS 0 (fire-and-forget) is used throughout. Event messages are ephemeral — a
+3 -2
View File
@@ -1,8 +1,9 @@
# GeuReflector — Twin (HA-Pair) Protocol
> **Status:** Implemented in v1.3.x+twin1. See §Implementation for
> **Status:** Implemented in v1.3.x+twin2. See §Implementation for
> what shipped and `tests/test_twin.py` for integration test coverage
> (8 tests including an end-to-end V2-client audio-mirror path).
> (11 tests including end-to-end V2-client audio mirroring and
> partner-roster propagation into `/status.twin.nodes`).
## Motivation
+6 -4
View File
@@ -5,8 +5,8 @@
The integration tests verify the trunk protocol, satellite links, twin (HA-pair) protocol, Redis-backed config store, and end-to-end audio routing by spinning up reflector meshes in Docker Compose and connecting fake peers and clients from a Python test harness.
`run_tests.sh` runs in **two phases**:
1. A 3-reflector trunk mesh + a satellite-mode reflector exercising `test_trunk.py` (31 tests).
2. A 4-reflector twin topology exercising `test_twin.py` (10 tests).
1. A 3-reflector trunk mesh + a satellite-mode reflector exercising `test_trunk.py` (32 tests).
2. A 4-reflector twin topology exercising `test_twin.py` (11 tests).
A separate harness (`run_redis_tests.sh`) runs `test_redis.py` (13 tests) against a single-reflector + Redis stack. See [Redis Integration Tests](#redis-integration-tests) below.
@@ -22,11 +22,11 @@ bash run_tests.sh
This will:
1. Generate the default configs and `docker-compose.test.yml` from `topology.py`
2. Build and start the 3-reflector mesh
3. Run 31 automated trunk/satellite/MQTT tests (`test_trunk.py`)
3. Run 32 automated trunk/satellite/MQTT tests (`test_trunk.py`)
4. Enter an interactive prompt to manually test any TG number
5. Tear down the default mesh
6. Regenerate with `--topology twin` (4-reflector twin topology)
7. Rebuild the mesh and run 10 automated twin-protocol tests (`test_twin.py`)
7. Rebuild the mesh and run 11 automated twin-protocol tests (`test_twin.py`)
8. Restore the default topology files and tear everything down
To regenerate configs without running tests:
@@ -212,6 +212,7 @@ each filter independently of the other trunk fixtures.
| # | Test | What it verifies |
|---|------|-----------------|
| 27 | `MsgTrunkNodeList` emission | Connecting a V2 client triggers a debounced node-list send to trunk peers; the harness receives a `MsgTrunkNodeList` (type 121) containing the new client |
| 27b | Trunk peer roster in `/status` | A client authenticated on the primary reflector appears in a peer's `/status.trunks[SECTION].nodes`; disappears after disconnect |
### Twin Protocol (HA-pair)
@@ -229,6 +230,7 @@ Run separately on the twin topology (`test_twin.py`). See `docs/TWIN_PROTOCOL.md
| 8 | Audio mirror end-to-end | A V2 client on ref1 transmits on TG 26201; a V2 client on ref2 receives UDP audio and a flush marker, exercising the full `TGHandler.talkerUpdated` → `TwinLink.onLocalAudio` → `MsgTrunkAudio` → `broadcastUdpMsg` path |
| 9 | Satellite + twin handshake | A satellite connects to ref1 (the `TWIN_SATELLITE_PARENT`) and is listed in `/status.satellites` after the two-way hello |
| 10 | Satellite sees twin-mirrored audio | A V2 client on ref2 transmits on TG 26201; the satellite attached to ref1 receives `TalkerStart` and `MsgTrunkAudio` — verifies `TwinLink::handleMsgTrunkAudio` re-forwards to satellites, not just talker state |
| 11 | Twin partner roster in `/status` | A V2 client authenticated on ref1 appears under ref2's `/status.twin.nodes`; disappears after disconnect. Exercises `MsgTrunkNodeList` over the `[TWIN]` socket and `TwinLink::m_partner_nodes` |
## Redis Integration Tests