~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
# allow: no-sut-import — exercises the real /history/api FastAPI route only
# through the shared `authenticated_client` fixture (tests/conftest.py:512),
# which imports local_deep_research itself; this file has no direct SUT import.
"""`/history/api` must tolerate malformed pagination params.
Flask parsed these with ``request.args.get(..., type=int)``, which falls back
to the default when the value will not parse rather than raising. The port
used a bare ``int()`` inside the endpoint's outer ``try``, so ``?limit=abc``
raised ValueError and was converted into a 500 with an empty item list —
turning a harmless typo or a stale client into a server error.
The sibling endpoint kept the guard: ``library.py``'s
``get_research_documents`` wraps both params in
``except (TypeError, ValueError)`` and its comment points back at this very
route. So this was the odd one out (the N-of-M pattern), not a deliberate
change.
These tests pin the Flask behaviour: bad input falls back to defaults and the
request still succeeds, and the clamp still bounds the good path.
"""
import pytest
@pytest.fixture
def client(authenticated_client):
return authenticated_client
@pytest.mark.parametrize(
"query",
[
"?limit=abc",
"?offset=abc",
"?limit=abc&offset=xyz",
"?limit=",
"?offset=",
"?limit=1.5",
"?limit=none&offset=none",
],
)
def test_malformed_pagination_does_not_500(client, query):
"""A value that will not parse falls back to the default."""
resp = client.get(f"/history/api{query}")
assert resp.status_code < 500, (
f"/history/api{query} returned {resp.status_code}; malformed "
f"pagination must fall back to defaults, not error"
)
@pytest.mark.parametrize(
"query",
["?limit=-1", "?limit=0", "?limit=99999", "?offset=-5"],
)
def test_out_of_range_pagination_is_clamped_not_rejected(client, query):
"""Negative or oversized values clamp rather than erroring.
``LIMIT -1`` means "no limit" in SQLite, so an unclamped negative limit
would load the entire history — the hazard the sibling endpoint's clamp
was added for.
"""
resp = client.get(f"/history/api{query}")
assert resp.status_code < 500, (
f"/history/api{query} returned {resp.status_code}; out-of-range "
f"pagination must be clamped"
)
def test_valid_pagination_still_works(client):
resp = client.get("/history/api?limit=10&offset=0")
assert resp.status_code == 200