~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.
Python academiaanthropicarxivbravedeep-researchencryptionhome-automationhomeserverlocallocal-deep-researchlocal-llmmistralollamaopenaipubmedresearchresearch-toolretrieval-augmented-generationsearxngself-hosted
test(metrics): correct link-analytics guard docstring; sync stale resource mock (#4774)
LearningCircuitff5a7f30c9e7
diff --git a/tests/test_link_analytics.py b/tests/test_link_analytics.pyindex 9de2b02b53..25921bcd9d 100644--- a/tests/test_link_analytics.py+++ b/tests/test_link_analytics.py@@ -114,15 +114,18 @@ class TestLinkAnalytics:assert len(analytics["top_domains"]) == 0def test_get_link_analytics_real_db_projection(self):- """Real-DB guard (#4560): exercise get_link_analytics against a real- in-memory DB so the projected query (url/research_id/created_at/- source_type/title + a ``has_preview`` SQL boolean — NOT the full- ``content_preview`` body) runs on real ``Row`` objects.-- A future consumer reading a non-projected column would AttributeError- in the per-row loop (swallowed by its broad ``except``) and silently- degrade the analytics output — which the attribute-permissive mock- tests cannot catch. These output assertions would fail in that case.+ """Real-DB guard (#4560): run get_link_analytics on real ``Row``+ objects (which expose ONLY the projected columns), not+ attribute-permissive mocks.++ Dropping a *consumed* projected column is caught by the assertions+ below: ``url`` and ``research_id`` make the function raise (→ the+ all-zeros error dict, so every assertion fails), and ``source_type``+ degrades ``source_type_analysis``. A bare ``MagicMock`` test catches+ none of these — the missing attribute just auto-vivifies. Intentionally+ NOT guarded: ``created_at`` (its only output, ``temporal_trend``, isn't+ asserted) and ``has_preview`` (feeds only the computed-but-unreturned+ ``quality_metrics``), so neither has an observable-output assertion."""from contextlib import contextmanagerdiff --git a/tests/web/routes/test_metrics_routes_coverage.py b/tests/web/routes/test_metrics_routes_coverage.pyindex c060de78f1..bfdc2f18d2 100644--- a/tests/web/routes/test_metrics_routes_coverage.py+++ b/tests/web/routes/test_metrics_routes_coverage.py@@ -59,6 +59,9 @@ def _make_resource(r.research_id = research_idr.title = titler.content_preview = content_preview+ # get_link_analytics reads the SQL-projected ``has_preview`` boolean+ # (content_preview IS NOT NULL AND != '') rather than the body (#4560).+ r.has_preview = bool(content_preview)r.source_type = source_typer.created_at = created_atreturn r