From 7121752f2da55bb0f38b4be068e36ff08570a824 Mon Sep 17 00:00:00 2001 From: zhouziying Date: Thu, 16 Jul 2026 14:41:15 +0800 Subject: [PATCH] fix(automation): harden main-wallet passphrase guard and slow SDK case pacing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - prepareStandaloneMainWallet: treat an unknown passphrase_protection state (features fetch failed) as still-enabled so main-wallet calls always carry useEmptyPassphrase — previously a transient getFeatures failure left calls bare and every securityCheck/chainMethodBatch case failed with "Device opened passphrase" after a deviceFlow suite left passphrase on - raise SDK_CASE_DELAY_MS 80ms -> 300ms Co-Authored-By: Claude Fable 5 --- .../testTools/automationTest/useAutomationTest.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/packages/connect-examples/expo-example/src/testTools/automationTest/useAutomationTest.ts b/packages/connect-examples/expo-example/src/testTools/automationTest/useAutomationTest.ts index f35b11759..5f80650a3 100644 --- a/packages/connect-examples/expo-example/src/testTools/automationTest/useAutomationTest.ts +++ b/packages/connect-examples/expo-example/src/testTools/automationTest/useAutomationTest.ts @@ -118,7 +118,7 @@ const CONFIRM_ACTION_STEP_DELAY_MS = 1000; const POST_SEQUENCE_SETTLE_MS = 3000; /** Extra settle time between device preparation (import/create) and the first SDK call. */ const PRE_SDK_SETTLE_MS = 3000; -const SDK_CASE_DELAY_MS = 80; +const SDK_CASE_DELAY_MS = 300; const DEVICE_FLOW_ONLY_SUITES: TestSuiteType[] = ['deviceFlow']; type DeviceUiAction = 'confirm' | 'slide'; @@ -1463,10 +1463,16 @@ export function useAutomationTest() { featuresAfter = await fetchDeviceFeatures(sdk, connectId); } - const forceUseEmptyPassphrase = featuresAfter?.passphrase_protection === true; + // Treat an unknown state (features fetch failed) as still-enabled: forcing + // useEmptyPassphrase on a passphrase-off device is a harmless no-op, while + // skipping it on a passphrase-on device fails every main-wallet call with + // DeviceOpenedPassphrase (a prior deviceFlow suite leaves passphrase on). + const forceUseEmptyPassphrase = featuresAfter?.passphrase_protection !== false; if (forceUseEmptyPassphrase) { addLog( - `[${suiteLabel}] passphrase_protection is still enabled; forcing useEmptyPassphrase for main-wallet SDK calls` + `[${suiteLabel}] passphrase_protection is ${ + featuresAfter ? 'still enabled' : 'unknown' + }; forcing useEmptyPassphrase for main-wallet SDK calls` ); }