~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
feat(hooks): advisory recommend-performance-tests pre-commit hook (#3540)
LearningCircuit1e51c5eca882
diff --git a/.gitignore b/.gitignoreindex 9ca24fbf66..92883f8d28 100644--- a/.gitignore+++ b/.gitignore@@ -95,6 +95,12 @@ src/local_deep_research/web/static/css/themes.css!.github/security/*.txt!.gitleaksignore!.grype.yaml+# Re-allow pre-commit hooks after the `.*/` catch-all (the earlier+# !.pre-commit-hooks/ block is overridden by `.*/` above, which is why+# new hook files land as ignored until this rule is re-applied here).+!.pre-commit-hooks/+!.pre-commit-hooks/*.py+!.pre-commit-hooks/*.sh# Allow installer files only in installers directory (text scripts only)!installers/**/*.batdiff --git a/.pre-commit-config.yaml b/.pre-commit-config.yamlindex a514acd9f0..d218b4d93f 100644--- a/.pre-commit-config.yaml+++ b/.pre-commit-config.yaml@@ -287,6 +287,14 @@ repos:always_run: trueverbose: truedescription: "Direct recommendation to include tests when source files change"+ - id: recommend-performance-tests+ name: Performance Test Reminder+ entry: .pre-commit-hooks/recommend-performance-tests.py+ language: script+ pass_filenames: false+ always_run: true+ verbose: true+ description: "Remind contributors about subsystem fast tests and opt-in live tests"- id: require-testsname: Require Tests for Substantial Changesentry: .pre-commit-hooks/require-tests.pydiff --git a/.pre-commit-hooks/recommend-performance-tests.py b/.pre-commit-hooks/recommend-performance-tests.pynew file mode 100755index 0000000000..b480c31a35--- /dev/null+++ b/.pre-commit-hooks/recommend-performance-tests.py@@ -0,0 +1,146 @@+#!/usr/bin/env python3+"""Advisory reminder for subsystem fast tests + opt-in live performance tests.++When staged source files touch a subsystem listed in PATH_RULES, print a+two-tier reminder: (1) the narrow fast mocked tests that catch+logic/contract regressions in seconds, and (2) the opt-in live+performance tests under ``tests/performance/<subsystem>/`` — plus a+nudge to add one if the subsystem doesn't have a live-tests dir yet.++Always exits 0 (advisory). Mirrors recommend-tests.py style.+"""++import sys+from pathlib import Path++# Allow importing sibling module+sys.path.insert(0, str(Path(__file__).resolve().parent))++from _commit_analysis import analyze_commit++# Keep this table at the top of the file — update it alongside any+# reshuffling of tests/performance/<subsystem>/ directories or when a+# new subsystem grows a fast-test suite worth recommending.+#+# Rules are evaluated most-specific-first: a staged file is attributed+# to the FIRST matching rule only, so overlapping prefixes+# (e.g. relevance_filter.py is inside web_search_engines/) don't+# fire two reminders.+PATH_RULES = [+ {+ "name": "relevance_filter",+ "prefixes": (+ "src/local_deep_research/web_search_engines/relevance_filter.py",+ ),+ "fast_tests": [+ "tests/web_search_engines/test_relevance_filter.py",+ ],+ "perf_dir": "tests/performance/relevance_filter/",+ "perf_exists": True,+ },+ {+ "name": "search_engine_adapters",+ "prefixes": ("src/local_deep_research/web_search_engines/engines/",),+ "fast_tests": [+ "tests/web_search_engines/test_search_engine_base.py",+ "tests/web_search_engines/test_parallel_search_engine.py",+ ],+ "perf_dir": "tests/performance/search_engines/",+ "perf_exists": True,+ },+ {+ "name": "web_search_engines",+ "prefixes": ("src/local_deep_research/web_search_engines/",),+ "fast_tests": [+ "tests/web_search_engines/test_search_engine_base.py",+ "tests/web_search_engines/test_parallel_search_engine.py",+ ],+ "perf_dir": None,+ "perf_exists": False,+ },+ {+ "name": "advanced_search_system",+ "prefixes": ("src/local_deep_research/advanced_search_system/",),+ "fast_tests": [+ "tests/advanced_search_system/constraint_checking/test_threshold_checker.py",+ "tests/advanced_search_system/constraint_checking/test_dual_confidence_checker.py",+ "tests/advanced_search_system/constraint_checking/test_base_constraint_checker.py",+ ],+ "perf_dir": "tests/performance/strategies/",+ "perf_exists": True,+ },+ {+ "name": "content_fetcher",+ "prefixes": (+ "src/local_deep_research/content_fetcher/",+ "src/local_deep_research/research_library/downloaders/",+ ),+ "fast_tests": [+ "tests/content_fetcher/test_html_content_extraction.py",+ "tests/research_library/downloaders/test_html_downloader.py",+ "tests/research_library/downloaders/test_extraction_pipeline.py",+ "tests/research_library/downloaders/test_metadata_extractor.py",+ ],+ "perf_dir": "tests/performance/content_fetcher/",+ "perf_exists": True,+ },+]+++def _print_rule(rule, matched):+ print()+ print(f" \033[33mPerformance Test Reminder — {rule['name']}\033[0m")+ print(" " + "-" * 40)+ print(f" You touched {len(matched)} file(s) under {rule['name']}:")+ for p in matched:+ print(f" - {p}")+ print()+ print(" Fast tests (mocked, ~5-30s) to run now:")+ print(f" pdm run pytest {' '.join(rule['fast_tests'])}")+ print()+ if rule["perf_exists"]:+ print(" Heavier real-service tests (opt-in, live):")+ print(+ f" LDR_TESTING_WITH_MOCKS=false pdm run pytest "+ f"{rule['perf_dir']} -m integration"+ )+ print(+ " If you added behavior only live tests catch, consider "+ f"adding a test under {rule['perf_dir']}."+ )+ elif rule["perf_dir"]:+ print(+ f" No live tests exist yet at {rule['perf_dir']}. If your "+ "change needs live-service coverage, consider adding one."+ )+ else:+ print(+ " No live-tests dir for this subsystem yet — consider "+ "adding one if live coverage matters."+ )+ print()+++def main():+ analysis = analyze_commit()+ if not analysis.source_files:+ return 0+ staged = [f.path for f in analysis.source_files]+ # First-match-wins assignment so overlapping prefixes+ # (relevance_filter.py is inside web_search_engines/) don't+ # double-fire. PATH_RULES is ordered most-specific-first.+ per_rule: dict[str, list[str]] = {}+ for path in staged:+ for rule in PATH_RULES:+ if path.startswith(rule["prefixes"]):+ per_rule.setdefault(rule["name"], []).append(path)+ break+ for rule in PATH_RULES:+ matched = per_rule.get(rule["name"], [])+ if matched:+ _print_rule(rule, matched)+ return 0+++if __name__ == "__main__":+ sys.exit(main())