fix(core): ignore unexpected messages in backup flow during setup#6650
Merged
fix(core): ignore unexpected messages in backup flow during setup#6650
Conversation
This comment has been minimized.
This comment has been minimized.
3419d74 to
111854f
Compare
Contributor
Author
|
Rebasing to resolve a conflict. |
09aa2c4 to
a331f07
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@tests/device_tests/reset_recovery/test_reset_bip39_t2.py`:
- Around line 38-41: The FLOW_ADAPTERS entry using try_to_cancel currently skips
{"backup_device", "setup_device", "success_backup"} but misses the
Delizia-specific ButtonRequest name "confirm_setup_device", causing a Cancel to
be injected during setup; update the try_to_cancel call in FLOW_ADAPTERS to
include "confirm_setup_device" in the skipped set (alongside "backup_device",
"setup_device", and "success_backup") so cancellations are ignored for that
setup request as intended.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 97bee016-947c-4897-80e4-47730471e0c8
📒 Files selected for processing (7)
core/src/apps/management/reset_device/__init__.pytests/device_tests/reset_recovery/test_reset_bip39_t2.pytests/device_tests/reset_recovery/test_reset_slip39_advanced.pytests/device_tests/reset_recovery/test_reset_slip39_basic.pytests/device_tests/test_msg_backup_device.pytests/input_flows.pytests/ui_tests/fixtures.json
🚧 Files skipped from review as they are similar to previous changes (3)
- core/src/apps/management/reset_device/init.py
- tests/device_tests/reset_recovery/test_reset_slip39_advanced.py
- tests/device_tests/reset_recovery/test_reset_slip39_basic.py
0204e18 to
2d11926
Compare
Contributor
Author
|
Squashed. |
mmilata
approved these changes
Apr 7, 2026
| return flow() | ||
|
|
||
|
|
||
| def try_to_cancel(skip_cancel: set[str] | None = None): |
Contributor
Author
There was a problem hiding this comment.
Thanks - fixed and rebased:
1: 9d5556ffa5 ! 1: dc41f5f3fc chore(core): move backup flow adapters to `tests.input_flows`
@@ tests/input_flows.py: class InputFlowCancelBrightness(InputFlowBase):
+ return flow()
+
+
-+def try_to_cancel(skip_cancel: set[str] | None = None):
++def try_to_cancel(skip_cancel: set[str] | None = None) -> FlowAdapter:
+ BACKUP_IN_PROGRESS = messages.Failure(
+ code=messages.FailureType.InProgress,
+ message="Backup in progress",
2: f56509c58b = 2: 77db2ff1b3 fix(core): ignore unexpected messages in backup flow during setup
3: c86a55a1f9 = 3: 5a94a97682 test(core): test backup cancellation during `ResetDevice`
4: 2d119266fa = 4: ed22f86ce7 chore(core): update UI fixtures
To be re-used in other tests as well. [no changelog]
Changelog entry will be added after #6348 is fully resolved. [no changelog]
Previously, backup cancellation was tested only during `BackupDevice`. [no changelog]
[no changelog]
2d11926 to
ed22f86
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.




























































































































































Similar to #6483 (backup should not fail due to unexpected messages from host), but for
ResetDevice-based backup, which is being used in trezor/trezor-suite#25084.Related to #6348.
CC: @STew790
This PR doesn't solve I/O error handling (i.e. ButtonRequest write errors due to dead host) -> should be done in #6651.
TODOs:
Note to QA:
Please test on both v1 & THP (e.g. TS5 & TS7):
trezorctl device setup -b single(single-share SLIP-39 wallet).trezorctlwith Ctrl+C when the first mnemonic words are shown.trezorctl ping 123trezorctlshould fail with:"Your Trezor is having trouble communicating with your connected device."warning after the backup succeeds.trezorctl ping 123