From e6ac7f8d9e01c8d838b0bf0cba32ec8e09534208 Mon Sep 17 00:00:00 2001 From: Samuel Newman Date: Wed, 29 Jul 2026 22:01:11 +0300 Subject: [PATCH] normalize ota update ids --- src/lib/hooks/useOTAUpdates.test.ts | 4 ++-- src/lib/hooks/useOTAUpdates.ts | 7 ++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/lib/hooks/useOTAUpdates.test.ts b/src/lib/hooks/useOTAUpdates.test.ts index 1b5ca63214..d174182a33 100644 --- a/src/lib/hooks/useOTAUpdates.test.ts +++ b/src/lib/hooks/useOTAUpdates.test.ts @@ -185,11 +185,11 @@ describe('useOTAUpdateRecovery', () => { ) }) - it('silently clears the marker when the attempted OTA launched', () => { + it('recognizes a launched OTA when the update ID casing differs', () => { jest.mocked(device.get).mockReturnValue({ attemptedAt: Date.now(), channel: 'pull-request-123', - updateId: currentUpdate.updateId, + updateId: currentUpdate.updateId.toUpperCase(), }) renderHook(() => useOTAUpdateRecovery()) diff --git a/src/lib/hooks/useOTAUpdates.ts b/src/lib/hooks/useOTAUpdates.ts index 97f30eb81f..a7e043aeb2 100644 --- a/src/lib/hooks/useOTAUpdates.ts +++ b/src/lib/hooks/useOTAUpdates.ts @@ -262,7 +262,12 @@ export function useOTAUpdateRecovery() { if (!pendingUpdate || !currentlyRunning) return device.remove(['pendingOTAUpdate']) - if (pendingUpdate.updateId === currentlyRunning.updateId) return + if ( + pendingUpdate.updateId.toLowerCase() === + currentlyRunning.updateId?.toLowerCase() + ) { + return + } // A fallback relaunch is immediate. A stale marker can be left by a // successful runtime-compatible bundle that predates this hook.