Skip to content

fix(automation): harden main-wallet passphrase guard and slow SDK case pacing#838

Open
wabicai wants to merge 1 commit into
onekeyfrom
chore/automation-sdk-case-delay
Open

fix(automation): harden main-wallet passphrase guard and slow SDK case pacing#838
wabicai wants to merge 1 commit into
onekeyfrom
chore/automation-sdk-case-delay

Conversation

@wabicai

@wabicai wabicai commented Jul 16, 2026

Copy link
Copy Markdown
Member

Summary

Two robustness fixes for the hardware automation test suite (runs against PhonePilot):

  • prepareStandaloneMainWallet: treat an unknown passphrase_protection state as still-enabled. The guard used featuresAfter?.passphrase_protection === true, so a transient getFeatures failure (undefined) skipped useEmptyPassphrase on all main-wallet calls. When a preceding deviceFlow suite left the device with passphrase enabled, every securityCheck/chainMethodBatch case then failed with failure(Device opened passphrase) (observed on the "BIP39 导入 / API 专用助记词" scenario). Forcing useEmptyPassphrase on a passphrase-off device is a harmless no-op, so unknown now defaults to forcing it; the log line distinguishes still enabled from unknown.
  • SDK_CASE_DELAY_MS 80ms → 300ms to reduce flakiness between consecutive SDK cases.

Counterpart PhonePilot changes (OCR calibration + sequence timing): OneKeyHQ/qa-auto-hardware#32. All PhonePilot sequence IDs referenced here (/health drift check) are unchanged.

🤖 Generated with Claude Code

// 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;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

当 Single Security Check 复用已准备好的设备,且这次 getFeatures 暂时失败时,featuresAfterPreparation 会是 undefined;复用分支仍使用 === true,因此会把未知状态当成 passphrase 已关闭,绕过这里新增的保守兜底。

如果设备实际仍开启 passphrase,后续主钱包调用不会携带 useEmptyPassphrase,会再次批量报 DeviceOpenedPassphrase。请让复用分支也采用 passphrase_protection !== false,或统一复用同一个状态判定函数。

…e pacing

- 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 <noreply@anthropic.com>
@wabicai
wabicai force-pushed the chore/automation-sdk-case-delay branch from 2f5ada2 to 7121752 Compare July 17, 2026 04:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants