Repository navigation
Conversation
processArguments in the session capabilities apply only to the first launch. reinstallApp and the other relaunch helpers call driver.activateApp, which starts the app with no environment, so E2E_LOCAL_HOST is lost and Env.swift falls back to the Info.plist value fixed at build time. Against a stack on another machine that means the app looks for Electrum on the simulator itself and never produces a balance, so completeOnboarding times out waiting for TotalBalance-primary. Every spec reinstalls in a before hook, so it affects all of them. Relaunch through `mobile: launchApp`, which does take an environment. Guarded on iOS and on the variable being set, so nothing changes for Android or for runs against a local stack. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Session creation intermittently times out waiting for WebDriverAgent, and logLevel warn hides whether it is building, launching or failing to connect. Route the appium server log to artifacts and let the level and the WDA timeouts be raised per run. Defaults are unchanged. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
LND issues its own cert on first start with SANs for 127.0.0.1, ::1 and its container address. Both gRPC and REST verify the hostname, so a suite running on another machine is rejected: ERR_TLS_CERT_ALTNAME_INVALID: IP 100.116.153.66 is not in the cert list: 127.0.0.1, ::1, 172.18.0.4 tlsextraip adds the address LND is actually reached on, reusing the variable externalip already takes. Defaults to 127.0.0.1, which is already covered, so a local stack is unaffected. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The spec builds its own LNURL server pointed at LND over REST, but pinned the address to 127.0.0.1:8080 while taking the macaroon and cert from lndConfig. Against a stack on another machine there is nothing on loopback, so the lnurl-channel flow never completes and ConnectButton never appears. Use lndConfig for the address too, which #206 already made configurable. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
getAmountUnder scans for static text descendants, but AvailableAmount exposes its value through a nested MoneyText, so the lookup found nothing and @send_1 and @send_2 failed on every attempt. Read it the way the onchain spec and getTotalBalance already do. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The toast expires before the drag runs, so dismissing it failed the element lookup and flaked @settings_01. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
5c3e81e to
78dce12
Compare
The controller script only needs python3 with websockets and reads its endpoint from TREZOR_CONTROLLER_WS, so docker exec was only supplying an interpreter. Under TREZOR_REMOTE=1 it runs locally against a forwarded controller socket and the container lifecycle is left to whoever started it, which lets the suite drive an emulator on a host that has Docker. Default behaviour is unchanged. The compose service also gains a host-gateway alias and an overridable MACOS flag so it can start on Linux. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
protocol_v1.probe drains stale responses with a 0.1s read and stops when it catches Timeout, but call_bridge lets the requests exception through. On loopback the bridge always answers inside that window; reached over a port forward it does not, and the probe dies instead of breaking. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
main hardened the same two toast flakes this branch did, via the new waitForToastBestEffort helper, so its versions win: - assertAddressTypeSwitchFeedback: main's retry-tolerant rewrite replaces the dismiss/timeout tweak here - settings BalanceUnitSwitchedToast: main drops the isIOS guard and treats a missed toast as non-fatal, which is what waitToDisappear was for The send/lnurl amount-cap helpers are kept as added; both sides appended at the same point in actions.ts. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
scripts/trezor-controller.py leaves scripts/__pycache__ behind, which showed the submodule dirty with untracked content. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
main's migration rework moved two scenarios behind MIGRATION_EXTENDED, which re-indented the blocks this branch had edited: kept main's structure with the activateAppWithEnv call, so the relaunch still carries E2E_LOCAL_HOST. main also gave the appium service its port argument where this branch gave it a log path. The service takes both. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
piotr-iohk
left a comment
There was a problem hiding this comment.
QA reviewed on 3066841.
QA review
3 actionable findings — resolve or provide an evidence-backed rebuttal.
Reviewed the full PR diff against its merge base a1e01e9, at 30668410. The merge base and the PR base are that same commit. This is the first review of the pull request; there is no earlier QA baseline.
The pass covered all 11 changed files and the callers of app relaunch, lndConfig / LND REST, and scripts/trezor-emulator. E2E_LOCAL_HOST is injected only on iOS, through appium:processArguments. Android capabilities do not set it, and Android relaunch stays on activateApp.
Validation: Diff and callers inspected. No review threads. No PR checks are reported. bash -n scripts/trezor-emulator and python3 -m py_compile scripts/trezor-controller.py passed. A reduced TREZOR_REMOTE=1 reproduction of remote container_logs exited 1 with TREZOR_CONTAINER: unbound variable. Host python3 raises ModuleNotFoundError for mnemonic and trezorlib. Current trezorlib protocol_v1.probe catches trezorlib.transport.Timeout, while bridge.call_bridge lets requests timeouts through, so the new translation matches that upstream source. Appium was not run, tsc was not run (node_modules is not installed), and no device, emulator, or simulator was started. The author reports tsc --noEmit and prettier --check clean at this head, and a full iOS shard in bitkit-ios run 33273316740 that predates the two merges of main. The pull request description mixes the intended behavior with notes about dropped toast edits and that older shard; those notes were not treated as proof.
Limitations: The Trezor user-env image's pinned trezorlib was not opened. Bitkit iOS Env.swift and Info.plist are not in this repository; the plist fallback is what the new helper states, not something this pass read in the app repo.
Additional test cases
- iOS, remote Electrum. Set
E2E_LOCAL_HOSTto the machine serving Electrum. Run@migration_native_upgradeand@migration_native_restore. After install, and again after the terminate/relaunch inverifyNativeMigration,TotalBalance-primaryshows the migrated balances. - iOS, legacy RN migration. Same host. Run
@migration_rn_restoreand@migration_rn_upgrade. The verification relaunch afterterminateAppstill shows the migrated balance. WithMIGRATION_EXTENDED=true,@migration_3and@migration_4should cold-start the native app with the same host. - Trezor on another machine.
TREZOR_REMOTE=1, ports 9001 and 21325 forwarded,python3withoutmnemonicortrezorlib../scripts/trezor-emulator startshould print a receive address or stop with an explicit dependency error../scripts/trezor-emulator logsshould not abort withTREZOR_CONTAINER: unbound variable. - Fresh LND certificate. New
docker/lndvolume andLND_EXTERNAL_IPset to the addressLND_HOSTuses. From the test runner, LND REST and@lnurl_1connect withoutERR_TLS_CERT_ALTNAME_INVALID. Restart LND after changing that IP without deletingtls.certand confirm the previous certificate is still the one being served. - Local defaults. Leave
E2E_LOCAL_HOSTandTREZOR_REMOTEunset.@send_1stops at the available-amount cap and showsSendAmountExceededToast../scripts/trezor-emulator startstill runs the controller inside the container.
Findings
- [MEDIUM] Pass E2E_LOCAL_HOST on the remaining iOS cold starts — Trigger: an iOS run with
E2E_LOCAL_HOSTset, on@migration_native_upgrade,@migration_native_restore, or the legacy@migration_rn_*scenarios that relaunch after migration.
Mechanism: activateAppWithEnv is the only relaunch that passes the variable, via mobile: launchApp. installNativeMigrationTarget still cold-starts an upgrade with driver.activateApp after terminateApp (native-migration.ts). verifyNativeMigration terminates and then calls activateApp again (line 230). The same pattern remains in migration.e2e.ts at lines 209, 235, and 261, after the install launches this PR converted. activateApp does not take an environment. Appium also ignores environment when the process is already running, and @migration_3 / @migration_4 call activateAppWithEnv without terminateApp after the RN app has been in use.
Consequence: those processes start without E2E_LOCAL_HOST. The new helper states that the app then uses the Info.plist Electrum host from build time. Against a stack on another machine the balance does not arrive, so these tests time out on TotalBalance-primary or expectMigrationBalances. That is the failure the relaunch helper was added to stop.
Expected: every iOS cold start and every post-migration relaunch of the native app goes through activateAppWithEnv, after terminateApp when a running process would ignore the environment.
Evidence basis: source analysis at 30668410. Compared with base a1e01e9: native-migration.ts is unchanged, and the verification activateApp calls in migration.e2e.ts are outside the diff hunks. No device run.
Source. Summary placement: The remaining driver.activateApp cold starts are not in the PR diff. native-migration.ts is unchanged, and the migration.e2e.ts verification relaunches sit outside the hunks.
- [MEDIUM] Remote Trezor start still needs mnemonic and trezorlib on the host — inline at
scripts/trezor-emulator:143. - [LOW] Remote Trezor logs treat a missing local container as running — inline at
scripts/trezor-emulator:86.
| print(Mnemonic("english").generate(strength=128)) | ||
| PY | ||
| if remote_mode; then | ||
| "${TREZOR_LOCAL_PYTHON:-python3}" -c "$script" |
There was a problem hiding this comment.
[MEDIUM] Remote Trezor start still needs mnemonic and trezorlib on the host
Trigger: TREZOR_REMOTE=1 ./scripts/trezor-emulator start with the default TREZOR_RANDOM_MNEMONIC=true and TREZOR_MNEMONIC unset, on a host Python that has only the websockets package named in the new comment.
Mechanism: remote mode generates the mnemonic with python3 -c 'from mnemonic import Mnemonic' and runs get-address through run_controller_script, which executes trezor-controller.py on the host. get_address() imports trezorlib. Local mode used the container venv, which already has those modules. The new comment says the controller script only needs python3 with websockets.
Consequence: start exits with ModuleNotFoundError: No module named 'mnemonic' before emulator setup. Setting TREZOR_MNEMONIC gets past that line, and get-address then fails while importing trezorlib. The remote emulator cannot be started or addressed with the dependency the script documents.
Expected: remote start should run mnemonic generation and get-address with an interpreter that has those modules, or stop immediately and name the real dependency list.
Evidence basis: source analysis at 30668410. Executed on this machine: python3 -c 'import mnemonic' and python3 -c 'import trezorlib' both raise ModuleNotFoundError. bash -n scripts/trezor-emulator passed. Docker and a device were not started.
There was a problem hiding this comment.
Right — remote mode moves those imports onto the host interpreter.
Comment corrected at L49-53 to name all three: websockets for the controller socket, mnemonic for a generated mnemonic, trezorlib for get-address.
Added require_local_modules (L62), called before the remote controller runs (L77, L79) and before remote mnemonic generation (L166). It now stops with:
python3 cannot import: websockets mnemonic trezorlib
TREZOR_REMOTE=1 runs the controller on this host; install them with
pip install websockets mnemonic trezor
Worth noting the CI path was already fine — e2e-tests.yml installs all three before the remote shard. The defect was the comment understating it, so a local run or a new workflow copying that comment would hit it.
| resolve_container() { | ||
| local compose_id | ||
|
|
||
| remote_mode && return 0 |
There was a problem hiding this comment.
[LOW] Remote Trezor logs treat a missing local container as running
Trigger: TREZOR_REMOTE=1 ./scripts/trezor-emulator logs, or start when the forwarded controller never answers.
Mechanism: resolve_container returns success in remote mode and does not set TREZOR_CONTAINER. container_exists follows that result, so container_logs takes the local-container branch and expands $TREZOR_CONTAINER under set -u.
Consequence: logs aborts with TREZOR_CONTAINER: unbound variable. The not-ready path calls container_logs ... || true, so that failure is discarded and the operator gets no logs after the controller wait.
Expected: remote mode should not claim a local container exists. logs should say the container is on the other machine, and the timeout path should not depend on a local container id.
Evidence basis: source analysis at 30668410. Executed a reduced bash script with TREZOR_REMOTE=1 and set -u that copies this resolve_container / container_logs control flow; it exited 1 with TREZOR_CONTAINER: unbound variable.
There was a problem hiding this comment.
Fixed at L140-143: container_logs returns early in remote mode with "the Trezor container runs on the stack machine; read its logs there", so it no longer dereferences an unset TREZOR_CONTAINER.
Reproduced your abort first, then confirmed it exits 0 with the message instead.
I left resolve_container alone — stop relies on it returning 0 in remote mode to reach controller stop. container_image and container_project have the same latent pattern but are never called, so I didn't touch them either.
Every iOS relaunch of the native app now carries E2E_LOCAL_HOST. The four terminate/relaunch pairs in migration.e2e.ts and the two in native-migration.ts still used driver.activateApp, which takes no environment, so against a stack on another machine those processes fell back to the Info.plist host and the balance never arrived - the failure activateAppWithEnv exists to stop. TREZOR_REMOTE=1 moves the controller's imports onto the host interpreter, so the comment claiming it needs only websockets was wrong: mnemonic is needed for a generated mnemonic and trezorlib for get-address. Names the real list and stops before the bare ModuleNotFoundError. Remote mode no longer claims a local container, so `logs` says where the container actually is instead of aborting on an unset TREZOR_CONTAINER - a failure the readiness path discarded with `|| true`, leaving no logs at the one moment they were wanted. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Appium's XCUITest driver ignores `environment` on `mobile: launchApp` when the app is already running, and its reference says to terminate first. @migration_3 and @migration_4 installed over a live RN app and then launched, so those two relaunches took the Info.plist host however the helper was called. Matches installNativeMigrationTarget, which already terminates before install. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
All three findings addressed in [MEDIUM] remaining cold starts. Six sites converted to On the For context on priority: those two are behind [MEDIUM] host dependencies and [LOW] remote logs — replies on their threads.
|
piotr-iohk
left a comment
There was a problem hiding this comment.
QA review
Scope: full reassessment at b5d6dfc, against merge base 54978d9, because prior coverage metadata was unreliable. No coverage was inherited.
No new actionable code findings.
The three concerns from the earlier review are fixed in the pinned source: migration cold starts preserve the environment, remote Python dependencies have explicit checks, and remote logging avoids the unset container ID. Both inline threads remain open, but their mechanisms were rechecked. Targeted selector, input-cap, launch and CI contracts were compared with iOS 7478f52 and Android d9cf6dd; neither app received a full review.
Validation: TypeScript compilation, Bash syntax and Python AST parsing passed. Remote logs exited successfully; an isolated missing-module preflight produced the dependency error and installation guidance. The structured code result passed contract validation. Prettier flagged actions.ts. No Appium or infrastructure run was performed, and no checks are reported for this head. The author’s older iOS run does not validate this revision.
Suggested additional test cases
- iOS: build with a different default backend host, set
E2E_LOCAL_HOSTto the reachable stack, then exercise native migration install and verification relaunch. Expect migrated balances and the live-payment balance to persist after restart. - Android and iOS: run
@send_1,@send_2and@lnurl_1at this head. After exceeding the displayed or LNURL cap, expect the amount to remain capped, the toast to appear, and subsequent Back or below-minimum validation to work.
Prettier fits it on one line. Flagged in QA review; the other files it reports are already unformatted on main. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
piotr-iohk
left a comment
There was a problem hiding this comment.
QA review
Scope: Follow-up review of the changes since b5d6dfc, including the affected toast-helper path and prior findings, at 167e8b3. Unchanged coverage is inherited from the completed baseline review.
No new actionable code findings.
No new actionable code findings in the follow-up.
The only change since that baseline is a formatting collapse of waitForTransientToastAfterAction in test/helpers/actions.ts. Prettier 3.6.2, using this repo's printWidth of 100, accepts the file, and formatting the baseline blob produces this head exactly. The function body matches the baseline, as do callers exceedAmountInputCap and exceedAvailableAmountInputCap. The pull request still touches the same 12 paths.
The cold-start, remote-dependency, and remote-log fixes from the earlier review are still present. The Trezor threads on host imports and remote logs remain open; scripts/trezor-emulator is unchanged in this commit.
Validation: Prettier 3.6.2 check of test/helpers/actions.ts passed at this revision. Local Git confirms the previous head is an ancestor and that the base and merge base are still 54978d9. This was a code review: Appium was not run, and no checks are reported for this head.
main parameterised launchFreshApp's relaunch wait while this branch changed how that relaunch starts the app. Kept both: the wait is a parameter and the launch carries E2E_LOCAL_HOST. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Verdict: ✅ Approve
Review: diff 12 files.
No tests ran because the description lists only the author's verification, specifies no reviewer test, and notes that this repository has no PR CI.
Findings:
1 inline (1 LOW)
Warning
@mdozhdev unsigned commits: b5f78bf, 5cc684e, 3066841, dd7b7a9, 2eaa11b, b5d6dfc, 167e8b3, 64c61c8. The base branch requires signed commits; to sign them:
git fetch origin && git rebase --gpg-sign --force-rebase origin/main && git push --force-with-lease
Reviewed by gpt-6.1-sol-high via gh-pr-review-loop skill
Commands: @ovi-reviewer review · test · retest
|
|
||
| run_controller_script() { | ||
| if remote_mode; then | ||
| require_local_modules websockets |
There was a problem hiding this comment.
LOW: Remote startup hides the missing Python dependency message.
Remote start exits silently when websockets is missing: wait_for_controller runs controller ping with both output streams redirected to /dev/null, then require_local_modules exits the shell. The missing package name and installation guidance are hidden on a fresh host. Could we run the remote dependency preflight before entering the redirected readiness loop?
|
@mdozhdev conflicts |
|
@mdozhdev is this still relevant or may be closed? |
#206 made the backend host configurable. Running the suite that way surfaced further places assuming localhost, an assertion that only flakes on hosted runners, and then the Trezor emulator needing to live on a second machine.
Relaunch loses the backend host.
processArgumentsapplies only to a session's first launch, soreinstallApp()droppedE2E_LOCAL_HOSTand the app fell back to theInfo.plistvalue fixed at build time — onboarding then timed out onTotalBalance-primary.activateAppWithEnv()relaunches viamobile: launchApp, which takes an environment, guarded on iOS and on the variable being set. Eight call sites.LND's cert misses its reachable address. It self-issues with SANs for
127.0.0.1,::1and its container IP, and both gRPC and REST verify the hostname.--tlsextraipadds the real address, reusing the variable--externalipalready takes.The lnurl spec pinned LND to
127.0.0.1:8080while taking its macaroon and cert fromlndConfig. Now reads the host from the same config.WDA timeouts and logs. WDA compiles on cold hosted runners and intermittently blew the 5-minute launch timeout, while
logLevel: warnhid the Appium log. Both are configurable now —WDA_LAUNCH_TIMEOUT,WDIO_CONNECTION_RETRY_TIMEOUT,WDIO_LOG_LEVEL.The capped-amount assertion raced its toast. The send screen caps numberpad input at the available amount, so the old "type over balance" check raced a 1.5s toast. Reads the cap from its
MoneyTextelement, then asserts the cap holds.The Trezor emulator can run on another machine.
TREZOR_REMOTE=1letsscripts/trezor-emulatordrive a container it cannot see: the controller websocket (9001) and the bridge (21325) arrive over a port forward, so the controller script runs under the localpython3instead ofdocker exec, and everything that needs a container on this host —resolve_container,container_running,start_env,stop— short-circuits.CONTROLLER_ENVSis a global array rather than a nameref because bash 3.2 on macOS does not have them.Two supporting changes come with it:
trezor-controller.pyre-raises therequeststimeout fromcall_bridgeas trezorlib's ownTimeout.protocol_v1.probedrains stale responses with a 0.1s read and stops by catchingTimeout, so the unwrapped exception only escapes once the bridge is slower than that read — which is to say, only when it is remote.MACOS=${TREZOR_MACOS:-1}andextra_hosts: host.docker.internal:host-gateway. The image assumes a macOS host, and that hostname is implicit on Docker Desktop but not on Linux, where the emulator otherwise cannot reach the published bitcoind port.Dropped since the first revision.
main'swaitForToastBestEffortnow covers the address-type and balance-unit toast races, so both of those changes came out whenmainwas merged in —test/specs/settings.e2e.tsis no longer touched at all.Defaults are unchanged except the Appium log, which now always writes to
artifacts/(override withAPPIUM_LOG_PATH).scripts/__pycache__is gitignored, since the controller script leaves it behind.Verified:
tsc --noEmitandprettier --checkclean at this head. The full iOS shard ran green against a stack on a second runner in synonymdev/bitkit-ios run 33273316740, but that predates two merges ofmain— evidence, not a current result. This repo has no PR CI, so nothing automated covers the branch.Branch name matches synonymdev/bitkit-ios
test/e2e-remote-jobssodetermine-e2e-branchpairs them automatically.Related: synonymdev/pubky-stack#275, #206