refactor(state): unify writer-conn setup, drop dead attrs/branches, compact hermes_state comments

This commit is contained in:
Teknium
2026-09-02 19:53:29 -07:00
parent d254525a39
commit 3c9a51bbf1
4 changed files with 241 additions and 419 deletions
+232 -413
View File
File diff suppressed because it is too large Load Diff
@@ -7,12 +7,12 @@ the delete wiring the picker's 'd' key relies on.
import pytest
from hermes_state import (
from hermes_state import SessionDB
from hermes_state_sessions import (
SESSION_STATUS_COMPLETE,
SESSION_STATUS_EMPTY,
SESSION_STATUS_ERROR,
SESSION_STATUS_INTERRUPTED,
SessionDB,
classify_session_status,
)
+1 -1
View File
@@ -11,7 +11,7 @@ the deletion set, permanently deleting the parent session and its messages.
import json
import sqlite3
from hermes_state import _collect_delegate_child_ids, _delete_delegate_children
from hermes_state_sessions import _collect_delegate_child_ids, _delete_delegate_children
def _make_conn():
+6 -3
View File
@@ -499,7 +499,8 @@ def test_idle_permits_are_reclaimed_from_a_peer_instance(db):
def test_peak_is_bounded_across_many_database_files(tmp_path):
"""Read connections must be capped for the PROCESS, not just per file."""
import hermes_state
from hermes_state import SessionDB, _READ_POOL_MAX, _READ_POOL_PROCESS_MAX
from hermes_state import SessionDB, _READ_POOL_MAX
from hermes_state_readpool import _READ_POOL_PROCESS_MAX
n_files = (_READ_POOL_PROCESS_MAX // _READ_POOL_MAX) + 2
dbs = []
@@ -548,7 +549,8 @@ def test_peak_is_bounded_across_many_database_files(tmp_path):
@pytest.mark.requires_wal
def test_idle_connections_are_reclaimed_across_database_files(tmp_path):
"""A quiet profile's idle connections must not starve the busy one."""
from hermes_state import SessionDB, _READ_POOL_MAX, _READ_POOL_PROCESS_MAX
from hermes_state import SessionDB, _READ_POOL_MAX
from hermes_state_readpool import _READ_POOL_PROCESS_MAX
quiet = []
try:
@@ -629,7 +631,8 @@ def test_duplicate_handles_on_one_path_are_reported(db, caplog):
"""Writer connections cannot be capped, so duplicates must be visible."""
import logging
from hermes_state import SessionDB, _HANDLES_PER_PATH_WARN
from hermes_state import SessionDB
from hermes_state_readpool import _HANDLES_PER_PATH_WARN
extra = []
try: