feat(server): list_sessions 支持 project 过滤(json_extract + Python 兜底)
This commit is contained in:
@@ -213,3 +213,24 @@ def test_projects_upsert_empty_name_rejected(projects_store, tmp_path):
|
||||
with pytest.raises(ProjectConfigError):
|
||||
projects_store.upsert(name="", display_name="P", template="", write_instruction="",
|
||||
rules=[], existing_system_code_dir="", design_docs_dir="")
|
||||
|
||||
def test_list_sessions_filter_by_project(store):
|
||||
a = store.create_session("u1", name="A", project="stock")
|
||||
b = store.create_session("u1", name="B", project="other")
|
||||
recs = store.list_sessions("u1", project="stock")
|
||||
ids = {r.session_id for r in recs}
|
||||
assert a.session_id in ids and b.session_id not in ids
|
||||
|
||||
|
||||
def test_list_sessions_filter_empty_project(store):
|
||||
e = store.create_session("u1", name="E")
|
||||
store.create_session("u1", name="X", project="stock")
|
||||
recs = store.list_sessions("u1", project="")
|
||||
assert all(r.project == "" for r in recs)
|
||||
assert e.session_id in {r.session_id for r in recs}
|
||||
|
||||
|
||||
def test_list_sessions_no_project_returns_all(store):
|
||||
store.create_session("u1", name="A", project="stock")
|
||||
store.create_session("u1", name="B", project="other")
|
||||
assert len(store.list_sessions("u1")) == 2
|
||||
|
||||
Reference in New Issue
Block a user