feat(FN-3212): remove runtime memory-backend side-load, add regression test

Merged FN-3207, FN-3212, and FN-3242: removed runtime memory-backend side-loading in core, added comprehensive regression tests for QuickChat, chat routes, and SSE streams, and documented compact mobile chat dialogs in the dashboard guide. The refactor in `project-memory.ts` reduces complexity while

Fusion-Task-Id: FN-3212
This commit is contained in:
Fusion
2026-05-03 07:32:04 -07:00
committed by gsxdsm
parent 3878132c4e
commit 0948be42fd
6 changed files with 182 additions and 0 deletions

View File

@@ -462,6 +462,55 @@ describe("useQuickChat", () => {
expect(mockStreamChatResponse).toHaveBeenCalledTimes(1);
});
it("starts a fresh stream and shows active state on second turn after first turn completes", async () => {
const existingSession = makeSession({ id: "session-existing", agentId: "agent-001" });
const handlers: Array<Parameters<typeof mockStreamChatResponse>[2]> = [];
mockFetchResumeChatSession.mockResolvedValueOnce({ session: existingSession });
mockFetchChatMessages.mockResolvedValue({ messages: [] });
mockStreamChatResponse.mockImplementation((_sessionId, _content, nextHandlers) => {
handlers.push(nextHandlers);
return { close: vi.fn(), isConnected: () => true };
});
const { result } = renderHook(() => useQuickChat("proj-123"));
await act(async () => {
await result.current.switchSession("agent-001");
});
act(() => {
void result.current.sendMessage("Turn 1");
});
expect(mockStreamChatResponse).toHaveBeenCalledTimes(1);
act(() => {
handlers[0]?.onDone?.({ messageId: "msg-001" });
});
await waitFor(() => {
expect(result.current.isStreaming).toBe(false);
});
act(() => {
void result.current.sendMessage("Turn 2");
});
await waitFor(() => {
expect(mockStreamChatResponse).toHaveBeenCalledTimes(2);
expect(result.current.isStreaming).toBe(true);
});
act(() => {
handlers[1]?.onError?.("second turn failed");
});
await waitFor(() => {
expect(result.current.isStreaming).toBe(false);
});
});
it("queued message is auto-sent after streaming onDone", async () => {
const existingSession = makeSession({ id: "session-existing", agentId: "agent-001" });
const handlers: Array<Parameters<typeof mockStreamChatResponse>[2]> = [];