~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(journal_quality): assert PRAGMA user_version on built DB (#3577)
LearningCircuitbd6a80a13e13
diff --git a/tests/journal_quality/test_db.py b/tests/journal_quality/test_db.pyindex 044910b391..979d2364c3 100644--- a/tests/journal_quality/test_db.py+++ b/tests/journal_quality/test_db.py@@ -297,6 +297,48 @@ class TestBuildReferenceDb:"full-table scan of ~217K rows.")+ def test_built_db_stamps_schema_version(self, tmp_path):+ """``build_db`` must stamp ``PRAGMA user_version`` to the+ current ``JOURNAL_QUALITY_SCHEMA_VERSION`` constant. The+ startup-time ``_validate_existing_db`` check reads this+ pragma to detect schema drift and force a rebuild — if the+ stamp goes missing silently, stale DBs survive forever past+ a schema change and users see mysterious query failures.++ Reads the constant dynamically rather than hardcoding a+ number so this test stays green across future version+ bumps without needing a mechanical update.+ """+ import sqlite3++ from local_deep_research.config.paths import (+ get_journal_data_directory,+ )+ from local_deep_research.journal_quality.db import (+ JOURNAL_QUALITY_SCHEMA_VERSION,+ build_db,+ )++ data_dir = get_journal_data_directory()+ if not (data_dir / "openalex_sources.json.gz").exists():+ pytest.skip("OpenAlex data file not found")++ output = tmp_path / "test_quality.db"+ build_db(data_dir=data_dir, output_path=output)++ conn = sqlite3.connect(f"file:{output}?mode=ro", uri=True)+ try:+ stamped = conn.execute("PRAGMA user_version").fetchone()[0]+ finally:+ conn.close()++ assert stamped == JOURNAL_QUALITY_SCHEMA_VERSION, (+ f"PRAGMA user_version={stamped}, expected "+ f"{JOURNAL_QUALITY_SCHEMA_VERSION}. If this fails, "+ "_validate_existing_db won't detect schema drift and "+ "stale DBs will never rebuild after the next bump."+ )+# ---------------------------------------------------------------------------# _populate_sources unit tests (hijacked + DOAJ-only second pass)