refactor(events): unify scoped runtime notifications across clients (#5670)
* refactor(events): unify scoped runtime notifications across clients * style(tests): sort auto-compaction event imports * refactor(events): scope connections and remove retry callback plumbing * docs: remove runtime notification design write-up * refactor(bus): route operation events through the message bus * fix(channels): isolate outbound sends by destination * style(events): group shared notification imports * refactor(events): converge runtime and hook delivery on MessageBus * test(events): migrate fixtures to unified message bus
This commit is contained in:
1 parent
3495281282
commit
192e2e90dc
78 files changed
+1620
-1194
No files matched your search
@@ -6,7 +6,7 @@ from unittest.mock import AsyncMock, MagicMock
|
||||
import pytest
|
||||
|
||||
from nanobot.agent.autocompact import AutoCompact
|
||||
from nanobot.bus.outbound_events import ContextCompactionEvent
|
||||
from nanobot.events import NO_EVENTS, ContextCompactionEvent, EventSink
|
||||
from nanobot.session.manager import Session, SessionManager
|
||||
|
||||
|
||||
@@ -269,7 +269,7 @@ class TestCheckExpired:
|
||||
"cli:old",
|
||||
runtime=admitted,
|
||||
max_suffix=ac._RECENT_SUFFIX_MESSAGES,
|
||||
on_compaction=None,
|
||||
events=NO_EVENTS,
|
||||
)
|
||||
|
||||
@pytest.mark.parametrize("resolution_error", [KeyError, ValueError])
|
||||
@@ -445,7 +445,7 @@ class TestArchiveDelegates:
|
||||
"cli:test",
|
||||
runtime=runtime,
|
||||
max_suffix=ac._RECENT_SUFFIX_MESSAGES,
|
||||
on_compaction=None,
|
||||
events=NO_EVENTS,
|
||||
)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@@ -457,11 +457,11 @@ class TestArchiveDelegates:
|
||||
def bind(key: str):
|
||||
async def publish(event: ContextCompactionEvent) -> None:
|
||||
observed.append((key, event))
|
||||
return publish
|
||||
return EventSink(publish)
|
||||
|
||||
async def compact(key: str, **kwargs):
|
||||
event = ContextCompactionEvent(compaction_id="compact-1", phase="started")
|
||||
await kwargs["on_compaction"](event)
|
||||
await kwargs["events"].emit(event)
|
||||
return "Summary."
|
||||
|
||||
consolidator.compact_idle_session = AsyncMock(side_effect=compact)
|
||||
@@ -469,7 +469,7 @@ class TestArchiveDelegates:
|
||||
sessions=sessions,
|
||||
consolidator=consolidator,
|
||||
session_ttl_minutes=15,
|
||||
bind_compaction=bind,
|
||||
bind_events=bind,
|
||||
)
|
||||
|
||||
await ac._archive("cli:test", runtime=_runtime())
|
||||
|
||||
Reference in new issue
Block a user