mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-31 19:16:29 +00:00
test: order compression-tip fixtures around the closed-parent write guard
Two compression-tip hydration tests simulated legacy state by emptying the parent AFTER end_session(compression) — exactly the durable write the new closed-parent guard refuses. Reordered: empty first, close second. The tests' actual contract (old id hydrates from the live tip) is unchanged and still pinned.
This commit is contained in:
parent
c54fe5b33f
commit
3960315af7
2 changed files with 7 additions and 2 deletions
|
|
@ -176,9 +176,12 @@ async def test_session_crud_and_message_history(adapter, session_db):
|
|||
async def test_session_messages_follow_compression_tip(adapter, session_db):
|
||||
source_id = session_db.create_session("source-session", "api_server")
|
||||
session_db.append_message(source_id, "user", "before compression")
|
||||
# Empty the parent BEFORE closing it: the closed-parent write guard
|
||||
# (CompressionSessionClosedError) refuses durable writes to a session
|
||||
# ended by compression, so the legacy-state simulation must run first.
|
||||
session_db.replace_messages(source_id, [])
|
||||
session_db.end_session(source_id, "compression")
|
||||
session_db.create_session("tip-session", "api_server", parent_session_id=source_id)
|
||||
session_db.replace_messages(source_id, [])
|
||||
session_db.append_message("tip-session", "user", "after compression")
|
||||
|
||||
app = _create_session_app(adapter)
|
||||
|
|
|
|||
|
|
@ -2293,6 +2293,9 @@ class TestWebServerEndpoints:
|
|||
try:
|
||||
db.create_session(session_id="desktop-root", source="cli")
|
||||
db.append_message(session_id="desktop-root", role="user", content="before compression")
|
||||
# Empty before closing: the closed-parent write guard refuses
|
||||
# durable writes to compression-ended sessions.
|
||||
db.replace_messages("desktop-root", [])
|
||||
db.end_session("desktop-root", "compression")
|
||||
now = _time.time()
|
||||
db._conn.execute(
|
||||
|
|
@ -2301,7 +2304,6 @@ class TestWebServerEndpoints:
|
|||
)
|
||||
db.create_session(session_id="desktop-tip", source="cli", parent_session_id="desktop-root")
|
||||
db._conn.execute("UPDATE sessions SET started_at = ? WHERE id = ?", (now - 4, "desktop-tip"))
|
||||
db.replace_messages("desktop-root", [])
|
||||
db.append_message(session_id="desktop-tip", role="user", content="after compression")
|
||||
db._conn.commit()
|
||||
finally:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue