normalize ota update ids

This commit is contained in:
Samuel Newman
2026-07-29 22:01:11 +03:00
parent 10e023829b
commit e6ac7f8d9e
2 changed files with 8 additions and 3 deletions
+2 -2
View File
@@ -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())
+6 -1
View File
@@ -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.