Skip to content

test: log out the jade during an open session in the locked journey - #2149

Merged
ovitrif merged 4 commits into
masterfrom
test/jade-locked-journey-order
Nov 27, 2026
Merged

ovitrif merged 4 commits into
masterfrom
test/jade-locked-journey-order

Conversation

@ovitrif

@ovitrif ovitrif commented Nov 27, 2026 •

Copy link
Copy Markdown
Collaborator

Refs:

Description

  • Fixes jade-device-locked.xml so both log-outs happen while the app holds an open Jade session, because closing Receive after Verify on Device calls disconnectStaleSession, so the sign step reconnected with a fresh PIN prompt instead of meeting HW_LOCKED and the locked retry from fix: ask for the pin when a logged-out jade is used #2140
  • New order: pair, read the Jade address on Receive without verifying and fund it, log out, Sign With Jade, log out again, Verify on Device. Receive closed without Verify never engages the device, and a completed send clears its signing wallet before the sign screen goes away, so neither ends the session
  • Updates the journey's line in the hardware-wallet README.md to match

Design

N/A — no UI changes.

Preview

The journey at this PR's head 96995c8 against the interactive Jade emulator, from pairing to the verified address (2x):

head2x.mp4

App log from the run: each leg meets the locked device on the session it already holds and unlocks it, with no Reconnected known Jade or Warming up known Jade anywhere in the run:

14:14:51.087 Paired hardware device 'tcp:10.0.2.2:30131' as 'jade:serial:000000000000'
             (funded 0.01 BTC, log out on the device, then Sign With Jade)
14:18:08.121 Marked Jade 'jade:serial:000000000000' locked after it logged out on the device
14:18:08.122 Jade getMasterFingerprint failed (JadeException$DeviceLocked)
14:18:08.131 [jade] -> auth_user        (PIN on the device)
14:18:37.386 [jade] -> sign_psbt
14:18:53.828 [jade] <- sign_psbt        (Bitcoin Sent)
             (log out on the device again, then Verify on Device)
14:19:48.106 [jade] -> get_receive_address
14:19:48.198 Marked Jade 'jade:serial:000000000000' locked after it logged out on the device
14:19:48.199 Jade verifyAddress failed
14:19:48.209 [jade] -> auth_user        (PIN on the device)
14:20:11.301 [jade] -> get_receive_address
14:20:23.055 [jade] <- get_receive_address   (button back to Verify on Device, no error)

QA Notes

Journeys

  • J1 updated jade-device-locked.xml — Sign With Jade and Verify on Device each show the Jade PIN pad after a log-out and finish without an error

Manual Tests

N/A

Automated Checks

N/A

Models used

  • Planning/scoping: Claude Opus 5.5 (reasoning: medium)
  • Implementation: Claude Opus 5.5 (reasoning: medium)
  • Review: Gemini 4 Neon (reasoning: high)
  • Review rounds: 2

Closing Receive after Verify on Device ends the Jade session, so the sign step reconnected instead of meeting the locked device. The journey now funds from the address Receive shows without verifying, logs out, signs, logs out again and verifies last: a send that completes keeps the session open.

Verified: journey run on an Android emulator against the interactive Jade emulator; both legs logged "Marked Jade ... locked" and unlocked on the open session with no reconnect
@ovitrif ovitrif self-assigned this Nov 27, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-27T10:21:22.669644Z 55bb6c8 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@ovitrif
ovitrif requested review from a team, ben-kaufman and piotr-iohk and removed request for a team November 27, 2026 10:21
@greptile-apps

greptile-apps Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 4/5 · The change appears safe to merge, with a non-blocking improvement needed to prevent the deposit sheet from interrupting the journey.RetriggerView in GreptileConfidence Score: 4/5

[Low impact] The changes stay within the Jade emulator journey and its setup notes.

The change appears safe to merge, with a non-blocking improvement needed to prevent the deposit sheet from interrupting the journey.

Findings

  1. P2 Deposit sheet interrupts the journey ▶

Summary

Updates the locked-Jade journey to sign before verifying an address, keeping the paired session open for both device log-outs.

  • The Jade journey checks signing and address verification after separate logouts.

Reviews (1) · Last reviewed commit: "test: log out the jade during an open se..." · Reviewed by Greptile

