Skip to content

~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.

test: annotate 28 PUNCHLIST KEEP-marked tests with audit-reviewed markers (#4295)

LearningCircuit7a92987b1e56
diff --git a/tests/metrics/test_pricing_cache.py b/tests/metrics/test_pricing_cache.py
index 933f5a6312..1b77586361 100644
--- a/tests/metrics/test_pricing_cache.py
+++ b/tests/metrics/test_pricing_cache.py
@@ -58,6 +58,7 @@ class TestPricingCacheGetSet:
def test_get_returns_none_for_expired_key(self):
"""Should return None and remove expired entries."""
+ # audit: PUNCHLIST reviewed 2026-05 — KEEP (TIMING_SLEEP).
cache = PricingCache(cache_ttl=1) # 1 second TTL
cache.set("test_key", {"value": 789})
@@ -145,6 +146,7 @@ class TestPricingCacheClear:
def test_clear_expired_removes_only_expired(self):
"""Should remove only expired entries."""
+ # audit: PUNCHLIST reviewed 2026-05 — KEEP (TIMING_SLEEP).
cache = PricingCache(cache_ttl=2) # 2 second TTL
cache.set("old_key", "old_value")
@@ -192,6 +194,7 @@ class TestPricingCacheStats:
def test_get_cache_stats_expired_entries_evicted(self):
"""TTLCache automatically evicts expired entries on get_cache_stats."""
+ # audit: PUNCHLIST reviewed 2026-05 — KEEP (TIMING_SLEEP).
cache = PricingCache(cache_ttl=1)
cache.set("key1", "value1")
@@ -222,6 +225,7 @@ class TestPricingCacheTTL:
def test_cache_respects_ttl(self):
"""Should respect TTL for entries."""
+ # audit: PUNCHLIST reviewed 2026-05 — KEEP (TIMING_SLEEP).
cache = PricingCache(cache_ttl=1)
cache.set("key1", "value1")
diff --git a/tests/metrics/test_research_metrics_extended.py b/tests/metrics/test_research_metrics_extended.py
index 09942b2a07..c47d05997c 100644
--- a/tests/metrics/test_research_metrics_extended.py
+++ b/tests/metrics/test_research_metrics_extended.py
@@ -82,6 +82,7 @@ class TestResearchMetrics:
def test_llm_latency_metrics(self):
"""Test LLM latency is tracked"""
+ # audit: PUNCHLIST reviewed 2026-05 — KEEP (TIMING_SLEEP).
from local_deep_research.metrics.token_counter import (
TokenCountingCallback,
)
diff --git a/tests/test_token_counter_coverage.py b/tests/test_token_counter_coverage.py
index d4f45dda45..4b78783a7f 100644
--- a/tests/test_token_counter_coverage.py
+++ b/tests/test_token_counter_coverage.py
@@ -604,6 +604,7 @@ class TestOnLlmError:
assert cb.error_type == "ValueError"
def test_response_time_calculated_on_error(self):
+ # audit: PUNCHLIST reviewed 2026-05 — KEEP (RACE_CONDITIONS).
cb = _make_callback()
cb.on_llm_start(serialized={}, prompts=["hi"], model="m")
cb.start_time = time.time() - 1.0 # 1 second ago
diff --git a/tests/utilities/test_log_utils.py b/tests/utilities/test_log_utils.py
index b1998d0c19..d8869ef53e 100644
--- a/tests/utilities/test_log_utils.py
+++ b/tests/utilities/test_log_utils.py
@@ -840,6 +840,7 @@ class TestLogQueueProcessorDaemon:
return fake_app
def test_spawns_daemon_thread(self):
+ # audit: PUNCHLIST reviewed 2026-05 — KEEP (OK).
from local_deep_research.utilities import log_utils
app = self._make_fake_app()
@@ -864,6 +865,7 @@ class TestLogQueueProcessorDaemon:
log_utils.stop_log_queue_processor(timeout=2.0)
def test_stop_joins_thread(self):
+ # audit: PUNCHLIST reviewed 2026-05 — KEEP (OK).
from local_deep_research.utilities import log_utils
app = self._make_fake_app()
diff --git a/tests/utilities/test_search_cache.py b/tests/utilities/test_search_cache.py
index 2a713f84f0..0bbb00772b 100644
--- a/tests/utilities/test_search_cache.py
+++ b/tests/utilities/test_search_cache.py
@@ -485,6 +485,7 @@ class TestSearchCacheGetOrFetch:
def test_stampede_protection_single_fetch(self, cache):
"""Test that only one thread fetches during stampede."""
+ # audit: PUNCHLIST reviewed 2026-05 — KEEP (OK).
fetch_count = []
def slow_fetch():
diff --git a/tests/web/test_app_coverage.py b/tests/web/test_app_coverage.py
index e946da36a6..536528f279 100644
--- a/tests/web/test_app_coverage.py
+++ b/tests/web/test_app_coverage.py
@@ -152,6 +152,7 @@ class TestMainHttpsBranch:
def test_https_branch_does_not_raise(self):
"""use_https=True must not raise; it only emits log warnings."""
+ # audit: PUNCHLIST reviewed 2026-05 — KEEP (ASSERT_TRUE).
config = _make_config(use_https=True)
with _patch_main(config):
from local_deep_research.web import app as app_module
@@ -160,6 +161,7 @@ class TestMainHttpsBranch:
def test_no_https_branch_runs_cleanly(self):
"""use_https=False takes the happy path without any HTTPS logging."""
+ # audit: PUNCHLIST reviewed 2026-05 — KEEP (ASSERT_TRUE).
config = _make_config(use_https=False)
with _patch_main(config):
from local_deep_research.web import app as app_module
@@ -414,6 +416,7 @@ class TestFlushLogsOnExit:
mock_flush.assert_called_once()
def test_flush_handler_swallows_exceptions(self):
+ # audit: PUNCHLIST reviewed 2026-05 — KEEP (ASSERT_TRUE).
with patch(
f"{MODULE}.flush_log_queue", side_effect=RuntimeError("log error")
):
@@ -471,6 +474,7 @@ class TestShutdownSchedulerHandler:
def test_shutdown_scheduler_noop_without_news_scheduler(self):
"""app with no news_scheduler attribute does not raise."""
+ # audit: PUNCHLIST reviewed 2026-05 — KEEP (ASSERT_TRUE).
mock_app = MagicMock(spec=[]) # no attributes at all
captured = self._run_and_capture_handlers(mock_app)
@@ -527,6 +531,7 @@ class TestShutdownDatabasesHandler:
mock_db_manager.close_all_databases.assert_called_once()
def test_shutdown_databases_swallows_exceptions(self):
+ # audit: PUNCHLIST reviewed 2026-05 — KEEP (ASSERT_TRUE).
captured = self._run_and_capture_handlers()
handler = _handler_by_name(captured, "shutdown_databases")
with patch(f"{_DB_MOD}.db_manager", side_effect=ImportError("db gone")):
diff --git a/tests/web/test_app_factory.py b/tests/web/test_app_factory.py
index 20a4dce088..24e8c06d2d 100644
--- a/tests/web/test_app_factory.py
+++ b/tests/web/test_app_factory.py
@@ -218,6 +218,7 @@ class TestSecurityHeaders:
def test_response_has_security_headers(self, client):
"""Responses have security headers."""
+ # audit: PUNCHLIST reviewed 2026-05 — KEEP (ASSERT_TRUE).
response = client.get("/")
# Check for common security headers
@@ -254,6 +255,7 @@ class TestCsrfProtection:
def test_csrf_token_endpoint_exists(self, app):
"""CSRF token endpoint exists."""
+ # audit: PUNCHLIST reviewed 2026-05 — KEEP (ASSERT_TRUE).
rules = [rule.rule for rule in app.url_map.iter_rules()]
csrf_routes = [r for r in rules if "csrf" in r.lower()]
# Should have a CSRF token endpoint
@@ -517,12 +519,14 @@ class TestBlueprintRegistration:
def test_settings_blueprint_registered(self, app):
"""Settings blueprint should be registered."""
+ # audit: PUNCHLIST reviewed 2026-05 — KEEP (ASSERT_TRUE).
rules = [rule.rule for rule in app.url_map.iter_rules()]
settings_routes = [r for r in rules if "/settings" in r]
assert len(settings_routes) >= 0 # May or may not exist
def test_library_blueprint_registered(self, app):
"""Library blueprint should be registered."""
+ # audit: PUNCHLIST reviewed 2026-05 — KEEP (ASSERT_TRUE).
rules = [rule.rule for rule in app.url_map.iter_rules()]
library_routes = [r for r in rules if "/library" in r]
assert len(library_routes) >= 0 # May or may not exist
diff --git a/tests/web/test_app_factory_coverage.py b/tests/web/test_app_factory_coverage.py
index 7020746af1..57e53193d4 100644
--- a/tests/web/test_app_factory_coverage.py
+++ b/tests/web/test_app_factory_coverage.py
@@ -228,6 +228,7 @@ class TestCreateDatabase:
def test_create_database_accepts_any_app(self):
"""create_database accepts any app argument without error."""
+ # audit: PUNCHLIST reviewed 2026-05 — KEEP (ASSERT_TRUE).
from local_deep_research.web.app_factory import create_database
create_database(None) # Even None is acceptable
@@ -386,6 +387,7 @@ class TestApplyMiddlewareTeardown:
def test_teardown_runs_without_db_session(self, app_with_middleware):
"""Teardown context function runs cleanly when no db_session in g."""
+ # audit: PUNCHLIST reviewed 2026-05 — KEEP (ASSERT_TRUE).
with app_with_middleware.test_request_context("/"):
# Push and pop app context; teardown should not raise
with app_with_middleware.app_context():
diff --git a/tests/web/test_app_main_coverage.py b/tests/web/test_app_main_coverage.py
index e88bf43e77..e083435c48 100644
--- a/tests/web/test_app_main_coverage.py
+++ b/tests/web/test_app_main_coverage.py
@@ -150,6 +150,7 @@ class TestMainCreatesAppAndRuns:
)
def test_main_completes_without_exception(self):
+ # audit: PUNCHLIST reviewed 2026-05 — KEEP (ASSERT_TRUE).
config = _make_config()
# Should not raise
_run_main(config)
@@ -578,6 +579,7 @@ class TestMainShutdownDatabasesAtexit:
def test_shutdown_databases_swallows_import_error(self):
"""shutdown_databases does not propagate exceptions."""
+ # audit: PUNCHLIST reviewed 2026-05 — KEEP (ASSERT_TRUE).
captured = self._run_and_capture()
handler = _handler_by_name(captured, "shutdown_databases")
# Simulate import failure inside the handler
@@ -586,6 +588,7 @@ class TestMainShutdownDatabasesAtexit:
def test_shutdown_databases_swallows_runtime_error(self):
"""shutdown_databases swallows RuntimeError from close_all_databases."""
+ # audit: PUNCHLIST reviewed 2026-05 — KEEP (ASSERT_TRUE).
captured = self._run_and_capture()
handler = _handler_by_name(captured, "shutdown_databases")
mock_db = MagicMock()
diff --git a/tests/web/test_teardown_cleanup.py b/tests/web/test_teardown_cleanup.py
index 3946782e83..29a1daa9f5 100644
--- a/tests/web/test_teardown_cleanup.py
+++ b/tests/web/test_teardown_cleanup.py
@@ -40,6 +40,7 @@ class TestCleanupDbSession:
def test_no_session_in_g_no_error(self, app):
"""When g has no db_session, teardown completes without error."""
+ # audit: PUNCHLIST reviewed 2026-05 — KEEP (ASSERT_TRUE).
with app.test_request_context("/"):
# Don't set g.db_session
pass
diff --git a/tests/web/test_websocket_middleware.py b/tests/web/test_websocket_middleware.py
index ac007689a0..1221635889 100644
--- a/tests/web/test_websocket_middleware.py
+++ b/tests/web/test_websocket_middleware.py
@@ -58,6 +58,7 @@ class TestHandleWebsocketRequests:
def test_socket_path_with_werkzeug_socket(self, app):
"""socket.io path with werkzeug.socket set goes through normally."""
+ # audit: PUNCHLIST reviewed 2026-05 — KEEP (ASSERT_TRUE).
with app.test_request_context(
"/socket.io/",
environ_base={"werkzeug.socket": True},
diff --git a/tests/web_search_engines/test_rate_limiting_tracker_coverage.py b/tests/web_search_engines/test_rate_limiting_tracker_coverage.py
index 78de5d2ad3..6b329674ab 100644
--- a/tests/web_search_engines/test_rate_limiting_tracker_coverage.py
+++ b/tests/web_search_engines/test_rate_limiting_tracker_coverage.py
@@ -860,18 +860,21 @@ class TestCleanupOldDataDetailed:
def test_programmatic_mode_no_op(self):
"""Programmatic mode returns early without error."""
+ # audit: PUNCHLIST reviewed 2026-05 — KEEP (H1,H2).
tracker = _make_tracker()
tracker.cleanup_old_data(days=7)
@patch(f"{MODULE}.is_ci_environment", return_value=True)
def test_ci_mode_no_op(self, _ci):
"""CI mode returns early without error."""
+ # audit: PUNCHLIST reviewed 2026-05 — KEEP (H1).
tracker = _make_tracker()
tracker.programmatic_mode = False
tracker.cleanup_old_data(days=7)
def test_default_days_param(self):
"""Default days parameter is 30."""
+ # audit: PUNCHLIST reviewed 2026-05 — KEEP (H1).
tracker = _make_tracker()
tracker.cleanup_old_data()