From e53b9fc1bfc31b5f8688d9ec97f71eb23740a734 Mon Sep 17 00:00:00 2001 From: Celes Renata Date: Fri, 17 Apr 2026 07:14:50 +0000 Subject: [PATCH] fix: macro tab MSW mock returns wrong response shape MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The handler for /api/macro/impacts/:ticker was returning the impacts array directly instead of { exposure_profile, impacts }. The frontend destructures macroData.impacts which was undefined, falling back to an empty array — so the Macro tab always showed 'No active macro impacts' even with mock data present. --- frontend/src/test/mocks/handlers.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/test/mocks/handlers.ts b/frontend/src/test/mocks/handlers.ts index dc39828..61f5d5a 100644 --- a/frontend/src/test/mocks/handlers.ts +++ b/frontend/src/test/mocks/handlers.ts @@ -163,7 +163,7 @@ export const handlers = [ const ev = mockMacroEvents.find((e) => e.id === params.id); return ev ? HttpResponse.json({ ...ev, model_provider: 'ollama', model_name: 'test-model', prompt_version: 'event-v1', schema_version: '1.0.0', impacts: mockMacroImpacts }) : new HttpResponse(null, { status: 404 }); }), - http.get('/api/macro/impacts/:ticker', () => HttpResponse.json(mockMacroImpacts)), + http.get('/api/macro/impacts/:ticker', () => HttpResponse.json({ exposure_profile: null, impacts: mockMacroImpacts })), http.get('/api/admin/macro/status', () => HttpResponse.json({ macro_enabled: true, source: 'default' })), http.put('/api/admin/macro/toggle', async ({ request }) => { const body = await request.json() as Record;