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

@@ -679,8 +679,8 @@ const MazeNET: React.FC = () => {
// patch local state so the chip set reflects shape without a full
// re-hydrate. The post-mutation services list lives on the
// payload; same shape the actor's POST/DELETE response carries.
if (event.name === 'decky.service.added'
|| event.name === 'decky.service.removed') {
if (event.name === 'decky.service_added'
|| event.name === 'decky.service_removed') {
const p = event.payload ?? {};
const deckyName = typeof p.decky_name === 'string' ? p.decky_name : null;
const services = Array.isArray(p.services) ? p.services as string[] : null;

View File

@@ -21,8 +21,8 @@ export type TopologyStreamEventName =
// server. The payload carries decky_name + service_name + the
// post-mutation services list, so a second tab can reconcile shape
// without a refetch.
| 'decky.service.added'
| 'decky.service.removed';
| 'decky.service_added'
| 'decky.service_removed';
export interface TopologyStreamEvent {
name: TopologyStreamEventName | string;
@@ -46,8 +46,8 @@ const NAMED_EVENTS: TopologyStreamEventName[] = [
'mutation.applied',
'mutation.failed',
'status',
'decky.service.added',
'decky.service.removed',
'decky.service_added',
'decky.service_removed',
];
export function useTopologyStream({