fix: search-logspam (#593)

* fix: search-logspam

* llm comment

* fix tests

---------

Co-authored-by: Igor Loskutov <igor.loskutoff@gmail.com>
This commit is contained in:
Igor Monadical
2025-08-29 18:55:51 -04:00
committed by GitHub
parent ccffdba75b
commit 695d1a957d
5 changed files with 85 additions and 33 deletions

View File

@@ -23,7 +23,7 @@ async def test_search_postgresql_only():
assert results == []
assert total == 0
params_empty = SearchParameters(query_text="")
params_empty = SearchParameters(query_text=None)
results_empty, total_empty = await search_controller.search_transcripts(
params_empty
)
@@ -34,7 +34,7 @@ async def test_search_postgresql_only():
@pytest.mark.asyncio
async def test_search_with_empty_query():
"""Test that empty query returns all transcripts."""
params = SearchParameters(query_text="")
params = SearchParameters(query_text=None)
results, total = await search_controller.search_transcripts(params)
assert isinstance(results, list)

View File

@@ -1,5 +1,7 @@
"""Unit tests for search snippet generation."""
import pytest
from reflector.db.search import (
SnippetCandidate,
SnippetGenerator,
@@ -512,11 +514,9 @@ data visualization and data storage"""
)
assert webvtt_count == 3
snippets_empty, count_empty = SnippetGenerator.combine_sources(
None, None, "data", max_total=3
)
assert snippets_empty == []
assert count_empty == 0
# combine_sources requires at least one source to be present
with pytest.raises(AssertionError, match="At least one source must be present"):
SnippetGenerator.combine_sources(None, None, "data", max_total=3)
def test_edge_cases(self):
"""Test edge cases for the pure functions."""