From 821d4a7fa479bd5c02dd2c8740e8aafed39bf11b Mon Sep 17 00:00:00 2001 From: ai-ag2026 <261867348+ai-ag2026@users.noreply.github.com> Date: Thu, 28 May 2026 09:52:42 +0200 Subject: [PATCH] test: keep redaction fixture visible in session index --- tests/test_session_summary_redaction.py | 38 +++++++++++-------------- 1 file changed, 17 insertions(+), 21 deletions(-) diff --git a/tests/test_session_summary_redaction.py b/tests/test_session_summary_redaction.py index e28645ae..e6a2c80f 100644 --- a/tests/test_session_summary_redaction.py +++ b/tests/test_session_summary_redaction.py @@ -21,30 +21,26 @@ def _get(path): def _write_session_with_secret_title(): - from tests.conftest import TEST_STATE_DIR + from api.models import Session + from tests.conftest import TEST_WORKSPACE sid = "sec_summary_" + uuid.uuid4().hex[:8] - sessions_dir = TEST_STATE_DIR / "sessions" - sessions_dir.mkdir(parents=True, exist_ok=True) now = time.time() - (sessions_dir / f"{sid}.json").write_text(json.dumps({ - "session_id": sid, - "title": f"session with {_FULL_SECRET}", - "workspace": "/tmp", - "model": "test", - "created_at": now, - "updated_at": now, - "pinned": False, - "archived": False, - "project_id": None, - "profile": "default", - "input_tokens": 0, - "output_tokens": 0, - "estimated_cost": None, - "personality": None, - "messages": [], - "tool_calls": [], - })) + session = Session( + session_id=sid, + title=f"session with {_FULL_SECRET}", + workspace=str(TEST_WORKSPACE), + model="test", + created_at=now, + updated_at=now, + profile="default", + messages=[], + tool_calls=[], + ) + # Save through the model layer so the sidebar index is updated just like a + # real session write. Direct sidecar writes are intentionally not visible to + # /api/sessions while an index exists. + session.save(touch_updated_at=False) return sid