Skip to content

test: catch reconnects in the jade locked journey - #2158

Merged
ovitrif merged 1 commit into
masterfrom
test/jade-locked-journey-lock-marker
Nov 27, 2026
Merged

ovitrif merged 1 commit into
masterfrom
test/jade-locked-journey-lock-marker

Conversation

@ovitrif

@ovitrif ovitrif commented Nov 27, 2026 •

Copy link
Copy Markdown
Collaborator

Refs:

Description

  • Fixes jade-device-locked.xml passing without the locked retry, because a dropped connection also ends in the Jade PIN pad: after the app reconnects it unlocks the device just as the HW_LOCKED path does. Each leg now checks the app log for Marked Jade '…' locked after it logged out on the device, which only the HW_LOCKED path writes
  • Fixes the funding step waiting forever for the "Received Bitcoin" sheet, because the sheet does not open when the deposit arrives with the app's first view of the Jade's history. The step now waits for the deposit's 1 000 000 sat received row in the activity list and dismisses the sheet only if it appears. It matches the row by the funding minute, since the Jade's seed is shared and other runs' rows can be newer

Design

N/A — no UI changes.

Preview

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

run2x.mp4

App log from the run: each leg logs the lock line, then unlocks with the PIN and retries, with no Reconnected known Jade or Warming up known Jade anywhere in the run:

15:50:14.756 Paired hardware device 'tcp:10.0.2.2:30131' as 'jade:serial:000000000000'
             (funded 0.01 BTC at 15:50:43, received row stamped 3:50 PM)
             (log out on the device, then Sign With Jade)
15:52:40.347 Marked Jade 'jade:serial:000000000000' locked after it logged out on the device
15:52:40.352 Jade getMasterFingerprint failed
15:52:40.371 [jade] -> auth_user        (PIN on the device)
15:53:04.393 [jade] -> sign_psbt
15:53:31.213 [jade] <- sign_psbt        (Bitcoin Sent)
             (log out on the device again, then Verify on Device)
15:54:23.268 [jade] -> get_receive_address
15:54:23.320 Marked Jade 'jade:serial:000000000000' locked after it logged out on the device
15:54:23.328 Jade verifyAddress failed
15:54:23.346 [jade] -> auth_user        (PIN on the device)
15:54:47.185 [jade] -> get_receive_address
15:55:01.860 [jade] <- get_receive_address   (button back to Verify on Device, no error)

QA Notes

Journeys

  • updated jade-device-locked.xml — each leg logs the lock line before the Jade PIN pad, and the funding step finds the deposit's row

Manual Tests

N/A

Automated Checks

  • ran xmllint --noout on the journey

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: 1

Each leg now checks the app log for "Marked Jade … locked", since a
dropped connection also ends in the PIN pad. The funding step waits for
the deposit's received row in the activity list, because the Received
sheet does not open when the deposit lands in the watcher's first
snapshot.

Verified: xmllint --noout on the journey; jade-device-locked.xml run end to end on an Android emulator against the interactive Jade emulator
@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-27T15:06:25.537144Z 968ad8d 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 changed the title test: assert the jade lock retry in the locked journey test: catch reconnects in the jade locked journey Nov 27, 2026
@ovitrif
ovitrif requested review from a team, ben-kaufman, coreyphillips and pwltr and removed request for a team November 27, 2026 15:05
@github-actions

Copy link
Copy Markdown
Contributor

Regtest APK

Built from 968ad8d (run).

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

@greptile-apps

greptile-apps Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5 · The journey changes appear safe to merge.RetriggerView in GreptileConfidence Score: 5/5

[Low impact] The journey changes appear safe to merge.

Summary

Strengthens the Jade locked-device journey.

  • Jade retry steps check the app log before accepting the PIN screen.
  • Funding waits for the matching deposit row, not just a received sheet.

Reviews (1) · Last reviewed commit: "test: assert the jade lock retry in the ..." · 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. Tightens jade-device-locked.xml: each leg now asserts the Marked Jade '…' locked after it logged out on the device log line, so a reconnect that also lands on the PIN pad no longer passes, and the funding step waits for the deposit's received row instead of a sheet that may not open. Reviewed 968ad8d, light tier.

What I checked, and 3 candidates I ruled out

Read in full: journeys/hardware-wallet/jade-device-locked.xml; JadeRepo.kt around markLockedIfLoggedOut, verifyAddress, signPsbt, getMasterFingerprint; JadeExceptionExt.kt.
Build: not built or run here. Auto reviews of bitkit-android never build the branch, and the diff is journey prose only, which no CI job reads.
CI: build-and-test green; lint and compose-ui pending at review time.

Ruled out

  • The marker could come from a non-lock path: the string is logged only in JadeRepo.markLockedIfLoggedOut (JadeRepo.kt:735), which returns early unless isJadeDeviceLocked() finds a JadeException.DeviceLocked in the cause chain and a session is connected. The reconnect paths log Reconnected known Jade / Warming up known Jade instead, so the assertion does separate the two.
  • Both legs reach the marker: signPsbt, getMasterFingerprint and verifyAddress all call markLockedIfLoggedOut in onFailure, matching the Sign With Jade and Verify on Device legs.
  • A stale marker from the first leg satisfying the second: the second action asks for the line "again for this tap", so a runner has to tie it to the Verify on Device timestamp, as the PR's log excerpt shows (15:52:40 then 15:54:23).

