From dac3c44afc1c0e83e769e4d6ea4bd71815cdae3b Mon Sep 17 00:00:00 2001 From: Teknium <127238744+teknium1@users.noreply.github.com> Date: Fri, 14 Aug 2026 20:52:41 -0700 Subject: [PATCH] test: fix salvage test imports; drop WAL worker-thread test superseded by read pool MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - tests/cron/test_sessiondb_init_hang.py: add threading/time imports the salvaged late-close regression tests rely on. - tests/test_hermes_state.py: drop test_close_closes_wal_read_connection_created_on_worker_thread — main replaced per-thread WAL reader ownership with the pooled read-connection design (permits + checkout/return), so cross-thread reader draining no longer exists in the form the test asserted. --- tests/cron/test_sessiondb_init_hang.py | 2 ++ tests/test_hermes_state.py | 35 -------------------------- 2 files changed, 2 insertions(+), 35 deletions(-) diff --git a/tests/cron/test_sessiondb_init_hang.py b/tests/cron/test_sessiondb_init_hang.py index 924b3cba50..b939ca8299 100644 --- a/tests/cron/test_sessiondb_init_hang.py +++ b/tests/cron/test_sessiondb_init_hang.py @@ -21,6 +21,8 @@ suite stays free of timing flakes under parallel load. """ import concurrent.futures +import threading +import time from unittest.mock import MagicMock, patch from cron.scheduler import run_job diff --git a/tests/test_hermes_state.py b/tests/test_hermes_state.py index 07236504ae..1b2f688ae7 100644 --- a/tests/test_hermes_state.py +++ b/tests/test_hermes_state.py @@ -177,41 +177,6 @@ class TestConnectionLifecycle: pass db.close() - def test_close_closes_wal_read_connection_created_on_worker_thread( - self, tmp_path - ): - """SessionDB.close() must drain read conns created by other threads.""" - from hermes_cli.sqlite_safe_read import has_live_connection - - db_path = tmp_path / "state.db" - db = SessionDB(db_path=db_path) - db._wal_active = True - opened = threading.Event() - release = threading.Event() - errors = [] - - def open_read_connection(): - try: - assert db._get_read_conn() is not None - opened.set() - release.wait(timeout=10) - except BaseException as exc: - errors.append(exc) - opened.set() - - worker = threading.Thread(target=open_read_connection) - worker.start() - assert opened.wait(timeout=10) - assert not errors - - db.close() - assert has_live_connection(db_path) is False - - release.set() - worker.join(timeout=10) - assert not worker.is_alive() - assert not errors - def test_read_only_close_never_requests_wal_checkpoint(self, tmp_path): db_path = tmp_path / "state.db" writable = SessionDB(db_path=db_path)