diff --git a/apps/mobile-shell/scripts/check-config.mjs b/apps/mobile-shell/scripts/check-config.mjs index 47e8717b4..4c6703aef 100644 --- a/apps/mobile-shell/scripts/check-config.mjs +++ b/apps/mobile-shell/scripts/check-config.mjs @@ -2368,6 +2368,14 @@ for (const snippet of [ } } +if (filesSource.includes('console.warn(`mobile HostBridge file failed for ${label}`, error)')) { + throw new Error('mobile shell file diagnostics must not log native error objects'); +} + +if (!filesSource.includes('console.warn(`mobile HostBridge file failed for ${label}`)')) { + throw new Error('mobile shell file diagnostics must use stable label-only logging'); +} + if ( !dispatchSource.includes('exportMobileHostBridgeTextFile(request)') || !dispatchSource.includes('importMobileHostBridgeTextFile(request)') || diff --git a/apps/mobile-shell/src/host-bridge/files.test.ts b/apps/mobile-shell/src/host-bridge/files.test.ts index fb52703d8..12ef4219a 100644 --- a/apps/mobile-shell/src/host-bridge/files.test.ts +++ b/apps/mobile-shell/src/host-bridge/files.test.ts @@ -222,7 +222,6 @@ describe('mobile HostBridge file actions', () => { expect(shareAsyncMock).not.toHaveBeenCalled(); expect(warnSpy).toHaveBeenCalledWith( 'mobile HostBridge file failed for sharing.available', - error, ); warnSpy.mockRestore(); }); @@ -252,7 +251,6 @@ describe('mobile HostBridge file actions', () => { ]); expect(warnSpy).toHaveBeenCalledWith( 'mobile HostBridge file failed for sharing.open', - error, ); warnSpy.mockRestore(); }); @@ -329,7 +327,6 @@ describe('mobile HostBridge file actions', () => { }); expect(warnSpy).toHaveBeenCalledWith( 'mobile HostBridge file failed for document_picker.open', - error, ); warnSpy.mockRestore(); }); @@ -357,7 +354,6 @@ describe('mobile HostBridge file actions', () => { }); expect(warnSpy).toHaveBeenCalledWith( 'mobile HostBridge file failed for file.read_text', - expect.any(Error), ); warnSpy.mockRestore(); }); @@ -386,7 +382,6 @@ describe('mobile HostBridge file actions', () => { }); expect(warnSpy).toHaveBeenCalledWith( 'mobile HostBridge file failed for file.read_base64', - expect.any(Error), ); warnSpy.mockRestore(); }); @@ -414,7 +409,6 @@ describe('mobile HostBridge file actions', () => { }); expect(warnSpy).toHaveBeenCalledWith( 'mobile HostBridge file failed for file.read_base64', - expect.any(Error), ); warnSpy.mockRestore(); }); @@ -498,7 +492,6 @@ describe('mobile HostBridge file actions', () => { expect(imageLibraryMock).not.toHaveBeenCalled(); expect(warnSpy).toHaveBeenCalledWith( 'mobile HostBridge file failed for image.library_permission', - error, ); warnSpy.mockRestore(); }); @@ -520,7 +513,6 @@ describe('mobile HostBridge file actions', () => { }); expect(warnSpy).toHaveBeenCalledWith( 'mobile HostBridge file failed for image.library_open', - error, ); warnSpy.mockRestore(); }); @@ -537,7 +529,6 @@ describe('mobile HostBridge file actions', () => { expect(cameraMock).not.toHaveBeenCalled(); expect(warnSpy).toHaveBeenCalledWith( 'mobile HostBridge file failed for image.camera_permission', - error, ); warnSpy.mockRestore(); }); @@ -559,7 +550,6 @@ describe('mobile HostBridge file actions', () => { }); expect(warnSpy).toHaveBeenCalledWith( 'mobile HostBridge file failed for image.camera_open', - error, ); warnSpy.mockRestore(); }); diff --git a/apps/mobile-shell/src/host-bridge/files.ts b/apps/mobile-shell/src/host-bridge/files.ts index 3b44ca19f..f1e85ab95 100644 --- a/apps/mobile-shell/src/host-bridge/files.ts +++ b/apps/mobile-shell/src/host-bridge/files.ts @@ -51,8 +51,8 @@ import { } from './filePayloads'; import { invalidRequest, ok } from './protocol'; -function logMobileHostBridgeFileFailure(label: string, error: unknown) { - console.warn(`mobile HostBridge file failed for ${label}`, error); +function logMobileHostBridgeFileFailure(label: string, _error: unknown) { + console.warn(`mobile HostBridge file failed for ${label}`); } type MobileDocumentPickerOptions = Parameters<