Merge confidence: 5/5, a journey spec change with no app code, validated by the author's end-to-end run on the Jade emulator.

Reviewer model: Claude Opus 5.5
Reasoning effort: Not exposed (the runtime does not report a reasoning setting for this session)

@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 968ad8d: one LOW inline. No other findings.

Checked and clean:

  • "Marked Jade '…' locked after it logged out on the device" is written only at JadeRepo.kt:735 in markLockedIfLoggedOut. It returns early unless the error is DeviceLocked with a connected session, and it is called only from the verifyAddress, signPsbt and getMasterFingerprint failure handlers. The reconnect paths (Reconnected known Jade, Warming up known Jade, auto-reconnect) never write it, so the log check does tell HW_LOCKED apart from a reconnect.
  • On the sign leg the line comes from getMasterFingerprint via composeFundingTransaction at the Sign With Jade tap, as the body's log excerpt shows.
  • The funding step's reason holds. The watcher's first event is the baseline (HwWalletRepo.kt:1231) and buildReceivedTxs skips anything in it (:1288). Before that first event getReceiveAddress falls back to an account scan, so a deposit funded early can land in the baseline with no sheet.
  • The blue hardware row (HardwareActivityIcon), "Show All" (ActivityShowAll, home shows at most 4 rows) and the 1 000 000 format are correct. The minute stamp matches across time zones.
  • The XML parses and follows journeys/README.md. The hardware-wallet suite README needs no change.
  • The iOS copy of this journey lives only on synonymdev/bitkit-ios#1441, which still waits unconditionally for the Received sheet. The port belongs there (100 000 sats, and no log check, since iOS has no such line). A Twin: line pointing at it would help.

perf: not relevant.

Device gate (partial): 968ad8d — not run yet; the reordered journey needs the interactive Jade emulator. Result to follow.

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

@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 968ad8d. The per-tap log checks distinguish Jade lock recovery from a reconnect that also reaches the PIN pad.

Low: The funding step in journeys/hardware-wallet/jade-device-locked.xml:32 identifies the deposit by its displayed amount and minute. On shared regtest history, another run's 0.01 BTC Jade receipt in the same minute can satisfy the check before this run's receipt appears. With Hide Balance enabled, both Home and All Activity mask the amount, so the check can time out even when the correct receipt is present. Capture the transaction ID returned by sendtoaddress and compare it with the ID in the activity's Explore view.

Review details

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

@ovitrif

ovitrif commented Nov 27, 2026

Copy link
Copy Markdown
Collaborator Author

@pwltr

Low: The funding step in journeys/hardware-wallet/jade-device-locked.xml:32 identifies the deposit by its displayed amount and minute.

Agreed; matching the sendtoaddress txid in the Explore view goes into #2159, with the UTC and new-line wording from the inline thread, so this PR keeps its approval.

@ovitrif

ovitrif commented Nov 27, 2026

Copy link
Copy Markdown
Collaborator Author

Merging at 968ad8d: approved on this head by @pwltr, the journey passed on this head in both legs, checks are green and no threads are open. The two Lows are in #2159.

@ovitrif
ovitrif merged commit 64670db into master Nov 27, 2026
18 checks passed
ovitrif added a commit to synonymdev/bitkit-ios that referenced this pull request Nov 27, 2026
As on Android (synonymdev/bitkit-android#2158), the funding step waits for the deposit's received row, with the Received Bitcoin sheet optional, and each leg checks the app log for the line only the HW_LOCKED path writes, so a dropped connection that also ends in the PIN pad cannot pass for it.

Verified: xmllint on the journey; both log lines appear in the J8 run at 2ac5ea0

@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 968ad8d with the one LOW open (UTC wording on the log checks). Fix it here or in a follow-up issue, your choice; please reply on the thread with which.

Device gate: 968ad8d (app built from this head with the Jade emulator enabled) — journeys: 1 passed (jade-device-locked.xml, all 13 actions); perf: not relevant; l10n: no UI text changed

  • Interactive Jade emulator, local regtest, Gate_Throwaway. Paired at 15:52:32 UTC. Funded 0.01 BTC at 12:53 local, and the blue hardware Received row of 1 000 000 sats is stamped 12:53 PM. The Received sheet did appear this run; I tapped its button as the new step says.
  • Sign leg (tap 15:54:41): Marked Jade 'jade:serial:000000000000' locked after it logged out on the device and the expected getMasterFingerprint failed at 15:54:41.565, then the PIN pad, then Output 0.0005 BTC. Bitcoin Sent within 4 s, with one Created sent onchain activity; the txid is in the mempool.
  • Verify leg (tap 15:56:11): a second, new Marked Jade … locked line and verifyAddress failed at 15:56:11.427, then the PIN pad. The Jade showed the address matching ReceiveHardwareAddress, and the button returned to Verify on Device with no toast.
  • From pairing to the end of the verify leg the log has exactly two lock lines, and no Reconnected known Jade, Warming up known Jade or Closed Jade emulator line.

Skipped — CI does not read journeys/.

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

ovitrif added a commit to synonymdev/bitkit-ios that referenced this pull request Nov 27, 2026
On a fresh chain a 50 000 sat send from a 100 000 sat Jade shows the over 50% of balance warning before Sign With Jade; funding 0.01 BTC avoids it, as on Android (synonymdev/bitkit-android#2158).

Verified: xmllint on the journey
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.

4 participants