mirror of
https://github.com/HKUDS/nanobot.git
synced 2026-09-04 02:01:48 +03:00
fix(session): reject read_session match-all patterns
This commit is contained in:
@@ -236,7 +236,7 @@ async def test_read_session_filters_by_query_and_returns_recent_matches(tmp_path
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.parametrize("query", [None, "", " ", "*", ".*"])
|
||||
@pytest.mark.parametrize("query", [None, "", " "])
|
||||
async def test_read_session_accepts_unfiltered_query_forms(tmp_path, query):
|
||||
manager = SessionManager(tmp_path)
|
||||
_save_session(
|
||||
@@ -262,6 +262,20 @@ async def test_read_session_accepts_unfiltered_query_forms(tmp_path, query):
|
||||
]
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.parametrize("query", ["*", ".*"])
|
||||
async def test_read_session_rejects_match_all_patterns_with_retry_guidance(tmp_path, query):
|
||||
with _webui_request():
|
||||
result = await ReadSessionTool(SessionManager(tmp_path)).execute(
|
||||
session_key="websocket:history",
|
||||
query=query,
|
||||
)
|
||||
|
||||
assert result.is_error
|
||||
assert "literal substring" in str(result)
|
||||
assert "Omit query" in str(result)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_read_session_reports_invalid_requests(tmp_path):
|
||||
with _webui_request():
|
||||
|
||||
Reference in New Issue
Block a user