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.

fix: Fix API test failure and infrastructure test CI

LearningCircuita314684a9a50
diff --git a/.github/workflows/infrastructure-tests.yml b/.github/workflows/infrastructure-tests.yml
index b45297a85c..8e338251a7 100644
--- a/.github/workflows/infrastructure-tests.yml
+++ b/.github/workflows/infrastructure-tests.yml
@@ -41,7 +41,7 @@ jobs:
-w /app \
-e PYTHONPATH=/app:/install/.venv/lib/python3.12/site-packages \
ldr-test \
- sh -c "cd /app && /install/.venv/bin/pip install pytest pytest-mock && /install/.venv/bin/python -m pytest tests/infrastructure_tests/test_*.py -v --color=yes --no-header -rN"
+ sh -c "cd /app && /install/.venv/bin/pip install pytest pytest-mock sqlalchemy && /install/.venv/bin/python -m pytest tests/infrastructure_tests/test_*.py -v --color=yes --no-header -rN"
- name: Run JavaScript infrastructure tests
run: |
diff --git a/src/local_deep_research/web/api.py b/src/local_deep_research/web/api.py
index 911706006d..2c669dc036 100644
--- a/src/local_deep_research/web/api.py
+++ b/src/local_deep_research/web/api.py
@@ -229,21 +229,31 @@ def api_quick_summary():
logger.debug(f"Getting settings snapshot for user: {username}")
with get_user_db_session(username) as db_session:
if db_session:
- settings_manager = get_settings_manager(
- db_session, username
- )
- all_settings = settings_manager.get_all_settings()
- # Extract just the values for the settings snapshot
- settings_snapshot = {}
- for key, setting in all_settings.items():
- if isinstance(setting, dict) and "value" in setting:
- settings_snapshot[key] = setting["value"]
- else:
- settings_snapshot[key] = setting
- params["settings_snapshot"] = settings_snapshot
- logger.debug(
- f"Got settings snapshot with {len(settings_snapshot)} settings"
- )
+ try:
+ settings_manager = get_settings_manager(
+ db_session, username
+ )
+ all_settings = settings_manager.get_all_settings()
+ # Extract just the values for the settings snapshot
+ settings_snapshot = {}
+ for key, setting in all_settings.items():
+ if (
+ isinstance(setting, dict)
+ and "value" in setting
+ ):
+ settings_snapshot[key] = setting["value"]
+ else:
+ settings_snapshot[key] = setting
+ params["settings_snapshot"] = settings_snapshot
+ logger.debug(
+ f"Got settings snapshot with {len(settings_snapshot)} settings"
+ )
+ except AttributeError as ae:
+ logger.error(
+ f"SettingsManager attribute error: {ae}. "
+ f"Type: {type(settings_manager) if 'settings_manager' in locals() else 'Unknown'}"
+ )
+ raise
else:
logger.warning(
f"No database session for user: {username}"
@@ -252,11 +262,14 @@ def api_quick_summary():
logger.warning(
f"Failed to get settings snapshot: {e}", exc_info=True
)
+ # Continue with empty snapshot rather than failing
+ params["settings_snapshot"] = {}
else:
logger.debug("No username in session, skipping settings snapshot")
+ params["settings_snapshot"] = {}
# Provide default settings if no snapshot
- if "settings_snapshot" not in params:
+ if not params.get("settings_snapshot"):
logger.debug("No settings snapshot, loading defaults")
try:
# Load default settings from JSON file
diff --git a/src/local_deep_research/web/routes/research_routes.py b/src/local_deep_research/web/routes/research_routes.py
index 43078df5a1..4695454086 100644
--- a/src/local_deep_research/web/routes/research_routes.py
+++ b/src/local_deep_research/web/routes/research_routes.py
@@ -209,7 +209,7 @@ def start_research():
import uuid
import threading
- created_at = datetime.utcnow().isoformat()
+ created_at = datetime.now(datetime.UTC).isoformat()
research_id = str(uuid.uuid4())
# Create organized research metadata with settings snapshot
diff --git a/tests/api_tests/test_api_basic.py b/tests/api_tests/test_api_basic.py
index 7e149ddc7b..e3ebb7ef99 100644
--- a/tests/api_tests/test_api_basic.py
+++ b/tests/api_tests/test_api_basic.py
@@ -49,7 +49,9 @@ class TestBasicAPI:
data = json.loads(response.data)
assert "error" in data
- def test_api_structure(self, authenticated_client):
+ def test_api_structure(
+ self, authenticated_client, setup_database_for_all_tests
+ ):
"""Test that API accepts properly formatted requests."""
payload = {
"query": "test",