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.

docs(notes-api): document omitted-default asymmetry and test omitted control defaults (#5500)

LearningCircuitc6abceb1bdb5
diff --git a/src/local_deep_research/web/routes/notes_routes.py b/src/local_deep_research/web/routes/notes_routes.py
index cfecc48efe..ed932ba9de 100644
--- a/src/local_deep_research/web/routes/notes_routes.py
+++ b/src/local_deep_research/web/routes/notes_routes.py
@@ -738,6 +738,7 @@ def patch_note_research(note_id, research_id):
try:
data = request.get_json(silent=True) or {}
+ # Omitted: is_collapsed stays None and is passed through (no-op).
is_collapsed = data.get("is_collapsed")
if "is_collapsed" in data and not isinstance(
data["is_collapsed"], bool
@@ -1429,6 +1430,7 @@ def index_note_to_collection(note_id):
), 400
collection_id = data["collection_id"]
+ # Omitted: defaults to False (do not force-reindex).
force_reindex = data.get("force_reindex", False)
if not isinstance(force_reindex, bool):
return jsonify(
@@ -2330,6 +2332,7 @@ def synthesize_notes():
"error": "synthesis_type must be a string",
}
), 400
+ # Omitted: defaults to True (persist synthesis as a new note).
create_note = data.get("create_note", True)
if not isinstance(create_note, bool):
return jsonify(
diff --git a/tests/notes/test_notes_api_validation_followups.py b/tests/notes/test_notes_api_validation_followups.py
index d4ec1622e1..5880373d6e 100644
--- a/tests/notes/test_notes_api_validation_followups.py
+++ b/tests/notes/test_notes_api_validation_followups.py
@@ -1,5 +1,6 @@
"""Route-level regressions for Notes API input validation follow-ups."""
+from contextlib import contextmanager
from unittest.mock import MagicMock
import pytest
@@ -130,6 +131,90 @@ class TestNotesAPIValidationFollowups:
is_collapsed=None,
)
+ def test_index_note_allows_omitted_force_reindex(
+ self, monkeypatch, db_session
+ ):
+ """omitting force_reindex defaults to False and flows through to the
+ RAG service (the boolean guard does not reject it)."""
+ app, _ = _route_app(monkeypatch, db_session)
+ note_service = MagicMock()
+ note_service.note_exists.return_value = True
+ monkeypatch.setattr(
+ notes_routes, "NoteService", lambda username: note_service
+ )
+ rag_service = MagicMock()
+ rag_service.index_document.return_value = {"status": "indexed"}
+ monkeypatch.setattr(
+ "local_deep_research.research_library.routes.rag_routes.get_rag_service",
+ lambda collection_id: rag_service,
+ )
+
+ payload, status = _call(
+ app,
+ "/notes/api/notes/note-1/index",
+ _unwrap(notes_routes.index_note_to_collection),
+ "note-1",
+ method="POST",
+ json={"collection_id": "collection-1"}, # force_reindex omitted
+ )
+
+ assert status == 200
+ assert payload["success"] is True
+ rag_service.index_document.assert_called_once_with(
+ document_id="note-1",
+ collection_id="collection-1",
+ force_reindex=False, # the omitted default
+ )
+
+ def test_synthesize_allows_omitted_create_note(
+ self, monkeypatch, db_session
+ ):
+ """omitting create_note defaults to True, so the synthesis is
+ persisted as a new note (status 201, not rejected by the guard)."""
+ app, _ = _route_app(monkeypatch, db_session)
+ ai_service = MagicMock()
+ ai_service.synthesize_notes.return_value = {
+ "suggested_title": "T",
+ "content": "C",
+ "source_notes": [],
+ }
+ monkeypatch.setattr(
+ notes_routes, "NoteAIService", lambda username: ai_service
+ )
+ note_service = MagicMock()
+ note_service.create_note.return_value = "new-note-id"
+ monkeypatch.setattr(
+ notes_routes, "NoteService", lambda username: note_service
+ )
+
+ @contextmanager
+ def fake_session(username=None):
+ yield MagicMock()
+
+ monkeypatch.setattr(
+ "local_deep_research.database.session_context.get_user_db_session",
+ fake_session,
+ )
+
+ payload, status = _call(
+ app,
+ "/notes/api/notes/synthesize",
+ _unwrap(notes_routes.synthesize_notes),
+ method="POST",
+ json={ # create_note omitted
+ "note_ids": ["note-1", "note-2"],
+ "synthesis_type": "merge",
+ },
+ )
+
+ assert status == 201
+ assert payload["success"] is True
+ note_service.create_note.assert_called_once_with(
+ title="T",
+ content="C",
+ tags=["synthesized", "merge"],
+ )
+
def test_similar_passages_rejects_stale_note_id(
self, monkeypatch, db_session
):