From 900c0c3ef5af6abd20401d2b66c3346310b1502e Mon Sep 17 00:00:00 2001 From: anti Date: Sun, 26 Apr 2026 19:53:40 -0400 Subject: [PATCH] =?UTF-8?q?refactor(bus):=20rename=20ORCHESTRATOR=5FACTIVI?= =?UTF-8?q?TY=20=E2=86=92=20ORCHESTRATOR=5FTRAFFIC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Aligns the bus token with the DB column value; OrchestratorEvent.kind is 'traffic'/'file' but the topic was 'activity'/'file'. The asymmetry made consumer code (UI filter, SSE event names) need a translation layer. No external subscribers existed yet. --- decnet/bus/topics.py | 6 +++--- decnet/orchestrator/events.py | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/decnet/bus/topics.py b/decnet/bus/topics.py index 7194de9c..9f456efb 100644 --- a/decnet/bus/topics.py +++ b/decnet/bus/topics.py @@ -10,7 +10,7 @@ Token structure (NATS-style, dot-separated): topology.{topology_id}.status decky.{decky_id}.state decky.{decky_id}.traffic - orchestrator.activity.{decky_id} + orchestrator.traffic.{decky_id} orchestrator.file.{decky_id} attacker.observed attacker.scored @@ -170,7 +170,7 @@ CREDENTIAL_REUSE_DETECTED = "reuse.detected" # static. Always nested with the destination decky uuid as the third # token, so consumers can subscribe to a single decky's life-injection # stream via ``orchestrator.*.``. -ORCHESTRATOR_ACTIVITY = "activity" +ORCHESTRATOR_TRAFFIC = "traffic" ORCHESTRATOR_FILE = "file" # System event types. @@ -296,7 +296,7 @@ def identity(event_type: str) -> str: def orchestrator(event_type: str, decky_id: str) -> str: """Build ``orchestrator..``. - *event_type* should be one of :data:`ORCHESTRATOR_ACTIVITY` or + *event_type* should be one of :data:`ORCHESTRATOR_TRAFFIC` or :data:`ORCHESTRATOR_FILE`. The destination decky is always the third token so per-decky subscribers can use ``orchestrator.*.``. diff --git a/decnet/orchestrator/events.py b/decnet/orchestrator/events.py index d434850f..c63af0b7 100644 --- a/decnet/orchestrator/events.py +++ b/decnet/orchestrator/events.py @@ -39,7 +39,7 @@ def to_row(action: Action, result: ActivityResult) -> dict[str, Any]: def topic_for(action: Action) -> str: """Map an action to its bus topic.""" if isinstance(action, TrafficAction): - return _topics.orchestrator(_topics.ORCHESTRATOR_ACTIVITY, action.dst_uuid) + return _topics.orchestrator(_topics.ORCHESTRATOR_TRAFFIC, action.dst_uuid) if isinstance(action, FileAction): return _topics.orchestrator(_topics.ORCHESTRATOR_FILE, action.dst_uuid) raise TypeError(f"unsupported action type: {type(action)!r}") @@ -47,7 +47,7 @@ def topic_for(action: Action) -> str: def event_type_for(action: Action) -> str: if isinstance(action, TrafficAction): - return _topics.ORCHESTRATOR_ACTIVITY + return _topics.ORCHESTRATOR_TRAFFIC if isinstance(action, FileAction): return _topics.ORCHESTRATOR_FILE raise TypeError(f"unsupported action type: {type(action)!r}")