SurfSense/surfsense_backend/tests/unit
CREDO23 cfdad85058 test(chat): add parity tests for streaming/flows/ parallel refactor
Adds 34 tests under tests/unit/tasks/chat/streaming/ that cover the
new flows tree against the legacy stream_new_chat.py module to gate
the upcoming cutover. Coverage:

* Public entry points: stream_new_chat and stream_resume_chat are
  async generator functions whose parameter signatures (name, kind,
  annotation, default) match the legacy versions one-for-one. Uses a
  normalized-annotation comparison so PEP-563 vs eager-annotation
  representation differences are tolerated.
* Extracted helpers: image-capability gate, runtime-context builders
  for new-chat and resume-chat, LLM-bundle dispatcher, premium-quota
  needs check + reservation dataclass, rate-limit recovery truth
  table, persistence-spawn registration/self-unregistration, await
  helpers.
* SSE frame iterators: iter_initial_frames + iter_final_frames emit
  the canonical sequence; iter_token_usage_frame skips on None.
* Initial thinking step: 4 parametrized branches (text, image-only,
  empty, mentioned-docs), long-query truncation, many-docs collapse.

These tests are scaffolding for the cutover and will be removed once
the legacy module is deleted.
2026-05-25 21:50:18 +02:00
..
adapters test: bootstrap pytest environment for backend 2026-02-24 18:19:56 +02:00
agents feat(agents): emit metrics for model and tool calls 2026-05-21 23:02:36 +05:30
connector_indexers Fix test mocks for vision_llm kwarg 2026-04-10 18:20:49 +02:00
connectors chore: ran linting 2026-04-07 05:55:39 +05:30
db feat: improved agent streaming 2026-04-29 07:20:31 -07:00
e2e_fakes test(backend): enhance Drive file filtering and add unit tests for _drive_list_files 2026-05-06 17:58:58 +05:30
etl_pipeline chore: linting 2026-05-15 17:33:44 -07:00
google_unification chore: ran linting 2026-05-09 05:28:09 +05:30
indexing_pipeline Merge remote-tracking branch 'upstream/dev' into fix/backend-tests 2026-05-16 19:40:01 +05:30
middleware fix(test): pin enable_kb_planner_runnable=false for KB-search planner tests 2026-05-05 02:00:34 +02:00
observability feat(env): add SURFSENSE_ENV variable for deployment environment and update observability resource attributes 2026-05-23 02:13:24 +05:30
routes feat: fixed vision/image provider specific errors and fixed podcast/video streaming 2026-05-02 19:18:53 -07:00
services feat: add no-update sentinel handling to save_memory function and corresponding unit tests 2026-05-20 15:03:35 +05:30
tasks test(chat): add parity tests for streaming/flows/ parallel refactor 2026-05-25 21:50:18 +02:00
utils test(backend): add OAuth state security unit tests 2026-05-06 17:18:31 +05:30
__init__.py test: bootstrap pytest environment for backend 2026-02-24 18:19:56 +02:00
test_error_contract.py chore: linting 2026-04-22 01:05:31 -07:00
test_obsidian_plugin_indexer.py chore: linting 2026-04-27 14:04:50 -07:00
test_stream_new_chat_contract.py perf(chat): kill auto-pin preflight + speculative build, rely on reactive 429 recovery 2026-05-20 11:03:08 +02:00