fix(bus): topic segments can't contain dots — service.added → service_added

Bus topic segments are NATS-style tokens and the validator at
bus/topics.py:402 rejects '.', '*', '>', whitespace.  My W3 constants
'service.added' / 'service.removed' tripped this on every live
add/remove call:

  ValueError: topic segment 'service.added' may not contain '.', ...

Renamed both to underscore form: DECKY_SERVICE_ADDED = 'service_added'.
Aligned the SSE forwarder's name mapping (decky.<name>.service_added →
SSE event 'decky.service_added') and the frontend's
useTopologyStream listener + MazeNET.tsx event handler.  Also updated
the wiki entry with a note about the underscore.
This commit is contained in:
2026-04-28 23:53:25 -04:00
parent d595240f55
commit bbed52a962
4 changed files with 15 additions and 10 deletions

View File

@@ -177,10 +177,15 @@ def _sse_name_for(topic: str) -> str:
``topology.<id>.mutation.applied`` → ``mutation.applied``
``topology.<id>.status`` → ``status``
``decky.<name>.service.added`` → ``decky.service.added``
``decky.<name>.service.removed`` → ``decky.service.removed``
``decky.<name>.service_added`` → ``decky.service_added``
``decky.<name>.service_removed`` → ``decky.service_removed``
Anything else is passed through unchanged so future topic families
don't silently collapse onto a generic bucket.
Bus topic segments are NATS-style tokens — no dots inside a segment
— which is why the leaf is ``service_added`` (underscore) here and
on the wire, not ``service.added``. The frontend's
``useTopologyStream`` listens on the underscore form too.
"""
parts = topic.split(".", 2)
if len(parts) < 3: