~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(history): lock username as required keyword-only on strategy fns (#4541)
LearningCircuit4844a2125199
diff --git a/tests/web/services/test_research_service.py b/tests/web/services/test_research_service.pyindex 5912a56502..85c88be0b1 100644--- a/tests/web/services/test_research_service.py+++ b/tests/web/services/test_research_service.py@@ -13,6 +13,8 @@ import hashlibfrom pathlib import Pathfrom unittest.mock import Mock, MagicMock, patch+import pytest+class TestGetCitationFormatter:"""Tests for get_citation_formatter function."""@@ -207,6 +209,27 @@ class TestSaveResearchStrategy:assert mock_strategy.strategy_name == "new_strategy"mock_session.commit.assert_called_once()+ def test_username_is_required_keyword_only(self):+ """Locks the security contract from #4526: ``username`` must be+ supplied, and only as a keyword. This guards the mutation the+ route-level autospec test cannot catch — re-adding a+ ``username=None`` default, which would silently reopen the+ ``get_user_db_session(None)`` implicit-fallback foot-gun. No DB+ mock: the TypeError is raised at call-binding time, before the+ body runs."""+ from local_deep_research.web.services.research_service import (+ save_research_strategy,+ )++ # Omitting username entirely -> missing required keyword-only arg.+ with pytest.raises(TypeError, match="username"):+ save_research_strategy(123, "standard")++ # Passing it positionally must also fail (keyword-only barrier),+ # so a refactor can't silently turn it into a positional arg.+ with pytest.raises(TypeError):+ save_research_strategy(123, "standard", "testuser")+class TestGetResearchStrategy:"""Tests for get_research_strategy function."""@@ -256,6 +279,26 @@ class TestGetResearchStrategy:assert result is None+ def test_username_is_required_keyword_only(self):+ """Locks the security contract from #4526: ``username`` must be+ supplied, and only as a keyword. Without this, re-adding a+ ``username=None`` default would pass every other strategy test+ (they all pass ``username=`` explicitly) while silently+ reopening the implicit Flask-session fallback path inside+ ``get_user_db_session``. No DB mock: the TypeError is raised at+ call-binding time, before the body runs."""+ from local_deep_research.web.services.research_service import (+ get_research_strategy,+ )++ # Omitting username entirely -> missing required keyword-only arg.+ with pytest.raises(TypeError, match="username"):+ get_research_strategy(123)++ # Passing it positionally must also fail (keyword-only barrier).+ with pytest.raises(TypeError):+ get_research_strategy(123, "testuser")+class TestGenerateReportPath:"""Tests for _generate_report_path function."""