SurfSense/surfsense_backend/tests/unit/tasks/chat/streaming
CREDO23 b9937cf4b1 refactor(chat): cut live chat streaming over to flows orchestrators (cutover)
Flip the live callers (new_chat_routes + gateway/agent_invoke) from the
legacy monolithic app.tasks.chat.stream_new_chat to the side-by-side
app.tasks.chat.streaming.flows orchestrators.

Adds a byte-for-byte differential parity test driving BOTH implementations
on identical, fully-deterministic glue inputs (frozen time/uuid, stubbed
LLM/persistence/agent seams). All glue paths are byte-identical:
  * new: auto-pin failure, LLM-load failure, persist-user fail,
    persist-assistant fail (full initial-frame ordering + handshake),
    pre-stream exception (top-level except path)
  * resume: persist-assistant fail

The differential test also surfaced one INTENTIONAL divergence: on a resume
turn whose auto-pin / LLM-load fails, the monolith crashes with
UnboundLocalError (_resume_premium_request_id read in finally before its
post-early-return definition); the flows version emits a clean terminal
error. The flows path is therefore byte-identical or strictly more correct.

The agent-content stream itself is shared, unforkable code
(stream_output -> EventRelay) so it cannot diverge.

Monolith + old parity test deletion follows in a separate commit.
2026-06-04 14:24: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_orchestrator_frame_parity.py refactor(chat): cut live chat streaming over to flows orchestrators (cutover) 2026-06-04 14:24:18 +02:00
test_parallel_refactor_parity.py refactor(agents): move filesystem_selection to app/agents/shared (slice 3a) 2026-06-04 12:28:20 +02:00
test_stage_1_parity.py refactor(agents): move middleware package to app/agents/shared (slice 5c) 2026-06-04 13:00:41 +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