@talosmachina talosmachina left a comment

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.

No findings. Reorders jade-device-locked.xml so both device log-outs land while the app still holds its Jade session (fund from the unverified Receive address, log out, Sign With Jade, log out again, Verify on Device), and updates the suite README to match. Reviewed 55bb6c8, light tier (journey and README only, no app code).

What I checked, and 3 candidates I ruled out

Read in full: jade-device-locked.xml, the changed README.md sections, jade-sign-on-device.xml for the send step wording

Session claims traced against the code at the head

  • Closing Receive without Verify keeps the session: HwReceiveViewModel.engagedWalletId is set only in verifyAddress() and submitPassphrase(), and disconnectEngaged() returns early while it is null.
  • A completed send keeps it: SendSheet calls hwSendViewModel.completeBroadcast() on success, which nulls signingWalletId without a disconnect, so the later cancel() path finds no wallet to disconnect.
  • Leaving Send unsent ends it: HwSendViewModel.cancel() calls disconnectStaleSession(signingWalletId), which is why the journey signs before it verifies.

Test tags: Send, AssetButton-switch (SendAmountScreen AssetButton-$testId), ContinueAmount, HardwareSendOpenTrezorConnect, SendSuccess, HardwareVerifyAddress all exist in app/src/main.

Ruled out

  • Funding too small for the send: 0.001 BTC funded, 50 000 sats sent, fee headroom is ample.
  • Emulator presses differ from the sign journey: press front then press right front matches jade-sign-on-device.xml's approve path.
  • First log-out before any request leaves no session to lock: pairing opens it, and the PR's log shows getMasterFingerprint meeting DeviceLocked on that session.

Build: not built; the diff has no code, and nothing in .github/workflows reads journeys/. CI was still pending at review time.

Merge confidence: 5/5, docs-only change whose session claims hold against HwReceiveViewModel and HwSendViewModel.

Reviewer model: Claude Opus 5.5
Reasoning effort: Not exposed (the run metadata available to this reviewer does not report it)

Funding the Jade opens the Received Bitcoin sheet over the wallet, so the next step's Send tap could miss. The journey now waits for it and taps Nice!.

Verified: xmllint on the journey; the 27 Nov run met and dismissed this sheet at that step
@github-actions

github-actions Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Regtest APK

Built from 96995c8 (run).

Download bitkit-dev-debug universal APK (expires in 30 days).

@piotr-iohk piotr-iohk left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

QA review

Scope: full PR diff against its merge base (aae7897), at a1f2310. The PR changes only the jade-device-locked.xml journey and its hardware-wallet README entries; no app code changes.

No new actionable code findings.

No actionable code findings. I checked the journey's new order against the app source at this head:

  • Showing the Jade address on Receive without Verify never engages the device. HwReceiveViewModel sets engagedWalletId only in verifyAddress() and submitPassphrase(), so closing the sheet does not disconnect.
  • A completed send does not end the session either: SendSheet calls hwSendViewModel.completeBroadcast() after showing success, which nulls signingWalletId, so the later cancel() on dispose skips disconnectStaleSession.
  • Leaving Send unsent, or closing Receive after Verify, does disconnect. That is why the journey signs first and verifies last.
  • Pairing leaves the session open, and the Jade background release applies only to Bluetooth, not the TCP emulator.
  • A Jade deposit emits through HwWalletRepo.receivedTxs, and AppViewModel opens the received sheet, whose single button carries the ReceivedTransactionButton tag.

Existing review: Greptile's deposit-sheet interruption thread is marked resolved. At this head the funding step waits for the "Received Bitcoin" sheet and dismisses it, so the concern is addressed in code.

Non-blocking consistency suggestions

  • The funding step says to tap "Nice!", but the received sheet's button text is picked at random from common__ok_random ("Awesome!", "Nice!", "Cool!", …). Referring only to the test tag, as other journeys do, avoids a literal-text mismatch for a runner.
  • iOS parity: the same journey in open bitkit-ios#1441 (compared at 2ac5ea0) documents an intentional difference on Sign With Jade, the busy toast tracked in bitkit-ios#1517. It also lacks the received-sheet dismissal step added here in a1f2310. Consider carrying that step over so the shared action prose stays aligned. This was a scoped comparison of the journey file only, not a review of the iOS PR.

