feat: glass ui pass
This commit is contained in:
@@ -125,6 +125,29 @@ class TestWebServerEndpoints:
|
||||
assert "hermes_home" in data
|
||||
assert "active_sessions" in data
|
||||
|
||||
def test_get_sessions_uses_only_persisted_cwd(self, monkeypatch):
|
||||
"""Session rows without persisted cwd must not inherit TERMINAL_CWD.
|
||||
|
||||
/api/sessions should reflect per-session DB state, not process/global
|
||||
cwd settings, so workspace grouping stays stable and deterministic.
|
||||
"""
|
||||
from hermes_state import SessionDB
|
||||
|
||||
monkeypatch.setenv("TERMINAL_CWD", "/tmp/global-default")
|
||||
|
||||
db = SessionDB()
|
||||
try:
|
||||
db.create_session(session_id="session-no-cwd", source="cli")
|
||||
finally:
|
||||
db.close()
|
||||
|
||||
resp = self.client.get("/api/sessions?limit=20&offset=0")
|
||||
assert resp.status_code == 200
|
||||
|
||||
rows = resp.json()["sessions"]
|
||||
row = next(s for s in rows if s["id"] == "session-no-cwd")
|
||||
assert row["cwd"] is None
|
||||
|
||||
def test_audio_transcription_endpoint(self, monkeypatch):
|
||||
import tools.transcription_tools as transcription_tools
|
||||
|
||||
|
||||
@@ -2348,6 +2348,24 @@ class TestCompressionChainProjection:
|
||||
assert tip_row["ended_at"] is None # tip is still live
|
||||
assert tip_row["end_reason"] is None
|
||||
|
||||
def test_list_projection_uses_tip_cwd(self, db):
|
||||
"""Projected lineage rows should carry cwd from the live tip row.
|
||||
|
||||
Without this, compressed conversations can lose workspace grouping
|
||||
even after the continuation session persists its cwd.
|
||||
"""
|
||||
import time as _time
|
||||
|
||||
self._build_compression_chain(db, _time.time() - 3600)
|
||||
db.update_session_cwd("tip1", "/tmp/workspaces/tip")
|
||||
db._conn.commit()
|
||||
|
||||
sessions = db.list_sessions_rich(source="cli", limit=20)
|
||||
tip_row = next(s for s in sessions if s["id"] == "tip1")
|
||||
|
||||
assert tip_row["_lineage_root_id"] == "root1"
|
||||
assert tip_row["cwd"] == "/tmp/workspaces/tip"
|
||||
|
||||
def test_list_without_projection_returns_raw_root(self, db):
|
||||
"""project_compression_tips=False returns the raw parent-NULL root
|
||||
rows — useful for admin/debug UIs.
|
||||
|
||||
Reference in New Issue
Block a user