The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
test: supply real session stores to gateway authority fixtures
Tekniume3d230875fe5
diff --git a/tests/gateway/test_authority_events.py b/tests/gateway/test_authority_events.pyindex 693387e24d8..6640e04dfc0 100644--- a/tests/gateway/test_authority_events.py+++ b/tests/gateway/test_authority_events.py@@ -30,12 +30,11 @@ async def test_replay_matches_subscription_watermark_or_requires_snapshot(tmp_paimport queuefrom types import SimpleNamespace- from gateway.config import Platform- from gateway.session import SessionSource+ from gateway.config import GatewayConfig, Platform+ from gateway.session import SessionSource, SessionStorefrom gateway.session_authority import LiveSession, initialize_session_authorityfrom gateway.session_contract import SessionRef, Submissionfrom gateway.session_controls import AuthorityConnection- from hermes_state import SessionDBfrom tui_gateway import event_replay# Small real rings exercise truncation and cross-session eviction without@@ -43,10 +42,12 @@ async def test_replay_matches_subscription_watermark_or_requires_snapshot(tmp_pa# the runner's answer boundary is deliberately deterministic here.monkeypatch.setattr(event_replay, '_REPLAY_BUFFER_MAX', 5)monkeypatch.setattr(event_replay, '_REPLAY_SESSIONS_MAX', 1)- db = SessionDB(tmp_path / 'replay.db')+ monkeypatch.setenv('HERMES_HOME', str(tmp_path))+ store = SessionStore(tmp_path / 'sessions', GatewayConfig())+ db = store._dbasync def answer(event):return event.text- runner = SimpleNamespace(_session_db=db, _draining=False,+ runner = SimpleNamespace(_session_db=db, session_store=store, _draining=False,_handle_message=answer, _adapter_for_source=lambda source: None)authority = await initialize_session_authority(runner, profile_id='replay', instance_id='owner')ref = SessionRef('replay', 'shared')diff --git a/tests/gateway/test_replace_child_reap.py b/tests/gateway/test_replace_child_reap.pyindex 818552fd357..86b60de90c8 100644--- a/tests/gateway/test_replace_child_reap.py+++ b/tests/gateway/test_replace_child_reap.py@@ -177,9 +177,12 @@ async def test_start_gateway_replace_reaps_old_gateway_children_posix(class _CleanExitRunner:def __init__(self, config):+ from gateway.session import SessionStorefrom hermes_state import SessionDBfrom hermes_constants import get_hermes_home+ self.session_store = SessionStore(get_hermes_home() / 'sessions', config)self._session_db = SessionDB(get_hermes_home() / 'state.db')+ self.session_store._db = self._session_dbself._draining = Falseself.config = configself.should_exit_cleanly = Truediff --git a/tests/gateway/test_runner_startup_failures.py b/tests/gateway/test_runner_startup_failures.pyindex 8a6c2341fb3..df31e462b9e 100644--- a/tests/gateway/test_runner_startup_failures.py+++ b/tests/gateway/test_runner_startup_failures.py@@ -91,9 +91,12 @@ async def test_start_gateway_verbosity_imports_redacting_formatter(monkeypatch,class _CleanExitRunner:def __init__(self, config):+ from gateway.session import SessionStorefrom hermes_state import SessionDBfrom hermes_constants import get_hermes_home+ self.session_store = SessionStore(get_hermes_home() / 'sessions', config)self._session_db = SessionDB(get_hermes_home() / 'state.db')+ self.session_store._db = self._session_dbself._draining = Falseself.config = configself.should_exit_cleanly = True@@ -235,9 +238,12 @@ async def test_start_gateway_replace_writes_takeover_marker_before_sigterm(class _CleanExitRunner:def __init__(self, config):+ from gateway.session import SessionStorefrom hermes_state import SessionDBfrom hermes_constants import get_hermes_home+ self.session_store = SessionStore(get_hermes_home() / 'sessions', config)self._session_db = SessionDB(get_hermes_home() / 'state.db')+ self.session_store._db = self._session_dbself._draining = Falseself.config = configself.should_exit_cleanly = True@@ -447,9 +453,12 @@ async def test_start_gateway_propagates_fatal_config_exit_code(monkeypatch, tmp_class _FatalConfigRunner:def __init__(self, config):+ from gateway.session import SessionStorefrom hermes_state import SessionDBfrom hermes_constants import get_hermes_home+ self.session_store = SessionStore(get_hermes_home() / 'sessions', config)self._session_db = SessionDB(get_hermes_home() / 'state.db')+ self.session_store._db = self._session_dbself._draining = Falseself.config = configself.should_exit_cleanly = Truediff --git a/tests/gateway/test_startup_restart_race.py b/tests/gateway/test_startup_restart_race.pyindex 3e53a0b55c5..45305c70deb 100644--- a/tests/gateway/test_startup_restart_race.py+++ b/tests/gateway/test_startup_restart_race.py@@ -192,9 +192,12 @@ async def test_start_gateway_does_not_start_cron_after_aborted_startup(tmp_path,class AbortedStartupRunner:def __init__(self, config):+ from gateway.session import SessionStorefrom hermes_state import SessionDBfrom hermes_constants import get_hermes_home+ self.session_store = SessionStore(get_hermes_home() / 'sessions', config)self._session_db = SessionDB(get_hermes_home() / 'state.db')+ self.session_store._db = self._session_dbself._draining = Falseself.config = configself.adapters = {}@@ -240,9 +243,12 @@ async def test_start_gateway_preserves_service_restart_fallback_after_aborted_stclass AbortedStartupRunner:def __init__(self, config):+ from gateway.session import SessionStorefrom hermes_state import SessionDBfrom hermes_constants import get_hermes_home+ self.session_store = SessionStore(get_hermes_home() / 'sessions', config)self._session_db = SessionDB(get_hermes_home() / 'state.db')+ self.session_store._db = self._session_dbself._draining = Falseself.config = configself.adapters = {}@@ -296,9 +302,12 @@ async def test_start_gateway_classifies_startup_signal_exit(class AbortedStartupRunner:def __init__(self, config):+ from gateway.session import SessionStorefrom hermes_state import SessionDBfrom hermes_constants import get_hermes_home+ self.session_store = SessionStore(get_hermes_home() / 'sessions', config)self._session_db = SessionDB(get_hermes_home() / 'state.db')+ self.session_store._db = self._session_dbself._draining = Falseself.config = configself.adapters = {}