MIDI key: every network MIDI peer must come over the wired network
The Macs are also on Wi-Fi and the Dante networks, and Bonjour lists each MIDI session once per network. ProdDash's Vista Cues module had Tracks and Companion set to their Wi-Fi addresses, so lighting MIDI rode Wi-Fi. A midi_wired check now names any peer, in NA Ingest's session or the other Macs', whose address is outside the wired network (10.1.0.0/16 at NA). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -458,6 +458,32 @@ class TestChecks(unittest.TestCase):
|
||||
self.assertEqual(sp.check_midi_peer({"type": "midi_peer", "host": "tracks", "session": "NA Tracks",
|
||||
"peer": "Lighting PC"}, self.snap, self.ctx)[0][1].level, sp.OK)
|
||||
|
||||
def test_a_midi_peer_on_wi_fi_is_named(self):
|
||||
"""2026-10-20: ProdDash joined Tracks' session over both Macs' Wi-Fi."""
|
||||
chk = {"type": "midi_wired", "nets": ["10.1.0.0/16"]}
|
||||
self.assertEqual([r.level for _, r in sp.check_midi_wired(chk, self.snap, self.ctx)], [sp.OK])
|
||||
self.snap.remote_midi["tracks"] = {"NA Tracks": {"port": 5004, "peers": [
|
||||
{"name": "ProdDash Lighting", "address": "10.6.3.222:5040", "state": "running"},
|
||||
{"name": "Studio B Mac Studio", "address": "\tStudio B Mac Studio\tlocal.", "state": "running"}, # a name: no verdict
|
||||
{"name": "NA Ingest", "address": "[fe80::1]:5004", "state": "running"}]}}
|
||||
self.snap.remote_midi_time["tracks"] = self.now
|
||||
self.snap.midi["NA Ingest"]["peers"].append({"name": "ProdDash Lighting", "address": "10.6.3.222:5040", "state": "running"})
|
||||
out = sp.check_midi_wired(chk, self.snap, self.ctx)
|
||||
self.assertEqual([r.msg for _, r in out], ["PRODDASH LIGH. NOT WIRED"]) # once, not per session
|
||||
self.snap.remote_midi_time["tracks"] = self.now - 30 # a stale stream: no verdict
|
||||
self.snap.midi["NA Ingest"]["peers"].pop()
|
||||
self.assertEqual([r.level for _, r in sp.check_midi_wired(chk, self.snap, self.ctx)], [sp.OK])
|
||||
cfg = json.loads(json.dumps(CONFIG))
|
||||
next(t for t in cfg["tiles"] if t["id"] == "midi")["checks"].append(dict(chk))
|
||||
import schema
|
||||
self.assertEqual([e for e in schema.validate(cfg)[0] if "wired" in e], [])
|
||||
next(t for t in cfg["tiles"] if t["id"] == "midi")["checks"][-1]["nets"] = ["wifi"]
|
||||
self.assertTrue(any("not a network" in e for e in schema.validate(cfg)[0]))
|
||||
self.snap.midi["NA Ingest"]["peers"].append({"name": "ProdDash Lighting", "address": "10.6.3.222:5040", "state": "running"})
|
||||
next(t for t in cfg["tiles"] if t["id"] == "midi")["checks"][-1]["nets"] = ["10.1.0.0/16"]
|
||||
tiles, _ = run_steps(sp.Engine(cfg), self.snap, self.now, 4)
|
||||
self.assertEqual(tiles["midi"]["x"], "MIDI\nPRODDASH LIGH. NOT WIRED")
|
||||
|
||||
def test_midi_peer_joining_is_not_an_error(self):
|
||||
for p in self.snap.midi["NA Ingest"]["peers"]:
|
||||
p["state"] = "connected" # joined, clock sync not finished yet
|
||||
|
||||
Reference in New Issue
Block a user