Ready for device testing: J1 (jade-device-locked.xml) with JADE_MODE=interactive in bitkit-docker, a regtest debug build with the Jade emulator enabled, and Electrum pointed at bitkit-docker.

Device testing: not performed in this review. The author reports one emulator run of the journey on aae789748 with an app log in the PR description; that is the author's evidence, not this reviewer's.

Reviewer model: claude-opus-5-5
Reasoning effort: high

The button's label is picked at random, so the step names only its test tag.

Verified: xmllint on the journey
@ovitrif

ovitrif commented Nov 27, 2026

Copy link
Copy Markdown
Collaborator Author

The funding step says to tap "Nice!", but the received sheet's button text is picked at random from common__ok_random

@piotr-iohk Fixed in 44665d7: the step names only the ReceivedTransactionButton tag.

iOS parity: […] It also lacks the received-sheet dismissal step added here in a1f2310.

Passed to the iOS journey's owner for synonymdev/bitkit-ios#1441.

@ovitrif
ovitrif requested a review from piotr-iohk November 27, 2026 10:52
ovitrif added a commit to synonymdev/bitkit-ios that referenced this pull request Nov 27, 2026
Funding the Jade opens the Received Bitcoin sheet over the wallet, which blocks the next Send tap; the journey now taps its button, as on Android (synonymdev/bitkit-android#2149).

Verified: xmllint on the journey

@piotr-iohk piotr-iohk left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

QA review

Scope: changes since a1f2310, including affected code paths and prior findings, at 44665d7. Baseline: previous QA review. The base and merge base (aae7897) are unchanged. The README entries, the rest of the reordered jade-device-locked.xml journey and the scoped iOS journey comparison carry over from that baseline.

No new actionable code findings.

No new actionable code findings in the follow-up. The only change is the funding step in jade-device-locked.xml, which now says to tap the received sheet's button by its ReceivedTransactionButton tag instead of tapping "Nice!". This matches the app. In NewTransactionSheet, the received sheet's only button carries that tag, and its text comes from localizedRandom(R.string.common__ok_random), which picks one of eight labels ("Awesome!", "Nice!", "Cool!", …). That resolves the consistency suggestion from the previous QA review.

Existing review: Greptile's deposit-sheet interruption thread is still marked resolved, and at this head the funding step still waits for the "Received Bitcoin" sheet and dismisses it.

iOS parity: the baseline compared the journey with bitkit-ios#1441 at 2ac5ea0. The author reports that the missing received-sheet dismissal step was passed to the iOS journey's owner. That PR has since moved to a54e9ed, which this follow-up did not recheck. The comparison remains a scoped journey-file check, not a review of the iOS PR.

Ready for device testing: jade-device-locked.xml with JADE_MODE=interactive in bitkit-docker, a regtest debug build with the Jade emulator enabled, and Electrum pointed at bitkit-docker.

Device testing: not performed in this review.

Reviewer model: claude-opus-5-5
Reasoning effort: high

@ovitrif
ovitrif requested review from jvsena42 and pwltr and removed request for ben-kaufman November 27, 2026 11:26
@ovitrif

ovitrif commented Nov 27, 2026

Copy link
Copy Markdown
Collaborator Author

Ben is away for a few days, so I moved this review request to @pwltr and @jvsena42.

@jvsena42 jvsena42 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Code scan at 44665d7: no findings.

Checked and clean, against the app at head:

  • Every tag the journey asserts exists (ReceivedTransactionButton, HardwareVerifyAddress, Receive, AssetButton-switch, ContinueAmount, SendSuccess and the pairing tags), and the "Received Bitcoin" / "Bitcoin Sent" titles match wallet__payment_received / wallet__send_sent.
  • The session stays open between the two log-outs. Opening Receive without Verify never engages the device. A completed send clears signingWalletId in completeBroadcast(), and Close only hides the sheet. HwSendViewModel.cancel() runs only from the sign screen's Back.
  • Both the send path and verifyJadeReceiveAddress reconnect with the PIN and retry when the Jade reports it is locked.
  • The received-sheet watcher takes its first event as a baseline, so history the Jade shares with the Trezor seed does not open the sheet before the deposit.
  • The suite README matches the new order, the Jade emulator capability row covers every device step, and the XML parses.
  • The iOS busy-toast difference on Sign With Jade predates this PR and is already noted in the QA review.

perf: not relevant.

Device gate (partial): 44665d7 — not run yet; the journey needs the Jade emulator. Result to follow.

Reviewer model: Opus 5.5 (claude-opus-5-5) coordinating, primary review and verification
Reasoning effort: Not exposed

On a fresh chain 0.001 BTC leaves under 100 000 sats spendable, so the 50 000 sat send trips the over-half-balance warning before Sign With Jade. The journey now funds 0.01 BTC, and its description says what it checks: the PIN prompt and retry, not an app message.

Verified: xmllint on the journey; self review of origin/master...HEAD
@ovitrif

ovitrif commented Nov 27, 2026

Copy link
Copy Markdown
Collaborator Author

Pushed 96995c8: the funding step now sends 0.01 BTC. On a fresh chain 0.001 BTC leaves under 100 000 sats spendable, so the 50 000 sat send would trip the over-half-balance warning before Sign With Jade. The journey description also now says what it checks: the PIN prompt on the device and the retry.

@pwltr pwltr left a comment

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.

Reviewed 96995c8. The larger deposit addresses the send amount warning, and the reordered journey avoids closing an engaged Receive session before signing.

Low candidate: journeys/hardware-wallet/jade-device-locked.xml:27 can wait indefinitely for ReceivedTransactionButton if the deposit lands in the watcher's first snapshot. Receive can show the address from an account scan before that snapshot. The first snapshot updates the balance and treats the deposit as existing history, so the receipt sheet may never open. Wait for the funded Jade balance and dismiss the receipt sheet if it appears.

Pre-existing Low candidate: The PIN pad and successful completion can also follow a fresh connection if the TCP session drops after logout. The assertions for Sign With Jade and Verify on Device in journeys/hardware-wallet/jade-device-locked.xml:36 and journeys/hardware-wallet/jade-device-locked.xml:45 can therefore pass without exercising HW_LOCKED recovery. Require the operation-specific lock marker before the PIN prompt in each leg, as shown in the run attached to the PR.

Review details

Quick review: Claude Opus 5.5, high reasoning effort
General review: GPT-6.2 Sol, high reasoning effort
Verification: GPT-6.2 Sol, high reasoning effort

@piotr-iohk piotr-iohk left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

QA review

Scope: changes since 44665d7, including affected code paths and prior findings, at 96995c8. Baseline: previous QA review. The comparison base and merge base (aae7897) are unchanged, and no new files or surfaces were added beyond journeys/hardware-wallet/jade-device-locked.xml and journeys/hardware-wallet/README.md. The README entries, the ReceivedTransactionButton tag verification, and the rest of the reordered journey carry over from the baseline.

No new actionable code findings.

No new actionable code findings in the follow-up. The delta in journeys/hardware-wallet/jade-device-locked.xml makes two adjustments that match the app at this head:

  • Funding is raised from 0.001 BTC to 0.01 BTC (1,000,000 sats). In AppViewModel.handleSanityChecks, OVER_HALF_BALANCE compares the 50,000-sat send against 50% of hardwareAvailableSats; a 0.001 BTC UTXO leaves less than 100,000 sats spendable after the estimated drain fee and trips that dialog, whereas 0.01 BTC leaves ~999,800 sats spendable and avoids the warning (with enableSendAmountWarning defaulting to false and regtest fees far below the fee warnings).
  • The opening sentence of <description> now states that the journey checks the on-device PIN prompt and retry rather than an app message, matching the rest of the journey, the suite README, and Android's DeviceLocked retry handling.
  • Verified xmllint --noout and git diff --check pass on the updated journey.

Existing reviews:

  • Greptile's deposit-sheet interruption thread remains marked resolved, and the funding step still dismisses ReceivedTransactionButton at 96995c8.
  • pwltr's approving review at 96995c8 notes two non-blocking low candidates whose code mechanisms check out in source: (1) if the deposit mines before the watcher's first TransactionsChanged event after HwWalletRepo.getReceiveAddress falls back to trezorRepo.getAccountInfo, observeWatcherEvents/buildReceivedTxs treats it as baseline history and suppresses receivedTxs, so waiting unconditionally for ReceivedTransactionButton could stall; (2) pre-existing: a fresh reconnect after a dropped TCP session also calls JadeRepo.unlockConnected() and shows the PIN pad without logging Marked Jade ... locked (markLockedIfLoggedOut), so UI assertions alone do not distinguish HW_LOCKED recovery from a reconnect.

iOS parity: refreshed against bitkit-ios#1441 at a54e9ed (scoped comparison of jade-device-locked.xml only, not a review of the iOS PR). The iOS journey now includes the ReceivedTransactionButton dismissal step, while still funding 0.001 BTC for the 50,000-sat send and still expecting the busy toast on Sign With Jade until bitkit-ios#1517.

Ready for device testing: J1 (jade-device-locked.xml) with JADE_MODE=interactive in bitkit-docker, a regtest debug build with the Jade emulator enabled, and Electrum pointed at bitkit-docker.

Device testing: not performed in this review. The author's video and log in the PR description were captured on an earlier run (aae789748), not this revision or this reviewer.

Reviewer model: gemini-4-neon
Reasoning effort: high

@jvsena42 jvsena42 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Approving at 96995c8. The new commit only raises the funding to 0.01 BTC and rewords the description to match the PIN-and-retry behaviour; nothing else changed.

Device gate: 96995c8 (app code 44665d7, equal to master aae7897) — journeys: 1 passed (jade-device-locked.xml, both legs); perf: not relevant; l10n: no UI text changed

  • Interactive Jade emulator, local bitkit-docker chain, emulator-5554. Paired with jade pin, funded 0.01 BTC from the Receive address without Verify, Received sheet dismissed; the session stayed open (no Closed Jade emulator after pairing).
  • Sign leg: after the on-device log-out, Sign With Jade logged Marked Jade … locked and one expected getMasterFingerprint failed, the PIN pad came up in about 2 s, and after the PIN the Jade showed Output 1/1 0.0005 BTC. One payment: Created sent onchain activity for the txid that reached the mempool. No busy toast, no Reconnected known Jade.
  • Verify leg: after the second log-out, Verify on Device logged Marked Jade … locked and one expected verifyAddress failed, the PIN pad came up at once, and the Jade showed the same address as ReceiveHardwareAddress. The button returned to Verify on Device with no toast.
  • One PIN prompt per leg.

Skipped — covered by CI at 96995c8: build-and-test, lint, compose-ui (all green).

Reviewer model: Opus 5.5 (claude-opus-5-5) coordinating, primary review and verification; Fable 5.2 (claude-fable-5-2) runbook; Sonnet 5.5 (claude-sonnet-5-5) device driver
Reasoning effort: Fable medium (run record); others Not exposed

@ovitrif

ovitrif commented Nov 27, 2026

Copy link
Copy Markdown
Collaborator Author

@pwltr

Low candidate: journeys/hardware-wallet/jade-device-locked.xml:27 can wait indefinitely for ReceivedTransactionButton if the deposit lands in the watcher's first snapshot.

Pre-existing Low candidate: The PIN pad and successful completion can also follow a fresh connection if the TCP session drops after logout.

Both go to a follow-up PR, so this one keeps its approvals. The second one happened on my re-run at 96995c8: on a heavily loaded host one attempt lost the TCP link after the log-out, and Sign With Jade then met DeviceDisconnected instead of HW_LOCKED. Only the Marked Jade … locked line told the two apart, so the journey should assert it in each leg. I discarded that attempt and ran the journey again from pairing. Both legs passed through the locked retry; the recording and log are in the description's Preview.

@ovitrif

ovitrif commented Nov 27, 2026

Copy link
Copy Markdown
Collaborator Author

Merging at 96995c8: approved on this head by @pwltr and @jvsena42, the journey passed on this head in both legs, checks are green and no threads are open.

@ovitrif
ovitrif merged commit e85277c into master Nov 27, 2026
17 checks passed
@ovitrif
ovitrif deleted the test/jade-locked-journey-order branch November 27, 2026 13:25
@ovitrif

ovitrif commented Nov 27, 2026

Copy link
Copy Markdown
Collaborator Author

@pwltr both Lows are in #2158: each leg now checks the app log for the lock line before the PIN pad, and the funding step waits for the deposit's received row instead of only the Received sheet. The journey passed on its head.

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.

5 participants