From 119bcf6e4a6eafdd073d95ea9ef4cd21a8d83786 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20F=C4=85ferek?= Date: Wed, 18 Feb 2026 18:53:32 +0100 Subject: [PATCH 1/2] fix: map PREFAILED fault status to pending in UI Faults with API status PREFAILED were falling through to the default 'active' mapping, making them visually identical to CONFIRMED faults. Fixes #36 --- src/lib/sovd-api.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/sovd-api.ts b/src/lib/sovd-api.ts index 2248726..db880fe 100644 --- a/src/lib/sovd-api.ts +++ b/src/lib/sovd-api.ts @@ -1557,7 +1557,7 @@ export class SovdApiClient { const apiStatus = apiFault.status?.toLowerCase() || ''; if (apiStatus === 'confirmed' || apiStatus === 'active') { status = 'active'; - } else if (apiStatus === 'pending') { + } else if (apiStatus === 'pending' || apiStatus === 'prefailed') { status = 'pending'; } else if (apiStatus === 'cleared' || apiStatus === 'resolved') { status = 'cleared'; From d18b0f52c6a96b0e5fa0bb5f24d96339ac3b1a01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20F=C4=85ferek?= Date: Wed, 18 Feb 2026 18:58:23 +0100 Subject: [PATCH 2/2] test: add PREFAILED status mapping test --- src/lib/sovd-api.test.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/lib/sovd-api.test.ts b/src/lib/sovd-api.test.ts index f97e1d7..3bf9077 100644 --- a/src/lib/sovd-api.test.ts +++ b/src/lib/sovd-api.test.ts @@ -119,6 +119,16 @@ describe('SovdApiClient', () => { expect(result.items[0]?.status).toBe('healed'); }); + it('maps PREFAILED API status to pending', async () => { + vi.mocked(fetch).mockResolvedValue({ + ok: true, + json: () => Promise.resolve({ items: [makeFaultItem({ status: 'PREFAILED' })] }), + } as Response); + + const result = await client.listAllFaults('all'); + expect(result.items[0]?.status).toBe('pending'); + }); + it('maps CONFIRMED API status to active', async () => { vi.mocked(fetch).mockResolvedValue({ ok: true,