SurfSense/surfsense_backend/tests/unit/tasks/chat
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
..
streaming test(chat): add parity tests for streaming/flows/ parallel refactor 2026-05-25 21:50:18 +02:00
__init__.py feat: improved agent streaming 2026-04-29 07:20:31 -07:00
test_content_builder.py feat: improved document, folder mentions rendering 2026-05-09 22:15:51 -07:00
test_extract_chunk_parts.py feat: enhance tool input streaming and agent action handling for improved chat experience 2026-04-30 03:13:58 -07:00
test_thinking_step_id_uniqueness.py chore: linting 2026-05-15 17:33:44 -07:00
test_tool_input_streaming.py refactor(chat): stream agent events via stream_output and remove parity v2 flag 2026-05-07 19:40:10 +02:00