mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-06-04 07:31:58 +00:00
test(gateway): pin SQLite-only load_transcript behaviour
This commit is contained in:
parent
4d2df86281
commit
1d27be0ff3
1 changed files with 27 additions and 0 deletions
27
tests/gateway/test_load_transcript_db_only.py
Normal file
27
tests/gateway/test_load_transcript_db_only.py
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
"""Verify load_transcript returns SQLite messages without any JSONL file."""
|
||||
from pathlib import Path
|
||||
import pytest
|
||||
|
||||
from gateway.session import SessionStore
|
||||
from gateway.config import GatewayConfig
|
||||
|
||||
|
||||
def test_load_transcript_returns_db_messages_when_no_jsonl(tmp_path):
|
||||
"""Reading a transcript must work from SQLite alone — no JSONL fallback needed."""
|
||||
config = GatewayConfig()
|
||||
store = SessionStore(sessions_dir=tmp_path, config=config)
|
||||
|
||||
sid = "test-session-db-only"
|
||||
store._db.create_session(session_id=sid, source="test")
|
||||
store.append_to_transcript(sid, {"role": "user", "content": "hello", "timestamp": 1.0})
|
||||
store.append_to_transcript(sid, {"role": "assistant", "content": "world", "timestamp": 2.0})
|
||||
|
||||
# Delete any JSONL that the current dual-writer left behind
|
||||
jsonl_path = tmp_path / f"{sid}.jsonl"
|
||||
if jsonl_path.exists():
|
||||
jsonl_path.unlink()
|
||||
|
||||
history = store.load_transcript(sid)
|
||||
assert len(history) == 2
|
||||
assert history[0]["content"] == "hello"
|
||||
assert history[1]["content"] == "world"
|
||||
Loading…
Add table
Add a link
Reference in a new issue