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.

5.6 KB
Raw Blame

Search setting contracts

Issue #6651 tracks prevention coverage for settings lost between callers, constructors and consumers after #6490. These tests run in the ordinary pytest suite. The dev dependencies include the optional MCP SDK so its caller contracts execute in the normal test image. No server, API credentials, model download or E2E label is required.

From an environment installed with pdm install, run:

PYTHONPATH=src python -m pytest \
  tests/web_search_engines/test_search_settings_library_contracts.py \
  tests/web_search_engines/test_search_settings_contracts.py \
  tests/citation_handlers/test_base_citation_handler.py \
  -q -o addopts=

The focused command passed 116 tests in 22.51 seconds on Linux/Python 3.12 during implementation. Runtime depends on the machine. The FAISS bindings reported three existing SWIG deprecation warnings.

Coverage map

Mechanism from #6490 Observable contract
Snapshot-only settings forwarding Both scalar and {value: ...} snapshots control SearXNG snippets/page content, the real relevance filter's result count, and provider HTTP arguments.
Constructor-signature filtering Real SearXNG/TinyFish constructors and Mojeek's **kwargs path initialize and run; observing the real base constructor also verifies the snippet flag survives filtering without duplicate kwargs.
Provider aliases Captured Mojeek, Serper, TinyFish and ScaleSerp requests preserve their region/location and language formats. Real SearXNG sends de; the real HTML downloader/extraction pipeline receives German and produces article text.
SearXNG snippet forwarding The real factory, engine and full-search wrapper return snippets or extract full pages according to the resolved mode.
Caller overrides MCP's real search entry honors the snapshot. MCP and get_search retrieve complete chunks through actual library/collection engines, SQLite, FAISS and DB hydration. LangGraph web/specialized tools explicitly force snippets, as intended by #7189.
Strategy execution flag Constructing SourceBasedSearchStrategy changes an oppositely configured real library engine; BaseSearchEngine.run() then returns the requested snippet/full chunk. Updating only include_full_content fails this check.
Citation fallback The existing citation tests now follow missing, null and empty full content through document creation into the actual standard citation prompt; valid full content takes precedence over a distinct snippet.

Existing factory/wrapper routing tests and strategy unit tests remain useful. The new tests complement their mocked-constructor and attribute assertions with real execution. They do not require every registered provider to support every global setting.

Precedence protected by the suite

The table describes direct create_search_engine calls. get_search also forwards its named argument defaults for the providers that accept them.

Setting Contract
search.snippets_only An explicit caller mode wins over the snapshot. A missing setting retains the safe engine default; malformed values fail closed. The LangGraph tools deliberately supply their own snippets-only override.
search.max_filtered_results An explicit argument wins over the global snapshot, which wins over engine defaults. Missing or malformed global values preserve the engine default. The assertions use the real relevance filter and selected result count.
search.region An explicit region wins over the global value; the global value overrides the engine's default region. Only TinyFish receives an automatic ISO location alias. all and wt-wt are not country locations. ScaleSerp retains its place-name default.
Safe search SearXNG's own enum default takes precedence over the global boolean; an explicit enum override wins. Other representative providers retain their documented boolean/request semantics.
Language Provider-specific language defaults and explicit overrides retain precedence. The extraction language is resolved separately: search_language, then the global search language, then the provider language, converted to a language name.

HTTP responses, DNS, LLM responses and embedding generation are isolated at their external boundaries. The library fixture replaces encrypted-engine discovery with temporary SQLite while retaining the production session scope, index service, integrity records, FAISS persistence and chunk rehydration. It sets and restores a background password context and closes its sessions.

Regression controls

Implementation review verified the following eight deliberate mutations in a separate scratch checkout. All eight were detected by assertion or document construction failures, with no collection errors or skips:

  • Remove snapshot snippet forwarding from the factory.
  • Update only the strategy's unused include_full_content attribute.
  • Pass the provider code de into full-page extraction.
  • Drop supported base parameters from a real **kwargs constructor.
  • Remove snapshot forwarding of the relevance-filter result limit.
  • Treat ScaleSerp's free-text location as an ISO country alias.
  • Restore the citation fallback that fails on present-but-null/empty content.
  • Drop the engine's configured relevance-filter default when the global value is missing or malformed.

The production behavior is already correct; these are prevention tests, so passing against unchanged main is expected. No new pre-commit hook or workflow is needed. The accessor cleanup claimed separately in the #6651 conversation, fetch-cache behavior and summary budgeting remain separate work.