hermes_state.py: delete every '# noqa: F401 (re-exported...)' import block (hermes_state_common/errors/guard/
readpool/sessions/fts/dbfile/wal/repair/registry + agent.context_compressor _DB_PERSISTED_MARKER_KEY); keep
only the names hermes_state.py itself uses, without noqa.
hermes_state_registry.py: drop get_shared_session_db/release_shared_session_db/close_shared_session_dbs
aliases; every caller (gateway/, tools/, tui_gateway/, cron/, mcp_serve, run_agent, tests) now imports
acquire/release/close_all/release_or_close from hermes_state_registry.
hermes_state_titles.py: drop set_auto_title_if_empty shim (title_generator keeps its getattr fallback).
Re-remove shim-only names restored by 34abf954bd: latest_user_message_row_id (tests call
latest_message_row_id(key, role='user'); role-targeting assertions kept) and get_session_activity (tests
build the snapshot via agent.session_activity.build_activity_snapshot over db.get_session(sid)).
hermes_state_wal._log_once resolves its dedupe sets as module globals instead of via hermes_state;
hermes_state_repair helpers call module globals directly (tests patch hermes_state_repair.<name>).
Frozen updater surface untouched (update_cmd_maint imports only SessionDB from hermes_state).
31 lines
1.1 KiB
Python
31 lines
1.1 KiB
Python
"""is_disk_full_error classifies ENOSPC / SQLITE_FULL failures."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import errno
|
|
import sqlite3
|
|
|
|
from hermes_state_errors import is_disk_full_error
|
|
|
|
|
|
def test_enospc_oserror():
|
|
assert is_disk_full_error(OSError(errno.ENOSPC, "No space left on device")) is True
|
|
|
|
|
|
def test_sqlite_full_operational_error():
|
|
assert is_disk_full_error(sqlite3.OperationalError("database or disk is full")) is True
|
|
|
|
|
|
def test_string_markers():
|
|
assert is_disk_full_error("disk full: session storage could not be written") is True
|
|
assert is_disk_full_error("ENOSPC writing state.db") is True
|
|
assert is_disk_full_error("This is often a full disk — free some space") is True
|
|
|
|
|
|
def test_unrelated_errors():
|
|
assert is_disk_full_error(None) is False
|
|
assert is_disk_full_error(OSError(errno.EACCES, "Permission denied")) is False
|
|
assert is_disk_full_error(RuntimeError("network timeout")) is False
|
|
assert is_disk_full_error("session not found") is False
|
|
assert is_disk_full_error("session storage could not be written: permission denied") is False
|