feat: add history UX and expand retention-focused roadmap
Some checks failed
CI / test (push) Failing after 15s

This commit is contained in:
2026-05-11 21:07:39 +02:00
parent 964aee3481
commit 7749a02706
5 changed files with 552 additions and 1 deletions

View File

@@ -77,3 +77,53 @@ def test_query_returns_past_sessions(tmp_path: Path) -> None:
assert isinstance(results[0], PastSession)
assert results[0].host == "web01"
assert "package missing" in results[0].summary
def test_list_recent_returns_sessions_sorted_desc(tmp_path: Path) -> None:
chroma_mock = _make_chromadb_mock()
collection = chroma_mock.PersistentClient.return_value.get_or_create_collection.return_value
collection.count.return_value = 3
collection.get.return_value = {
"ids": ["20260506T120000Z", "20260507T120000Z", "20260505T120000Z"],
"documents": ["older", "newer", "oldest"],
"metadatas": [
{"host": "web01", "issue": "i1"},
{"host": "web01", "issue": "i2"},
{"host": "db01", "issue": "i3"},
],
}
with patch.dict("sys.modules", {"chromadb": chroma_mock}):
store = SessionStore(tmp_path / "store")
results = store.list_recent(limit=2)
assert len(results) == 2
assert results[0].session_id == "20260507T120000Z"
assert results[1].session_id == "20260506T120000Z"
def test_search_keyword_filters_by_term_and_host(tmp_path: Path) -> None:
chroma_mock = _make_chromadb_mock()
collection = chroma_mock.PersistentClient.return_value.get_or_create_collection.return_value
collection.count.return_value = 3
collection.get.return_value = {
"ids": ["20260505T120000Z", "20260506T120000Z", "20260507T120000Z"],
"documents": [
"Root cause: nginx config typo",
"Root cause: package missing",
"Root cause: nginx port conflict",
],
"metadatas": [
{"host": "web01", "issue": "nginx fails"},
{"host": "web01", "issue": "sssd fails"},
{"host": "db01", "issue": "nginx start failed"},
],
}
with patch.dict("sys.modules", {"chromadb": chroma_mock}):
store = SessionStore(tmp_path / "store")
results = store.search_keyword("nginx", host="web01", limit=5)
assert len(results) == 1
assert results[0].host == "web01"
assert "nginx" in results[0].issue.lower()