SurfSense/surfsense_backend/tests/unit/tasks/chat/streaming
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
..
__init__.py Add parity unit tests for extracted chat streaming vs legacy. 2026-05-06 20:08:48 +02:00
test_interrupt_inspector_all.py chore: linting 2026-05-15 17:33:44 -07:00
test_parallel_refactor_parity.py test(chat): add parity tests for streaming/flows/ parallel refactor 2026-05-25 21:50:18 +02:00
test_stage_1_parity.py chat/stream_new_chat: emit one SSE frame per pending interrupt 2026-05-13 20:59:48 +02:00
test_stage_2_parity.py Carry thinkingStepId on tool output and extend builder and parity tests. 2026-05-08 23:17:12 +02:00
test_stream_output.py refactor: remove memory extraction functions and related components from the new chat agent 2026-05-20 14:03:28 +05:30
test_task_span.py feat: improved document, folder mentions rendering 2026-05-09 22:15:51 -07:00
test_tool_activity_metadata.py Cover tool_activity_metadata for span-only, step-only, and combined cases. 2026-05-08 23:16:56 +02:00