Repository navigation
fix: decouple wallet restore from profile refresh - #1686
ben-kaufman wants to merge 179 commits into
Conversation
|
Triage: 3.1.0. It keeps the shipped wallet restore from waiting on profile refresh, and 3.1.0 is due 28 Oct. |
[Medium impact] The PR appears safe to merge; no actionable issues were found. SummaryWallet restore now schedules optional identity activation and profile reads without waiting for them.
No actionable issues found. Review covered source and tests; tests were not run. Diagram%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Required wallet and USDT recovery] --> B{Succeeded?}
B -->|No| C[Keep restore blocked]
B -->|Yes| D[Schedule identity work]
D --> E[Complete wallet restore]
D --> F{Identity revision still current?}
F -->|No| G[Skip obsolete work]
F -->|Yes| H[Activate identity and load profile]
I[Build backup] --> J{Identity data complete?}
J -->|No| K[Keep previous remote backup]
J -->|Yes| L[Upload backup]
Reviews (1) · Last reviewed commit: "fix: decouple wallet restore from profil..." · Reviewed by Greptile |
talosmachina
left a comment
There was a problem hiding this comment.
No findings. Moves Pubky identity activation after a wallet restore off the restore screen's critical path (scheduleInitializationAfterRestore, coalesced per stored-identity revision), and makes WALLET and METADATA backups fail rather than upload a payload with the identity part silently missing. Reviewed ac2a7c6, full tier, stacked on #1685 (fix/pending-wallet-restore-admission), reviewed as the delta against that base.
What I checked, and 6 candidates I ruled out
Read in full: PubkyRepo.kt (initialization, restore, adoption, sign-out and backup-state regions), BackupRepo.kt (scheduling, triggerBackup, markBackupFailed, wallet and metadata snapshots, full restore), WalletViewModel.kt restore paths, PrivatePaykitRepo.backupSnapshot, PaykitSdkService (currentPublicKey, session provider, clearSessionAccess), and paykit-rs v0.1.1-rc1 identity_status / initialize.
Call sites traced: scheduleInitializationAfterRestore (both WalletViewModel restore paths), hasIdentityForBackup (only captureWalletBackupDataBytes), initialize() (still only the init block, unchanged semantics with expectedRevision = null).
CI: lint, detekt and build-local green. build is red on one test, PubkyAuthManifestTest > signup and authorization links resolve only through their enabled aliases, at its first assertion (line 77, every alias still at its default). The diff touches neither that test nor the manifest; the base head 837aa1c passed build, and the same test failed the same way in two of the last eight failed ci runs on unrelated branches (fix/update-terms-of-use, feat/usdt-design-followup-20261015). All seven new tests in PubkyRepoTest, BackupRepoTest passed in that run. The e2e shards were still running when I read the checks.
Not built here: this review is reasoned from the code and CI; CI is the gate.
Ruled out
- Scheduled activation lost when the revision moves: the revision only moves through
startSignIn(non-restoring) or a non-preservingclearAuthenticatedState, both of which are a newer identity's own path, so dropping the stale job is the intent.restoreSessionBackupStatebumps it inside the restore, before the schedule reads it. - Something after
Completedneeding the identity: the public key is already set inside the required boundary (restoreSessionBackupStateLocalSeedstartSignIn), and the payment-requestactivateatBackupRepo.kt:1058runs during the restore, unchanged. - Coalescing reusing a finished job:
takeIf { !it.second.isCompleted }, and the completion handler clears the slot only when it still holds the same job. - Uncaught failure in the background job:
initializeSessioncatches its own failures,checkAdoptedSourcereturns aResult, andappScopecarries aSupervisorJobplus a logging handler. - WALLET backup blocked for good while a saved session exists: with a stored session
currentPublicKey()reads the bound identity state throughidentity_status, sostateis null only when the SDK has no identity, which is the case the check means to hold; an unreadable keychain fails the backup (covered bywallet backup cannot treat unreadable identity as absent). - METADATA
getOrThrowturning a benign miss into a failure: both snapshots returnnullfor absence insiderunSuspendCatching, so only a read error now fails, which is what the two new tests pin.
Merge confidence: 3/5, the build job is red on PubkyAuthManifestTest, which I traced to a flake outside this diff; a green re-run would move it to 4/5 (J1 is still unrun).
Reviewer model: claude-opus-5-5
Reasoning effort: Not exposed
Regtest APKDownload bitkit-dev-debug universal APK (expires in 30 days). |
jvsena42
left a comment
There was a problem hiding this comment.
Code scan: one LOW inline, reproduced with a failing unit test.
Checked and clean:
- No cross-identity leak on wipe and restore: the mutex, the revision and the
isCurrent(signIn)guards hold. - Identity isn't lost for good: the retry paths cover a failed background refresh. The WALLET backup that can stay blocked is the open P1 thread.
- No payment path starts before the identity exists: the key is set inside the required restore.
- Twin synonymdev/bitkit-ios#1121 keeps the header signed-out until the background activation lands, so it has no flip.
Performance-relevant (the purpose is a faster restore). wallet/restore-during-identity-outage.xml needs fault controls that aren't provisioned, so the gate uses a proxy. It restores a regtest wallet whose backup carries a pubky session, then:
- times
Full restore success→ Completed, head vs master, with the homeserver reachable and with it blocked; - checks that the header shows the identity and that profile and contacts arrive afterwards;
- counts
Restored paykit session forper restore (expected 1); - runs Settings → Backup for WALLET once the identity is active.
Device gate (partial): ac2a7c6 — not run yet; pending that proxy run. Device results will follow in a separate review.
piotr-iohk
left a comment
There was a problem hiding this comment.
QA review
Scope: changes since 198f3e3, including the affected restore and wipe paths, at 94c7e21. Baseline: previous review.
No new actionable code findings.
The new commit retries a session restore only when a wallet wipe cancels or refuses one and then does not finish, records the native Paykit init before that cancellation is observed, and clears the startup restoring flag when initial initialization finishes. A failed wipe that has already entered the Paykit wipe barrier still clears the live session before this retry; if the in-memory public key is still set, the retry reloads profile data instead of importing the saved session again. That is the same unusable session a failed wipe already left, and sign-in during a pending wallet reset still stops at the removal admission check.
Compared with bitkit-ios#1121 at 3af88fff for this restore/wipe path only. That revision has no equivalent retry after a failed reset.
Device testing: not performed in this review. The unit suite was not run. PubkyIdentityOperationsTest covers the retry callback; PubkyRepo does not cover a failed reset that interrupts an in-flight restore.
Suggested additional test cases
- Android, saved profile, dev build: start wallet reset while session restore or profile load is still in progress, and fail the reset before it deletes credentials. The profile session should be usable again without restarting the app, and the restoring indicator should not stay on.
- Android, same setup: fail a reset after the pending wallet-reset record exists and the live Paykit session has been cleared, but before the in-memory profile key is cleared. The app should stay on wallet-reset recovery and should not sign that profile back in.
Earlier findings reconciled at this revision: 5 still present, 1 verified fixed.
Existing concerns
- [MEDIUM] Bound native authentication before draining VSS during reset — Reset still waits on a held LNURL-auth response before it can shut the standalone VSS clients down or delete credentials. Both GitHub threads #1686 (comment) and #1686 (comment) are unresolved, not outdated, and anchored at VssClientCoordinator.kt:138. WipeWalletUseCase.kt:82-84 sets wiping, then line 86 enters withWalletWipeAdmission and withIdentityChange; lightningRepo.stop() at line 100 runs only inside that block, and the finally at lines 116-119 clears wiping only after it returns. The coordinator join at lines 136-139 is NonCancellable. gradle/libs.versions.toml:98 still pins com.synonym:vss-client-android 0.5.26-rc3 and that pin is not in the diff against b0a01b1. Tag v0.5.26-rc3 peels to 3baf76dda37126d313f85ed2298abd65f6ef62b2, where execute_async at src/lib.rs:32-41 still runs Runtime::block_on, used by vss_get at line 209 and vss_ldk_get at line 477. KeyDomainLnurlAuthProvider at src/lnurl_auth.rs:147 builds reqwest with Client::builder().build() and fetch_jwt_token at lines 166-191 awaits the challenge and signed callback with no deadline. VssBackupClient.kt:73 and :127 and VssBackupClientLdk.kt:61 and :79 pass that key domain and admit get through withClient. Cancelling the Kotlin job therefore leaves that blocked poll running. ResetAndRestoreScreen.kt:76, :81, :114, and :122 keep Back disabled and Reset loading while isWiping stays true. synonymdev/vss-rust-client-ffi#36 is still open, mergedAt null, head 1a5b788ceabac22739a9c9deabef67fea071b644, and diverged from 3baf76d. The commit since 198f3e3 does not change this join. This is the same mechanism as synonymdev/bitkit-ios#1121 (comment). No device hold was repeated here.
- [LOW] Allowance journey describes a delayed-contact check its actions do not perform — The journey description still tells the runner to repeat the off/on sequence while contact loading is delayed, and the action list still does one off, one request, and one on. The GitHub thread #1686 (comment) is marked resolved, not outdated, and anchored at journeys/allowances/allowances-turned-off.xml:6. The author reply says it is out of scope and tracked in #1766. That resolution leaves the mismatched sentence in this PR's diff against b0a01b1. #1766 is open, titled "docs: clarify delayed-contact coverage in the allowance toggle journey". The journey file is unchanged since 198f3e3.
- [MEDIUM] Backups required during restore stay unscheduled after restore — A non-SPARK_EXIT backup marked required while restore is in progress is still not scheduled when restore ends. shouldBackup is false while restoring, the status observer drops that emission, and distinctUntilChanged does not emit again when only the restore flag changes. At this head, startBackupStatusObservers combines restoreInProgress only for SPARK_EXIT; line 497 leaves every other category on the status flow. This non-Spark gap already exists at b0a01b1, where no category combined restoreInProgress. This PR adds the Spark-only resume and does not introduce or widen the other categories, so it is not an introduced or worsened defect. Focused issue searches returned no open or closed same-repository issue for this observer gap, so it is not tracked_separately. The existing report is #1686 (comment). That comment's device run was not repeated here. BackupRepo.kt is unchanged since 198f3e3.
- [MEDIUM] Retry cannot refresh an expired session for a failed pubky profile delete — A failed pubky profile delete still cannot refresh an expired session on retry. The thread #1689 (comment) is unresolved and its anchor is outdated. deleteProfile calls pubkyService.deletePubkyProfile directly. refreshSessionIfPossibleLocked is private and its only call is inside withPubkyAppScopeLocked, which this delete path does not call. ProfileRemovalCoordinator.reviewAgain prepares a new deletion and remove calls the same deleteProfile. An expired session therefore fails the delete again on Retry. The PubkyRepo delta since 198f3e3 does not touch this delete path.
- [LOW] Reset still waits out one in-flight Pubky restore call — Reset still waits out one in-flight Pubky restore or re-sign-in call. The thread #1686 (comment) is marked resolved, not outdated, and anchored at PubkyIdentityOperations.kt:87. The author reply says the wipe now cancels an admitted session restore so later retries do not run, and that a native call already on the Pubky queue is not interrupted, so Reset can still wait out that one attempt. That remaining wait is in the current source: wipe cancels cancelOnWipe transitions at line 82 and then awaits every active transition at line 86 before the wipe block. ServiceQueue.background runs that call with withContext on the queue's own SupervisorJob, so cancelling the restore does not finish the call. lightningRepo.stop() at WipeWalletUseCase.kt:100 is inside the wipe block and cannot start until the drain returns. The commit since 198f3e3 does not remove this await. The spinner is shown while it waits. No device hold was repeated here.
Reviewer model: grok-4.7
Reasoning effort: xhigh
There was a problem hiding this comment.
Verdict: ⛔️ Request changes — three existing failures remain. No new delta defect found.
Findings:
-
Existing HIGH — Terminal identity failure blocks newer ordinary WALLET backups. BackupRepo.kt:1438: new ordinary reservation state remained pending and remote WALLET bytes/version stayed unchanged until the original credentials were repaired. Keep the complete-backup guard while resolving ordinary-wallet recovery.
-
Existing MEDIUM — Native authentication keeps Reset waiting. VssClientCoordinator.kt:138: credentials remained present and admission closed at 196.7s after confirmation. Releasing the genuine authentication response allowed Reset to finish 7.4s later. VSS 0.5.26-rc3 still lacks the native deadline correction.
-
Existing MEDIUM — Profile-delete Retry cannot recover expired authorization. PubkyRepo.kt:1566: after real grant expiry, Delete and repeated Review returned to the recovery failure with an HTTP 401 toast. Original credentials remained; the narrower Identity-specific retry claim is not established by this execution.
QA for 94c7e21:
Isolated unfunded Android 16/API 36 wallets against staging services. The pristine head was built and installed; recorded cases use unpublished Debug holds, repository readbacks and a controlled node-stop failure before erasure. No native result was substituted, and every native library matches the pristine APK. Videos play at 2×; hidden-state claims below use the stated app, keychain, VSS or proxy readbacks.
Recover profile after Reset interrupts native initialization ✅ A cancelled successful native initialization recovered the original profile/contact after Reset failed; recovery did not initialize Pubky twice (app readback).
The hold is after the real native import succeeds, before its result returns to the repository. Reset cancels restoration, then the injected node-stop failure leaves credentials intact. The original identity, profile and contact return automatically, without reopening Profile or restarting after Reset. Readback: initCount=1, recoveryCount=1, sameIdentity=true, contacts=1, restoring=false, wiping=false.
cancel-init-failed-reset2x.2x.mp4
Recover profile after Reset interrupts session import ✅ A warm saved-session import recovered the original profile/contact automatically after failed Reset (app readback).
The fixture retains the exact original saved credentials while clearing volatile display/session access, then runs the real repository import. Reset interrupts its successful native return. After the controlled pre-erasure failure, one recovery callback restores the same identity, profile and contact.
cancel-import-failed-reset2x.2x.mp4
Reload profile data after interrupted enrichment ✅ An already-published sign-in reloaded its profile/contact after interrupted enrichment and failed Reset (app readback).
The hold starts before optional profile/contact loading, after sign-in publication. Reset cancels that work. Its failure starts one recovery callback; releasing enrichment loads the same profile and contact without another sign-in or process restart.
cancel-enrichment-failed-reset2x.2x.mp4
Retry startup refused by a failed Reset ✅ Startup refused during Reset cleared the restoring flag, then recovered automatically when Reset failed (app readback).
Startup is explicitly held until Reset owns wipe admission. Releasing startup while wipe is held leaves identity=false, restoring=false, serviceInitialized=false, and wiping=true. Releasing the controlled stop failure starts one recovery callback; original identity, profile and contact return with credentials retained.
refused-restore-failed-reset2x.2x.mp4
Keep old profile erased after successful Reset ✅ Successful Reset erased the old profile and credentials and triggered no interrupted-restore callback (UI/app readback).
A separate disposable profile starts a successful native import, then Reset cancels restoration and completes normally after release. The app reaches Terms with credentials absent, no profile/identity, and recoveryCount=0; a later readback still shows no old-profile retry.
successful-reset2x.2x.mp4
Back up ordinary changes after terminal identity failure ❌ New ordinary reservation state stayed pending and remote WALLET was unchanged until credential repair (real VSS/app readback).
A synchronized SDK-bearing complete backup existed before the fault. The control removes the disposable recovery root and installs an invalid saved session, then reserves a new watch-only account index. Real VSS reads compare WALLET bytes/version across the failed upload. Restoring the original credentials permits a complete upload.
terminal-wallet-backup2x.2x.mp4
Retry profile deletion after the current grant expires ❌ Delete and repeated Review failed after genuine grant expiry, retaining the original signer and expired grant (UI/keychain readback).
A genuine four-minute grant is signed by the disposable identity’s existing root and imported through the normal native API before expiry. An explicit hold delays the real Pubky delete until actual expiry. Delete fails; repeated Review stays in the recovery failure with acquire Pubky write lock (HTTP 401). Local comparisons show rootUnchanged=true and savedSessionUnchanged=true. No clock was advanced.
expired-profile-delete-retry2x.2x.mp4
Finish Reset while native authentication is held ❌ Reset retained credentials and closed admission at 196.7s; it finished 7.4s after authentication release (UI/app/proxy readback).
A forwarding proxy holds a genuine standalone LDK authentication response while the actual Settings Reset action runs. During the hold, credentialsPresent=true, wiping=true and admissionOpen=false persist without a retryable error. Release lets the old lookup cancel, credentials disappear, admission reopen and Terms appear. No native result is replaced.
stalled-native-auth2x.2x.mp4
Keep pending Reset recovery closed after a failed wipe ✅ A failed wipe after durable Reset admission kept recovery restricted and did not re-import the saved profile (UI/app readback).
This also covers the additional same-head QA request. The control fails Reset after its pending record is acknowledged but before credentials or the in-memory profile key are cleared. The interrupted-restore callback runs, while the app stays on wallet-reset recovery: live session remains cleared, saved credentials remain, explicit restore returns false and node startup is refused with ProfileRemovalPending. The native session-import counter does not increase.
pending-reset-failure2x.2x.mp4
Check: pristine build and full JVM/static checks ✅ Assembly, compile, full JVM suite and lint completed.
Ran assembleDevDebug, just compile, just test and just lint at the pristine head. No failures; Detekt and Android Lint reports contain no findings. The suite has two opt-in integration skips. Compose instrumentation was not repeated locally.
Retained earlier case evidence These executions retain their original heads and qualifications.
The previous review at 0294558 reconciles the constituent results below. This cancellation/bookkeeping delta does not replace those executions with a fresh funded campaign.
- Manual 1–2, J2 and J1 required-recovery gates: real allowance execution, WALLET/USDT failure gates and Retry at 710292a.
- Manual 3 and Manual 4 interrupted debounce: status-write replay, interrupted debounce and acknowledged in-flight SETTINGS replacement at cd0befc.
- Manual 4 restore-clear/real ten-minute expiry: acdd99c execution.
- Manual 5 funded sends/results/withdrawal and zero-cache: c4d9939 execution.
- Manual 5 retained-display/native-error boundary: bc6b171 execution.
- Manual 6 cache availability before held native startup: 89f3bc6 execution.
- J1 missing-profile reconnect and stale enrichment: 4aa622f execution.
- J1 restart without duplication: 3e1fdb7 execution.
- J3 queued Settings acknowledgement and interrupted post-erasure Reset/cold Retry: 5c7df26 execution.
- Queued node handler, stopped-node replacement and foreground recovery: 0294558 execution.
These are attributed constituent results, not a fresh uninterrupted J1 run. The deferred allowance-documentation issue and pre-existing non-Spark backup observer gap retain their disposition.
Not driven: an actual Rust panic, external Ring application UI, funded nonempty-USDT recovery or an actual unilateral Spark exit. They are outside this delta and require distinct external fixtures or runtime behavior. No fresh funded-payment campaign was repeated.
Coverage: contiguous 198f3e3..94c7e21, three files, plus outstanding findings. Device cases exercised the changed restore, initialization and wipe outcomes; the added coordinator tests ran in the pristine JVM suite.
Twin: synonymdev/bitkit-ios#1121 at 3af88fff matches required recovery before optional profile work and retains the complete-backup guard. Its initialization uses independent tasks and a failed wipe retains a durable gate with retries; Android’s cancelled-continuation recovery is platform-specific. This was a targeted source comparison, with no iOS device execution.
Unpublished Debug controls
Not pushed. Holds, readbacks, disposable fixture setup and a pre-erasure node-stop failure; no SDK return value is substituted. Earlier recordings use the same relevant holds/readbacks; later helper changes make credential/status readbacks local-only and preserve the original credentials when staging a warm restore. All native libraries match the pristine head APK.
diff --git a/app/src/debug/java/to/bitkit/dev/DevToolsProvider.kt b/app/src/debug/java/to/bitkit/dev/DevToolsProvider.kt
index 289131a72..bee9048f5 100644
--- a/app/src/debug/java/to/bitkit/dev/DevToolsProvider.kt
+++ b/app/src/debug/java/to/bitkit/dev/DevToolsProvider.kt
@@ -43,6 +43,7 @@ class DevToolsProvider : ContentProvider() {
override fun call(method: String, arg: String?, extras: Bundle?): Bundle {
check(Binder.getCallingUid() == SHELL_UID) { "Only ADB shell callers are allowed" }
+ if (method.startsWith("qa1686")) return kotlinx.coroutines.runBlocking(kotlinx.coroutines.Dispatchers.IO) { Qa1686.run(requireNotNull(context), method, arg) } // test hook
return runCatching {
// Needs no node, so it does not wait behind LDK work.
if (method == OverrideNfc.METHOD) return@runCatching OverrideNfc.execute(arg)
diff --git a/app/src/main/java/to/bitkit/data/backup/VssBackupClientLdk.kt b/app/src/main/java/to/bitkit/data/backup/VssBackupClientLdk.kt
index 259d689d6..1ddbcf79b 100644
--- a/app/src/main/java/to/bitkit/data/backup/VssBackupClientLdk.kt
+++ b/app/src/main/java/to/bitkit/data/backup/VssBackupClientLdk.kt
@@ -57,7 +57,7 @@ class VssBackupClientLdk @Inject constructor(
storeId = vssDeriveStoreId(Env.vssStoreIdPrefix, mnemonic, passphrase),
mnemonic = mnemonic,
passphrase = passphrase,
- lnurlAuthServerUrl = Env.lnurlAuthServerUrl,
+ lnurlAuthServerUrl = if (to.bitkit.BuildConfig.DEBUG && java.io.File("/data/user/0/to.bitkit.dev/files/qa1686-auth-override").exists()) "http://127.0.0.1:23569/lnurl_auth/auth" else Env.lnurlAuthServerUrl, // test hook
keyDomain = Env.lnurlAuthKeyDomain,
)
Logger.info("VSS LDK client setup for wallet[$walletIndex]", context = TAG)
diff --git a/app/src/main/java/to/bitkit/repositories/LightningRepo.kt b/app/src/main/java/to/bitkit/repositories/LightningRepo.kt
index 1ec0241b3..084936b37 100644
--- a/app/src/main/java/to/bitkit/repositories/LightningRepo.kt
+++ b/app/src/main/java/to/bitkit/repositories/LightningRepo.kt
@@ -914,7 +914,17 @@ class LightningRepo @Inject constructor(
suspend fun stop(): Result<Unit> = withContext(bgDispatcher) {
stopRequestCount.incrementAndGet()
- lifecycleMutex.withLock { stopLocked() }
+ lifecycleMutex.withLock { // test hook
+ if (to.bitkit.BuildConfig.DEBUG) { // test hook
+ val root = java.io.File("/data/user/0/to.bitkit.dev/files") // test hook
+ if (java.io.File(root, "qa1686-fail-stop").exists()) { // test hook
+ java.io.File(root, "qa1686-stop-entered").writeText("before credential erasure") // test hook
+ while (java.io.File(root, "qa1686-stop-hold").exists()) kotlinx.coroutines.delay(100) // test hook
+ return@withLock Result.failure(AppError("QA controlled node stop failure")) // test hook
+ } // test hook
+ } // test hook
+ stopLocked() // test hook
+ } // test hook
}
private suspend fun stopLocked(): Result<Unit> {
diff --git a/app/src/main/java/to/bitkit/repositories/PubkyRepo.kt b/app/src/main/java/to/bitkit/repositories/PubkyRepo.kt
index 6b201b7ed..f545fcec7 100644
--- a/app/src/main/java/to/bitkit/repositories/PubkyRepo.kt
+++ b/app/src/main/java/to/bitkit/repositories/PubkyRepo.kt
@@ -481,7 +481,13 @@ class PubkyRepo @Inject constructor(
private var restoreInitialization: Pair<Long, Job>? = null
init {
- scope.launch { initialize() }.invokeOnCompletion {
+ scope.launch { // test hook
+ if (to.bitkit.BuildConfig.DEBUG) { // test hook
+ val f = java.io.File("/data/user/0/to.bitkit.dev/files/qa1686-before-startup-hold") // test hook
+ while (f.exists()) kotlinx.coroutines.delay(100) // test hook
+ } // test hook
+ initialize() // test hook
+ }.invokeOnCompletion {
// A wipe can cancel startup before the restore clears this flag itself.
_isRestoringSession.update { false }
initializationReady.complete(Unit)
@@ -643,6 +649,11 @@ class PubkyRepo @Inject constructor(
}
private suspend fun resumeInterruptedRestore() {
+ if (to.bitkit.BuildConfig.DEBUG) { // test hook
+ val f = java.io.File("/data/user/0/to.bitkit.dev/files/qa1686-resume-count") // test hook
+ if (f.exists()) f.writeText((f.readText().trim().toInt() + 1).toString()) // test hook
+ Logger.info("QA1686 resumed interrupted restore", context = TAG) // test hook
+ } // test hook
if (!restoreSessionIfNeeded() && _publicKey.value != null) loadIdentityData()
checkAdoptedSource()
}
@@ -687,6 +698,14 @@ class PubkyRepo @Inject constructor(
}
private suspend fun loadIdentityData() {
+ if (to.bitkit.BuildConfig.DEBUG) { // test hook
+ val f = java.io.File("/data/user/0/to.bitkit.dev/files/qa1686-enrichment-hold") // test hook
+ if (f.exists()) { // test hook
+ java.io.File(f.parentFile, "qa1686-enrichment-held").writeText("entered after sign-in") // test hook
+ Logger.info("QA1686 held optional enrichment", context = TAG) // test hook
+ while (f.exists()) kotlinx.coroutines.delay(100) // test hook
+ } // test hook
+ } // test hook
coroutineScope {
launch { loadProfile() }
launch { loadContacts() }
diff --git a/app/src/main/java/to/bitkit/services/PaykitSdkService.kt b/app/src/main/java/to/bitkit/services/PaykitSdkService.kt
index 7a86b78f8..486647f16 100644
--- a/app/src/main/java/to/bitkit/services/PaykitSdkService.kt
+++ b/app/src/main/java/to/bitkit/services/PaykitSdkService.kt
@@ -949,6 +949,15 @@ class PaykitSdkService @Inject constructor(
requireProfileIdentity(currentIdentity(), expectedIdentity)
requireNoActiveSubscriptions(handle())
completeSdkCall {
+ if (to.bitkit.BuildConfig.DEBUG) { // test hook
+ val deadlineFile = java.io.File("/data/user/0/to.bitkit.dev/files/qa1686-expiry-deadline") // test hook
+ if (deadlineFile.exists()) { // test hook
+ deadlineFile.delete() // test hook
+ Logger.info("QA1686 entered Pubky delete before genuine grant expiry", context = TAG) // test hook
+ while (java.io.File("/data/user/0/to.bitkit.dev/files/qa1686-expiry-hold").exists()) kotlinx.coroutines.delay(100) // test hook
+ Logger.info("QA1686 dispatched Pubky delete after genuine grant expiry", context = TAG) // test hook
+ } // test hook
+ } // test hook
handle().deletePubkyProfile(expectedRevision)
onAcknowledged()
}
diff --git a/app/src/main/java/to/bitkit/services/PubkyService.kt b/app/src/main/java/to/bitkit/services/PubkyService.kt
index b3df230b4..f86fd63e8 100644
--- a/app/src/main/java/to/bitkit/services/PubkyService.kt
+++ b/app/src/main/java/to/bitkit/services/PubkyService.kt
@@ -43,16 +43,29 @@ class PubkyService @Inject constructor(
}
suspend fun initializeAndImportSession(secret: String): Result<String> = ServiceQueue.PUBKY.background {
- paykitSdkService.initializeAndImportSession(secret).map { it.publicKey }
+ paykitSdkService.initializeAndImportSession(secret).map { it.publicKey }.also { qa1686Hold("init", it.isSuccess) } // test hook
}
suspend fun republishIdentityIfNeeded(publicKey: String? = null) =
paykitSdkService.republishIdentityIfNeeded(publicKey)
+ private suspend fun qa1686Hold(name: String, success: Boolean = true) { // test hook
+ if (!to.bitkit.BuildConfig.DEBUG) return // test hook
+ val root = java.io.File("/data/user/0/to.bitkit.dev/files") // test hook
+ val counter = java.io.File(root, "qa1686-$name-count") // test hook
+ if (counter.exists()) counter.writeText((counter.readText().trim().toInt() + 1).toString()) // test hook
+ val hold = java.io.File(root, "qa1686-$name-hold") // test hook
+ if (!hold.exists()) return // test hook
+ java.io.File(root, "qa1686-$name-held").writeText("actual native call returned; success=$success") // test hook
+ to.bitkit.utils.Logger.info("QA1686 held actual native $name result", context = "TestHook") // test hook
+ while (hold.exists()) kotlinx.coroutines.delay(100) // test hook
+ to.bitkit.utils.Logger.info("QA1686 released actual native $name result", context = "TestHook") // test hook
+ } // test hook
+
// region Session management
suspend fun importSession(secret: String): String = ServiceQueue.PUBKY.background {
- paykitSdkService.importSession(secret).publicKey
+ paykitSdkService.importSession(secret).publicKey.also { qa1686Hold("import") } // test hook
}
suspend fun currentPublicKey(): String? = ServiceQueue.PUBKY.background {
diff --git a/app/src/main/java/to/bitkit/usecases/WipeWalletUseCase.kt b/app/src/main/java/to/bitkit/usecases/WipeWalletUseCase.kt
index de2718562..43ac6f917 100644
--- a/app/src/main/java/to/bitkit/usecases/WipeWalletUseCase.kt
+++ b/app/src/main/java/to/bitkit/usecases/WipeWalletUseCase.kt
@@ -99,6 +99,7 @@ class WipeWalletUseCase @Inject constructor(
privatePaykitRepo.get().withProfileDeletionPaused { pause ->
lightningRepo.stop().getOrThrow()
profileRemovalStore.begin(attemptId)
+ if (to.bitkit.BuildConfig.DEBUG && java.io.File("/data/user/0/to.bitkit.dev/files/qa1686-fail-after-pending").exists()) throw AppError("QA controlled failure after pending Reset record") // test hook
if (pending.scope != ProfileRemovalScope.WALLET_WIPE) cleanupRemote()
wipeLocal(walletIndex, pause) { credentialsMayBeErased = true }.getOrThrow()
profileRemovalStore.complete(attemptId)
diff --git a/app/src/debug/java/to/bitkit/dev/Qa1686.kt b/app/src/debug/java/to/bitkit/dev/Qa1686.kt
new file mode 100644
index 000000000..2bd623c1f
--- /dev/null
+++ b/app/src/debug/java/to/bitkit/dev/Qa1686.kt
@@ -0,0 +1,207 @@
+package to.bitkit.dev // test hook
+
+import android.content.Context // test hook
+import android.content.ClipData // test hook
+import android.content.ClipboardManager // test hook
+import android.os.Bundle // test hook
+import dagger.hilt.EntryPoint // test hook
+import dagger.hilt.InstallIn // test hook
+import dagger.hilt.android.EntryPointAccessors // test hook
+import dagger.hilt.components.SingletonComponent // test hook
+import kotlinx.coroutines.Dispatchers // test hook
+import kotlinx.coroutines.flow.first // test hook
+import kotlinx.coroutines.withContext // test hook
+import to.bitkit.data.CacheStore // test hook
+import to.bitkit.data.backup.VssBackupClient // test hook
+import to.bitkit.data.keychain.Keychain // test hook
+import to.bitkit.models.BackupCategory // test hook
+import to.bitkit.repositories.BackupRepo // test hook
+import to.bitkit.repositories.PubkyRepo // test hook
+import to.bitkit.repositories.WalletRepo // test hook
+import to.bitkit.repositories.LightningRepo // test hook
+import to.bitkit.services.PubkyService // test hook
+import to.bitkit.di.json // test hook
+import to.bitkit.models.WalletBackupV1 // test hook
+import to.bitkit.utils.Logger // test hook
+import java.io.File // test hook
+import kotlinx.coroutines.*
+import to.bitkit.models.*
+import to.bitkit.repositories.*
+import to.bitkit.services.*
+import kotlin.time.Clock
+
+object Qa1686 { // test hook
+ private var replacementPhrase: String? = null
+ private val scope = kotlinx.coroutines.CoroutineScope(kotlinx.coroutines.SupervisorJob() + Dispatchers.IO)
+ @EntryPoint @InstallIn(SingletonComponent::class) // test hook
+ interface Dependencies { // test hook
+ fun removal(): to.bitkit.data.ProfileRemovalStore
+ fun sparkExit(): SparkExitRepo
+ fun spark(): SparkRepo
+ fun sparkService(): SparkService
+ fun recovery(): to.bitkit.data.WalletConnectionRecovery
+ fun vssClients(): to.bitkit.data.backup.VssClientCoordinator
+ fun vssLdk(): to.bitkit.data.backup.VssBackupClientLdk
+ fun sdk(): to.bitkit.services.PaykitSdkService
+ fun allowanceExecutor(): to.bitkit.repositories.PaykitAllowanceExecutor
+ fun privatePaykit(): to.bitkit.repositories.PrivatePaykitRepo
+ fun allowances(): to.bitkit.repositories.PaykitAllowanceRepo
+ fun allowanceStore(): to.bitkit.repositories.PaykitAllowanceStore
+ fun keychain(): Keychain // test hook
+ fun backupRepo(): BackupRepo // test hook
+ fun pubkyRepo(): PubkyRepo // test hook
+ fun pubkyService(): PubkyService // test hook
+ fun vss(): VssBackupClient // test hook
+ fun cache(): CacheStore // test hook
+ fun wallet(): WalletRepo // test hook
+ fun accounts(): to.bitkit.data.WatchOnlyAccountStore
+ fun settings(): to.bitkit.data.SettingsStore
+ fun nodeService(): LightningService
+ fun lightning(): LightningRepo // test hook
+ } // test hook
+ suspend fun run(context: Context, method: String, arg: String?): Bundle { // test hook
+ val d = EntryPointAccessors.fromApplication(context, Dependencies::class.java) // test hook
+ fun file(name: String) = File(context.filesDir, "qa1686-$name")
+ val result = kotlin.runCatching { // test hook
+ when (method) {
+ "qa1686PendingState" -> {
+ val sdk=d.sdk()
+ val provider=sdk.javaClass.getDeclaredField("sessionProvider").apply { isAccessible=true }.get(sdk)
+ val live=provider.javaClass.getDeclaredField("liveSessionAccess").apply { isAccessible=true }.get(provider) != null
+ val repo=d.pubkyRepo()
+ val expected=file("expected-key").readText()
+ val imports=file("import-count").takeIf { it.exists() }?.readText()
+ "pending=${d.removal().pendingAttempt() != null}; resetRecovery=${d.removal().walletResetRecovery.first()}; sameIdentity=${repo.publicKey.value == expected}; identityPublished=${repo.publicKey.value != null}; liveSession=$live; imports=$imports; recoveryCount=${file("resume-count").readText()}; credentials=${d.keychain().exists(Keychain.Key.BIP39_MNEMONIC.name)}; savedSession=${d.keychain().exists(Keychain.Key.PAYKIT_SESSION.name)}; savedRoot=${d.keychain().exists(Keychain.Key.PUBKY_SECRET_KEY.name)}; wiping=${d.backupRepo().isWiping.value}; restoring=${repo.isRestoringSession.value}"
+ }
+ "qa1686PendingAdmission" -> {
+ val restored=d.pubkyRepo().restoreSessionIfNeeded()
+ val start=d.lightning().start(shouldRetry=false)
+ "restored=$restored; startSuccess=${start.isSuccess}; startError=${start.exceptionOrNull()?.javaClass?.simpleName}"
+ }
+ "qa1686DeltaState" -> {
+ val repo = d.pubkyRepo()
+ fun privateValue(name: String): Any? = repo.javaClass.getDeclaredField(name).apply { isAccessible = true }.get(repo)
+ val same = file("expected-key").takeIf { it.exists() }?.readText() == repo.publicKey.value
+ val credentials = d.keychain().exists(Keychain.Key.BIP39_MNEMONIC.name)
+ val initCount = file("init-count").takeIf { it.exists() }?.readText()
+ val retryCount = file("resume-count").takeIf { it.exists() }?.readText()
+ "sameIdentity=$same; identity=${repo.publicKey.value != null}; profile=${repo.profile.value?.name}; contacts=${repo.contacts.value.size}; restoring=${repo.isRestoringSession.value}; serviceInitialized=${privateValue("isServiceInitialized")}; initCount=$initCount; recoveryCount=$retryCount; credentials=$credentials; savedSession=${d.keychain().exists(Keychain.Key.PAYKIT_SESSION.name)}; savedRoot=${d.keychain().exists(Keychain.Key.PUBKY_SECRET_KEY.name)}; wiping=${d.backupRepo().isWiping.value}"
+ }
+ "qa1686DeltaPrepare" -> {
+ d.backupRepo().stopObservingBackups()
+ d.settings().update { it.copy(isDevModeEnabled = true) }
+ val key = requireNotNull(d.pubkyRepo().publicKey.value)
+ file("expected-key").writeText(key)
+ file("init-count").writeText("0")
+ file("resume-count").writeText("0")
+ "saved expected identity; profile=${d.pubkyRepo().profile.value?.name}; contacts=${d.pubkyRepo().contacts.value.size}"
+ }
+ "qa1686DeltaContact" -> {
+ val key = "pubky" + d.pubkyService().publicKeyFromSecret("01".repeat(32))
+ val p = PubkyProfile.forDisplay(publicKey = key, name = "QA contact", imageUrl = null)
+ d.pubkyRepo().addContact(key, p).getOrThrow()
+ "contact saved through native API; count=${d.pubkyRepo().contacts.value.size}"
+ }
+ "qa1686DeltaWarm" -> {
+ val repo=d.pubkyRepo()
+ val originalSession=requireNotNull(d.keychain().loadString(Keychain.Key.PAYKIT_SESSION.name))
+ val originalRoot=requireNotNull(d.keychain().loadString(Keychain.Key.PUBKY_SECRET_KEY.name))
+ d.pubkyService().forgetSessionAccess()
+ d.keychain().upsertString(Keychain.Key.PAYKIT_SESSION.name, originalSession)
+ d.keychain().upsertString(Keychain.Key.PUBKY_SECRET_KEY.name, originalRoot)
+ for (name in listOf("_publicKey", "_profile")) {
+ val f=repo.javaClass.getDeclaredField(name).apply { isAccessible=true }
+ @Suppress("UNCHECKED_CAST")
+ (f.get(repo) as kotlinx.coroutines.flow.MutableStateFlow<Any?>).value=null
+ }
+ val cf=repo.javaClass.getDeclaredField("_contacts").apply { isAccessible=true }
+ @Suppress("UNCHECKED_CAST")
+ (cf.get(repo) as kotlinx.coroutines.flow.MutableStateFlow<List<PubkyProfile>>).value=emptyList()
+ scope.launch { repo.initialize() }
+ "cleared volatile display and native access only; started real saved-session import"
+ }
+ "qa1686ExpiryExport" -> {
+ d.backupRepo().stopObservingBackups()
+ val root = requireNotNull(d.keychain().loadString(Keychain.Key.PUBKY_SECRET_KEY.name))
+ val session = requireNotNull(d.keychain().loadString(Keychain.Key.PAYKIT_SESSION.name))
+ file("ttl-root").writeText(root)
+ file("ttl-original-session").writeText(session)
+ "exported disposable signer/session to app-private fixture files; rootPresent=true; sessionPresent=true"
+ }
+ "qa1686ExpiryImport" -> {
+ val root = requireNotNull(d.keychain().loadString(Keychain.Key.PUBKY_SECRET_KEY.name))
+ val identity = requireNotNull(d.pubkyRepo().publicKey.value)
+ val imported = d.pubkyService().importSession(file("ttl-session").readText())
+ check(imported.removePrefix("pubky") == identity.removePrefix("pubky"))
+ check(root == d.keychain().loadString(Keychain.Key.PUBKY_SECRET_KEY.name))
+ check(identity == d.pubkyRepo().publicKey.value)
+ "imported genuine short-lived signed grant; originalRootUnchanged=true; currentRepositoryIdentityUnchanged=true; expiresAt=${file("expiry-deadline").readText()}"
+ }
+ "qa1686ExpiryState" -> {
+ val root = d.keychain().loadString(Keychain.Key.PUBKY_SECRET_KEY.name)
+ val current = d.keychain().loadString(Keychain.Key.PAYKIT_SESSION.name)
+ "rootUnchanged=${root == file("ttl-root").readText()}; savedSessionUnchanged=${current == file("ttl-session").readText()}; repositoryIdentityPresent=${d.pubkyRepo().publicKey.value != null}; profilePresent=${d.pubkyRepo().profile.value != null}"
+ }
+ "qa1686Dev" -> { d.settings().update { it.copy(isDevModeEnabled = true) }; "enabled developer mode" }
+ "qa1686NativeAuth" -> {
+ d.backupRepo().stopObservingBackups()
+ d.vssClients().withSuspendedClients {}
+ file("auth-override").writeText("hold")
+ d.vssLdk().setup().getOrThrow()
+ file("native-result").delete()
+ scope.launch {
+ try {
+ val result = d.vssLdk().getObject("qa1686-held-auth")
+ file("native-result").writeText("returned success=${result.isSuccess}; error=${result.exceptionOrNull()?.javaClass?.simpleName}")
+ } catch(e: Exception) { file("native-result").writeText("cancelled=${e.javaClass.simpleName}") }
+ }
+ "scheduled actual standalone LDK lookup against held auth response"
+ }
+ "qa1686NativeState" -> "credentialsPresent=${d.keychain().exists(Keychain.Key.BIP39_MNEMONIC.name)}; wiping=${d.backupRepo().isWiping.value}; admissionOpen=${runCatching { d.vssClients().captureOwner() }.isSuccess}; result=${file("native-result").takeIf { it.exists() }?.readText()}"
+ "qa1686Backup" -> {
+ for (c in listOf(BackupCategory.WALLET, BackupCategory.METADATA, BackupCategory.SETTINGS)) d.backupRepo().triggerBackup(c).getOrThrow()
+ val wallet = requireNotNull(d.vss().getObject("WALLET").getOrThrow())
+ val metadata = requireNotNull(d.vss().getObject("METADATA").getOrThrow())
+ val pending = d.cache().backupStatuses.first().filterKeys { it in listOf(BackupCategory.WALLET, BackupCategory.METADATA) }.any { it.value.isRequired }
+ check(!pending)
+ "backup synchronized; sdk=${json.decodeFromString<WalletBackupV1>(wallet.value.decodeToString()).paykitSdkBackupState != null}; metadataBytes=${metadata.value.size}"
+ }
+ "qa1686Terminal" -> {
+ d.backupRepo().stopObservingBackups()
+ val secret = requireNotNull(d.keychain().loadString(Keychain.Key.PUBKY_SECRET_KEY.name))
+ File(context.filesDir, "qa1686-original-secret").writeText(secret)
+ val session = requireNotNull(d.keychain().loadString(Keychain.Key.PAYKIT_SESSION.name))
+ File(context.filesDir, "qa1686-original-session").writeText(session)
+ d.pubkyService().forgetSessionAccess()
+ d.keychain().delete(Keychain.Key.PUBKY_SECRET_KEY.name)
+ d.keychain().upsertString(Keychain.Key.PAYKIT_SESSION.name, "qa1686-invalid-session")
+ d.pubkyRepo().initialize().getOrThrow()
+ check(d.pubkyRepo().publicKey.value == null)
+ val before = requireNotNull(d.vss().getObject("WALLET").getOrThrow())
+ val reserved = d.accounts().reserveAccountIndex(0, "qa1686-terminal-ordinary")
+ check(d.accounts().backupSnapshot().allocationState.highestAccountIndexByWallet["0"] == reserved)
+ val failed = d.backupRepo().triggerBackup(BackupCategory.WALLET)
+ val after = requireNotNull(d.vss().getObject("WALLET").getOrThrow())
+ val same = before.value.contentEquals(after.value) && before.version == after.version
+ val pending = d.cache().backupStatuses.first()[BackupCategory.WALLET]?.isRequired == true
+ check(failed.isFailure && same && pending)
+ "terminal=true; ordinary watch-only index=$reserved reserved; failed=true; remote unchanged=true; pending=true; error=${failed.exceptionOrNull()?.javaClass?.simpleName}"
+ }
+ "qa1686RepairIdentity" -> {
+ d.keychain().upsertString(Keychain.Key.PUBKY_SECRET_KEY.name, File(context.filesDir, "qa1686-original-secret").readText())
+ d.keychain().upsertString(Keychain.Key.PAYKIT_SESSION.name, File(context.filesDir, "qa1686-original-session").readText())
+ d.pubkyRepo().initialize().getOrThrow()
+ d.backupRepo().triggerBackup(BackupCategory.WALLET).getOrThrow()
+ "recovered original identity and complete WALLET upload"
+ }
+ "qa1686CreateProfile" -> {
+ d.pubkyRepo().createIdentity("QA restore", "", emptyList(), emptyList(), null).getOrThrow()
+ "created disposable profile"
+ }
+ else -> "source=${d.keychain().exists(Keychain.Key.SHARED_PUBKY_SOURCE.name)}, savedSecret=${!d.keychain().loadString(Keychain.Key.PUBKY_SECRET_KEY.name).isNullOrBlank()}, savedSession=${!d.keychain().loadString(Keychain.Key.PAYKIT_SESSION.name).isNullOrBlank()}, sdk=${d.pubkyService().currentPublicKey() != null}, identity=${d.pubkyRepo().publicKey.value != null}, profile=${d.pubkyRepo().profile.value?.name}, contacts=${d.pubkyRepo().contacts.value.size}, pendingRestore=${d.backupRepo().hasPendingWalletRestore()}, node=${d.lightning().lightningState.value.nodeLifecycleState}" // test hook
+ } // test hook
+ }.fold({ it }, { "ERROR: ${it.javaClass.simpleName}: ${it.message}" }) // test hook
+ Logger.info("QA1686 $method: $result", context="TestHook") // test hook
+ return Bundle().apply { putString("result", result) } // test hook
+ } // test hook
+} // test hook
Reviewed by gpt-6.1-sol-high
jvsena42
left a comment
There was a problem hiding this comment.
Code scan of 0294558..94c7e21 (198f3e3, 94c7e21): no HIGH or MEDIUM. Two LOWs inline, both in the failed-Reset recovery added in 94c7e21, each with a failing test.
Checked and sound:
- The
CancellationException→PubkyIdentityBusyconversion only applies when the operation was cancelled and the caller is still active; caller cancellation and timeouts still rethrow. run()releasesactive/drainedon every path, including cancelled-before-bind.restoreRefusedis set and cleared under the same lock aswiping, so it cannot carry over to the next wipe.- One resume per failed wipe; a successful wipe does not resume.
- A cancelled restore's detached native call finishes before
drainedcompletes, so noPAYKIT_SESSIONwrite lands after the keychain wipe. NonCancellablearound native init cannot deadlock:serviceInitializeMutexis only taken inside transitions the wipe drains or cancels first.
What still bounds the Reset wait: the one native restore or sign-in call already in flight (~24–31 s), as you noted on the thread, plus non-restore transitions (checkAdoptedSource, Ring adoption, sign-in/out).
Performance-relevant (lock and drain timing on Reset). CI is green at 94c7e21.
Device gate (partial): 94c7e21 — running now: Reset with the homeserver held (cold, warm, free) against master, Reset during a profile load, wipe then new wallet ×4, restore journeys J1.1/J1.3/J1.6 and 7.1. Results follow.
Reviewer model: claude-fable-5-2 (delta review), claude-opus-5-5 (verification and this review)
Reasoning effort: medium (Fable, from the agent's environment); Not exposed (Opus)
Verified: just compile, just test, just lint
piotr-iohk
left a comment
There was a problem hiding this comment.
QA review
Scope: changes since 94c7e21, including the affected session-restore paths, at f166072. Baseline: previous review. Unchanged coverage from that baseline is inherited.
No new actionable code findings.
Startup completion now leaves isRestoringSession set when initialization has already finished, so a later restoreSessionIfNeeded keeps its in-progress flag until that restore finishes. After a failed wipe that interrupted a restore, the resume runs inside cancel-on-wipe admission and skips profile, contact, and adopted-source loads while profile recovery is pending; with no pending recovery it still restores and loads. PubkyRepoTest covers both outcomes (startup tail does not clear a later restore in flight, failed wipe after pending removal does not resume identity loads). Those tests were inspected, not executed. The commit message reports just compile, just test, and just lint; this review did not re-run them.
Compared only this flow with bitkit-ios 3af88fff: iOS clears the restoring flag from its single initialization task and will not start initialization while profile deletion is in flight. That does not conflict with this Android change. Device testing: not performed in this review.
Earlier findings reconciled at this revision: 5 still present, 2 verified fixed.
Existing concerns
- [MEDIUM] Bound native authentication before draining VSS during reset — Reset still waits on a held LNURL-auth response before it can shut the standalone VSS clients down or delete credentials. Both GitHub threads #1686 (comment) and #1686 (comment) are unresolved, not outdated, and anchored at VssClientCoordinator.kt:138. WipeWalletUseCase.kt:82-87 sets wiping and then enters withIdentityChange; the finally at lines 116-119 clears wiping only after that call returns. The coordinator join at lines 136-139 is NonCancellable. gradle/libs.versions.toml:98 still pins com.synonym:vss-client-android 0.5.26-rc3 at both the base and this head. Tag v0.5.26-rc3 peels to 3baf76dda37126d313f85ed2298abd65f6ef62b2, where execute_async at src/lib.rs:32-40 still runs Runtime::block_on, used by vss_get at line 209 and vss_ldk_get at line 477. KeyDomainLnurlAuthProvider at src/lnurl_auth.rs:147 builds reqwest with Client::builder().build() and fetch_jwt_token at lines 162-191 awaits the challenge and signed callback with no deadline. VssBackupClient.kt:73 and :143-144 and VssBackupClientLdk.kt:61 and :79 pass that key domain and admit get through withClient. Cancelling the Kotlin job therefore leaves that blocked poll running. ResetAndRestoreScreen.kt:76, :81, :114, and :122 keep Back disabled and Reset loading while isWiping stays true. synonymdev/vss-rust-client-ffi#36 is still open, mergedAt null, head 1a5b788ceabac22739a9c9deabef67fea071b644, and diverged from 3baf76d. f166072 does not change this join or the pin. The reviewer reports a hold at 94c7e21; that run was not repeated here. This is the same mechanism as synonymdev/bitkit-ios#1121 (comment).
- [LOW] Allowance journey describes a delayed-contact check its actions do not perform — The journey description still tells the runner to repeat the off/on sequence while contact loading is delayed, and the action list still does one off, one request, and one on. The GitHub thread #1686 (comment) is marked resolved, not outdated, and anchored at journeys/allowances/allowances-turned-off.xml:6. The author reply says it is out of scope and tracked in #1766. That resolution leaves the mismatched sentence in this PR's diff against b0a01b1. #1766 is open, titled docs: clarify delayed-contact coverage in the allowance toggle journey. The journey file is unchanged since 94c7e21.
- [MEDIUM] Backups required during restore stay unscheduled after restore — A non-SPARK_EXIT backup marked required while restore is in progress is still not scheduled when restore ends. shouldBackup is false while restoring, the status observer drops that emission, and distinctUntilChanged does not emit again when only the restore flag changes. At this head, startBackupStatusObservers combines restoreInProgress only for SPARK_EXIT; line 497 leaves every other category on the status flow. This non-Spark gap already exists at b0a01b1, where no category combined restoreInProgress. This PR adds the Spark-only resume and does not introduce or widen the other categories, so it is not an introduced or worsened defect. Focused issue search for restoreInProgress backup returned total_count 0. The other hit, open #1252, is a legacy-session and node-start backup report, so this observer gap is not tracked_separately. The existing report is #1686 (comment). That comment's device run was not repeated here. BackupRepo.kt is unchanged since 94c7e21.
- [MEDIUM] Retry cannot refresh an expired session for a failed pubky profile delete — A failed pubky profile delete still cannot refresh an expired session on retry. The thread #1689 (comment) is unresolved and its anchor is outdated. deleteProfile calls pubkyService.deletePubkyProfile directly. refreshSessionIfPossibleLocked is private and its only call is inside withPubkyAppScopeLocked, which this delete path does not call. ProfileRemovalCoordinator.remove calls the same deleteProfile. PaykitSdkService.completeSdkCall does not refresh a session after PaykitException.Identity; invalidatePaykitKeyIfNeeded only clears the cached key. An expired session therefore fails the delete again on Retry. The PubkyRepo delta since 94c7e21 does not touch this delete path; the call moved from line 1566 to line 1571 because lines were inserted above it. A focused issue search for refreshSessionIfPossible profile delete returned no issue.
- [LOW] Reset still waits out one in-flight Pubky restore call — Reset still waits out one in-flight Pubky restore or re-sign-in call. The thread #1686 (comment) is marked resolved, not outdated, and anchored at PubkyIdentityOperations.kt:87. The author reply says the wipe now cancels an admitted session restore so later retries do not run, and that a native call already on the Pubky queue is not interrupted, so Reset can still wait out that one attempt. The latest reply traces that residual at 94c7e21 and says it stays open until a held-homeserver Reset re-measure is recorded; that result is not on the thread. The remaining wait is in the current source: wipe cancels cancelOnWipe transitions at line 83 and then awaits every active transition at line 87 before the wipe block. ServiceQueue.background runs that call with withContext on the queue's own SupervisorJob, so cancelling the restore does not finish the call. lightningRepo.stop() at WipeWalletUseCase.kt:100 is inside the wipe block and cannot start until the drain returns. f166072 places the failed-wipe resume inside another cancel-on-wipe transition and does not remove this await. The spinner is shown while it waits. No device hold was repeated here. A focused issue search returned no matching issue.
Reviewer model: grok-4.7
Reasoning effort: xhigh
There was a problem hiding this comment.
Verdict: ⛔️ Request changes — three existing failures remain. No new delta defect found.
Findings:
- Existing HIGH — Terminal identity failure blocks ordinary WALLET backups.
BackupRepo.kt:1438: a new ordinary watch-only reservation stayed pending and remote WALLET bytes/version stayed unchanged. Repairing the original credentials permitted a complete upload. Keep the complete-backup guard while resolving ordinary-wallet recovery. - Existing MEDIUM — Native authentication keeps Reset waiting.
VssClientCoordinator.kt:138: Reset retained credentials and closed admission at 196.3s after confirmation while actual native authentication was held; it finished 13.3s after release (UI/app/proxy readbacks). VSS 0.5.26-rc3 still lacks the native deadline correction. - Existing MEDIUM — Profile-delete Retry cannot recover expired authorization.
PubkyRepo.kt:1571: after genuine grant expiry, Delete and repeated Review stayed in recovery failure with a visible HTTP 401 toast; the original signer and expired grant were retained. The observed HTTP 401/transport failure does not establish a narrower Identity-specific renewal claim.
QA for f166072:
Isolated unfunded Android 16/API 36 wallets against staging services. The pristine head was built and installed; recorded cases use unpublished Debug holds, repository readbacks and controlled node-stop/pending-Reset failures before erasure. No native result was substituted; all 11 native libraries match the pristine APK, and the installed APK matches the control build. Videos play at 2×. Hidden-state claims use the stated app, keychain, VSS or proxy readbacks.
Recover profile after Reset interrupts native initialization ✅ A cancelled successful native initialization recovered the original profile/contact after Reset failed; recovery did not initialize Pubky twice (app readback).
The hold follows successful native import, before its result returns to the repository. Reset cancels restoration; the injected node-stop failure retains credentials. Readback: initCount=1, recoveryCount=1, sameIdentity=true, contacts=1, restoring=false, wiping=false.
cancel-init-failed-reset2x.2x.mp4
Recover profile after Reset interrupts session import ✅ A real warm saved-session import recovered the original profile/contact automatically after failed Reset (app readback).
cancel-import-failed-reset2x.2x.mp4
Reload profile data after interrupted enrichment ✅ An already-published sign-in reloaded its profile/contact after interrupted enrichment and failed Reset (app readback).
cancel-enrichment-failed-reset2x.2x.mp4
Retry startup refused by a failed Reset ✅ Startup refused during Reset cleared the loading state and recovered automatically when Reset failed (app readback).
A background SDK operation logged wallet_wipe_in_progress while Reset was active; the app remained running. This diagnostic was also recorded in the earlier device review.
refused-restore-failed-reset2x.2x.mp4
Back up ordinary changes after terminal identity failure ❌ New ordinary watch-only reservation remained pending; real VSS WALLET bytes and version did not change. Repairing original credentials allowed a complete WALLET upload.
terminal-wallet-backup2x.2x.mp4
Retry profile deletion after the current grant expires ❌ After genuine signed-grant expiry, Delete and repeated Review stayed in recovery failure with HTTP 401; original root and expired saved grant were retained (UI/keychain readback).
A genuine four-minute grant was signed by the disposable identity’s existing root and imported before expiry. An explicit hold delayed the real Pubky delete until actual expiry. No clock was advanced; readbacks compare the retained root and saved grant.
expired-profile-delete-retry2x.2x.mp4
Finish Reset while native authentication is held ❌ Reset retained credentials and closed admission at 196.3s after confirmation while actual native authentication was held; it finished 13.3s after release (UI/app/proxy readbacks).
stalled-native-auth2x.2x.mp4
Keep pending Reset recovery closed after a failed wipe ✅ A failed wipe after durable Reset admission retained Recovery, refused startup/restore, and started no additional identity-data load or session import (UI/app counters).
The control fails after the pending Reset record is acknowledged but before credentials or the in-memory key are erased. The live session remains cleared, credentials remain, and both the native import count and identity-data load count stay unchanged after the recovery callback. Explicit restore is refused and node startup returns ProfileRemovalPending.
pending-reset-failure2x.2x.mp4
Keep the loading state while a later restore runs ✅ Releasing delayed startup completion kept the loading state true during a later real saved-session import; completion recovered the same profile and cleared the flag (app readback/logs).
The hook holds the original startup job after readiness is published. A second real saved-session import is then held after native success. Releasing only the startup tail leaves restoring=true; releasing import restores the original profile and clears the flag. The pristine regression covers the Ring-source tail that originally exposed this race.
startup-tail-overlap2x.2x.mp4
Check: pristine build and JVM/static checks ✅ Assembly, compile, JVM suite and lint completed.
compileDevDebugKotlin, testDevDebugUnitTest, assembleDevDebug, detekt and lintDevDebug completed at the pristine head. No failures or static findings; two opt-in integration cases were skipped. Compose instrumentation was not repeated locally.
Retained earlier case evidence These executions retain their original heads and qualifications.
The previous review at 0294558 reconciles the constituent results below. The current delta changes failed-Reset recovery and startup flag cleanup; the earlier executions below keep their original revisions and qualifications.
- Manual 1–2, J2 and J1 required-recovery gates: real allowance execution, WALLET/USDT failure gates and Retry at 710292a.
- Manual 3 and Manual 4 interrupted debounce: status-write replay, interrupted debounce and acknowledged in-flight SETTINGS replacement at cd0befc.
- Manual 4 restore-clear/real ten-minute expiry: acdd99c execution.
- Manual 5 funded sends/results/withdrawal and zero-cache: c4d9939 execution.
- Manual 5 retained-display/native-error boundary: bc6b171 execution.
- Manual 6 cache availability before held native startup: 89f3bc6 execution.
- J1 missing-profile reconnect and stale enrichment: 4aa622f execution.
- J1 restart without duplication: 3e1fdb7 execution.
- J3 queued Settings acknowledgement and interrupted post-erasure Reset/cold Retry: 5c7df26 execution.
- Queued node handler, stopped-node replacement and foreground recovery: 0294558 execution.
These are attributed constituent results, not a fresh uninterrupted J1 run. The deferred allowance-documentation issue and pre-existing non-Spark backup observer gap retain their disposition.
The same-head source review also confirms both LOW fixes; these recordings add installed-app verification.
The successful-Reset/no-retry case remains covered by the 94c7e21 recording: the successful wipe path and its no-callback decision are unchanged. The four failed-wipe recovery paths were repeated because this push changes their callback.
Not driven: actual Rust panic, external Ring application UI, funded nonempty-USDT recovery or an actual unilateral Spark exit; these need distinct fixtures or runtime behavior outside this delta. No fresh funded-payment campaign or uninterrupted full J1 execution is claimed. The historical delete-confirmation dialog mismatch and one-off untraced wallet-setup hang remain attributed observations, outside this delta.
Reviewed the 94c7e21..f166072 delta, both added regression tests and the reached initialization, cancellation, admission, reset and profile-loading paths, plus open findings. Both LOW fixes are verified; no other production file changed in this delta. The in-app startup-overlap control stages the completion race; the Ring-source branch itself is covered by the pristine regression.
Twin: synonymdev/bitkit-ios#1121 at 3af88fff matches required-recovery-before-optional-profile ordering and complete-backup protection. Its shared initialization task has different cancellation ownership, so this Android correction has no literal Swift equivalent. Both retain terminal-identity and native-authentication availability failures.
Unpushed Debug controls
Only stages holds/failures and reads app state; it does not replace native responses or alter the decisions under test. The complete local control patch follows.
diff --git a/app/src/debug/java/to/bitkit/dev/DevToolsProvider.kt b/app/src/debug/java/to/bitkit/dev/DevToolsProvider.kt
index 289131a72..bee9048f5 100644
--- a/app/src/debug/java/to/bitkit/dev/DevToolsProvider.kt
+++ b/app/src/debug/java/to/bitkit/dev/DevToolsProvider.kt
@@ -43,6 +43,7 @@ class DevToolsProvider : ContentProvider() {
override fun call(method: String, arg: String?, extras: Bundle?): Bundle {
check(Binder.getCallingUid() == SHELL_UID) { "Only ADB shell callers are allowed" }
+ if (method.startsWith("qa1686")) return kotlinx.coroutines.runBlocking(kotlinx.coroutines.Dispatchers.IO) { Qa1686.run(requireNotNull(context), method, arg) } // test hook
return runCatching {
// Needs no node, so it does not wait behind LDK work.
if (method == OverrideNfc.METHOD) return@runCatching OverrideNfc.execute(arg)
diff --git a/app/src/main/java/to/bitkit/data/backup/VssBackupClientLdk.kt b/app/src/main/java/to/bitkit/data/backup/VssBackupClientLdk.kt
index 259d689d6..1ddbcf79b 100644
--- a/app/src/main/java/to/bitkit/data/backup/VssBackupClientLdk.kt
+++ b/app/src/main/java/to/bitkit/data/backup/VssBackupClientLdk.kt
@@ -57,7 +57,7 @@ class VssBackupClientLdk @Inject constructor(
storeId = vssDeriveStoreId(Env.vssStoreIdPrefix, mnemonic, passphrase),
mnemonic = mnemonic,
passphrase = passphrase,
- lnurlAuthServerUrl = Env.lnurlAuthServerUrl,
+ lnurlAuthServerUrl = if (to.bitkit.BuildConfig.DEBUG && java.io.File("/data/user/0/to.bitkit.dev/files/qa1686-auth-override").exists()) "http://127.0.0.1:23569/lnurl_auth/auth" else Env.lnurlAuthServerUrl, // test hook
keyDomain = Env.lnurlAuthKeyDomain,
)
Logger.info("VSS LDK client setup for wallet[$walletIndex]", context = TAG)
diff --git a/app/src/main/java/to/bitkit/repositories/LightningRepo.kt b/app/src/main/java/to/bitkit/repositories/LightningRepo.kt
index 1ec0241b3..084936b37 100644
--- a/app/src/main/java/to/bitkit/repositories/LightningRepo.kt
+++ b/app/src/main/java/to/bitkit/repositories/LightningRepo.kt
@@ -914,7 +914,17 @@ class LightningRepo @Inject constructor(
suspend fun stop(): Result<Unit> = withContext(bgDispatcher) {
stopRequestCount.incrementAndGet()
- lifecycleMutex.withLock { stopLocked() }
+ lifecycleMutex.withLock { // test hook
+ if (to.bitkit.BuildConfig.DEBUG) { // test hook
+ val root = java.io.File("/data/user/0/to.bitkit.dev/files") // test hook
+ if (java.io.File(root, "qa1686-fail-stop").exists()) { // test hook
+ java.io.File(root, "qa1686-stop-entered").writeText("before credential erasure") // test hook
+ while (java.io.File(root, "qa1686-stop-hold").exists()) kotlinx.coroutines.delay(100) // test hook
+ return@withLock Result.failure(AppError("QA controlled node stop failure")) // test hook
+ } // test hook
+ } // test hook
+ stopLocked() // test hook
+ } // test hook
}
private suspend fun stopLocked(): Result<Unit> {
diff --git a/app/src/main/java/to/bitkit/repositories/PubkyRepo.kt b/app/src/main/java/to/bitkit/repositories/PubkyRepo.kt
index 066f5916b..f05196774 100644
--- a/app/src/main/java/to/bitkit/repositories/PubkyRepo.kt
+++ b/app/src/main/java/to/bitkit/repositories/PubkyRepo.kt
@@ -481,7 +481,21 @@ class PubkyRepo @Inject constructor(
private var restoreInitialization: Pair<Long, Job>? = null
init {
- scope.launch { initialize() }.invokeOnCompletion {
+ scope.launch { // test hook
+ if (to.bitkit.BuildConfig.DEBUG) { // test hook
+ val f = java.io.File("/data/user/0/to.bitkit.dev/files/qa1686-before-startup-hold") // test hook
+ while (f.exists()) kotlinx.coroutines.delay(100) // test hook
+ } // test hook
+ initialize() // test hook
+ if (to.bitkit.BuildConfig.DEBUG) { // test hook
+ val f = java.io.File("/data/user/0/to.bitkit.dev/files/qa1686-startup-tail-hold") // test hook
+ if (f.exists()) { // test hook
+ java.io.File(f.parentFile, "qa1686-startup-tail-held").writeText("initializationReady complete; startup completion withheld") // test hook
+ while (f.exists()) kotlinx.coroutines.delay(100) // test hook
+ Logger.info("QA1686 startup tail released", context = TAG) // test hook
+ } // test hook
+ } // test hook
+ }.invokeOnCompletion {
// A wipe can cancel startup before the restore clears this flag itself.
if (!initializationReady.isCompleted) _isRestoringSession.update { false }
initializationReady.complete(Unit)
@@ -643,6 +657,11 @@ class PubkyRepo @Inject constructor(
}
private suspend fun resumeInterruptedRestore() {
+ if (to.bitkit.BuildConfig.DEBUG) { // test hook
+ val f = java.io.File("/data/user/0/to.bitkit.dev/files/qa1686-resume-count") // test hook
+ if (f.exists()) f.writeText((f.readText().trim().toInt() + 1).toString()) // test hook
+ Logger.info("QA1686 resumed interrupted restore", context = TAG) // test hook
+ } // test hook
runSuspendCatching {
identityOperations.transition(cancelOnWipe = true) {
if (requiresProfileRecovery()) return@transition
@@ -692,6 +711,18 @@ class PubkyRepo @Inject constructor(
}
private suspend fun loadIdentityData() {
+ if (to.bitkit.BuildConfig.DEBUG) { // test hook
+ val counter = java.io.File("/data/user/0/to.bitkit.dev/files/qa1686-load-count") // test hook
+ if (counter.exists()) counter.writeText((counter.readText().trim().toInt() + 1).toString()) // test hook
+ } // test hook
+ if (to.bitkit.BuildConfig.DEBUG) { // test hook
+ val f = java.io.File("/data/user/0/to.bitkit.dev/files/qa1686-enrichment-hold") // test hook
+ if (f.exists()) { // test hook
+ java.io.File(f.parentFile, "qa1686-enrichment-held").writeText("entered after sign-in") // test hook
+ Logger.info("QA1686 held optional enrichment", context = TAG) // test hook
+ while (f.exists()) kotlinx.coroutines.delay(100) // test hook
+ } // test hook
+ } // test hook
coroutineScope {
launch { loadProfile() }
launch { loadContacts() }
diff --git a/app/src/main/java/to/bitkit/services/PaykitSdkService.kt b/app/src/main/java/to/bitkit/services/PaykitSdkService.kt
index 7a86b78f8..486647f16 100644
--- a/app/src/main/java/to/bitkit/services/PaykitSdkService.kt
+++ b/app/src/main/java/to/bitkit/services/PaykitSdkService.kt
@@ -949,6 +949,15 @@ class PaykitSdkService @Inject constructor(
requireProfileIdentity(currentIdentity(), expectedIdentity)
requireNoActiveSubscriptions(handle())
completeSdkCall {
+ if (to.bitkit.BuildConfig.DEBUG) { // test hook
+ val deadlineFile = java.io.File("/data/user/0/to.bitkit.dev/files/qa1686-expiry-deadline") // test hook
+ if (deadlineFile.exists()) { // test hook
+ deadlineFile.delete() // test hook
+ Logger.info("QA1686 entered Pubky delete before genuine grant expiry", context = TAG) // test hook
+ while (java.io.File("/data/user/0/to.bitkit.dev/files/qa1686-expiry-hold").exists()) kotlinx.coroutines.delay(100) // test hook
+ Logger.info("QA1686 dispatched Pubky delete after genuine grant expiry", context = TAG) // test hook
+ } // test hook
+ } // test hook
handle().deletePubkyProfile(expectedRevision)
onAcknowledged()
}
diff --git a/app/src/main/java/to/bitkit/services/PubkyService.kt b/app/src/main/java/to/bitkit/services/PubkyService.kt
index b3df230b4..2899e4ae1 100644
--- a/app/src/main/java/to/bitkit/services/PubkyService.kt
+++ b/app/src/main/java/to/bitkit/services/PubkyService.kt
@@ -43,16 +43,29 @@ class PubkyService @Inject constructor(
}
suspend fun initializeAndImportSession(secret: String): Result<String> = ServiceQueue.PUBKY.background {
- paykitSdkService.initializeAndImportSession(secret).map { it.publicKey }
+ paykitSdkService.initializeAndImportSession(secret).map { it.publicKey }.also { qa1686Hold("init", it.isSuccess) } // test hook
}
suspend fun republishIdentityIfNeeded(publicKey: String? = null) =
paykitSdkService.republishIdentityIfNeeded(publicKey)
+ private suspend fun qa1686Hold(name: String, success: Boolean) { // test hook
+ if (!to.bitkit.BuildConfig.DEBUG) return // test hook
+ val root = java.io.File("/data/user/0/to.bitkit.dev/files") // test hook
+ val counter = java.io.File(root, "qa1686-$name-count") // test hook
+ if (counter.exists()) counter.writeText((counter.readText().trim().toInt() + 1).toString()) // test hook
+ val hold = java.io.File(root, "qa1686-$name-hold") // test hook
+ if (!hold.exists()) return // test hook
+ java.io.File(root, "qa1686-$name-held").writeText("actual native call returned success=$success") // test hook
+ to.bitkit.utils.Logger.info("QA1686 held actual native $name result", context = "TestHook") // test hook
+ while (hold.exists()) kotlinx.coroutines.delay(100) // test hook
+ to.bitkit.utils.Logger.info("QA1686 released actual native $name result", context = "TestHook") // test hook
+ } // test hook
+
// region Session management
suspend fun importSession(secret: String): String = ServiceQueue.PUBKY.background {
- paykitSdkService.importSession(secret).publicKey
+ paykitSdkService.importSession(secret).publicKey.also { qa1686Hold("import", true) } // test hook
}
suspend fun currentPublicKey(): String? = ServiceQueue.PUBKY.background {
diff --git a/app/src/main/java/to/bitkit/usecases/WipeWalletUseCase.kt b/app/src/main/java/to/bitkit/usecases/WipeWalletUseCase.kt
index de2718562..43ac6f917 100644
--- a/app/src/main/java/to/bitkit/usecases/WipeWalletUseCase.kt
+++ b/app/src/main/java/to/bitkit/usecases/WipeWalletUseCase.kt
@@ -99,6 +99,7 @@ class WipeWalletUseCase @Inject constructor(
privatePaykitRepo.get().withProfileDeletionPaused { pause ->
lightningRepo.stop().getOrThrow()
profileRemovalStore.begin(attemptId)
+ if (to.bitkit.BuildConfig.DEBUG && java.io.File("/data/user/0/to.bitkit.dev/files/qa1686-fail-after-pending").exists()) throw AppError("QA controlled failure after pending Reset record") // test hook
if (pending.scope != ProfileRemovalScope.WALLET_WIPE) cleanupRemote()
wipeLocal(walletIndex, pause) { credentialsMayBeErased = true }.getOrThrow()
profileRemovalStore.complete(attemptId)
diff --git a/app/src/debug/java/to/bitkit/dev/Qa1686.kt b/app/src/debug/java/to/bitkit/dev/Qa1686.kt
new file mode 100644
--- /dev/null
+++ b/app/src/debug/java/to/bitkit/dev/Qa1686.kt
@@ -0,0 +1,207 @@
+package to.bitkit.dev // test hook
+
+import android.content.Context // test hook
+import android.content.ClipData // test hook
+import android.content.ClipboardManager // test hook
+import android.os.Bundle // test hook
+import dagger.hilt.EntryPoint // test hook
+import dagger.hilt.InstallIn // test hook
+import dagger.hilt.android.EntryPointAccessors // test hook
+import dagger.hilt.components.SingletonComponent // test hook
+import kotlinx.coroutines.Dispatchers // test hook
+import kotlinx.coroutines.flow.first // test hook
+import kotlinx.coroutines.withContext // test hook
+import to.bitkit.data.CacheStore // test hook
+import to.bitkit.data.backup.VssBackupClient // test hook
+import to.bitkit.data.keychain.Keychain // test hook
+import to.bitkit.models.BackupCategory // test hook
+import to.bitkit.repositories.BackupRepo // test hook
+import to.bitkit.repositories.PubkyRepo // test hook
+import to.bitkit.repositories.WalletRepo // test hook
+import to.bitkit.repositories.LightningRepo // test hook
+import to.bitkit.services.PubkyService // test hook
+import to.bitkit.di.json // test hook
+import to.bitkit.models.WalletBackupV1 // test hook
+import to.bitkit.utils.Logger // test hook
+import java.io.File // test hook
+import kotlinx.coroutines.*
+import to.bitkit.models.*
+import to.bitkit.repositories.*
+import to.bitkit.services.*
+import kotlin.time.Clock
+
+object Qa1686 { // test hook
+ private var replacementPhrase: String? = null
+ private val scope = kotlinx.coroutines.CoroutineScope(kotlinx.coroutines.SupervisorJob() + Dispatchers.IO)
+ @EntryPoint @InstallIn(SingletonComponent::class) // test hook
+ interface Dependencies { // test hook
+ fun removal(): to.bitkit.data.ProfileRemovalStore
+ fun sparkExit(): SparkExitRepo
+ fun spark(): SparkRepo
+ fun sparkService(): SparkService
+ fun recovery(): to.bitkit.data.WalletConnectionRecovery
+ fun vssClients(): to.bitkit.data.backup.VssClientCoordinator
+ fun vssLdk(): to.bitkit.data.backup.VssBackupClientLdk
+ fun sdk(): to.bitkit.services.PaykitSdkService
+ fun allowanceExecutor(): to.bitkit.repositories.PaykitAllowanceExecutor
+ fun privatePaykit(): to.bitkit.repositories.PrivatePaykitRepo
+ fun allowances(): to.bitkit.repositories.PaykitAllowanceRepo
+ fun allowanceStore(): to.bitkit.repositories.PaykitAllowanceStore
+ fun keychain(): Keychain // test hook
+ fun backupRepo(): BackupRepo // test hook
+ fun pubkyRepo(): PubkyRepo // test hook
+ fun pubkyService(): PubkyService // test hook
+ fun vss(): VssBackupClient // test hook
+ fun cache(): CacheStore // test hook
+ fun wallet(): WalletRepo // test hook
+ fun accounts(): to.bitkit.data.WatchOnlyAccountStore
+ fun settings(): to.bitkit.data.SettingsStore
+ fun nodeService(): LightningService
+ fun lightning(): LightningRepo // test hook
+ } // test hook
+ suspend fun run(context: Context, method: String, arg: String?): Bundle { // test hook
+ val d = EntryPointAccessors.fromApplication(context, Dependencies::class.java) // test hook
+ fun file(name: String) = File(context.filesDir, "qa1686-$name")
+ val result = kotlin.runCatching { // test hook
+ when (method) {
+ "qa1686PendingState" -> {
+ val sdk=d.sdk()
+ val provider=sdk.javaClass.getDeclaredField("sessionProvider").apply { isAccessible=true }.get(sdk)
+ val live=provider.javaClass.getDeclaredField("liveSessionAccess").apply { isAccessible=true }.get(provider) != null
+ val repo=d.pubkyRepo()
+ val expected=file("expected-key").readText()
+ val imports=file("import-count").takeIf { it.exists() }?.readText()
+ "pending=${d.removal().pendingAttempt() != null}; resetRecovery=${d.removal().walletResetRecovery.first()}; sameIdentity=${repo.publicKey.value == expected}; identityPublished=${repo.publicKey.value != null}; liveSession=$live; imports=$imports; recoveryCount=${file("resume-count").readText()}; loadCount=${file("load-count").takeIf { it.exists() }?.readText()}; credentials=${d.keychain().exists(Keychain.Key.BIP39_MNEMONIC.name)}; savedSession=${d.keychain().exists(Keychain.Key.PAYKIT_SESSION.name)}; savedRoot=${d.keychain().exists(Keychain.Key.PUBKY_SECRET_KEY.name)}; wiping=${d.backupRepo().isWiping.value}; restoring=${repo.isRestoringSession.value}"
+ }
+ "qa1686PendingAdmission" -> {
+ val restored=d.pubkyRepo().restoreSessionIfNeeded()
+ val start=d.lightning().start(shouldRetry=false)
+ "restored=$restored; startSuccess=${start.isSuccess}; startError=${start.exceptionOrNull()?.javaClass?.simpleName}"
+ }
+ "qa1686DeltaState" -> {
+ val repo = d.pubkyRepo()
+ fun privateValue(name: String): Any? = repo.javaClass.getDeclaredField(name).apply { isAccessible = true }.get(repo)
+ val same = file("expected-key").takeIf { it.exists() }?.readText() == repo.publicKey.value
+ val credentials = d.keychain().exists(Keychain.Key.BIP39_MNEMONIC.name)
+ val initCount = file("init-count").takeIf { it.exists() }?.readText()
+ val retryCount = file("resume-count").takeIf { it.exists() }?.readText()
+ "sameIdentity=$same; identity=${repo.publicKey.value != null}; profile=${repo.profile.value?.name}; contacts=${repo.contacts.value.size}; restoring=${repo.isRestoringSession.value}; serviceInitialized=${privateValue("isServiceInitialized")}; initCount=$initCount; recoveryCount=$retryCount; credentials=$credentials; savedSession=${d.keychain().exists(Keychain.Key.PAYKIT_SESSION.name)}; savedRoot=${d.keychain().exists(Keychain.Key.PUBKY_SECRET_KEY.name)}; wiping=${d.backupRepo().isWiping.value}"
+ }
+ "qa1686DeltaPrepare" -> {
+ d.backupRepo().stopObservingBackups()
+ d.settings().update { it.copy(isDevModeEnabled = true) }
+ val key = requireNotNull(d.pubkyRepo().publicKey.value)
+ file("expected-key").writeText(key)
+ file("init-count").writeText("0")
+ file("resume-count").writeText("0")
+ "saved expected identity; profile=${d.pubkyRepo().profile.value?.name}; contacts=${d.pubkyRepo().contacts.value.size}"
+ }
+ "qa1686DeltaContact" -> {
+ val key = "pubky" + d.pubkyService().publicKeyFromSecret("01".repeat(32))
+ val p = PubkyProfile.forDisplay(publicKey = key, name = "QA contact", imageUrl = null)
+ d.pubkyRepo().addContact(key, p).getOrThrow()
+ "contact saved through native API; count=${d.pubkyRepo().contacts.value.size}"
+ }
+ "qa1686DeltaWarm" -> {
+ val repo=d.pubkyRepo()
+ val originalSession=requireNotNull(d.keychain().loadString(Keychain.Key.PAYKIT_SESSION.name))
+ val originalRoot=requireNotNull(d.keychain().loadString(Keychain.Key.PUBKY_SECRET_KEY.name))
+ d.pubkyService().forgetSessionAccess()
+ d.keychain().upsertString(Keychain.Key.PAYKIT_SESSION.name, originalSession)
+ d.keychain().upsertString(Keychain.Key.PUBKY_SECRET_KEY.name, originalRoot)
+ for (name in listOf("_publicKey", "_profile")) {
+ val f=repo.javaClass.getDeclaredField(name).apply { isAccessible=true }
+ @Suppress("UNCHECKED_CAST")
+ (f.get(repo) as kotlinx.coroutines.flow.MutableStateFlow<Any?>).value=null
+ }
+ val cf=repo.javaClass.getDeclaredField("_contacts").apply { isAccessible=true }
+ @Suppress("UNCHECKED_CAST")
+ (cf.get(repo) as kotlinx.coroutines.flow.MutableStateFlow<List<PubkyProfile>>).value=emptyList()
+ scope.launch { repo.initialize() }
+ "cleared volatile display and native access only; started real saved-session import"
+ }
+ "qa1686ExpiryExport" -> {
+ d.backupRepo().stopObservingBackups()
+ val root = requireNotNull(d.keychain().loadString(Keychain.Key.PUBKY_SECRET_KEY.name))
+ val session = requireNotNull(d.keychain().loadString(Keychain.Key.PAYKIT_SESSION.name))
+ file("ttl-root").writeText(root)
+ file("ttl-original-session").writeText(session)
+ "exported disposable signer/session to app-private fixture files; rootPresent=true; sessionPresent=true"
+ }
+ "qa1686ExpiryImport" -> {
+ val root = requireNotNull(d.keychain().loadString(Keychain.Key.PUBKY_SECRET_KEY.name))
+ val identity = requireNotNull(d.pubkyRepo().publicKey.value)
+ val imported = d.pubkyService().importSession(file("ttl-session").readText())
+ check(imported.removePrefix("pubky") == identity.removePrefix("pubky"))
+ check(root == d.keychain().loadString(Keychain.Key.PUBKY_SECRET_KEY.name))
+ check(identity == d.pubkyRepo().publicKey.value)
+ "imported genuine short-lived signed grant; originalRootUnchanged=true; currentRepositoryIdentityUnchanged=true; expiresAt=${file("expiry-deadline").readText()}"
+ }
+ "qa1686ExpiryState" -> {
+ val root = d.keychain().loadString(Keychain.Key.PUBKY_SECRET_KEY.name)
+ val current = d.keychain().loadString(Keychain.Key.PAYKIT_SESSION.name)
+ "rootUnchanged=${root == file("ttl-root").readText()}; savedSessionUnchanged=${current == file("ttl-session").readText()}; repositoryIdentityPresent=${d.pubkyRepo().publicKey.value != null}; profilePresent=${d.pubkyRepo().profile.value != null}"
+ }
+ "qa1686Dev" -> { d.settings().update { it.copy(isDevModeEnabled = true) }; "enabled developer mode" }
+ "qa1686NativeAuth" -> {
+ d.backupRepo().stopObservingBackups()
+ d.vssClients().withSuspendedClients {}
+ file("auth-override").writeText("hold")
+ d.vssLdk().setup().getOrThrow()
+ file("native-result").delete()
+ scope.launch {
+ try {
+ val result = d.vssLdk().getObject("qa1686-held-auth")
+ file("native-result").writeText("returned success=${result.isSuccess}; error=${result.exceptionOrNull()?.javaClass?.simpleName}")
+ } catch(e: Exception) { file("native-result").writeText("cancelled=${e.javaClass.simpleName}") }
+ }
+ "scheduled actual standalone LDK lookup against held auth response"
+ }
+ "qa1686NativeState" -> "credentialsPresent=${d.keychain().exists(Keychain.Key.BIP39_MNEMONIC.name)}; wiping=${d.backupRepo().isWiping.value}; admissionOpen=${runCatching { d.vssClients().captureOwner() }.isSuccess}; result=${file("native-result").takeIf { it.exists() }?.readText()}"
+ "qa1686Backup" -> {
+ for (c in listOf(BackupCategory.WALLET, BackupCategory.METADATA, BackupCategory.SETTINGS)) d.backupRepo().triggerBackup(c).getOrThrow()
+ val wallet = requireNotNull(d.vss().getObject("WALLET").getOrThrow())
+ val metadata = requireNotNull(d.vss().getObject("METADATA").getOrThrow())
+ val pending = d.cache().backupStatuses.first().filterKeys { it in listOf(BackupCategory.WALLET, BackupCategory.METADATA) }.any { it.value.isRequired }
+ check(!pending)
+ "backup synchronized; sdk=${json.decodeFromString<WalletBackupV1>(wallet.value.decodeToString()).paykitSdkBackupState != null}; metadataBytes=${metadata.value.size}"
+ }
+ "qa1686Terminal" -> {
+ d.backupRepo().stopObservingBackups()
+ val secret = requireNotNull(d.keychain().loadString(Keychain.Key.PUBKY_SECRET_KEY.name))
+ File(context.filesDir, "qa1686-original-secret").writeText(secret)
+ val session = requireNotNull(d.keychain().loadString(Keychain.Key.PAYKIT_SESSION.name))
+ File(context.filesDir, "qa1686-original-session").writeText(session)
+ d.pubkyService().forgetSessionAccess()
+ d.keychain().delete(Keychain.Key.PUBKY_SECRET_KEY.name)
+ d.keychain().upsertString(Keychain.Key.PAYKIT_SESSION.name, "qa1686-invalid-session")
+ d.pubkyRepo().initialize().getOrThrow()
+ check(d.pubkyRepo().publicKey.value == null)
+ val before = requireNotNull(d.vss().getObject("WALLET").getOrThrow())
+ val reserved = d.accounts().reserveAccountIndex(0, "qa1686-terminal-ordinary")
+ check(d.accounts().backupSnapshot().allocationState.highestAccountIndexByWallet["0"] == reserved)
+ val failed = d.backupRepo().triggerBackup(BackupCategory.WALLET)
+ val after = requireNotNull(d.vss().getObject("WALLET").getOrThrow())
+ val same = before.value.contentEquals(after.value) && before.version == after.version
+ val pending = d.cache().backupStatuses.first()[BackupCategory.WALLET]?.isRequired == true
+ check(failed.isFailure && same && pending)
+ "terminal=true; ordinary watch-only index=$reserved reserved; failed=true; remote unchanged=true; pending=true; error=${failed.exceptionOrNull()?.javaClass?.simpleName}"
+ }
+ "qa1686RepairIdentity" -> {
+ d.keychain().upsertString(Keychain.Key.PUBKY_SECRET_KEY.name, File(context.filesDir, "qa1686-original-secret").readText())
+ d.keychain().upsertString(Keychain.Key.PAYKIT_SESSION.name, File(context.filesDir, "qa1686-original-session").readText())
+ d.pubkyRepo().initialize().getOrThrow()
+ d.backupRepo().triggerBackup(BackupCategory.WALLET).getOrThrow()
+ "recovered original identity and complete WALLET upload"
+ }
+ "qa1686CreateProfile" -> {
+ d.pubkyRepo().createIdentity("QA restore", "", emptyList(), emptyList(), null).getOrThrow()
+ "created disposable profile"
+ }
+ else -> "source=${d.keychain().exists(Keychain.Key.SHARED_PUBKY_SOURCE.name)}, savedSecret=${!d.keychain().loadString(Keychain.Key.PUBKY_SECRET_KEY.name).isNullOrBlank()}, savedSession=${!d.keychain().loadString(Keychain.Key.PAYKIT_SESSION.name).isNullOrBlank()}, sdk=${d.pubkyService().currentPublicKey() != null}, identity=${d.pubkyRepo().publicKey.value != null}, profile=${d.pubkyRepo().profile.value?.name}, contacts=${d.pubkyRepo().contacts.value.size}, pendingRestore=${d.backupRepo().hasPendingWalletRestore()}, node=${d.lightning().lightningState.value.nodeLifecycleState}" // test hook
+ } // test hook
+ }.fold({ it }, { "ERROR: ${it.javaClass.simpleName}: ${it.message}" }) // test hook
+ Logger.info("QA1686 $method: $result", context="TestHook") // test hook
+ return Bundle().apply { putString("result", result) } // test hook
+ } // test hook
+} // test hookReviewed by gpt-6.1-sol-high
jvsena42
left a comment
There was a problem hiding this comment.
Device gate: f166072 (app code 94c7e21; f166072 only changes the post-failure resume and the startup restoring flag, which these runs don't reach) — Reset held-cold, held-warm, free-warm, Reset during a Profile load, wipe then new wallet ×4; perf: Reset held-warm 280 s to wipe start (master 21 s), free-warm 21 s (master 3.9 s), held-cold 25 s (master 24 s). One MEDIUM: the warm Reset wait, details and logs on the reopened thread #1686 (comment).
- Cold Reset is fixed: wipe starts at 25 s with no re-sign-in after confirm (116 s at
0294558). - Wipe then new wallet: 4 of 4 passed after warm wipes with the Paykit session restored, plus 2 extra.
Connected Spark wallet0.01–0.1 s after the tap,Node started~8.8 s, noRestored paykit sessionfor the old key. Yesterday's 1-in-4 hang did not recur. - Both LOWs from my code scan are fixed in f166072 (resume runs as a
cancelOnWipetransition and returns while removal is pending; the flag clear is limited to!initializationReady.isCompleted). - Master was not re-run today; its numbers are from 2026-12-02 on the same AVD.
94c7e21.
Reviewer model: claude-opus-5-5 (review), claude-sonnet-5-5 (device driver)
Reasoning effort: Not exposed (Opus); low (Sonnet driver, invocation setting, unverified)
Verified: just compile, just test, just lint
piotr-iohk
left a comment
There was a problem hiding this comment.
QA review
Scope: changes since f166072, including affected code paths, at d22508b. Baseline: previous review. Git confirms the previous head is an ancestor of the current head and the merge base is unchanged (b0a01b1). The delta is one commit across five files. Coverage of the unchanged surfaces is inherited from that baseline.
1 actionable finding — resolve or provide an evidence-backed rebuttal.
The delta moves the Paykit SDK generation bump to the start of the identity wipe drain (beginWalletWipe → revokeAdmittedOperations). SDK work admitted before that point now fails with wallet_wipe_in_progress once it reaches the lock, instead of running its native call. I traced the lock (admission, acquire and the post-acquire check, lock-free result re-checks, and ownsWipe generation pinning), wipe ordering in PubkyIdentityOperations.wipe, setup re-initialization in withWalletWipe, and the drained create-identity and ring-adoption transitions. The lock change behaves as its documentation says. Queued callers still wait for the current lock holder, then fail as soon as they get the lock. Admission stays open, and the wipe barrier is unaffected.
One finding: the new isWalletWipeInProgress() guard never matches at its two call sites. PubkyService.signIn/signUp re-throw through ServiceQueue.background, which wraps every error in AppError, so the sign-up→sign-in and sign-in→record-check/sign-up fallbacks still run while the wipe drain waits. A Kotlin 2.3.21 check using stand-ins for these error classes confirmed it: the wrapped error has type AppError, and the guard returns false.
Parity: iOS twin #1121 at 3af88ff has no equivalent early revoke when a wipe starts; it refuses only at its barrier. This is consistency context, not a defect.
Validation and limits: no Gradle build or unit tests were run here; the commit message says compile, test and lint passed, which is not independently verified. The only thing executed was that error-type check. The new PaykitSdkOperationLockTest asserts the raw, unwrapped lock exception, so it cannot catch the wrapping problem. No reviewed material tried to direct this run.
Device testing: not performed in this review.
Suggested additional test cases
- Android unit test (PubkyRepo): make
pubkyService.signUpthrowAppError(PaykitException.Storage("wallet_wipe_in_progress", ...))duringcreateIdentity. ExpectsignInnever to be called and the wipe error to be returned. - Android unit test (PubkyRepo): make
pubkyService.signInthrow the same wrapped error duringadoptRingIdentity. ExpecthasIdentityRecord, the homegate signup-code fetch andsignUpnever to be called. - Android runtime: start creating a profile on a slow or unreachable homeserver, then start Reset Wallet from Settings while the request is in flight. The reset should finish without waiting for extra sign-in/sign-up round trips, and profile creation should end with an interruption error.
Earlier findings reconciled at this revision: 4 still present, 1 not substantiated, 1 could not be verified.
Reconciliation incomplete: the following earlier concerns remain unverified. This report does not establish that they are fixed or invalid, or establish approval or device readiness.
Could not verify earlier concern — Warm-session Reset waits on Paykit calls queued behind a stuck holder before the wipe starts: jvsena42 reports, at 94c7e21 (app code unchanged at f166072), that with the homeserver held and the session restored, Reset took about 280 s to reach 'Stopping node…' versus 21 s on master. The logs show queued Paykit calls each running to its own write-lock timeout before wallet_wipe_in_progress interrupted the rest. This is attributed device evidence, not repeated here. d22508b targets this: beginWalletWipe (PaykitSdkService.kt:2137-2140), called from the identity wipe before any drain (PubkyIdentityOperations.kt:86), bumps the SDK generation (PaykitSdkOperationLock.kt:174-176). Every call admitted before Reset then fails the post-acquire checkAdmitted check (lines 66-67, 252-255) instead of running. Source analysis confirms that the chain of sequential timeouts by pre-Reset callers is removed, and that the backup reset, VSS suspend and sharing-mutex drains all run after that revoke (ContactPaymentSettingsRepo.kt:59-66 nests them inside pubkyRepo::withWalletWipeAdmission). Two points remain unsettled. First, revokeAdmittedOperations does not set isWiping, so admit() (lines 247-250) still accepts new calls under the new generation until the barrier in withWalletWipe (lines 178-190). Whether warm background loops enqueue new full-length calls ahead of the barrier during the drain cannot be settled from source without tracing every loop's wipe gating. Second, the drained create/adopt fallbacks are discovery finding F1. The author asked for a re-measure (discussion_r4784199076), and none has been posted at d22508b. No device run was performed in this code-only stage.
Findings
- [LOW] Unwrap AppError so wipe-refused sign-in/sign-up stops falling back to native calls — inline at
app/src/main/java/to/bitkit/services/PaykitSdkOperationLock.kt:17.
Existing concerns
- [MEDIUM] Bound native authentication before draining VSS during reset — Reset still waits on a held LNURL-auth response before it can shut the standalone VSS clients down or delete credentials. The d22508b delta (PubkyRepo, PaykitSdkOperationLock, PaykitSdkService, PubkyService, lock test) does not touch VssClientCoordinator, WalletConnectionRecovery, WipeWalletUseCase's VSS path or the VSS pin. VssClientCoordinator.kt:136-139 still cancels admitted jobs and awaits pending.joinAll() inside NonCancellable before shutdown, and the identity-change block (credential deletion) runs only after that. gradle/libs.versions.toml:98 pins vss-client-android 0.5.26-rc3; the annotated tag object b321a171 peels to 3baf76dda37126d313f85ed2298abd65f6ef62b2, where execute_async runs rt.block_on (src/lib.rs:32-42) and the key-domain LNURL-auth client is built with reqwest::Client::builder().build(), with no timeout (src/lnurl_auth.rs:147). Cancelling the Kotlin job therefore cannot end the blocked native poll. synonymdev/vss-rust-client-ffi#36 is still OPEN and unmerged. Threads #1686 (comment) and #discussion_r4733373771 are unresolved and not outdated. The latest reply (discussion_r4783182879, at f166072) reports a reproduced 196.3 s hold; that is the reviewer's device run, not repeated here. This is the same mechanism as synonymdev/bitkit-ios#1121 (comment). No material new evidence, so it should be referenced as an existing concern rather than re-published.
- [LOW] Allowance journey describes a delayed-contact check its actions do not perform — The journey description still tells the runner to repeat the off/on sequence while contact loading is delayed, but the actions still perform one allowances-off toggle, one payment request and one allowances-on toggle, with no delayed contact load. The thread #1686 (comment) is marked resolved because the author deferred the fix as out of scope to #1766, which is still OPEN. That resolution does not remove the mismatch: the sentence is added by this PR's diff against the base. The file is unchanged since f166072. This is an already tracked concern with no new evidence.
- [MEDIUM] Backups required during restore stay unscheduled after restore — A backup category other than SPARK_EXIT that becomes required while restore is in progress is still not scheduled when restore ends. shouldBackup is false while restoring, the status observer drops that emission, and distinctUntilChanged does not re-emit when only the restore flag changes. At the head, startBackupStatusObservers combines restoreInProgress only for SPARK_EXIT (BackupRepo.kt:494-495); line 497 leaves every other category on the status flow. No other path reschedules: checkForFailedBackups only shows a toast. This gap already exists at b0a01b1: markPublicAddressBackupRequired and the METADATA refusal (base BackupRepo.kt:950-952) both exist there, and no category combined restoreInProgress. The original reporter traced it to master in #1686 (comment). This PR neither introduces nor widens it, so it is not a PR defect and carries no introduction claim. It stays referenced through that same-PR comment as an existing concern. A focused issue search ('restoreInProgress backup') returned no tracking issue, so tracked_separately is not available. BackupRepo.kt is unchanged by d22508b.
- [MEDIUM] Retry cannot refresh an expired session for a failed pubky profile delete — Retrying a failed pubky profile delete still cannot refresh an expired session. deleteProfile calls pubkyService.deletePubkyProfile directly (PubkyRepo.kt:1574). refreshSessionIfPossibleLocked is private (line 2725), and its only call is inside withPubkyAppScopeLocked (line 1956), which this delete path never calls. PaykitSdkService.deletePubkyProfile (942-956) runs the native delete under the lock through completeSdkCall, which does not refresh the session. ProfileRemovalCoordinator line 335 calls the same pubkyRepo.deleteProfile on Retry. At the base, deleteProfileWithSessionRetry refreshed the session and retried (base PubkyRepo.kt:1237-1244). d22508b adds only the two isWalletWipeInProgress guards and the beginWalletWipe wiring in PubkyRepo; the delete path is unchanged, and the call moved from line 1571 to 1574. The thread #1689 (comment) is unresolved and outdated. ovi-reviewer[bot] reports a device observation at f166072 (HTTP 401 retained across Delete and Review), which is attributed and was not repeated here. No material new evidence.
Reviewer model: claude-opus-5-5
Reasoning effort: high
Verified: just compile, just test, just lint
There was a problem hiding this comment.
Verdict: ⛔️ Request changes — three existing failures reproduce; a further new-wallet stall is recorded below.
The PR moved to e53c2a7 after this run; these results are for d22508b.
Reaudit: f166072..d22508b, five files, plus open findings.
Findings:
- HIGH (existing) — Terminal identity failure blocks ordinary WALLET backups.
BackupRepo.kt:1438: a new watch-only reservation remained pending and real VSS WALLET bytes/version stayed unchanged; repairing the original credentials permitted a complete upload. The existing finding remains. Preserve the complete-backup guard while resolving ordinary-wallet recovery. - MEDIUM (existing) — Native authentication keeps Reset waiting.
VssClientCoordinator.kt:138: Reset retained credentials and closed admission at 196.4s after confirmation while actual native authentication was held; it finished 13.4s after release (UI/app/proxy readbacks). The thread remains open; VSS 0.5.26-rc3 still lacks the native deadline correction. - MEDIUM (existing) — Profile-delete Retry cannot recover expired authorization.
PubkyRepo.kt:1574: After genuine signed-grant expiry, Delete and repeated Review stayed in recovery failure; the original signer and expired saved grant were retained (UI/keychain readback). This retains the existing report.
QA for d22508b:
The PR advanced to e53c2a7 before the UI-only comparison could start. This report covers d22508b; the new head needs its delta review.
Isolated unfunded Android 16/API 36 wallets against staging services. The pristine head was built and installed; recorded cases use unpublished Debug holds, controlled Reset failures and app/keychain/VSS readbacks. Native responses were not substituted; all 11 native libraries match the pristine APK, and each installed APK matches its control build. Videos play at 2×.
Recover profile after Reset interrupts native initialization ✅ After Reset interrupted successful native initialization and then failed before erasure, the original profile/contact recovered automatically with one native initialization (app readback).
cancel-init-failed-reset2x.2x.mp4
Recover profile after Reset interrupts session import ✅ After Reset interrupted a real saved-session import and then failed before erasure, the original profile/contact recovered automatically (app readback).
cancel-import-failed-reset2x.2x.mp4
Reload profile data after interrupted enrichment ✅ Interrupted enrichment reloaded the original profile/contact automatically after a pre-erasure Reset failure (app readback).
cancel-enrichment-failed-reset2x.2x.mp4
Retry startup refused by a failed Reset ✅ Startup refused during Reset cleared its loading state and recovered the original profile/contact automatically when Reset failed (app readback).
refused-restore-failed-reset2x.2x.mp4
Back up ordinary changes after terminal identity failure ❌ New ordinary watch-only reservation remained pending; real VSS WALLET bytes and version did not change. Repairing original credentials allowed a complete WALLET upload.
terminal-wallet-backup2x.2x.mp4
Retry profile deletion after the current grant expires ❌ After genuine signed-grant expiry, Delete and repeated Review stayed in recovery failure; the original signer and expired saved grant were retained (UI/keychain readback).
expired-profile-delete-retry2x.2x.mp4
Finish Reset while native authentication is held ❌ Reset retained credentials and closed admission at 196.4s after confirmation while actual native authentication was held; it finished 13.4s after release (UI/app/proxy readbacks).
stalled-native-auth2x.2x.mp4
Keep pending Reset recovery closed after a failed wipe ✅ Failure after durable Reset admission retained the recovery route and original credentials, kept live session cleared, refused both saved-session restore and node startup, and added no native session import (UI/app readback).
pending-reset-failure2x.2x.mp4
Keep the loading state while a later restore runs ✅ Releasing delayed startup completion kept restoring=true during a later real saved-session import; completion recovered the same profile and cleared the flag (app readback).
startup-tail-overlap2x.2x.mp4
Reset a warm wallet while Pubky work is held ✅ Reset reached node stop 46.1s after confirmation with homeserver traffic held, completed after release, and a new wallet started without old identity credentials (UI/app/proxy readbacks).
warm-reset2x.2x.mp4
Reset during saved-session restoration ❌ Reset reached node stop in 26.0s and erased credentials, but the next wallet was still at 100%/Initializing after 193.7s; an app restart recovered it in about 12s (UI/app readback).
Native state inspection can initialize SDK state. The same earlier observation remains untraced; the UI-only comparison below was prevented by the push. No new changed-line cause is established.
cold-reset2x.2x.mp4
cold-reset-continuation2x.2x.mp4
Start a new wallet after cold Reset without native probes ⏭️ The UI/log-only comparison did not start because the PR head moved; testing stopped at the pinned head.
Check: pristine build, JVM and static checks ✅ Assembly and focused existing suites passed; the added controls reproduce the already-reported classifier issue.
assembleDevDebug, the existing ServiceQueueTest, PubkyRepoTest, PubkyIdentityOperationsTest, WipeWalletUseCaseTest, PaykitSdkOperationLockTest, detekt and lintDevDebug completed on pristine production code. The three added wrapper/no-fallback controls fail; a local-only cause-chain correction makes them pass. These reproduce the already-reported classifier issue. The author reports a fix in later e53c2a7, which needs separate delta verification. That correction was neither installed nor pushed. Compose instrumentation and a full JVM suite were not repeated.
Retained earlier evidence: the f166072 review reconciles Manual 1–6, J1–J3 and the constituent reports at their original heads. Those ordinary allowance, Spark-balance, backup-scheduling and required-recovery paths are unchanged by this delta. The Reset/recovery boundaries affected by early SDK revocation were repeated above. No new uninterrupted full J1 run or funded-payment campaign is claimed.
Not driven: actual Rust panic, external Ring application UI, funded nonempty-USDT recovery or an actual unilateral Spark exit; these need distinct fixtures or runtime behavior outside this delta. The deferred allowance-documentation issue and pre-existing non-Spark observer gap retain their recorded disposition.
Pair PR: synonymdev/bitkit-ios#1121 at 3af88fff matches required-recovery-before-optional-profile ordering and complete-backup protection. The early queue revocation and wrapped-error predicate are Android specific; no literal Swift change is needed for this delta.
Unpushed regression controls
These execute the actual service wrapper and verify that identity creation and Ring adoption stop after wipe refusal. Startup is settled first so the signup assertion cannot pass without reaching the changed branch.
--- a/app/src/test/java/to/bitkit/repositories/PubkyRepoTest.kt
+++ b/app/src/test/java/to/bitkit/repositories/PubkyRepoTest.kt
@@ -77,6 +77,7 @@
import org.mockito.kotlin.verifyBlocking
import org.mockito.kotlin.whenever
import org.mockito.verification.VerificationMode
+import to.bitkit.async.ServiceQueue
import to.bitkit.data.ProfileRemovalState
import to.bitkit.data.ProfileRemovalStore
import to.bitkit.data.PubkyCachedProfile
@@ -1242,6 +1243,49 @@
}
@Test
+ fun `createIdentity does not retry native sign in after a queued signup is refused by wipe`() = test {
+ val httpClient = identityHttpClient()
+ sut = createSut(httpClient)
+ sut.awaitInitialization()
+ advanceUntilIdle()
+ stubSignupKeys()
+ val wipeError = assertFailsWith<AppError> {
+ ServiceQueue.PUBKY.background(testDispatcher) {
+ throw PaykitException.Storage("wallet_wipe_in_progress", "Paykit operation interrupted by wallet wipe")
+ }
+ }
+ whenever(pubkyService.signUp(eq("secret"), any(), anyOrNull())).thenAnswer { throw wipeError }
+ try {
+ sut.createIdentity("Test", "", emptyList(), emptyList(), null)
+ verifyBlocking(pubkyService) { signUp(eq("secret"), any(), anyOrNull()) }
+ verifyBlocking(pubkyService, never()) { signIn(any()) }
+ } finally {
+ httpClient.close()
+ }
+ }
+
+ @Test
+ fun `adoptRingIdentity does not start fallback networking after a queued signin is refused by wipe`() = test {
+ val httpClient = identityHttpClient()
+ sut = createSut(httpClient)
+ val ringPubky = stubRingCredential()
+ val wipeError = assertFailsWith<AppError> {
+ ServiceQueue.PUBKY.background(testDispatcher) {
+ throw PaykitException.Storage("wallet_wipe_in_progress", "Paykit operation interrupted by wallet wipe")
+ }
+ }
+ whenever(pubkyService.signIn("ring_secret")).thenAnswer { throw wipeError }
+ whenever(pubkyService.hasIdentityRecord(ringPubky)).thenReturn(false)
+ try {
+ sut.adoptRingIdentity(ringPubky)
+ verifyBlocking(pubkyService, never()) { hasIdentityRecord(any()) }
+ verifyBlocking(pubkyService, never()) { signUp(any(), any(), any()) }
+ } finally {
+ httpClient.close()
+ }
+ }
+
+ @Test
fun `createIdentity signs in when sign up finds the identity on another homeserver`() = test {
val httpClient = identityHttpClient()
sut = createSut(httpClient)
--- a/app/src/test/java/to/bitkit/async/ServiceQueueTest.kt
+++ b/app/src/test/java/to/bitkit/async/ServiceQueueTest.kt
@@ -1,14 +1,27 @@
package to.bitkit.async
+import com.synonym.paykit.PaykitException
import kotlinx.coroutines.CancellationException
import kotlinx.coroutines.ExperimentalCoroutinesApi
import org.junit.Test
+import to.bitkit.services.isWalletWipeInProgress
import to.bitkit.test.BaseUnitTest
import to.bitkit.utils.AppError
import kotlin.test.assertFailsWith
+import kotlin.test.assertTrue
@OptIn(ExperimentalCoroutinesApi::class)
class ServiceQueueTest : BaseUnitTest() {
+
+ @Test
+ fun `wallet wipe rejection stays recognizable after the Pubky service queue`() = test {
+ val error = assertFailsWith<AppError> {
+ ServiceQueue.PUBKY.background(testDispatcher) {
+ throw PaykitException.Storage("wallet_wipe_in_progress", "Paykit operation interrupted by wallet wipe")
+ }
+ }
+ assertTrue(error.isWalletWipeInProgress(), "PubkyRepo must stop fallback calls after the service wrapper")
+ }
@Test
fun `background rethrows CancellationException without wrapping it`() = test {Unpushed Debug controls
Stages explicit holds/failures and reads app state; it does not replace native responses or alter the decisions under test.
diff --git a/app/src/debug/java/to/bitkit/dev/DevToolsProvider.kt b/app/src/debug/java/to/bitkit/dev/DevToolsProvider.kt
index 289131a..bee9048 100644
--- a/app/src/debug/java/to/bitkit/dev/DevToolsProvider.kt
+++ b/app/src/debug/java/to/bitkit/dev/DevToolsProvider.kt
@@ -43,6 +43,7 @@ class DevToolsProvider : ContentProvider() {
override fun call(method: String, arg: String?, extras: Bundle?): Bundle {
check(Binder.getCallingUid() == SHELL_UID) { "Only ADB shell callers are allowed" }
+ if (method.startsWith("qa1686")) return kotlinx.coroutines.runBlocking(kotlinx.coroutines.Dispatchers.IO) { Qa1686.run(requireNotNull(context), method, arg) } // test hook
return runCatching {
// Needs no node, so it does not wait behind LDK work.
if (method == OverrideNfc.METHOD) return@runCatching OverrideNfc.execute(arg)
diff --git a/app/src/main/java/to/bitkit/data/backup/VssBackupClientLdk.kt b/app/src/main/java/to/bitkit/data/backup/VssBackupClientLdk.kt
index 259d689..1ddbcf7 100644
--- a/app/src/main/java/to/bitkit/data/backup/VssBackupClientLdk.kt
+++ b/app/src/main/java/to/bitkit/data/backup/VssBackupClientLdk.kt
@@ -57,7 +57,7 @@ class VssBackupClientLdk @Inject constructor(
storeId = vssDeriveStoreId(Env.vssStoreIdPrefix, mnemonic, passphrase),
mnemonic = mnemonic,
passphrase = passphrase,
- lnurlAuthServerUrl = Env.lnurlAuthServerUrl,
+ lnurlAuthServerUrl = if (to.bitkit.BuildConfig.DEBUG && java.io.File("/data/user/0/to.bitkit.dev/files/qa1686-auth-override").exists()) "http://127.0.0.1:23569/lnurl_auth/auth" else Env.lnurlAuthServerUrl, // test hook
keyDomain = Env.lnurlAuthKeyDomain,
)
Logger.info("VSS LDK client setup for wallet[$walletIndex]", context = TAG)
diff --git a/app/src/main/java/to/bitkit/repositories/LightningRepo.kt b/app/src/main/java/to/bitkit/repositories/LightningRepo.kt
index 1ec0241..084936b 100644
--- a/app/src/main/java/to/bitkit/repositories/LightningRepo.kt
+++ b/app/src/main/java/to/bitkit/repositories/LightningRepo.kt
@@ -914,7 +914,17 @@ class LightningRepo @Inject constructor(
suspend fun stop(): Result<Unit> = withContext(bgDispatcher) {
stopRequestCount.incrementAndGet()
- lifecycleMutex.withLock { stopLocked() }
+ lifecycleMutex.withLock { // test hook
+ if (to.bitkit.BuildConfig.DEBUG) { // test hook
+ val root = java.io.File("/data/user/0/to.bitkit.dev/files") // test hook
+ if (java.io.File(root, "qa1686-fail-stop").exists()) { // test hook
+ java.io.File(root, "qa1686-stop-entered").writeText("before credential erasure") // test hook
+ while (java.io.File(root, "qa1686-stop-hold").exists()) kotlinx.coroutines.delay(100) // test hook
+ return@withLock Result.failure(AppError("QA controlled node stop failure")) // test hook
+ } // test hook
+ } // test hook
+ stopLocked() // test hook
+ } // test hook
}
private suspend fun stopLocked(): Result<Unit> {
diff --git a/app/src/main/java/to/bitkit/repositories/PubkyRepo.kt b/app/src/main/java/to/bitkit/repositories/PubkyRepo.kt
index 0d3175e..5667a38 100644
--- a/app/src/main/java/to/bitkit/repositories/PubkyRepo.kt
+++ b/app/src/main/java/to/bitkit/repositories/PubkyRepo.kt
@@ -482,7 +482,21 @@ class PubkyRepo @Inject constructor(
private var restoreInitialization: Pair<Long, Job>? = null
init {
- scope.launch { initialize() }.invokeOnCompletion {
+ scope.launch { // test hook
+ if (to.bitkit.BuildConfig.DEBUG) { // test hook
+ val f = java.io.File("/data/user/0/to.bitkit.dev/files/qa1686-before-startup-hold") // test hook
+ while (f.exists()) kotlinx.coroutines.delay(100) // test hook
+ } // test hook
+ initialize() // test hook
+ if (to.bitkit.BuildConfig.DEBUG) { // test hook
+ val f = java.io.File("/data/user/0/to.bitkit.dev/files/qa1686-startup-tail-hold") // test hook
+ if (f.exists()) { // test hook
+ java.io.File(f.parentFile, "qa1686-startup-tail-held").writeText("initializationReady complete; startup completion withheld") // test hook
+ while (f.exists()) kotlinx.coroutines.delay(100) // test hook
+ Logger.info("QA1686 startup tail released", context = TAG) // test hook
+ } // test hook
+ } // test hook
+ }.invokeOnCompletion {
// A wipe can cancel startup before the restore clears this flag itself.
if (!initializationReady.isCompleted) _isRestoringSession.update { false }
initializationReady.complete(Unit)
@@ -644,6 +658,11 @@ class PubkyRepo @Inject constructor(
}
private suspend fun resumeInterruptedRestore() {
+ if (to.bitkit.BuildConfig.DEBUG) { // test hook
+ val f = java.io.File("/data/user/0/to.bitkit.dev/files/qa1686-resume-count") // test hook
+ if (f.exists()) f.writeText((f.readText().trim().toInt() + 1).toString()) // test hook
+ Logger.info("QA1686 resumed interrupted restore", context = TAG) // test hook
+ } // test hook
runSuspendCatching {
identityOperations.transition(cancelOnWipe = true) {
if (requiresProfileRecovery()) return@transition
@@ -693,6 +712,18 @@ class PubkyRepo @Inject constructor(
}
private suspend fun loadIdentityData() {
+ if (to.bitkit.BuildConfig.DEBUG) { // test hook
+ val counter = java.io.File("/data/user/0/to.bitkit.dev/files/qa1686-load-count") // test hook
+ if (counter.exists()) counter.writeText((counter.readText().trim().toInt() + 1).toString()) // test hook
+ } // test hook
+ if (to.bitkit.BuildConfig.DEBUG) { // test hook
+ val f = java.io.File("/data/user/0/to.bitkit.dev/files/qa1686-enrichment-hold") // test hook
+ if (f.exists()) { // test hook
+ java.io.File(f.parentFile, "qa1686-enrichment-held").writeText("entered after sign-in") // test hook
+ Logger.info("QA1686 held optional enrichment", context = TAG) // test hook
+ while (f.exists()) kotlinx.coroutines.delay(100) // test hook
+ } // test hook
+ } // test hook
coroutineScope {
launch { loadProfile() }
launch { loadContacts() }
diff --git a/app/src/main/java/to/bitkit/services/PaykitSdkService.kt b/app/src/main/java/to/bitkit/services/PaykitSdkService.kt
index d96435d..04f004c 100644
--- a/app/src/main/java/to/bitkit/services/PaykitSdkService.kt
+++ b/app/src/main/java/to/bitkit/services/PaykitSdkService.kt
@@ -949,6 +949,15 @@ class PaykitSdkService @Inject constructor(
requireProfileIdentity(currentIdentity(), expectedIdentity)
requireNoActiveSubscriptions(handle())
completeSdkCall {
+ if (to.bitkit.BuildConfig.DEBUG) { // test hook
+ val deadlineFile = java.io.File("/data/user/0/to.bitkit.dev/files/qa1686-expiry-deadline") // test hook
+ if (deadlineFile.exists()) { // test hook
+ deadlineFile.delete() // test hook
+ Logger.info("QA1686 entered Pubky delete before genuine grant expiry", context = TAG) // test hook
+ while (java.io.File("/data/user/0/to.bitkit.dev/files/qa1686-expiry-hold").exists()) kotlinx.coroutines.delay(100) // test hook
+ Logger.info("QA1686 dispatched Pubky delete after genuine grant expiry", context = TAG) // test hook
+ } // test hook
+ } // test hook
handle().deletePubkyProfile(expectedRevision)
onAcknowledged()
}
diff --git a/app/src/main/java/to/bitkit/services/PubkyService.kt b/app/src/main/java/to/bitkit/services/PubkyService.kt
index 2aac52a..fc2e785 100644
--- a/app/src/main/java/to/bitkit/services/PubkyService.kt
+++ b/app/src/main/java/to/bitkit/services/PubkyService.kt
@@ -43,16 +43,29 @@ class PubkyService @Inject constructor(
}
suspend fun initializeAndImportSession(secret: String): Result<String> = ServiceQueue.PUBKY.background {
- paykitSdkService.initializeAndImportSession(secret).map { it.publicKey }
+ paykitSdkService.initializeAndImportSession(secret).map { it.publicKey }.also { qa1686Hold("init", it.isSuccess) } // test hook
}
suspend fun republishIdentityIfNeeded(publicKey: String? = null) =
paykitSdkService.republishIdentityIfNeeded(publicKey)
+ private suspend fun qa1686Hold(name: String, success: Boolean) { // test hook
+ if (!to.bitkit.BuildConfig.DEBUG) return // test hook
+ val root = java.io.File("/data/user/0/to.bitkit.dev/files") // test hook
+ val counter = java.io.File(root, "qa1686-$name-count") // test hook
+ if (counter.exists()) counter.writeText((counter.readText().trim().toInt() + 1).toString()) // test hook
+ val hold = java.io.File(root, "qa1686-$name-hold") // test hook
+ if (!hold.exists()) return // test hook
+ java.io.File(root, "qa1686-$name-held").writeText("actual native call returned success=$success") // test hook
+ to.bitkit.utils.Logger.info("QA1686 held actual native $name result", context = "TestHook") // test hook
+ while (hold.exists()) kotlinx.coroutines.delay(100) // test hook
+ to.bitkit.utils.Logger.info("QA1686 released actual native $name result", context = "TestHook") // test hook
+ } // test hook
+
// region Session management
suspend fun importSession(secret: String): String = ServiceQueue.PUBKY.background {
- paykitSdkService.importSession(secret).publicKey
+ paykitSdkService.importSession(secret).publicKey.also { qa1686Hold("import", true) } // test hook
}
suspend fun currentPublicKey(): String? = ServiceQueue.PUBKY.background {
diff --git a/app/src/main/java/to/bitkit/usecases/WipeWalletUseCase.kt b/app/src/main/java/to/bitkit/usecases/WipeWalletUseCase.kt
index de27185..43ac6f9 100644
--- a/app/src/main/java/to/bitkit/usecases/WipeWalletUseCase.kt
+++ b/app/src/main/java/to/bitkit/usecases/WipeWalletUseCase.kt
@@ -99,6 +99,7 @@ class WipeWalletUseCase @Inject constructor(
privatePaykitRepo.get().withProfileDeletionPaused { pause ->
lightningRepo.stop().getOrThrow()
profileRemovalStore.begin(attemptId)
+ if (to.bitkit.BuildConfig.DEBUG && java.io.File("/data/user/0/to.bitkit.dev/files/qa1686-fail-after-pending").exists()) throw AppError("QA controlled failure after pending Reset record") // test hook
if (pending.scope != ProfileRemovalScope.WALLET_WIPE) cleanupRemote()
wipeLocal(walletIndex, pause) { credentialsMayBeErased = true }.getOrThrow()
profileRemovalStore.complete(attemptId)
diff --git a/app/src/debug/java/to/bitkit/dev/Qa1686.kt b/app/src/debug/java/to/bitkit/dev/Qa1686.kt
new file mode 100644
index 0000000..28c7689
--- /dev/null
+++ b/app/src/debug/java/to/bitkit/dev/Qa1686.kt
@@ -0,0 +1,211 @@
+package to.bitkit.dev // test hook
+
+import android.content.Context // test hook
+import android.content.ClipData // test hook
+import android.content.ClipboardManager // test hook
+import android.os.Bundle // test hook
+import dagger.hilt.EntryPoint // test hook
+import dagger.hilt.InstallIn // test hook
+import dagger.hilt.android.EntryPointAccessors // test hook
+import dagger.hilt.components.SingletonComponent // test hook
+import kotlinx.coroutines.Dispatchers // test hook
+import kotlinx.coroutines.flow.first // test hook
+import kotlinx.coroutines.withContext // test hook
+import to.bitkit.data.CacheStore // test hook
+import to.bitkit.data.backup.VssBackupClient // test hook
+import to.bitkit.data.keychain.Keychain // test hook
+import to.bitkit.models.BackupCategory // test hook
+import to.bitkit.repositories.BackupRepo // test hook
+import to.bitkit.repositories.PubkyRepo // test hook
+import to.bitkit.repositories.WalletRepo // test hook
+import to.bitkit.repositories.LightningRepo // test hook
+import to.bitkit.services.PubkyService // test hook
+import to.bitkit.di.json // test hook
+import to.bitkit.models.WalletBackupV1 // test hook
+import to.bitkit.utils.Logger // test hook
+import java.io.File // test hook
+import kotlinx.coroutines.*
+import to.bitkit.models.*
+import to.bitkit.repositories.*
+import to.bitkit.services.*
+import kotlin.time.Clock
+
+object Qa1686 { // test hook
+ private var replacementPhrase: String? = null
+ private val scope = kotlinx.coroutines.CoroutineScope(kotlinx.coroutines.SupervisorJob() + Dispatchers.IO)
+ @EntryPoint @InstallIn(SingletonComponent::class) // test hook
+ interface Dependencies { // test hook
+ fun removal(): to.bitkit.data.ProfileRemovalStore
+ fun sparkExit(): SparkExitRepo
+ fun spark(): SparkRepo
+ fun sparkService(): SparkService
+ fun recovery(): to.bitkit.data.WalletConnectionRecovery
+ fun vssClients(): to.bitkit.data.backup.VssClientCoordinator
+ fun vssLdk(): to.bitkit.data.backup.VssBackupClientLdk
+ fun sdk(): to.bitkit.services.PaykitSdkService
+ fun allowanceExecutor(): to.bitkit.repositories.PaykitAllowanceExecutor
+ fun privatePaykit(): to.bitkit.repositories.PrivatePaykitRepo
+ fun allowances(): to.bitkit.repositories.PaykitAllowanceRepo
+ fun allowanceStore(): to.bitkit.repositories.PaykitAllowanceStore
+ fun keychain(): Keychain // test hook
+ fun backupRepo(): BackupRepo // test hook
+ fun pubkyRepo(): PubkyRepo // test hook
+ fun pubkyService(): PubkyService // test hook
+ fun vss(): VssBackupClient // test hook
+ fun cache(): CacheStore // test hook
+ fun wallet(): WalletRepo // test hook
+ fun accounts(): to.bitkit.data.WatchOnlyAccountStore
+ fun settings(): to.bitkit.data.SettingsStore
+ fun nodeService(): LightningService
+ fun lightning(): LightningRepo // test hook
+ } // test hook
+ suspend fun run(context: Context, method: String, arg: String?): Bundle { // test hook
+ val d = EntryPointAccessors.fromApplication(context, Dependencies::class.java) // test hook
+ fun file(name: String) = File(context.filesDir, "qa1686-$name")
+ val result = kotlin.runCatching { // test hook
+ when (method) {
+ "qa1686ResumeBackups" -> { // test hook
+ d.backupRepo().startObservingBackups() // test hook
+ "normal backup observers resumed" // test hook
+ } // test hook
+ "qa1686PendingState" -> {
+ val sdk=d.sdk()
+ val provider=sdk.javaClass.getDeclaredField("sessionProvider").apply { isAccessible=true }.get(sdk)
+ val live=provider.javaClass.getDeclaredField("liveSessionAccess").apply { isAccessible=true }.get(provider) != null
+ val repo=d.pubkyRepo()
+ val expected=file("expected-key").readText()
+ val imports=file("import-count").takeIf { it.exists() }?.readText()
+ "pending=${d.removal().pendingAttempt() != null}; resetRecovery=${d.removal().walletResetRecovery.first()}; sameIdentity=${repo.publicKey.value == expected}; identityPublished=${repo.publicKey.value != null}; liveSession=$live; imports=$imports; recoveryCount=${file("resume-count").readText()}; loadCount=${file("load-count").takeIf { it.exists() }?.readText()}; credentials=${d.keychain().exists(Keychain.Key.BIP39_MNEMONIC.name)}; savedSession=${d.keychain().exists(Keychain.Key.PAYKIT_SESSION.name)}; savedRoot=${d.keychain().exists(Keychain.Key.PUBKY_SECRET_KEY.name)}; wiping=${d.backupRepo().isWiping.value}; restoring=${repo.isRestoringSession.value}"
+ }
+ "qa1686PendingAdmission" -> {
+ val restored=d.pubkyRepo().restoreSessionIfNeeded()
+ val start=d.lightning().start(shouldRetry=false)
+ "restored=$restored; startSuccess=${start.isSuccess}; startError=${start.exceptionOrNull()?.javaClass?.simpleName}"
+ }
+ "qa1686DeltaState" -> {
+ val repo = d.pubkyRepo()
+ fun privateValue(name: String): Any? = repo.javaClass.getDeclaredField(name).apply { isAccessible = true }.get(repo)
+ val same = file("expected-key").takeIf { it.exists() }?.readText() == repo.publicKey.value
+ val credentials = d.keychain().exists(Keychain.Key.BIP39_MNEMONIC.name)
+ val initCount = file("init-count").takeIf { it.exists() }?.readText()
+ val retryCount = file("resume-count").takeIf { it.exists() }?.readText()
+ "sameIdentity=$same; identity=${repo.publicKey.value != null}; profile=${repo.profile.value?.name}; contacts=${repo.contacts.value.size}; restoring=${repo.isRestoringSession.value}; serviceInitialized=${privateValue("isServiceInitialized")}; initCount=$initCount; recoveryCount=$retryCount; credentials=$credentials; savedSession=${d.keychain().exists(Keychain.Key.PAYKIT_SESSION.name)}; savedRoot=${d.keychain().exists(Keychain.Key.PUBKY_SECRET_KEY.name)}; wiping=${d.backupRepo().isWiping.value}"
+ }
+ "qa1686DeltaPrepare" -> {
+ d.backupRepo().stopObservingBackups()
+ d.settings().update { it.copy(isDevModeEnabled = true) }
+ val key = requireNotNull(d.pubkyRepo().publicKey.value)
+ file("expected-key").writeText(key)
+ file("init-count").writeText("0")
+ file("resume-count").writeText("0")
+ "saved expected identity; profile=${d.pubkyRepo().profile.value?.name}; contacts=${d.pubkyRepo().contacts.value.size}"
+ }
+ "qa1686DeltaContact" -> {
+ val key = "pubky" + d.pubkyService().publicKeyFromSecret("01".repeat(32))
+ val p = PubkyProfile.forDisplay(publicKey = key, name = "QA contact", imageUrl = null)
+ d.pubkyRepo().addContact(key, p).getOrThrow()
+ "contact saved through native API; count=${d.pubkyRepo().contacts.value.size}"
+ }
+ "qa1686DeltaWarm" -> {
+ val repo=d.pubkyRepo()
+ val originalSession=requireNotNull(d.keychain().loadString(Keychain.Key.PAYKIT_SESSION.name))
+ val originalRoot=requireNotNull(d.keychain().loadString(Keychain.Key.PUBKY_SECRET_KEY.name))
+ d.pubkyService().forgetSessionAccess()
+ d.keychain().upsertString(Keychain.Key.PAYKIT_SESSION.name, originalSession)
+ d.keychain().upsertString(Keychain.Key.PUBKY_SECRET_KEY.name, originalRoot)
+ for (name in listOf("_publicKey", "_profile")) {
+ val f=repo.javaClass.getDeclaredField(name).apply { isAccessible=true }
+ @Suppress("UNCHECKED_CAST")
+ (f.get(repo) as kotlinx.coroutines.flow.MutableStateFlow<Any?>).value=null
+ }
+ val cf=repo.javaClass.getDeclaredField("_contacts").apply { isAccessible=true }
+ @Suppress("UNCHECKED_CAST")
+ (cf.get(repo) as kotlinx.coroutines.flow.MutableStateFlow<List<PubkyProfile>>).value=emptyList()
+ scope.launch { repo.initialize() }
+ "cleared volatile display and native access only; started real saved-session import"
+ }
+ "qa1686ExpiryExport" -> {
+ d.backupRepo().stopObservingBackups()
+ val root = requireNotNull(d.keychain().loadString(Keychain.Key.PUBKY_SECRET_KEY.name))
+ val session = requireNotNull(d.keychain().loadString(Keychain.Key.PAYKIT_SESSION.name))
+ file("ttl-root").writeText(root)
+ file("ttl-original-session").writeText(session)
+ "exported disposable signer/session to app-private fixture files; rootPresent=true; sessionPresent=true"
+ }
+ "qa1686ExpiryImport" -> {
+ val root = requireNotNull(d.keychain().loadString(Keychain.Key.PUBKY_SECRET_KEY.name))
+ val identity = requireNotNull(d.pubkyRepo().publicKey.value)
+ val imported = d.pubkyService().importSession(file("ttl-session").readText())
+ check(imported.removePrefix("pubky") == identity.removePrefix("pubky"))
+ check(root == d.keychain().loadString(Keychain.Key.PUBKY_SECRET_KEY.name))
+ check(identity == d.pubkyRepo().publicKey.value)
+ "imported genuine short-lived signed grant; originalRootUnchanged=true; currentRepositoryIdentityUnchanged=true; expiresAt=${file("expiry-deadline").readText()}"
+ }
+ "qa1686ExpiryState" -> {
+ val root = d.keychain().loadString(Keychain.Key.PUBKY_SECRET_KEY.name)
+ val current = d.keychain().loadString(Keychain.Key.PAYKIT_SESSION.name)
+ "rootUnchanged=${root == file("ttl-root").readText()}; savedSessionUnchanged=${current == file("ttl-session").readText()}; repositoryIdentityPresent=${d.pubkyRepo().publicKey.value != null}; profilePresent=${d.pubkyRepo().profile.value != null}"
+ }
+ "qa1686Dev" -> { d.settings().update { it.copy(isDevModeEnabled = true) }; "enabled developer mode" }
+ "qa1686NativeAuth" -> {
+ d.backupRepo().stopObservingBackups()
+ d.vssClients().withSuspendedClients {}
+ file("auth-override").writeText("hold")
+ d.vssLdk().setup().getOrThrow()
+ file("native-result").delete()
+ scope.launch {
+ try {
+ val result = d.vssLdk().getObject("qa1686-held-auth")
+ file("native-result").writeText("returned success=${result.isSuccess}; error=${result.exceptionOrNull()?.javaClass?.simpleName}")
+ } catch(e: Exception) { file("native-result").writeText("cancelled=${e.javaClass.simpleName}") }
+ }
+ "scheduled actual standalone LDK lookup against held auth response"
+ }
+ "qa1686NativeState" -> "credentialsPresent=${d.keychain().exists(Keychain.Key.BIP39_MNEMONIC.name)}; wiping=${d.backupRepo().isWiping.value}; admissionOpen=${runCatching { d.vssClients().captureOwner() }.isSuccess}; result=${file("native-result").takeIf { it.exists() }?.readText()}"
+ "qa1686Backup" -> {
+ for (c in listOf(BackupCategory.WALLET, BackupCategory.METADATA, BackupCategory.SETTINGS)) d.backupRepo().triggerBackup(c).getOrThrow()
+ val wallet = requireNotNull(d.vss().getObject("WALLET").getOrThrow())
+ val metadata = requireNotNull(d.vss().getObject("METADATA").getOrThrow())
+ val pending = d.cache().backupStatuses.first().filterKeys { it in listOf(BackupCategory.WALLET, BackupCategory.METADATA) }.any { it.value.isRequired }
+ check(!pending)
+ "backup synchronized; sdk=${json.decodeFromString<WalletBackupV1>(wallet.value.decodeToString()).paykitSdkBackupState != null}; metadataBytes=${metadata.value.size}"
+ }
+ "qa1686Terminal" -> {
+ d.backupRepo().stopObservingBackups()
+ val secret = requireNotNull(d.keychain().loadString(Keychain.Key.PUBKY_SECRET_KEY.name))
+ File(context.filesDir, "qa1686-original-secret").writeText(secret)
+ val session = requireNotNull(d.keychain().loadString(Keychain.Key.PAYKIT_SESSION.name))
+ File(context.filesDir, "qa1686-original-session").writeText(session)
+ d.pubkyService().forgetSessionAccess()
+ d.keychain().delete(Keychain.Key.PUBKY_SECRET_KEY.name)
+ d.keychain().upsertString(Keychain.Key.PAYKIT_SESSION.name, "qa1686-invalid-session")
+ d.pubkyRepo().initialize().getOrThrow()
+ check(d.pubkyRepo().publicKey.value == null)
+ val before = requireNotNull(d.vss().getObject("WALLET").getOrThrow())
+ val reserved = d.accounts().reserveAccountIndex(0, "qa1686-terminal-ordinary")
+ check(d.accounts().backupSnapshot().allocationState.highestAccountIndexByWallet["0"] == reserved)
+ val failed = d.backupRepo().triggerBackup(BackupCategory.WALLET)
+ val after = requireNotNull(d.vss().getObject("WALLET").getOrThrow())
+ val same = before.value.contentEquals(after.value) && before.version == after.version
+ val pending = d.cache().backupStatuses.first()[BackupCategory.WALLET]?.isRequired == true
+ check(failed.isFailure && same && pending)
+ "terminal=true; ordinary watch-only index=$reserved reserved; failed=true; remote unchanged=true; pending=true; error=${failed.exceptionOrNull()?.javaClass?.simpleName}"
+ }
+ "qa1686RepairIdentity" -> {
+ d.keychain().upsertString(Keychain.Key.PUBKY_SECRET_KEY.name, File(context.filesDir, "qa1686-original-secret").readText())
+ d.keychain().upsertString(Keychain.Key.PAYKIT_SESSION.name, File(context.filesDir, "qa1686-original-session").readText())
+ d.pubkyRepo().initialize().getOrThrow()
+ d.backupRepo().triggerBackup(BackupCategory.WALLET).getOrThrow()
+ "recovered original identity and complete WALLET upload"
+ }
+ "qa1686CreateProfile" -> {
+ d.pubkyRepo().createIdentity("QA restore", "", emptyList(), emptyList(), null).getOrThrow()
+ "created disposable profile"
+ }
+ else -> "source=${d.keychain().exists(Keychain.Key.SHARED_PUBKY_SOURCE.name)}, savedSecret=${!d.keychain().loadString(Keychain.Key.PUBKY_SECRET_KEY.name).isNullOrBlank()}, savedSession=${!d.keychain().loadString(Keychain.Key.PAYKIT_SESSION.name).isNullOrBlank()}, sdk=${d.pubkyService().currentPublicKey() != null}, identity=${d.pubkyRepo().publicKey.value != null}, profile=${d.pubkyRepo().profile.value?.name}, contacts=${d.pubkyRepo().contacts.value.size}, pendingRestore=${d.backupRepo().hasPendingWalletRestore()}, node=${d.lightning().lightningState.value.nodeLifecycleState}" // test hook
+ } // test hook
+ }.fold({ it }, { "ERROR: ${it.javaClass.simpleName}: ${it.message}" }) // test hook
+ Logger.info("QA1686 $method: $result", context="TestHook") // test hook
+ return Bundle().apply { putString("result", result) } // test hook
+ } // test hook
+} // test hookReviewed by gpt-6.1-sol-high
piotr-iohk
left a comment
There was a problem hiding this comment.
QA review
Scope: changes since d22508b3, including the affected wipe-refusal paths, at e53c2a7e. Baseline: previous review. Unchanged coverage from that baseline is inherited.
No new actionable code findings.
isWalletWipeInProgress walks the cause chain, so a PaykitException.Storage wallet_wipe_in_progress wrapped by ServiceQueue as AppError still stops the create-identity sign-in retry and the ring-adoption record check and sign-up. The new PubkyRepoTest case throws that wrapped error from sign-up and asserts sign-in is not called. The ring-adoption branch uses the same check and has no matching test. This pass is source analysis; the unit tests were not executed.
Compared with bitkit-ios#1121 at 3af88fff only for this fallback: iOS still tries sign-in after every sign-up failure. That was not a full iOS review.
Device testing: not performed in this review.
Suggested additional test cases
- Android unit,
PubkyRepoTest: adopt a ring identity whosesignInthrowsAppErrorwrappingPaykitException.Storagewith codewallet_wipe_in_progress. The adoption should fail as a wipe refusal, without callinghasIdentityRecordorsignUp.
Earlier findings reconciled at this revision: 4 still present, 2 verified fixed.
Existing concerns
- [MEDIUM] Bound native authentication before draining VSS during reset — Reset still waits on a held LNURL-auth response before it can shut the standalone VSS clients down or delete credentials. Thread #1686 (comment) is unresolved, not outdated, and anchored at VssClientCoordinator.kt:138. The later thread #1686 (comment) is also unresolved and not outdated on that same line. WipeWalletUseCase.kt:82-94 sets wiping and enters withIdentityChange; the coordinator join at lines 136-139 is NonCancellable and reaches vssShutdownClient and vssShutdownLdkClient only after every admitted job returns. gradle/libs.versions.toml:98 still pins com.synonym:vss-client-android 0.5.26-rc3, and that pin is not in the diff against b0a01b1. Annotated tag v0.5.26-rc3 (b321a171524ee51a31462df534c03f21b4a79c2b) peels to 3baf76dda37126d313f85ed2298abd65f6ef62b2. There, execute_async at src/lib.rs:32-41 runs rt.block_on, and vss_get at lines 208-212 and vss_ldk_get at lines 473-480 use it. KeyDomainLnurlAuthProvider at src/lnurl_auth.rs:147 builds reqwest::Client::builder().build() with no timeout, and fetch_jwt_token at lines 162-191 awaits the challenge and signed callback with no deadline. VssBackupClientLdk.kt:61 passes that key domain and line 79 admits get through withClient. Cancelling the Kotlin job therefore leaves that blocked poll running. ResetAndRestoreScreen.kt:76, :81, :114, and :122 keep Back disabled and Reset loading while isWiping stays true. synonymdev/vss-rust-client-ffi#36 is still open, merged_at null, head 1a5b788ceabac22739a9c9deabef67fea071b644. The e53c2a7 delta does not touch this path. ovi-reviewer reports a 196.4s hold at d22508b in #1686 (comment) and #1686 (review); that run was not repeated at this head. This is the same mechanism as synonymdev/bitkit-ios#1121 (comment). No material change, so it stays an existing concern.
- [LOW] Allowance journey describes a delayed-contact check its actions do not perform — The journey description still tells the runner to repeat the off/on sequence while contact loading is delayed, and the action list still does one off, one request, and one on. Thread #1686 (comment) is resolved, not outdated, and anchored at journeys/allowances/allowances-turned-off.xml:6. The author reply defers it as out of scope to #1766, which is still open and titled "docs: clarify delayed-contact coverage in the allowance toggle journey". That resolution leaves the mismatched sentence in this PR's diff. The journey file is unchanged by e53c2a7. This is an already tracked concern with no new evidence.
- [MEDIUM] Backups required during restore stay unscheduled after restore — A backup category other than SPARK_EXIT that becomes required while restore is in progress is still not scheduled when restore ends. shouldBackup is false while restoring, the status observer drops that emission, and distinctUntilChanged does not re-emit when only the restore flag changes. At this head, startBackupStatusObservers combines restoreInProgress only for SPARK_EXIT (BackupRepo.kt:494-495); line 497 leaves every other category on the status flow, and lines 499-502 schedule only when shouldBackup is true. checkForFailedBackups at lines 896-913 only shows a notification. This gap already exists at b0a01b1: shouldSkipBackup is true while restoring, and startBackupStatusObservers at lines 342-360 collects distinct status fields for every category without restoreInProgress. This PR adds the Spark-only resume and does not introduce or widen the other categories, so it carries no introduction claim and is not a PR defect. A focused issue search for restoreInProgress backup returned no open or closed issues, so tracked_separately is not available. It stays referenced through #1686 (comment). BackupRepo.kt is unchanged by e53c2a7. No new evidence.
- [MEDIUM] Retry cannot refresh an expired session for a failed pubky profile delete — Retrying a failed pubky profile delete still cannot refresh an expired session. deleteProfile calls pubkyService.deletePubkyProfile directly at PubkyRepo.kt:1574. refreshSessionIfPossibleLocked is private at line 2725, and its only call is inside withPubkyAppScopeLocked at line 1956, which this delete path never calls. ProfileRemovalCoordinator.kt:335 calls the same pubkyRepo.deleteProfile again on Retry. The thread #1689 (comment) is unresolved and outdated; pull request 1689 is merged. The e53c2a7 delta does not change this delete path. ovi-reviewer reports, at d22508b, that Delete and repeated Review stayed in recovery failure after genuine signed-grant expiry (#1686 (review)); that run was not repeated at this head. No material change, so it stays an existing concern.
Reviewer model: grok-4.7
Reasoning effort: xhigh
|
@ben-kaufman please resolve conflicts. |
Keep master's receive-session guard on the paid public invoice refresh alongside this branch's publication admission. Verified: just compile, just test, just lint
@piotr-iohk Resolved by merging master in 0625a27. The conflicts came from #2236:
Compile, unit tests and lint pass locally. |
There was a problem hiding this comment.
Verdict: ⛔️ Request changes — three existing availability failures remain; no new delta finding.
Findings:
- HIGH (existing) — Terminal identity failure blocks ordinary WALLET backups.
BackupRepo.kt:1438: a new watch-only account reservation stayed pending and the remote WALLET bytes/version stayed unchanged. Repairing the original credentials allowed a complete upload. The existing finding remains. Preserve backup completeness while repairing availability. - MEDIUM (existing) — Native authentication keeps Reset waiting.
VssClientCoordinator.kt:138: Reset retained credentials and closed admission at 201.5s after confirmation while actual native authentication was held; it finished 7.2s after release (UI/app/proxy readbacks). The native deadline correction is still not adopted by VSS 0.5.26-rc3. - MEDIUM (existing) — Profile-delete Retry cannot recover expired authorization.
PubkyRepo.kt:1580: After genuine signed-grant expiry, Delete and repeated Review stayed in recovery failure; the original signer and expired saved grant were retained (UI/keychain readback). This retains the existing report.
QA for 0625a27:
Unfunded Android 15/API 35 dev wallets against staging services. Built and installed the pristine head; the recorded cases use unpublished Debug controls for fault boundaries and app/VSS readbacks. All 11 native libraries match the pristine APK, and the installed APK matches its control build. Videos play at 2×.
Back up ordinary changes after terminal identity failure ❌ New ordinary watch-only reservation remained pending; real VSS WALLET bytes and version did not change. Repairing original credentials allowed a complete WALLET upload.
terminal-wallet-backup2x.2x.mp4
Start a new wallet after cold Reset without native probes ✅ Reset reached node stop in 20.9s during a real homeserver hold, reached Terms after release, and the next wallet reached Home in 36.7s without a process restart or native state probes (UI, proxy and runtime logs).
cold-reset-ui-only2x.2x.mp4
Finish Reset while native authentication is held ❌ Reset retained credentials and closed admission at 201.5s after confirmation while actual native authentication was held; it finished 7.2s after release (UI/app/proxy readbacks).
stalled-native-auth2x.2x.mp4
Retry profile deletion after the current grant expires ❌ After genuine signed-grant expiry, Delete and repeated Review stayed in recovery failure; the original signer and expired saved grant were retained (UI/keychain readback).
expired-profile-delete-retry2x.2x.mp4
Automated regression and static checks ✅ Assembly, focused JVM suites, Detekt and Android Lint pass.
Ran assembleDevDebug, PubkyRepoTest, PubkyIdentityOperationsTest, AppViewModelSendFlowTest, PublicPaykitRepoTest, PaykitSdkOperationLockTest, WipeWalletUseCaseTest, NearbyAdvertisePermissionTest, detekt and lintDevDebug. The committed wrapped-wipe creation regression passes. An additional unpushed Ring-adoption regression invokes the real ServiceQueue wrapper, verifies sign-in was reached and checks that neither record lookup nor sign-up follows the wrapped wipe refusal; it also passes. Full JVM, Compose instrumentation and E2E suites were not repeated.
Retained evidence (original heads and qualifications):
- Manual 1–2, J2 and required recovery/Retry: 710292a.
- Manual 3 and Manual 4 interrupted debounce/acknowledged SETTINGS replacement: cd0befc.
- Manual 4 restore-clear/real ten-minute expiry: acdd99c.
- Manual 5 funded sends/results/withdrawal: c4d9939.
- Manual 5 retained-display/native-error boundary: bc6b171.
- Manual 6 cache hydration during held startup: 89f3bc6.
- J1 reconnect/stale enrichment: 4aa622f.
- J1 restart without duplication: 3e1fdb7.
- J3 queued Settings acknowledgement and post-erasure Reset recovery: 5c7df26.
- Failed-Reset restore recovery and loading ownership: d22508b.
- Merged queued-receipt journey: synonymdev/bitkit-android#2236 at badf588.
- Merged nearby permission flows: synonymdev/bitkit-android#2231 at 21439c1.
These are constituent runs, not a new uninterrupted J1 execution. The merged receipt and permission behavior keeps its recorded upstream device coverage; the receipt/publication ownership integration was also exercised by the current-head JVM regressions. The upstream queued-receipt restart concern retains its existing disposition.
Not driven: actual Rust panic, external Ring application UI, funded nonempty-USDT recovery or an actual unilateral Spark exit; these require distinct fixtures or runtime behavior outside this delta. The deferred allowance-documentation issue and pre-existing non-Spark observer gap retain their recorded disposition.
Reviewed the contiguous e53c2a7..0625a27 delta, all 13 paths, reached receipt, identity and permission code, and the open findings. This is a master merge; it preserves the wrapped-wipe refusal fix. No new dependency, workflow or rule-file changes occur. Receipt/nearby device cases were inherited as above; their current integration was checked in code and JVM tests.
Twin: synonymdev/bitkit-ios#1121 remains at 3af88fff and matches required-recovery-before-optional-profile ordering and complete-backup protection. The merged Android receipt queue and split Bluetooth permission changes have separate upstream scope; no new Swift restore change is implied.
Unpushed regression control
diff --git a/app/src/test/java/to/bitkit/repositories/PubkyRepoTest.kt b/app/src/test/java/to/bitkit/repositories/PubkyRepoTest.kt
index c396bc07a..9ae7cf290 100644
--- a/app/src/test/java/to/bitkit/repositories/PubkyRepoTest.kt
+++ b/app/src/test/java/to/bitkit/repositories/PubkyRepoTest.kt
@@ -77,6 +77,7 @@ import org.mockito.kotlin.verify
import org.mockito.kotlin.verifyBlocking
import org.mockito.kotlin.whenever
import org.mockito.verification.VerificationMode
+import to.bitkit.async.ServiceQueue
import to.bitkit.data.ProfileRemovalState
import to.bitkit.data.ProfileRemovalStore
import to.bitkit.data.PubkyCachedProfile
@@ -1242,6 +1243,30 @@ class PubkyRepoTest : BaseUnitTest() {
httpClient.close()
}
+ @Test
+ fun `adoptRingIdentity does not start fallback networking after wrapped wipe refusal`() = test {
+ val httpClient = identityHttpClient()
+ sut = createSut(httpClient)
+ sut.awaitInitialization()
+ advanceUntilIdle()
+ val ringPubky = stubRingCredential()
+ val wipeError = assertFailsWith<AppError> {
+ ServiceQueue.PUBKY.background(testDispatcher) {
+ throw PaykitException.Storage("wallet_wipe_in_progress", "Paykit operation interrupted by wallet wipe")
+ }
+ }
+ whenever(pubkyService.signIn("ring_secret")).thenAnswer { throw wipeError }
+ whenever(pubkyService.hasIdentityRecord(ringPubky)).thenReturn(false)
+ try {
+ sut.adoptRingIdentity(ringPubky)
+ verifyBlocking(pubkyService) { signIn("ring_secret") }
+ verifyBlocking(pubkyService, never()) { hasIdentityRecord(any()) }
+ verifyBlocking(pubkyService, never()) { signUp(any(), any(), any()) }
+ } finally {
+ httpClient.close()
+ }
+ }
+
@Test
fun `createIdentity signs in when sign up finds the identity on another homeserver`() = test {
val httpClient = identityHttpClient()Unpushed Debug controls
Stages explicit holds/failures and reports app/VSS state; native responses are not substituted.
diff --git a/app/src/debug/java/to/bitkit/dev/DevToolsProvider.kt b/app/src/debug/java/to/bitkit/dev/DevToolsProvider.kt
index 289131a..bee9048 100644
--- a/app/src/debug/java/to/bitkit/dev/DevToolsProvider.kt
+++ b/app/src/debug/java/to/bitkit/dev/DevToolsProvider.kt
@@ -43,6 +43,7 @@ class DevToolsProvider : ContentProvider() {
override fun call(method: String, arg: String?, extras: Bundle?): Bundle {
check(Binder.getCallingUid() == SHELL_UID) { "Only ADB shell callers are allowed" }
+ if (method.startsWith("qa1686")) return kotlinx.coroutines.runBlocking(kotlinx.coroutines.Dispatchers.IO) { Qa1686.run(requireNotNull(context), method, arg) } // test hook
return runCatching {
// Needs no node, so it does not wait behind LDK work.
if (method == OverrideNfc.METHOD) return@runCatching OverrideNfc.execute(arg)
diff --git a/app/src/main/java/to/bitkit/data/backup/VssBackupClientLdk.kt b/app/src/main/java/to/bitkit/data/backup/VssBackupClientLdk.kt
index 259d689..1ddbcf7 100644
--- a/app/src/main/java/to/bitkit/data/backup/VssBackupClientLdk.kt
+++ b/app/src/main/java/to/bitkit/data/backup/VssBackupClientLdk.kt
@@ -57,7 +57,7 @@ class VssBackupClientLdk @Inject constructor(
storeId = vssDeriveStoreId(Env.vssStoreIdPrefix, mnemonic, passphrase),
mnemonic = mnemonic,
passphrase = passphrase,
- lnurlAuthServerUrl = Env.lnurlAuthServerUrl,
+ lnurlAuthServerUrl = if (to.bitkit.BuildConfig.DEBUG && java.io.File("/data/user/0/to.bitkit.dev/files/qa1686-auth-override").exists()) "http://127.0.0.1:23569/lnurl_auth/auth" else Env.lnurlAuthServerUrl, // test hook
keyDomain = Env.lnurlAuthKeyDomain,
)
Logger.info("VSS LDK client setup for wallet[$walletIndex]", context = TAG)
diff --git a/app/src/main/java/to/bitkit/repositories/LightningRepo.kt b/app/src/main/java/to/bitkit/repositories/LightningRepo.kt
index 1ec0241..084936b 100644
--- a/app/src/main/java/to/bitkit/repositories/LightningRepo.kt
+++ b/app/src/main/java/to/bitkit/repositories/LightningRepo.kt
@@ -914,7 +914,17 @@ class LightningRepo @Inject constructor(
suspend fun stop(): Result<Unit> = withContext(bgDispatcher) {
stopRequestCount.incrementAndGet()
- lifecycleMutex.withLock { stopLocked() }
+ lifecycleMutex.withLock { // test hook
+ if (to.bitkit.BuildConfig.DEBUG) { // test hook
+ val root = java.io.File("/data/user/0/to.bitkit.dev/files") // test hook
+ if (java.io.File(root, "qa1686-fail-stop").exists()) { // test hook
+ java.io.File(root, "qa1686-stop-entered").writeText("before credential erasure") // test hook
+ while (java.io.File(root, "qa1686-stop-hold").exists()) kotlinx.coroutines.delay(100) // test hook
+ return@withLock Result.failure(AppError("QA controlled node stop failure")) // test hook
+ } // test hook
+ } // test hook
+ stopLocked() // test hook
+ } // test hook
}
private suspend fun stopLocked(): Result<Unit> {
diff --git a/app/src/main/java/to/bitkit/repositories/PubkyRepo.kt b/app/src/main/java/to/bitkit/repositories/PubkyRepo.kt
index 0d3175e..5667a38 100644
--- a/app/src/main/java/to/bitkit/repositories/PubkyRepo.kt
+++ b/app/src/main/java/to/bitkit/repositories/PubkyRepo.kt
@@ -482,7 +482,21 @@ class PubkyRepo @Inject constructor(
private var restoreInitialization: Pair<Long, Job>? = null
init {
- scope.launch { initialize() }.invokeOnCompletion {
+ scope.launch { // test hook
+ if (to.bitkit.BuildConfig.DEBUG) { // test hook
+ val f = java.io.File("/data/user/0/to.bitkit.dev/files/qa1686-before-startup-hold") // test hook
+ while (f.exists()) kotlinx.coroutines.delay(100) // test hook
+ } // test hook
+ initialize() // test hook
+ if (to.bitkit.BuildConfig.DEBUG) { // test hook
+ val f = java.io.File("/data/user/0/to.bitkit.dev/files/qa1686-startup-tail-hold") // test hook
+ if (f.exists()) { // test hook
+ java.io.File(f.parentFile, "qa1686-startup-tail-held").writeText("initializationReady complete; startup completion withheld") // test hook
+ while (f.exists()) kotlinx.coroutines.delay(100) // test hook
+ Logger.info("QA1686 startup tail released", context = TAG) // test hook
+ } // test hook
+ } // test hook
+ }.invokeOnCompletion {
// A wipe can cancel startup before the restore clears this flag itself.
if (!initializationReady.isCompleted) _isRestoringSession.update { false }
initializationReady.complete(Unit)
@@ -644,6 +658,11 @@ class PubkyRepo @Inject constructor(
}
private suspend fun resumeInterruptedRestore() {
+ if (to.bitkit.BuildConfig.DEBUG) { // test hook
+ val f = java.io.File("/data/user/0/to.bitkit.dev/files/qa1686-resume-count") // test hook
+ if (f.exists()) f.writeText((f.readText().trim().toInt() + 1).toString()) // test hook
+ Logger.info("QA1686 resumed interrupted restore", context = TAG) // test hook
+ } // test hook
runSuspendCatching {
identityOperations.transition(cancelOnWipe = true) {
if (requiresProfileRecovery()) return@transition
@@ -693,6 +712,18 @@ class PubkyRepo @Inject constructor(
}
private suspend fun loadIdentityData() {
+ if (to.bitkit.BuildConfig.DEBUG) { // test hook
+ val counter = java.io.File("/data/user/0/to.bitkit.dev/files/qa1686-load-count") // test hook
+ if (counter.exists()) counter.writeText((counter.readText().trim().toInt() + 1).toString()) // test hook
+ } // test hook
+ if (to.bitkit.BuildConfig.DEBUG) { // test hook
+ val f = java.io.File("/data/user/0/to.bitkit.dev/files/qa1686-enrichment-hold") // test hook
+ if (f.exists()) { // test hook
+ java.io.File(f.parentFile, "qa1686-enrichment-held").writeText("entered after sign-in") // test hook
+ Logger.info("QA1686 held optional enrichment", context = TAG) // test hook
+ while (f.exists()) kotlinx.coroutines.delay(100) // test hook
+ } // test hook
+ } // test hook
coroutineScope {
launch { loadProfile() }
launch { loadContacts() }
diff --git a/app/src/main/java/to/bitkit/services/PaykitSdkService.kt b/app/src/main/java/to/bitkit/services/PaykitSdkService.kt
index d96435d..04f004c 100644
--- a/app/src/main/java/to/bitkit/services/PaykitSdkService.kt
+++ b/app/src/main/java/to/bitkit/services/PaykitSdkService.kt
@@ -949,6 +949,15 @@ class PaykitSdkService @Inject constructor(
requireProfileIdentity(currentIdentity(), expectedIdentity)
requireNoActiveSubscriptions(handle())
completeSdkCall {
+ if (to.bitkit.BuildConfig.DEBUG) { // test hook
+ val deadlineFile = java.io.File("/data/user/0/to.bitkit.dev/files/qa1686-expiry-deadline") // test hook
+ if (deadlineFile.exists()) { // test hook
+ deadlineFile.delete() // test hook
+ Logger.info("QA1686 entered Pubky delete before genuine grant expiry", context = TAG) // test hook
+ while (java.io.File("/data/user/0/to.bitkit.dev/files/qa1686-expiry-hold").exists()) kotlinx.coroutines.delay(100) // test hook
+ Logger.info("QA1686 dispatched Pubky delete after genuine grant expiry", context = TAG) // test hook
+ } // test hook
+ } // test hook
handle().deletePubkyProfile(expectedRevision)
onAcknowledged()
}
diff --git a/app/src/main/java/to/bitkit/services/PubkyService.kt b/app/src/main/java/to/bitkit/services/PubkyService.kt
index 2aac52a..fc2e785 100644
--- a/app/src/main/java/to/bitkit/services/PubkyService.kt
+++ b/app/src/main/java/to/bitkit/services/PubkyService.kt
@@ -43,16 +43,29 @@ class PubkyService @Inject constructor(
}
suspend fun initializeAndImportSession(secret: String): Result<String> = ServiceQueue.PUBKY.background {
- paykitSdkService.initializeAndImportSession(secret).map { it.publicKey }
+ paykitSdkService.initializeAndImportSession(secret).map { it.publicKey }.also { qa1686Hold("init", it.isSuccess) } // test hook
}
suspend fun republishIdentityIfNeeded(publicKey: String? = null) =
paykitSdkService.republishIdentityIfNeeded(publicKey)
+ private suspend fun qa1686Hold(name: String, success: Boolean) { // test hook
+ if (!to.bitkit.BuildConfig.DEBUG) return // test hook
+ val root = java.io.File("/data/user/0/to.bitkit.dev/files") // test hook
+ val counter = java.io.File(root, "qa1686-$name-count") // test hook
+ if (counter.exists()) counter.writeText((counter.readText().trim().toInt() + 1).toString()) // test hook
+ val hold = java.io.File(root, "qa1686-$name-hold") // test hook
+ if (!hold.exists()) return // test hook
+ java.io.File(root, "qa1686-$name-held").writeText("actual native call returned success=$success") // test hook
+ to.bitkit.utils.Logger.info("QA1686 held actual native $name result", context = "TestHook") // test hook
+ while (hold.exists()) kotlinx.coroutines.delay(100) // test hook
+ to.bitkit.utils.Logger.info("QA1686 released actual native $name result", context = "TestHook") // test hook
+ } // test hook
+
// region Session management
suspend fun importSession(secret: String): String = ServiceQueue.PUBKY.background {
- paykitSdkService.importSession(secret).publicKey
+ paykitSdkService.importSession(secret).publicKey.also { qa1686Hold("import", true) } // test hook
}
suspend fun currentPublicKey(): String? = ServiceQueue.PUBKY.background {
diff --git a/app/src/main/java/to/bitkit/usecases/WipeWalletUseCase.kt b/app/src/main/java/to/bitkit/usecases/WipeWalletUseCase.kt
index de27185..43ac6f9 100644
--- a/app/src/main/java/to/bitkit/usecases/WipeWalletUseCase.kt
+++ b/app/src/main/java/to/bitkit/usecases/WipeWalletUseCase.kt
@@ -99,6 +99,7 @@ class WipeWalletUseCase @Inject constructor(
privatePaykitRepo.get().withProfileDeletionPaused { pause ->
lightningRepo.stop().getOrThrow()
profileRemovalStore.begin(attemptId)
+ if (to.bitkit.BuildConfig.DEBUG && java.io.File("/data/user/0/to.bitkit.dev/files/qa1686-fail-after-pending").exists()) throw AppError("QA controlled failure after pending Reset record") // test hook
if (pending.scope != ProfileRemovalScope.WALLET_WIPE) cleanupRemote()
wipeLocal(walletIndex, pause) { credentialsMayBeErased = true }.getOrThrow()
profileRemovalStore.complete(attemptId)
diff --git a/app/src/debug/java/to/bitkit/dev/Qa1686.kt b/app/src/debug/java/to/bitkit/dev/Qa1686.kt
new file mode 100644
index 0000000..28c7689
--- /dev/null
+++ b/app/src/debug/java/to/bitkit/dev/Qa1686.kt
@@ -0,0 +1,211 @@
+package to.bitkit.dev // test hook
+
+import android.content.Context // test hook
+import android.content.ClipData // test hook
+import android.content.ClipboardManager // test hook
+import android.os.Bundle // test hook
+import dagger.hilt.EntryPoint // test hook
+import dagger.hilt.InstallIn // test hook
+import dagger.hilt.android.EntryPointAccessors // test hook
+import dagger.hilt.components.SingletonComponent // test hook
+import kotlinx.coroutines.Dispatchers // test hook
+import kotlinx.coroutines.flow.first // test hook
+import kotlinx.coroutines.withContext // test hook
+import to.bitkit.data.CacheStore // test hook
+import to.bitkit.data.backup.VssBackupClient // test hook
+import to.bitkit.data.keychain.Keychain // test hook
+import to.bitkit.models.BackupCategory // test hook
+import to.bitkit.repositories.BackupRepo // test hook
+import to.bitkit.repositories.PubkyRepo // test hook
+import to.bitkit.repositories.WalletRepo // test hook
+import to.bitkit.repositories.LightningRepo // test hook
+import to.bitkit.services.PubkyService // test hook
+import to.bitkit.di.json // test hook
+import to.bitkit.models.WalletBackupV1 // test hook
+import to.bitkit.utils.Logger // test hook
+import java.io.File // test hook
+import kotlinx.coroutines.*
+import to.bitkit.models.*
+import to.bitkit.repositories.*
+import to.bitkit.services.*
+import kotlin.time.Clock
+
+object Qa1686 { // test hook
+ private var replacementPhrase: String? = null
+ private val scope = kotlinx.coroutines.CoroutineScope(kotlinx.coroutines.SupervisorJob() + Dispatchers.IO)
+ @EntryPoint @InstallIn(SingletonComponent::class) // test hook
+ interface Dependencies { // test hook
+ fun removal(): to.bitkit.data.ProfileRemovalStore
+ fun sparkExit(): SparkExitRepo
+ fun spark(): SparkRepo
+ fun sparkService(): SparkService
+ fun recovery(): to.bitkit.data.WalletConnectionRecovery
+ fun vssClients(): to.bitkit.data.backup.VssClientCoordinator
+ fun vssLdk(): to.bitkit.data.backup.VssBackupClientLdk
+ fun sdk(): to.bitkit.services.PaykitSdkService
+ fun allowanceExecutor(): to.bitkit.repositories.PaykitAllowanceExecutor
+ fun privatePaykit(): to.bitkit.repositories.PrivatePaykitRepo
+ fun allowances(): to.bitkit.repositories.PaykitAllowanceRepo
+ fun allowanceStore(): to.bitkit.repositories.PaykitAllowanceStore
+ fun keychain(): Keychain // test hook
+ fun backupRepo(): BackupRepo // test hook
+ fun pubkyRepo(): PubkyRepo // test hook
+ fun pubkyService(): PubkyService // test hook
+ fun vss(): VssBackupClient // test hook
+ fun cache(): CacheStore // test hook
+ fun wallet(): WalletRepo // test hook
+ fun accounts(): to.bitkit.data.WatchOnlyAccountStore
+ fun settings(): to.bitkit.data.SettingsStore
+ fun nodeService(): LightningService
+ fun lightning(): LightningRepo // test hook
+ } // test hook
+ suspend fun run(context: Context, method: String, arg: String?): Bundle { // test hook
+ val d = EntryPointAccessors.fromApplication(context, Dependencies::class.java) // test hook
+ fun file(name: String) = File(context.filesDir, "qa1686-$name")
+ val result = kotlin.runCatching { // test hook
+ when (method) {
+ "qa1686ResumeBackups" -> { // test hook
+ d.backupRepo().startObservingBackups() // test hook
+ "normal backup observers resumed" // test hook
+ } // test hook
+ "qa1686PendingState" -> {
+ val sdk=d.sdk()
+ val provider=sdk.javaClass.getDeclaredField("sessionProvider").apply { isAccessible=true }.get(sdk)
+ val live=provider.javaClass.getDeclaredField("liveSessionAccess").apply { isAccessible=true }.get(provider) != null
+ val repo=d.pubkyRepo()
+ val expected=file("expected-key").readText()
+ val imports=file("import-count").takeIf { it.exists() }?.readText()
+ "pending=${d.removal().pendingAttempt() != null}; resetRecovery=${d.removal().walletResetRecovery.first()}; sameIdentity=${repo.publicKey.value == expected}; identityPublished=${repo.publicKey.value != null}; liveSession=$live; imports=$imports; recoveryCount=${file("resume-count").readText()}; loadCount=${file("load-count").takeIf { it.exists() }?.readText()}; credentials=${d.keychain().exists(Keychain.Key.BIP39_MNEMONIC.name)}; savedSession=${d.keychain().exists(Keychain.Key.PAYKIT_SESSION.name)}; savedRoot=${d.keychain().exists(Keychain.Key.PUBKY_SECRET_KEY.name)}; wiping=${d.backupRepo().isWiping.value}; restoring=${repo.isRestoringSession.value}"
+ }
+ "qa1686PendingAdmission" -> {
+ val restored=d.pubkyRepo().restoreSessionIfNeeded()
+ val start=d.lightning().start(shouldRetry=false)
+ "restored=$restored; startSuccess=${start.isSuccess}; startError=${start.exceptionOrNull()?.javaClass?.simpleName}"
+ }
+ "qa1686DeltaState" -> {
+ val repo = d.pubkyRepo()
+ fun privateValue(name: String): Any? = repo.javaClass.getDeclaredField(name).apply { isAccessible = true }.get(repo)
+ val same = file("expected-key").takeIf { it.exists() }?.readText() == repo.publicKey.value
+ val credentials = d.keychain().exists(Keychain.Key.BIP39_MNEMONIC.name)
+ val initCount = file("init-count").takeIf { it.exists() }?.readText()
+ val retryCount = file("resume-count").takeIf { it.exists() }?.readText()
+ "sameIdentity=$same; identity=${repo.publicKey.value != null}; profile=${repo.profile.value?.name}; contacts=${repo.contacts.value.size}; restoring=${repo.isRestoringSession.value}; serviceInitialized=${privateValue("isServiceInitialized")}; initCount=$initCount; recoveryCount=$retryCount; credentials=$credentials; savedSession=${d.keychain().exists(Keychain.Key.PAYKIT_SESSION.name)}; savedRoot=${d.keychain().exists(Keychain.Key.PUBKY_SECRET_KEY.name)}; wiping=${d.backupRepo().isWiping.value}"
+ }
+ "qa1686DeltaPrepare" -> {
+ d.backupRepo().stopObservingBackups()
+ d.settings().update { it.copy(isDevModeEnabled = true) }
+ val key = requireNotNull(d.pubkyRepo().publicKey.value)
+ file("expected-key").writeText(key)
+ file("init-count").writeText("0")
+ file("resume-count").writeText("0")
+ "saved expected identity; profile=${d.pubkyRepo().profile.value?.name}; contacts=${d.pubkyRepo().contacts.value.size}"
+ }
+ "qa1686DeltaContact" -> {
+ val key = "pubky" + d.pubkyService().publicKeyFromSecret("01".repeat(32))
+ val p = PubkyProfile.forDisplay(publicKey = key, name = "QA contact", imageUrl = null)
+ d.pubkyRepo().addContact(key, p).getOrThrow()
+ "contact saved through native API; count=${d.pubkyRepo().contacts.value.size}"
+ }
+ "qa1686DeltaWarm" -> {
+ val repo=d.pubkyRepo()
+ val originalSession=requireNotNull(d.keychain().loadString(Keychain.Key.PAYKIT_SESSION.name))
+ val originalRoot=requireNotNull(d.keychain().loadString(Keychain.Key.PUBKY_SECRET_KEY.name))
+ d.pubkyService().forgetSessionAccess()
+ d.keychain().upsertString(Keychain.Key.PAYKIT_SESSION.name, originalSession)
+ d.keychain().upsertString(Keychain.Key.PUBKY_SECRET_KEY.name, originalRoot)
+ for (name in listOf("_publicKey", "_profile")) {
+ val f=repo.javaClass.getDeclaredField(name).apply { isAccessible=true }
+ @Suppress("UNCHECKED_CAST")
+ (f.get(repo) as kotlinx.coroutines.flow.MutableStateFlow<Any?>).value=null
+ }
+ val cf=repo.javaClass.getDeclaredField("_contacts").apply { isAccessible=true }
+ @Suppress("UNCHECKED_CAST")
+ (cf.get(repo) as kotlinx.coroutines.flow.MutableStateFlow<List<PubkyProfile>>).value=emptyList()
+ scope.launch { repo.initialize() }
+ "cleared volatile display and native access only; started real saved-session import"
+ }
+ "qa1686ExpiryExport" -> {
+ d.backupRepo().stopObservingBackups()
+ val root = requireNotNull(d.keychain().loadString(Keychain.Key.PUBKY_SECRET_KEY.name))
+ val session = requireNotNull(d.keychain().loadString(Keychain.Key.PAYKIT_SESSION.name))
+ file("ttl-root").writeText(root)
+ file("ttl-original-session").writeText(session)
+ "exported disposable signer/session to app-private fixture files; rootPresent=true; sessionPresent=true"
+ }
+ "qa1686ExpiryImport" -> {
+ val root = requireNotNull(d.keychain().loadString(Keychain.Key.PUBKY_SECRET_KEY.name))
+ val identity = requireNotNull(d.pubkyRepo().publicKey.value)
+ val imported = d.pubkyService().importSession(file("ttl-session").readText())
+ check(imported.removePrefix("pubky") == identity.removePrefix("pubky"))
+ check(root == d.keychain().loadString(Keychain.Key.PUBKY_SECRET_KEY.name))
+ check(identity == d.pubkyRepo().publicKey.value)
+ "imported genuine short-lived signed grant; originalRootUnchanged=true; currentRepositoryIdentityUnchanged=true; expiresAt=${file("expiry-deadline").readText()}"
+ }
+ "qa1686ExpiryState" -> {
+ val root = d.keychain().loadString(Keychain.Key.PUBKY_SECRET_KEY.name)
+ val current = d.keychain().loadString(Keychain.Key.PAYKIT_SESSION.name)
+ "rootUnchanged=${root == file("ttl-root").readText()}; savedSessionUnchanged=${current == file("ttl-session").readText()}; repositoryIdentityPresent=${d.pubkyRepo().publicKey.value != null}; profilePresent=${d.pubkyRepo().profile.value != null}"
+ }
+ "qa1686Dev" -> { d.settings().update { it.copy(isDevModeEnabled = true) }; "enabled developer mode" }
+ "qa1686NativeAuth" -> {
+ d.backupRepo().stopObservingBackups()
+ d.vssClients().withSuspendedClients {}
+ file("auth-override").writeText("hold")
+ d.vssLdk().setup().getOrThrow()
+ file("native-result").delete()
+ scope.launch {
+ try {
+ val result = d.vssLdk().getObject("qa1686-held-auth")
+ file("native-result").writeText("returned success=${result.isSuccess}; error=${result.exceptionOrNull()?.javaClass?.simpleName}")
+ } catch(e: Exception) { file("native-result").writeText("cancelled=${e.javaClass.simpleName}") }
+ }
+ "scheduled actual standalone LDK lookup against held auth response"
+ }
+ "qa1686NativeState" -> "credentialsPresent=${d.keychain().exists(Keychain.Key.BIP39_MNEMONIC.name)}; wiping=${d.backupRepo().isWiping.value}; admissionOpen=${runCatching { d.vssClients().captureOwner() }.isSuccess}; result=${file("native-result").takeIf { it.exists() }?.readText()}"
+ "qa1686Backup" -> {
+ for (c in listOf(BackupCategory.WALLET, BackupCategory.METADATA, BackupCategory.SETTINGS)) d.backupRepo().triggerBackup(c).getOrThrow()
+ val wallet = requireNotNull(d.vss().getObject("WALLET").getOrThrow())
+ val metadata = requireNotNull(d.vss().getObject("METADATA").getOrThrow())
+ val pending = d.cache().backupStatuses.first().filterKeys { it in listOf(BackupCategory.WALLET, BackupCategory.METADATA) }.any { it.value.isRequired }
+ check(!pending)
+ "backup synchronized; sdk=${json.decodeFromString<WalletBackupV1>(wallet.value.decodeToString()).paykitSdkBackupState != null}; metadataBytes=${metadata.value.size}"
+ }
+ "qa1686Terminal" -> {
+ d.backupRepo().stopObservingBackups()
+ val secret = requireNotNull(d.keychain().loadString(Keychain.Key.PUBKY_SECRET_KEY.name))
+ File(context.filesDir, "qa1686-original-secret").writeText(secret)
+ val session = requireNotNull(d.keychain().loadString(Keychain.Key.PAYKIT_SESSION.name))
+ File(context.filesDir, "qa1686-original-session").writeText(session)
+ d.pubkyService().forgetSessionAccess()
+ d.keychain().delete(Keychain.Key.PUBKY_SECRET_KEY.name)
+ d.keychain().upsertString(Keychain.Key.PAYKIT_SESSION.name, "qa1686-invalid-session")
+ d.pubkyRepo().initialize().getOrThrow()
+ check(d.pubkyRepo().publicKey.value == null)
+ val before = requireNotNull(d.vss().getObject("WALLET").getOrThrow())
+ val reserved = d.accounts().reserveAccountIndex(0, "qa1686-terminal-ordinary")
+ check(d.accounts().backupSnapshot().allocationState.highestAccountIndexByWallet["0"] == reserved)
+ val failed = d.backupRepo().triggerBackup(BackupCategory.WALLET)
+ val after = requireNotNull(d.vss().getObject("WALLET").getOrThrow())
+ val same = before.value.contentEquals(after.value) && before.version == after.version
+ val pending = d.cache().backupStatuses.first()[BackupCategory.WALLET]?.isRequired == true
+ check(failed.isFailure && same && pending)
+ "terminal=true; ordinary watch-only index=$reserved reserved; failed=true; remote unchanged=true; pending=true; error=${failed.exceptionOrNull()?.javaClass?.simpleName}"
+ }
+ "qa1686RepairIdentity" -> {
+ d.keychain().upsertString(Keychain.Key.PUBKY_SECRET_KEY.name, File(context.filesDir, "qa1686-original-secret").readText())
+ d.keychain().upsertString(Keychain.Key.PAYKIT_SESSION.name, File(context.filesDir, "qa1686-original-session").readText())
+ d.pubkyRepo().initialize().getOrThrow()
+ d.backupRepo().triggerBackup(BackupCategory.WALLET).getOrThrow()
+ "recovered original identity and complete WALLET upload"
+ }
+ "qa1686CreateProfile" -> {
+ d.pubkyRepo().createIdentity("QA restore", "", emptyList(), emptyList(), null).getOrThrow()
+ "created disposable profile"
+ }
+ else -> "source=${d.keychain().exists(Keychain.Key.SHARED_PUBKY_SOURCE.name)}, savedSecret=${!d.keychain().loadString(Keychain.Key.PUBKY_SECRET_KEY.name).isNullOrBlank()}, savedSession=${!d.keychain().loadString(Keychain.Key.PAYKIT_SESSION.name).isNullOrBlank()}, sdk=${d.pubkyService().currentPublicKey() != null}, identity=${d.pubkyRepo().publicKey.value != null}, profile=${d.pubkyRepo().profile.value?.name}, contacts=${d.pubkyRepo().contacts.value.size}, pendingRestore=${d.backupRepo().hasPendingWalletRestore()}, node=${d.lightning().lightningState.value.nodeLifecycleState}" // test hook
+ } // test hook
+ }.fold({ it }, { "ERROR: ${it.javaClass.simpleName}: ${it.message}" }) // test hook
+ Logger.info("QA1686 $method: $result", context="TestHook") // test hook
+ return Bundle().apply { putString("result", result) } // test hook
+ } // test hook
+} // test hookReviewed by gpt-6.1-sol-high
piotr-iohk
left a comment
There was a problem hiding this comment.
QA review
Scope: full PR at 0625a27, re-reviewed after the comparison base changed to 7a204ab. Merge base is that same commit. No prior coverage was inherited.
2 actionable findings — resolve or provide an evidence-backed rebuttal.
Two defects are introduced or worsened here. A profile deletion whose cleanup marker fails to save keeps the in-memory removal session after the failure dialog is dismissed, so Delete and Sign out stay blocked until the process is restarted. An LDK VSS setup timeout during network-graph or pathfinding-score reset now cancels the caller: the Recovery reset control keeps spinning with no error, and a failed score reset no longer restarts the node.
Restore still finishes required wallet and USDT recovery before optional Pubky activation. An unreadable identity is refused instead of being uploaded as an empty snapshot. A terminal backup failure still leaves that category quiet until a newer required timestamp arrives; that quiet-retry policy already existed for other terminal failures, and this refusal uses it. Compared with bitkit-ios#1121 at 3af88ff for the shared restore and profile-removal flow only: iOS keeps a delete-failure disconnect action and does not use this Android session. That was not a full iOS review. The timeout is specific to these Kotlin callers.
Device testing was not performed. No unit suite was run for this review. Author cases 1–6 and journeys J1–J3 do not exercise either failure below. No matching GitHub issue was found for either mechanism.
Suggested additional test cases:
- Android, Edit Profile: confirm Delete and fail
ProfileRemovalStore.beginbefore it commits. Dismiss the failure dialog with Close, then tap Delete again and Sign out from Profile. Another attempt can start, or Disconnect stays available. The remote profile and local credentials stay unchanged. - Android, Recovery: reset the network graph while standalone LDK VSS setup exceeds 30 seconds. The reset returns a failure, the button stops spinning, and an error is shown. Repeat a pathfinding-score reset: the node is restarted after the timeout.
Earlier findings reconciled at this revision: 4 still present, 1 could not be verified.
Reconciliation incomplete: the following earlier concerns remain unverified. This report does not establish that they are fixed or invalid, or establish approval or device readiness.
Could not verify earlier concern — Cold reset next-wallet initializing stall is untraced: Thread #1686 (comment) (PRRT_kwDOMPAnV86-5Fvg) remains unresolved, not outdated, and anchored at PubkyIdentityOperations.kt:87. Its queued-before-wipe mechanism was previously verified fixed and is not reopened. The remaining report is separate: at d22508b, after a cold Reset erased credentials, the next wallet stayed at 100%/Initializing for 193.7 seconds and recovered after an app restart. The reviewer states that no changed-line cause was established, that native state probes may affect SDK setup, and that the UI-only comparison did not start before the head moved. The commits after d22508b do not identify that stall. This run did not start a device, so the observation was not repeated at 0625a27 and is not a verified defect.
Findings
- [MEDIUM] Release the profile-removal session when the marker write fails — inline at
app/src/main/java/to/bitkit/usecases/ProfileRemovalCoordinator.kt:314. - [MEDIUM] Return LDK VSS setup timeouts as reset failures — inline at
app/src/main/java/to/bitkit/repositories/LightningRepo.kt:957.
Existing concerns
- [MEDIUM] Bound native authentication before draining VSS during reset — Reset still waits on a held LNURL-auth response before it can shut the standalone VSS clients down or delete credentials. Threads #1686 (comment) (PRRT_kwDOMPAnV861DLWS) and #1686 (comment) (PRRT_kwDOMPAnV869SvsQ) are unresolved, not outdated, and anchored at VssClientCoordinator.kt:138. WipeWalletUseCase.kt:82-87 sets wiping and then enters withIdentityChange; the finally at lines 116-119 clears wiping only after that call returns. The coordinator join is NonCancellable and reaches vssShutdownClient and vssShutdownLdkClient only after every admitted job returns. Both the base and this head pin com.synonym:vss-client-android 0.5.26-rc3. Annotated tag v0.5.26-rc3 (b321a171524ee51a31462df534c03f21b4a79c2b) peels to 3baf76dda37126d313f85ed2298abd65f6ef62b2. There, execute_async at src/lib.rs:32-41 runs rt.block_on, used by vss_get at lines 208-212 and vss_ldk_get at lines 473-480. KeyDomainLnurlAuthProvider at src/lnurl_auth.rs:147 builds reqwest::Client::builder().build() with no timeout, and fetch_jwt_token at lines 162-191 awaits the challenge and signed callback with no deadline. VssBackupClient.kt:73 and VssBackupClientLdk.kt:61 pass that key domain, and the gets at VssBackupClient.kt:127 and VssBackupClientLdk.kt:79 are admitted through withClient. Cancelling the Kotlin job therefore leaves that blocked poll running. ResetAndRestoreScreen.kt:76, :81, :114, and :122 keep Back disabled and Reset loading while isWiping stays true. synonymdev/vss-rust-client-ffi#36 is still open, merged_at null, head 1a5b788ceabac22739a9c9deabef67fea071b644. This is the same mechanism as synonymdev/bitkit-ios#1121 (comment). Earlier device holds were not repeated at this head. No material change, so it stays an existing concern.
- [LOW] Allowance journey describes a delayed-contact check its actions do not perform — The journey description still tells the runner to repeat the off/on sequence while contact loading is delayed, and the action list still does one off, one request, and one on. Thread #1686 (comment) (PRRT_kwDOMPAnV86yliGN) is resolved, not outdated, and anchored at journeys/allowances/allowances-turned-off.xml:6. The author reply defers it as out of scope to #1766, which is still open and titled "docs: clarify delayed-contact coverage in the allowance toggle journey". That resolution leaves the mismatched sentence in this PR's diff against 7a204ab. No new evidence.
- [MEDIUM] Backups required during restore stay unscheduled after restore — A backup category other than SPARK_EXIT that becomes required while restore is in progress is still not scheduled when restore ends. shouldBackup is false while restoring, the status observer drops that emission, and distinctUntilChanged does not re-emit when only the restore flag changes. At this head, startBackupStatusObservers combines restoreInProgress only for SPARK_EXIT; line 497 leaves every other category on the status flow, and lines 499-502 schedule only when shouldBackup is true. This gap already exists at 7a204ab: shouldSkipBackup is true while restoring, startBackupStatusObservers at lines 342-357 collects distinct status fields for every category without restoreInProgress, and restorePublicAddress at line 122 already calls markPublicAddressBackupRequired. This PR adds the Spark-only resume and does not introduce or worsen the other categories, so it carries no introduction claim and is not a PR defect. A focused issue search for restoreInProgress backup status observer returned total_count 0, including closed issues, so tracked_separately is not available. It stays referenced through #1686 (comment). That comment's device run was not repeated here.
- [MEDIUM] Retry cannot refresh an expired session for a failed pubky profile delete — Retrying a failed pubky profile delete still cannot refresh an expired session. The thread #1689 (comment) is unresolved and its anchor is outdated; pull request 1689 is merged. deleteProfile calls pubkyService.deletePubkyProfile directly at PubkyRepo.kt:1580. refreshSessionIfPossibleLocked is private at line 2731, and its only call is inside withPubkyAppScopeLocked at line 1962, which this delete path never calls. ProfileRemovalCoordinator.reviewAgain at line 193 prepares another deletion, and remove at line 335 calls the same pubkyRepo.deleteProfile again. An expired session therefore fails the delete again on Review. The master merge moved the call from line 1574 to 1580 by inserting storedIdentityGuard and did not add a refresh. ovi-reviewer reports, at d22508b, that Delete and repeated Review stayed in recovery failure after genuine signed-grant expiry (#1686 (review)); that run was not repeated at this head. No material behavior change, so it stays an existing concern.
Reviewer model: grok-4.7
Reasoning effort: xhigh
A profile removal whose durable marker never lands, by write failure or cancellation, now releases its session so Delete and Sign out can run again. The marker is read after any in-flight write settles. An LDK VSS setup timeout during deleteObjects is now a failed Result, so network graph and pathfinding score resets report it and restart paths run. Verified: just compile, just test, just lint
piotr-iohk
left a comment
There was a problem hiding this comment.
QA review
Scope: changes since 0625a27, including affected code paths, at 84599e3. Baseline: previous review. Unchanged restore, backup, wipe, allowance, balance, and journey coverage is inherited. This pass reviewed the removal-marker release and the LDK setup-timeout result.
No new actionable code findings.
A profile removal whose marker write fails or is cancelled reads the store after in-flight DataStore updates settle. The in-memory session is released only when that read shows no attempt id, and the original error is rethrown, so Delete and Sign out can be prepared again. When the marker has landed, the session stays held and remote deletion still starts only after a successful begin. An LDK VSS setup timeout inside deleteObjects becomes BackupClientSetupTimeout instead of escaping as cancellation, so network-graph, pathfinding, and payment-routing resets receive a failed result and their existing restart paths run.
Compared with twin bitkit-ios#1121 at 3af88ff for these two contracts only. iOS throws VSS setup timeouts as normal errors and does not keep this Android removal session.
Hosted unit, lint, and Compose checks on this head had succeeded. Local E2E was still running. Device testing was not performed. The PR description still records the terminal complete-WALLET availability limitation; this follow-up does not change that path.
Suggested additional test cases
- Android, disposable profile: start Delete or Sign out and fail or cancel the removal-marker write before it lands. The error should be retryable, a second Delete or Sign out should run, and no remote profile or payment-endpoint deletion should have occurred. When the marker does land, recovery should remain required.
- Android, dev wallet: stall LDK VSS setup past its 30s timeout during a network-graph or pathfinding reset. The reset should report failure, the reset control should leave its busy state, and the node should be running again.
Earlier findings reconciled at this revision: 5 still present, 2 verified fixed, 1 not substantiated.
Existing concerns
- [MEDIUM] Bound native authentication before draining VSS during reset — Reset still waits on a held LNURL-auth response before it can shut the standalone VSS clients down or delete credentials. Threads #1686 (comment) (PRRT_kwDOMPAnV861DLWS) and #1686 (comment) (PRRT_kwDOMPAnV869SvsQ) are unresolved, not outdated, and anchored at VssClientCoordinator.kt:138. WipeWalletUseCase.kt:82-87 sets wiping and then enters withIdentityChange; the finally at lines 116-119 clears wiping only after that call returns. The coordinator join is NonCancellable and reaches vssShutdownClient and vssShutdownLdkClient only after every admitted job returns. Both the base and this head pin com.synonym:vss-client-android 0.5.26-rc3, and that pin is not in the diff. Annotated tag v0.5.26-rc3 (b321a171524ee51a31462df534c03f21b4a79c2b) peels to 3baf76dda37126d313f85ed2298abd65f6ef62b2. There, execute_async at src/lib.rs:32-41 runs rt.block_on, used by vss_get at lines 208-212 and vss_ldk_get at lines 473-480. KeyDomainLnurlAuthProvider at src/lnurl_auth.rs:147 builds reqwest 0.12.25 with Client::builder().build() and sets no timeout, and fetch_jwt_token at lines 162-191 awaits the challenge and signed callback with no deadline. VssBackupClient.kt:73 and VssBackupClientLdk.kt:61 pass that key domain, and the gets at VssBackupClient.kt:127 and VssBackupClientLdk.kt:79 are admitted through withClient. Cancelling the Kotlin job therefore leaves that blocked poll running. ResetAndRestoreScreen.kt:76, :81, :114, and :122 keep Back disabled and Reset loading while isWiping stays true. synonymdev/vss-rust-client-ffi#36 is still open, merged_at null, head 1a5b788ceabac22739a9c9deabef67fea071b644. This is the same mechanism as synonymdev/bitkit-ios#1121 (comment). ovi-reviewer reports a 201.5s hold at 0625a27 in #1686 (review); that run was not repeated here, and 84599e3 does not change this path. No material change, so it stays an existing concern.
- [LOW] Allowance journey describes a delayed-contact check its actions do not perform — The journey description still tells the runner to repeat the off/on sequence while contact loading is delayed, and the action list still does one off, one request, and one on. Thread #1686 (comment) (PRRT_kwDOMPAnV86yliGN) is resolved, not outdated, and anchored at journeys/allowances/allowances-turned-off.xml:6. The author reply defers it as out of scope to #1766, which is still open and titled "docs: clarify delayed-contact coverage in the allowance toggle journey". That resolution leaves the mismatched sentence in this PR's diff against 7a204ab. No new evidence.
- [MEDIUM] Backups required during restore stay unscheduled after restore — A backup category other than SPARK_EXIT that becomes required while restore is in progress is still not scheduled when restore ends. shouldBackup is false while restoring, the status observer drops that emission, and distinctUntilChanged does not re-emit when only the restore flag changes. At this head, startBackupStatusObservers combines restoreInProgress only for SPARK_EXIT; line 497 leaves every other category on the status flow, and lines 499-502 schedule only when shouldBackup is true. This gap already exists at 7a204ab: shouldSkipBackup is true while restoring, startBackupStatusObservers at lines 342-357 collects distinct status fields for every category without restoreInProgress, and restorePublicAddress at line 122 already calls markPublicAddressBackupRequired. This PR adds the Spark-only resume and does not introduce or worsen the other categories, so it carries no introduction claim and is not a PR defect. A focused issue search for restoreInProgress backup status observer returned total_count 0, including closed issues, so tracked_separately is not available. It stays referenced through #1686 (comment). That comment's device run was not repeated here. 84599e3 does not change BackupRepo.kt.
- [MEDIUM] Retry cannot refresh an expired session for a failed pubky profile delete — Retrying a failed pubky profile delete still cannot refresh an expired session. The thread #1689 (comment) is unresolved and its anchor is outdated; pull request 1689 is merged. deleteProfile calls pubkyService.deletePubkyProfile directly at PubkyRepo.kt:1580. refreshSessionIfPossibleLocked is private at line 2731, and its only call is inside withPubkyAppScopeLocked at line 1962, which this delete path never calls. ProfileRemovalCoordinator.reviewAgain at line 193 prepares another deletion, and remove at line 345 calls the same pubkyRepo.deleteProfile again. PaykitSdkService.deletePubkyProfile at lines 942-955 runs the native delete through completeSdkCall at lines 2374-2381, which does not refresh the session; invalidatePaykitKeyIfNeeded at lines 2318-2321 only clears the cached key on PaykitException.Identity. An expired session therefore fails the delete again on Review. 84599e3 does not change PubkyRepo.kt. ovi-reviewer reports, at 0625a27, that Delete and repeated Review stayed in recovery failure after genuine signed-grant expiry (#1686 (review)); that run was not repeated at this head. No material behavior change, so it stays an existing concern.
- [LOW] Offer local disconnect when delete fails before the removal marker — Confirming Delete while the homeserver refuses the pre-marker profile read still shows a toast and no recovery dialog. jvsena42 reports this at 0294558 in #1686 (review): with the homeserver refused, Delete showed only "Failed to disconnect profile" for a transport error whose context was "read Pubky v1 migration flag", stayed on Edit Profile, deleted nothing, and left retry working but without Disconnect. That SDK context string is not in the app source, and the reviewer did not trace which call produced it. At this head the same class of failure still bypasses the dialog: validateProfileLogout and validateProfileDeletion run before removalMayHaveStarted is set, the catch rethrows when that flag is false, and Edit Profile shows the dialog only for a ProfileRemovalFailure. Other errors go to showRemovalError, which sets local disconnect only for a local-only or subscription error and otherwise toasts profile__disconnect_error. A refused homeserver during that validation therefore offers no local Disconnect, while a later cleanup failure still does. This run did not repeat the device check. Issue search found no matching open issue. The marker-write release in 84599e3 uses this plain-error path for an unwritten marker; it does not add Disconnect for a pre-marker network failure.
Reviewer model: grok-4.7
Reasoning effort: xhigh
There was a problem hiding this comment.
Verdict: ⛔️ Request changes — three existing availability failures remain; no new delta finding.
Findings:
- HIGH (existing) — Terminal identity failure blocks ordinary WALLET backups.
BackupRepo.kt:1438: a new ordinary watch-only reservation remained pending while the remote WALLET bytes and version stayed unchanged. Repairing the original credentials allowed a complete upload. The existing finding remains. Preserve backup completeness while repairing availability. - MEDIUM (existing) — Native authentication keeps Reset waiting.
VssClientCoordinator.kt:138: Reset retained credentials and closed admission while a real native authentication response was held; it finished after release. VSS 0.5.26-rc3 still does not adopt the native deadline correction. - MEDIUM (existing) — Profile-delete Retry cannot recover expired authorization.
PubkyRepo.kt:1580: Delete and repeated Review failed after genuine signed-grant expiry, retaining the original identity credentials. This retains the existing report.
QA for 84599e3:
Unfunded Android 15/API 35 development wallets against staging services. Built and installed the pristine head; the recorded cases use unpublished Debug controls for fault boundaries and app/VSS readbacks. All native libraries match the pristine APK, and installed APK checksums were verified. Videos play at 2×. The setup-timeout controls wait inside the existing 30-second setup deadline before native construction; the separate native-authentication case holds an actual HTTP response.
Retry Delete and Sign out after a failed cleanup marker ✅ A real cleanup-marker write failure left no pending record; fresh Delete reopened in the UI and normal sign-out preparation succeeded through the real coordinator in the same process; original credentials and remote profile revision were unchanged (UI hierarchy and app/remote readbacks).
removal-marker-failure2x.2x.mp4
Show a Recovery error after graph setup times out ✅ A controlled setup wait hit the existing 30-second deadline; Recovery handled BackupClientSetupTimeout, cleared loading, and allowed another reset confirmation (UI hierarchy and runtime log).
graph-setup-timeout2x.2x.mp4
Restart Lightning after score setup times out ✅ A controlled setup wait hit the existing 30-second deadline; score reset returned BackupClientSetupTimeout and restarted Lightning to Running (app readback and native runtime log).
score-setup-timeout2x.2x.mp4
Back up ordinary changes after terminal identity failure ❌ New ordinary watch-only reservation remained pending; real VSS WALLET bytes and version did not change; repairing original credentials allowed a complete WALLET upload.
terminal-wallet-backup2x.2x.mp4
Finish Reset while native authentication is held ❌ Reset retained credentials and closed admission at 190.2s after confirmation while actual native authentication was held; it finished 28.5s after release (UI/app/proxy readbacks).
stalled-native-auth2x.2x.mp4
Retry profile deletion after the current grant expires ❌ After genuine signed-grant expiry, Delete and repeated Review stayed in recovery failure; the original signer and expired saved grant were retained (UI/keychain readback).
expired-profile-delete-retry2x.2x.mp4
Automated regression and static checks ✅ Pristine assembly, focused JVM suites, Detekt and Android Lint pass; additional real DataStore settlement and timeout/cancellation controls pass.
Ran assembleDevDebug, ProfileRemovalCoordinatorTest, ProfileRemovalStoreTest, VssBackupClientLdkTest, VssClientCoordinatorTest, detekt and lintDevDebug on the pristine head. Additional unpublished controls exercise a real DataStore write landing after cancellation, a real pre-commit storage failure, internal setup timeout conversion and external cancellation. The DataStore controls use real persistence with mocked repositories. Full JVM, Compose instrumentation and E2E suites were not repeated.
The cleanup-marker fix also passed a real DataStore cancellation control: settlement waits for the in-flight write, preserves its landed marker and recovery ownership, and admits no remote cleanup. Sign-out preparation was checked through the real app coordinator; the loaded owned-profile screen does not expose a Sign out button.
Retained evidence (original heads and qualifications; these flows are unchanged by this delta):
- Manual 1–2, J2 and required recovery/Retry: 710292a.
- Manual 3 and Manual 4 interrupted debounce/acknowledged SETTINGS replacement: cd0befc.
- Manual 4 restore-clear/real ten-minute expiry: acdd99c.
- Manual 5 funded sends/results/withdrawal: c4d9939.
- Manual 5 retained-display/native-error boundary: bc6b171.
- Manual 6 cache hydration during held startup: 89f3bc6.
- J1 reconnect/stale enrichment: 4aa622f.
- J1 restart without duplication: 3e1fdb7.
- J3 queued Settings acknowledgement and post-erasure Reset recovery: 5c7df26.
- Failed-Reset restore recovery and loading ownership: d22508b.
- Cold Reset/new-wallet continuation without native probes and merged receipt/permission coverage: 0625a27.
These are constituent runs, not a new uninterrupted J1 execution. Actual Rust panic, external Ring application UI, funded nonempty-USDT recovery and an actual unilateral Spark exit were not driven: they require distinct external fixtures or runtime behavior outside this delta. The deferred allowance-documentation issue and pre-existing non-Spark observer gap retain their recorded disposition.
Reviewed the contiguous 0625a27..84599e3 delta, all four paths, reached removal/reset callers and the open findings. Read the full PR body, all comments, reviews and inline discussions. No dependency, workflow or rule-file changes occur. Changed failure paths received device coverage; the cancellation settlement boundary received the real DataStore control described above.
Twin: synonymdev/bitkit-ios#1121 remains at 3af88fff and matches required recovery before optional profile initialization and complete-backup protection. This delta's retained Kotlin removal session and timeout-to-Result conversion are Android-specific; no Swift change is implied.
Reviewed by gpt-6.1-sol-high
|
@ben-kaufman please resolve conflicts. |
Verified: just compile, just test, just lint
@piotr-iohk Resolved in 5d94c53: merged master. The only conflict was in |
There was a problem hiding this comment.
Verdict: ⛔️ Request changes — existing backup, Reset and profile-removal failures remain; no new delta defect.
Findings:
- HIGH (existing) — Terminal identity failure blocks ordinary WALLET backups.
BackupRepo.kt:1438: a new watch-only reservation remained pending while remote WALLET bytes and version stayed unchanged. Repairing the original credentials restored a complete upload. The existing finding remains; preserve completeness while repairing availability. - MEDIUM (existing) — Native authentication keeps Reset waiting.
VssClientCoordinator.kt:138: Reset retained credentials and closed admission through the 196.5-second checkpoint; it finished 13.4 seconds after the actual authentication response was released. The app still pins VSS 0.5.26-rc3, without the native deadline correction. - MEDIUM (existing) — Profile-delete Retry cannot refresh expired authorization.
PubkyRepo.kt:1580: Delete and repeated Review fail after a genuine signed grant expires, retaining the original identity credentials. The existing finding remains. - LOW (existing) — Pre-marker deletion errors offer no local Disconnect.
EditProfileViewModel.kt:389: a network failure during confirmation validation shows only a toast and returns to Edit Profile without recovery options. This reproduces the earlier report; the durable removal marker stays absent.
QA for 5d94c53:
Unfunded Android 15/API 35 development wallets against staging services. Built and verified the pristine APK; recorded fault cases use unpublished Debug controls and app/VSS readbacks, with native libraries verified unchanged. Videos play at 2×.
Load Pubky profile pictures up to 5 MiB ✅ A real 3,451,979-byte PNG uploaded through the native API, failed a native 1 MiB fetch, returned identical bytes at 5 MiB, decoded through production Coil at 192x192, and displayed on Profile and its QR (native readback and screenshot).
pubky-avatar-limit2x.2x.mp4
Back up ordinary changes after terminal identity failure ❌ New ordinary watch-only reservation remained pending; real VSS WALLET bytes and version did not change; repairing original credentials allowed a complete WALLET upload.
terminal-wallet-backup2x.2x.mp4
Finish Reset while native authentication is held ❌ Reset retained credentials and closed admission at 196.5s after confirmation while actual native authentication was held; it finished 13.4s after release (UI/app/proxy readbacks).
stalled-native-auth2x.2x.mp4
Offer local disconnect when profile deletion fails before its marker ❌ With only the device offline, confirmed Delete failed reading the Pubky social v1 migration flag and showed only Failed to disconnect profile; no recovery dialog or local Disconnect appeared, the marker stayed absent, and identity credentials remained (UI and app/DataStore readbacks).
pre-marker-delete-offline2x.2x.mp4
Retry profile deletion after the current grant expires ❌ After genuine signed-grant expiry, Delete and two Review attempts returned to Unable to Delete Profile; the original signer, saved expired grant and identity remained (UI and keychain readbacks).
expired-profile-delete-retry2x.2x.mp4
Check: preserve the reviewed December terms ✅ Exact TOS and terms journey blobs match upstream c9a390d, preserving the recorded wording, emphasis and Continue assertions.
Retained device reports:
Automated regression and static checks ✅ Pristine assembleDevDebug, complete testDevDebugUnitTest, Detekt and lintDevDebug completed successfully; two existing opt-in Spark regtest cases skipped.
Ran assembleDevDebug, testDevDebugUnitTest, detekt and lintDevDebug on the pristine head. Current WalletRepoTest executions also cover nonzero retained rail contributions, overlapping balance/cache updates and unvalidated receiving-address gates with mocked native resources. Compose instrumentation and E2E were not repeated. The two opt-in Spark regtest cases only exercise unchanged Spark code.
Retained the unchanged constituent device passes and their original heads/qualifications from the 84599e3 review: Manual 1–6, J1–J3, cleanup-marker retry and setup-timeout recovery. These are constituent runs, with component coverage for nonzero retained balances and cache-ordering boundaries; no new uninterrupted J1 or funded cross-rail run is claimed. The warm Reset pass at d22508b retains its original timing and lack of a fresh master comparison.
Real Ring UI, funded nonempty USDT recovery, an actual Rust panic and a unilateral Spark exit were not driven: they require separate external fixtures or runtime behavior outside this delta. The avatar case covers native fetch, Coil and Profile; it does not claim Ring import or a Contacts-screen run. The deferred allowance-documentation issue and pre-existing non-Spark observer gap retain their recorded disposition.
Reviewed the contiguous 84599e3..5d94c53 delta, all nine changed paths, the avatar merge resolution, reached callers and existing findings. No dependency, workflow or rule-file changes occur. Avatar fetching received device coverage; the inherited terms rely on their unchanged recorded cases.
Twin: synonymdev/bitkit-ios#1121 at 3af88fff matches required recovery before optional profile initialization and complete-backup protection. The Kotlin avatar-constant merge does not alter that shared behavior.
Reviewed by gpt-6.1-sol-high
piotr-iohk
left a comment
There was a problem hiding this comment.
QA review
Scope: full PR at 5d94c53, re-reviewed after the comparison base changed from 7a204ab to 32de582 and that base update touches PubkyRepo.kt.
2 actionable findings — resolve or provide an evidence-backed rebuttal.
Refusing a wallet or metadata backup while a saved identity cannot be read keeps the previous complete remote record, then leaves that attempt's newer wallet and metadata state unsent until another edit or Settings Retry. A reservation file that fails to decode is treated as an empty ledger for receive and new assignments, and the new write guard prevents replacing it.
Profile removal, original-grant logout, wipe resume, and Spark balance updates were traced against the journeys in this diff. No separate defect was established there. Compared with bitkit-ios#1121 at 3af88fff for the shared backup refusal only: iOS also refuses a null SDK snapshot when a stored identity exists, and a terminal failure does not loop inside the scheduled job. iOS foreground recovery still reruns every backup that is still required. That was not a full iOS review. Device testing was not performed. The pull request description mixes the restore contract with earlier review notes; this pass judged the pinned source and did not use review threads.
Suggested additional test cases
Android, dev build. Replace the reservation datastore with invalid JSON while a cached receive address from that file is known. Cold-start and open Receive. The cached address must not be offered. Saving a contact or public payment address must not persist the empty unreadable ledger as if those reservations were absent.
Earlier findings reconciled at this revision: 5 still present.
Findings
- [MEDIUM] Resume the retained backup when identity can be exported again — inline at
app/src/main/java/to/bitkit/repositories/BackupRepo.kt:1438. - [MEDIUM] Fail closed when the reservation ledger cannot be read — inline at
app/src/main/java/to/bitkit/data/PrivatePaykitStores.kt:216.
Existing concerns
- [MEDIUM] Bound native authentication before draining VSS during reset — Reset still waits on a held LNURL-auth response before it can shut the standalone VSS clients down or delete credentials. Threads #1686 (comment) and #1686 (comment) are unresolved, not outdated, and anchored at VssClientCoordinator.kt:138. WipeWalletUseCase.kt:82-87 sets wiping and then enters withIdentityChange; the finally at lines 116-119 clears wiping only after that call returns. The coordinator join at lines 136-139 is NonCancellable and reaches vssShutdownClient and vssShutdownLdkClient only after every admitted job returns. Both the base and this head pin com.synonym:vss-client-android 0.5.26-rc3 at gradle/libs.versions.toml:98, and that pin is not in the diff. Annotated tag v0.5.26-rc3 (b321a171524ee51a31462df534c03f21b4a79c2b) peels to 3baf76dda37126d313f85ed2298abd65f6ef62b2. There, execute_async at src/lib.rs:32-40 runs rt.block_on, used by vss_get at lines 208-212 and vss_ldk_get at lines 473-477. KeyDomainLnurlAuthProvider at src/lnurl_auth.rs:147 builds reqwest::Client::builder().build() with no timeout, and fetch_jwt_token at lines 162-191 awaits the challenge and signed callback with no deadline. VssBackupClient.kt:73 and VssBackupClientLdk.kt:61 pass that key domain, and the gets at VssBackupClient.kt:143 and VssBackupClientLdk.kt:79 are admitted through withClient. Cancelling the Kotlin job therefore leaves that blocked poll running. ResetAndRestoreScreen.kt:76, :81, :114, and :122 keep Back disabled and Reset loading while isWiping stays true. synonymdev/vss-rust-client-ffi#36 is still open, mergedAt null, head 1a5b788ceabac22739a9c9deabef67fea071b644, and diverged from 3baf76d. The reviewer reports, at this head, that Reset retained credentials and closed admission 196.5 seconds after confirmation until the held response was released (#1686 (review)). That run was not repeated here. This is the same mechanism as synonymdev/bitkit-ios#1121 (comment).
- [LOW] Allowance journey describes a delayed-contact check its actions do not perform — The journey description still tells the runner to repeat the off/on sequence while contact loading is delayed, and the action list still does one off, one request, and one on. Thread #1686 (comment) is resolved, not outdated, and anchored at journeys/allowances/allowances-turned-off.xml:6. The author reply defers it as out of scope to #1766, which is still open and titled docs: clarify delayed-contact coverage in the allowance toggle journey. That resolution leaves the mismatched sentence in this PR's diff against 32de582.
- [MEDIUM] Backups required during restore stay unscheduled after restore — A backup category other than SPARK_EXIT that becomes required while restore is in progress is still not scheduled when restore ends. shouldBackup is false while restoring, the status observer drops that emission, and distinctUntilChanged does not re-emit when only the restore flag changes. At this head, startBackupStatusObservers combines restoreInProgress only for SPARK_EXIT; line 497 leaves every other category on the status flow, and lines 499-502 schedule only when shouldBackup is true. checkForFailedBackups at lines 896-913 only shows a notification, and rewriteMigratedBackups at lines 1979-1983 triggers only categories that need a rewrite. The finally at line 1645 clears _isRestoring without restarting the status collectors. This gap already exists at 32de582: shouldSkipBackup is true while restoring, startBackupStatusObservers at lines 342-360 collects distinct status fields for every category without restoreInProgress, and restorePublicAddress at line 122 already calls markPublicAddressBackupRequired. This PR adds the Spark-only resume and does not introduce or worsen the other categories, so it carries no introduction claim and is not a PR defect. A focused issue search for restoreInProgress backup returned no open or closed issues, so tracked_separately is not available. It stays referenced through #1686 (comment). That comment's device run was not repeated here.
- [MEDIUM] Retry cannot refresh an expired session for a failed pubky profile delete — Retrying a failed pubky profile delete still cannot refresh an expired session. The thread #1689 (comment) is unresolved and its anchor is outdated; pull request 1689 is merged. deleteProfile calls pubkyService.deletePubkyProfile directly at PubkyRepo.kt:1580. refreshSessionIfPossibleLocked is private at line 2731, and its only call is inside withPubkyAppScopeLocked at line 1962, which this delete path never calls. ProfileRemovalCoordinator.reviewAgain at line 193 prepares another deletion, and remove at line 345 calls the same pubkyRepo.deleteProfile again. PaykitSdkService.deletePubkyProfile at lines 942-954 runs the native delete through completeSdkCall at lines 2374-2381, which does not refresh the session; invalidatePaykitKeyIfNeeded at lines 2318-2321 only clears the cached key on PaykitException.Identity. An expired session therefore fails the delete again on Review. The merge since 84599e3 changes only the avatar byte limit in PubkyRepo.kt and leaves this call at line 1580. The reviewer reports, at this head, that Delete and two Review attempts stayed on Unable to Delete Profile after genuine signed-grant expiry (#1686 (review)). That run was not repeated here.
- [LOW] Offer local disconnect when delete fails before the removal marker — A profile delete that fails before the removal marker still shows a toast and returns to Edit Profile, with no recovery dialog and no local Disconnect. ProfileRemovalCoordinator.remove validates the profile at lines 303-308, then sets removalMayHaveStarted and writes the marker at lines 313-316. The catch at lines 386-387 rethrows that validation error unwrapped when the marker has not started, so captureFailure does not run. EditProfileViewModel.performRemoval stores the error only when it is a ProfileRemovalFailure (line 380) and otherwise calls showRemovalError at line 389, which toasts profile__disconnect_error. The failure dialog at EditProfileScreen.kt:243, which offers Review or Disconnect, stays hidden because showDeleteFailureDialog follows removalFailure. At the base, attemptDeleteProfile showed that dialog for every failed delete. The reviewer reports, at this head, that an offline Delete failed while reading the profile and showed only Failed to disconnect profile, with the marker absent and credentials retained (#1686 (review)). That run was not repeated here. The earlier report is #1686 (review).
Reviewer model: grok-4.7
Reasoning effort: xhigh
| val privateRepo = privatePaykitRepo.get() | ||
| val privateVersion = privateRepo.backupStateVersion.value | ||
| val paykitSdkBackupState = privateRepo.backupSnapshot().getOrThrow() | ||
| check(paykitSdkBackupState.state != null || !pubkyRepo.hasIdentityForBackup()) { |
There was a problem hiding this comment.
[MEDIUM] Resume the retained backup when identity can be exported again
A scheduled wallet backup runs while Bitkit still has a saved identity but backupSnapshot() returns a null SDK state, or a metadata backup runs while the session or contact-override read fails. The read later succeeds, no other wallet or metadata edit occurs, and the user does not tap Retry.
captureWalletBackupDataBytes rejects that null SDK state when hasIdentityForBackup() is true (BackupRepo.kt:1437-1440). Metadata now uses getOrThrow() for the session and contact-override reads (BackupRepo.kt:1373-1374). Those errors are not temporary (BackupRepo.kt:2125-2141), so markBackupFailed stores that attempt's required timestamp (BackupRepo.kt:1224-1225) and shouldBackup skips the same timestamp (BackupRepo.kt:357-361). A later importSession does clear the latch, because it bumps backupStateVersion (PaykitSdkService.kt:680) and the wallet observer calls updateBackupRequired (BackupRepo.kt:587, BackupRepo.kt:719-722). An export or metadata read that simply starts succeeding does not. Returning to the foreground does not rerun a latched category either. Settings shows Retry because synced < required and running is false (BackupSettingsScreen.kt:148, BackupCategory.kt:71). BackupRepoTest's automatic wallet backup marks failure when Paykit snapshot fails locks this one-attempt suppression for a thrown snapshot.
The previous complete remote record stays in place. Transfers, reservations, proofs, allowances, and metadata bundled into the failed attempt stay local. Restoring on another device before a later edit or Settings Retry drops that delta. Journey restore-during-identity-outage.xml says that releasing the identity fault completes the retained backup once.
Keep the incomplete snapshot off the server. When that same identity can be exported again, or the metadata read succeeds, upload the retained wallet or metadata backup once without requiring another wallet edit.
Evidence basis: source analysis at 5d94c53e, not an executed test. At base 32de582d, a successful null SDK state was still uploaded (BackupRepo.kt assigned paykitSdkBackupState.state with no identity check, previously around line 1069) and the metadata reads used getOrDefault(null) (previously lines 969-970), so those attempts could mark synced. The latch already existed for other terminal errors; these new refusals now enter it. iOS 3af88fff throws sessionNotActive from PrivatePaykitService.backupSnapshot in the same null-key case and does not loop a terminal failure inside runScheduledBackup, but retryPendingBackups on foreground reruns every category that is still required.
| }.getOrElse { | ||
| Logger.error("Failed to deserialize PrivatePaykitReservationData", it, context = TAG) | ||
| defaultValue | ||
| defaultValue.copy(receiptSourceReadable = false) |
There was a problem hiding this comment.
[MEDIUM] Fail closed when the reservation ledger cannot be read
The reservation datastore fails to decode, for example truncated or invalid JSON. The user cold-starts and opens Receive, or saves a contact or public payment address.
PrivatePaykitReservationSerializer.readFrom returns the empty default with receiptSourceReadable = false and leaves the original bytes in place (PrivatePaykitStores.kt:211-220). writeTo rejects any copy of that value (PrivatePaykitStores.kt:219-220). isUnavailableForReusableReceive never reads the flag (PrivatePaykitAddressReservationRepo.kt:279-290); empty assignments make it return false. WalletRepo.loadFromCache then publishes the cached on-chain address, bolt11, and bip21 (WalletRepo.kt:254-276). allocateAddress copies that sentinel, and persist throws (PrivatePaykitAddressReservationRepo.kt:452-478). receiptAssignments() does check the flag (PrivatePaykitAddressReservationRepo.kt:311-312). clear() and reset() can still write a fresh readable default, so a wipe can replace the file. Ordinary receive and assignment cannot. backupSnapshot() also reports empty ceilings for this read, so a later successful wallet backup can store those empty ceilings.
The user can be shown a receive address whose reservation state was never validated, including one that was reserved or quarantined in the unreadable file. Later contact and public assignment saves fail, and the corrupt file remains, so the next launch repeats it.
Withhold that cached address and fail allocation closed while the ledger is unreadable. Do not persist or upload the empty sentinel as if the reservations were absent. A fresh readable ledger fits an explicit reset, not a failed read.
Evidence basis: source analysis at 5d94c53e, not an executed test. At base the same decode failure returned a normal empty default, so receive could already show the address, but a later copy could be written and replace the file. Head adds the unreadable flag and the write refusal without checking the flag on the receive and allocation paths.
November 14 · compose current master
Published
c4d9939don mastere63b9d89, preserving the restore/background identity changes and incorporating the upstream swap-route cleanup dependency. The first hosted checkout0c9cc62dhas tree1cc40637, matching the published result.Original CI, Lint and E2E passed: 6,076 unit, 257 Compose and 39 E2E passes. Two opt-in unit cases, Settings08 and six migration jobs were skipped. All seven E2E shards passed their first attempt on suite
24c1c4f5; no workflow rerun. All six static reports have zero findings. All 36 live-base commits report valid signatures on GitHub.Complete original diagnostics retain cursor/storage warnings, five metadata refusals followed by ordered same-process WALLET then METADATA success, two restore-wait timeouts, one legacy-list timeout and three on-chain sync deadlines followed by successful retries. RGS, fee/channel-close and native bootstrap diagnostics remain qualified. The external test harness also reports npm vulnerabilities. No new introduced finding was established; this does not establish complete-WALLET recovery, bounded native Reset, private authenticated cleanup or a runtime-clean app. Existing findings, prior failures and authored QA below remain unchanged.
November 12 · restore Spark balance updates after a finished exit
Published
d28a1578on52bc2736(validated treeb5b0fd34). Retained Done/Failed exit records now use the existingisExitingpredicate in both derivation and the stopped/timeout fallback. Spark and active-transfer exit guards remain. The extended existing regression first reproduced the stale 119,865-sat total instead of 70,000, then passed with the correction.Final local formatting, compile, full tests, lint and APK checks passed: 5,981 unit passes plus two explicit opt-in regtest skips; 133 focused passes. Complete Detekt/Android Lint reports have zero findings. All 35 live-base commits verify locally and on GitHub.
Original hosted CI, Lint and E2E passed on matching synthetic
bd39ccf6: 5,981 unit passes plus two skips, 257 Compose passes and 39 first-attempt E2E passes. Settings08 and six migration jobs were skipped; no job/workflow rerun. Executed external suite:ce9c0e2b.Complete diagnostics retain a real target-package Zygote abort during explicit suite reinstall (nine shard cases subsequently passed), 29 stale-element helper notices, fee disagreement followed by force-close/commitment broadcast, restore-wait guards, metadata refusals/later acknowledgements and widget cancellation. The exact abort initiator and actual-base runtime are not established. Hosted unit XML/Gradle Problems HTML were not uploaded; local reports remain separate evidence. These controls do not establish a funded finished-exit device journey, complete WALLET recovery, authenticated endpoint cleanup or native Reset Wallet. Earlier failures and authored QA remain below.
November 12 · refresh Spark balances after node startup times out
Published
b2c3ea6e0against12d78484. The existing Spark fallback now handlesNodeRunTimeoutErrorand preserves the current usable channel limit when the node becomes Running as the read finishes. The one-minute wait and cancellation handling are unchanged.Local final formatting, compilation, full tests, lint and APK checks passed on tree
b526c8b2: 5,579 unit tests, 111 focusedWalletRepoTestcases and zero findings in six static reports. The new control first reproduced the stale total (119865 instead of 70000), then the recovered-channel limit (39900 instead of 55000). All 32 commits in the live-base range verify locally and on GitHub.The original CI, Lint and E2E completed successfully on synthetic
8fbb0516, whose tree equals the local result. Hosted results: 5,579 units, 256 Compose tests, six clean static reports and 39 unique E2E cases eventually passed. Send's first@send_2attempt stayed on Home after an acknowledged Send tap; the recipient/permission screen did not appear within 30 seconds. Its configured second attempt passed and skipped two already-passed cases. The cause of the first failure remains unproven. Settings08 remains disabled; all six migration jobs were skipped.Runtime qualifications remain: Transfer passed while a 139/182-sat peer fee disagreement caused a force-close and commitment broadcast; three restore waits later completed in the same process; four METADATA acknowledgements and two widget-fetch cancellations were inspected. These results establish neither confirmed returned funds nor new private profile, complete-WALLET, native-reset or withdrawal-journal retirement acceptance. Earlier failures and exact-head results below remain historical. Later GitHub mergeability metadata returned dirty/null despite unchanged head/base; the completed checks retain their original recorded checkout identity.
November 12 · keep cached wallet data available during startup
At
89f3bc6b, cache hydration can publish cached balances and receiving details while a native balance read waits for node startup. Balance derivations remain serialized, final publication remains atomic, and the original wallet admission and owner checks remain in place. The local regression failed onff9275d6with the cached 50,000-sat balance still at zero; it passes with this fix and checks that a subsequent refresh remains current.All five final local commands passed against master
6bb0ff55: formatting, compilation, 5,442 unit tests, lint and APK assembly. There were no test failures, skips or retries and no findings in six native static reports. The full WalletRepo class passed 110 cases. Two independent source reviews and the exact child-composition qualification found no outstanding defect.The first original hosted CI run, Lint run and E2E run passed. Synthetic commit
66206d4ehas the exact validated tree. Hosted results: 5,442 unit tests, 256 Compose tests, six static reports with zero findings and 39 enabled E2E cases passing on their first internal attempt. One Settings case remained disabled; all six migration jobs were skipped by their release-ref guards. The executed E2E suite was0ca01e0a, whose restore helper changed since the preceding run; it is distinct from the selected reusable-workflow revision.Complete available diagnostics retain the transfer peer-fee disagreement, force-close and commitment broadcast: the passing UI does not prove a cooperative close or confirmed returned funds. A stock restore wait hit its 30-second guard before later same-process restore success. Six guarded METADATA refusals received later same-process acknowledgements. Optional restore categories and no-session remote-cleanup warnings remain qualified. Unit XML and Gradle Problems HTML were not uploaded. Compose fixture results, stock E2E results and the controlled local startup regression do not establish authenticated/private recovery, native Reset Wallet or complete SDK WALLET acceptance.
All 30 commits in the live-base range verified locally and on GitHub. The earlier installed cold-start reproduction remains attributed to its original head; manual case 6 records the current-head fixture still needed. Earlier source, formatter and runtime failures remain below with their original inputs.
November 12 · keep Spark balances and payment results current
At
ff9275d6, Spark balance changes update Home/Spending while LDK is stopped, preserving known Lightning and on-chain contributions. Cache hydration and retired wallet writes cannot overwrite newer balances. Pending, Success and Error payment screens retain their Close/Details actions when the remaining Spark balance falls below the paid invoice; the existing admission checks remain in place for payment entry.Final formatting, compilation, full tests, lint and APK assembly passed on tree
413b4374against master6bb0ff55: 5,441 unit tests, zero failures/skips/retries and zero findings in six native static reports. The ten added balance, cache, cancellation and navigation controls passed alongside all 36 previous controls. Independent source reviews cover the affected production and child composition paths. All 29 live-base commits verify locally and on GitHub.The first original CI, Lint and E2E runs passed on synthetic
d6183ae4, with the same validated tree: 5,441 units, 256 Compose cases and 39 E2E passes. All seven E2E shards passed on internal attempt one, with no failed test execution;settings_08remains intentionally disabled and six migration jobs were skipped. Complete available diagnostics and artifact provenance were inspected. The 48 helper notices are separate from testcase retries.Runtime qualifications remain: Transfer recorded the peer's 139 versus 182 sat closing-fee disagreement, force-close and commitment broadcast; its passing UI assertions do not establish cooperative closure or confirmed returned funds. An initial native on-chain sync timeout later reached same-process sync completion and a successful explicit app retry. The 30-second restore wait guard was followed by a successful full restore, with WALLET/BLOCKTANK absent. Six guarded METADATA refusals had later same-process acknowledgements. A Zygote abort during test-package uninstall occurred before app initialization; the replacement process passed, without an established introduced app-code cause. Compiler/provider/JVM warnings and transient emulator connection notices remain recorded.
Current inputs are Core
0.8.0-rc14, Paykit0.1.1-rc8, LDK0.7.0-rc.80, VSS0.5.26-rc2and Spark0.28.0; older pin lists below describe their original evidence. These checks do not include the unreleased owned SDK changes. Hosted stock fixtures do not reproduce the exact controlled stopped-node Spark journey, authenticated cleanup, terminal complete-WALLET recovery or bounded native Reset. Manual case 5 below records the remaining controlled app check. The earlier red balance regression and formatter/test-fixture failures remain preserved; passing controls do not erase them. Earlier evidence and authored QA notes follow.November 12 · retain profile ownership with the current restore guards
At
2dc86ae0, the composition with master6bb0ff55retains the original sign-in throughout deferred profile refresh, migration and avatar writes. Wipe or replacement invalidates that work before it mutates storage or publishes profile state. The upstream invoice-history holds remain inside admitted recovery, after uploads drain and before category reads. Ordinary remote profile reads remain outside the identity-write lock.Final formatting, compilation, full lint and APK assembly passed on tree
32497f24, with 5,431 unit tests, zero failures/skips/retries and zero introduced findings. All 36 affected controls passed, including the four identity controls and 32 added upstream cases. Two independent affected source reviews cover the composition. All 28 commits against the live base verify locally and on GitHub.The first original CI, Lint and E2E runs passed on synthetic
e1514446, whose tree equals the local validated tree: 5,431 unit tests, 256 Compose cases and 39 E2E passes. All seven E2E shards ran on attempt one with matching APK provenance and no testcase retry.settings_08remains intentionally disabled; six migration jobs were skipped. Complete available diagnostics retain 37 helper/stale-element notices and inherited compiler, JVM and provider warnings.The hosted
transfer_2case again recorded a peer closing-fee disagreement (139 versus 182 sat), followed by force-close and commitment broadcast. Its UI-success and connection-removal assertions passed; they do not establish cooperative closure or confirmed returned funds. The direct close path and LDK pin match base, without a base-runtime reproduction or an established introduced cause. Four guarded METADATA refusals had later same-process acknowledgements. Activity-tag cancellation remains unexplained. These stock checks do not establish authenticated profile cleanup, terminal complete-WALLET recovery, bounded native Reset or private SDK acceptance.Earlier
cd1d1290validation remains scoped to tree91ce475cand base14e6d3dd: 389 focused and 5,399 full local tests, 27 verified commits, then 5,399 hosted units, 256 Compose cases and 39 E2E passes in the original run. Its 43 helper notices, force-close, three guarded metadata refusals and Legacy-account sync timeout remain recorded. The current run did not reproduce that exact Legacy timeout; it does not establish a fix for it. The three original stale-write failures and later passing controls retain their original revisions.The deferred-refresh finding already has its verified fix reply. Existing human requests remain pending. Earlier evidence and authored QA notes continue below.
November 11 · resume Spark backups when restore ends
At
cd0befc6, pending Spark backup state is reconsidered when the existing restore gate clears or expires. A second restore that interrupts the debounce also retains the pending work. Three repository controls reproduced these gaps before the correction; acknowledged generations still do not upload twice.The first
acdd99c3hosted composition with master831c4d2aexposed five obsolete Pubky test fixtures. They now use the upstream own-profile revision API; no production behavior or assertions were removed for that correction. The original five failures remain recorded. Final local format, compile, lint and APK assembly passed, with 5,396 full-suite and 255 focused tests on tree79ef817eusing Paykit rc7. Two independent affected reviews are clean; all 26 live-base commits were verified locally and on GitHub.The first
cd0befc6hosted checks used syntheticd5d49a33, tree2332eb13, against master8e86d30dwith the separate upstream rc8 pin. All 5,396 JVM tests, including the five former failures, and 256 Compose cases passed. Lint reported zero findings. Seven E2E shards passed 39 cases on internal attempt one using suite53e8b45b;@settings_08was disabled and six migration jobs were skipped by their branch rule. Complete diagnostics retain 45 stale-element/helper recovery lines, a caught optional permission-button timeout, two native sync timeouts followed by same-process successes, and a legacy-listing timeout before a successful full VSS restore. These are qualified results, not a claim of clean runtime or full recovery acceptance. CI · Lint · E2EThe external reviewer reported two controlled installed-app passes on the earlier
acdd99c3: one upload after explicit restore completion and one after real ten-minute expiry. Those results belong to that tested revision and reviewer; their recordings/readbacks have not been independently qualified here. Interrupted debounce, storage-error timing and replacement during a native PUT remain distinct fixture gaps. The existing complete-WALLET and unbounded native-authentication findings remain open, including the recorded disposition. No SDK release/adoption or reset acceptance is implied.The required child compositions are published separately at #1688
dc9a9813and #1689e0d25982; their first hosted checks are in progress.November 11 · Spark backup notifications through identity retirement
At
710292aa, the additive composition with master4f401bd3preserves Spark startup, payment history and backup behavior alongside this PR’s original-wallet admission. A Spark notification is acknowledged only after its required status is stored. Cancellation before that write can replay after the original owner reopens; a storage error no longer stops later notifications. Three controls reproduced the two cancelled-write cases and the stopped collector before the fixes.Final format, compile, full unit tests, lint and APK assembly passed on one frozen tree: 5,334 unit tests, 371 focused tests and zero static findings. Two independent scoped reviews found no unresolved issue. All 24 live-base commits verify locally and on GitHub.
First hosted checks passed 5,334 JVM tests, 256 Compose cases and 39 E2E cases. One Settings case and five migration jobs were explicitly skipped. All seven E2E shards passed their first internal attempt on suite
53e8b45b; 36 stale-element messages remain recorded. Four metadata guards each had a later acknowledgement in the same process. Full logs and ten diagnostic archives were inspected, including fixture database/startup, network, fee, channel-closing and dependency advisories. CI · Lint · E2EThese controls do not establish a new authenticated Spark recovery journey, terminal complete-WALLET recovery or native VSS reset acceptance. Existing open findings, SDK decisions and fixture limits remain. #1688’s direct-child projection is clean with the same feature patch; #1689’s conflicting composition is being validated separately.
November 9 · activity backups on
3e1fdb7dAn observed ACTIVITY backup skips an unchanged payload only after a successful write for the same wallet owner. A full-backup request received while that read is in progress still sends the activity data. An uncertain PUT clears the cached digest. Restore and reset detach the old cache. VSS admission and shutdown stay with the original coordinator.
The regression test paused an unchanged read and requested a full backup before releasing it. The initial composition sent only the seed upload. The corrected tree sent the requested second PUT. Local checks passed all 125 focused tests and 4,993 full-suite tests, with no skips or failures. The six lint and Detekt reports contained no findings. All 23 commits verified against master
596f46cd. The published VSS dependency stays at 0.5.26-rc1.The first hosted run passed 4,993 JVM tests and 256 Compose tests. All seven E2E shards passed on their first workflow test attempt, with 39 cases passing and one explicitly disabled. Six migration jobs were skipped. Hosted lint and Detekt reported zero findings. The backup/wipe logs retained missing restored entries and a missing Pubky session during endpoint cleanup. Authenticated cleanup and complete WALLET recovery remain open. CI · E2E · Lint
November 6 validation at
b5d5858dThis branch now includes the upstream send-flow tests and keeps the allowance-admission regression. All 600 cases from the two parents ran locally. The full local suite passed 4,967 tests, lint reported zero findings, and all 22 commits in the live-master range verified locally and on GitHub.
GitHub tested merge tree
b1ad9c4eagainst masterebe9bc09. All 4,969 unit tests and 256 Compose cases passed. Six lint reports contained zero findings. The seven regtest E2E shards passed 39 cases on their first attempt. Settings address-type switching was disabled in the suite, and the release-branch migration jobs skipped. Hosted logs retain helper and runtime warnings. This run adds no authenticated Pubky/Paykit journey or terminal wallet-recovery result. CI · Lint · E2ECurrent backup-status correction — November 4
Signed fix
a2c58f2427635719b63263b9441b8d22a7b6c858prevents cancelled backup cleanup from inheriting Running from a replacement reservation that never entered its original wallet. Each pending reservation now records actual native admission and is removed by exact identity. Retirement drains admitted cleanup; rejected queued work cannot leave a stale Running flag. Startup status cleanup uses the same distinction. This is a two-file correction with no new public API or persisted state.Final formatting, compilation, 4,890 unit tests across 264 suites, lint and APK assembly passed with zero failures/errors/skips and zero static findings. All 1,797 frozen inputs match, complete diagnostics were inspected, and 1,947 sealed evidence files were verified. The single added regression covers retirement before and after the cancelled writer's status cleanup; it fails on the published predecessor and passes on this fix. Two affected independent source reviews are clean. All 21 live-master range commits verify locally and on GitHub.
Author J3: the frozen final ARM64 APK (
317136cc1b1385d9776f5edba2c22d4a25a5dd56109045595d1ddaf19b70609e) was installed in place on the preserved unfunded API36 ARM emulator, and installed bytes were verified. Changing EUR to GBP in the actual app showed Settings Running during its five-second queue, then Latest Backup after the VSS acknowledgement. No Settings Retry was observed. The original wallet and fixtures were preserved. This runtime case is distinct from the controlled unit retirement race; no wallet reset or complete-WALLET acceptance is claimed.The separate brief Transaction Log Failed Backup/Retry flash remains documented. Capture limitations and native/runtime diagnostics remain in the audit. The first CLI emulator launch exited after reporting boot; the single foreground SDK recovery ran the case. The emulator later accepted shutdown but exited134 after saving its snapshot. These observations are preserved and are not described as warning-free execution.
Current-head hosted CI, Lint and E2E all passed on attempt 1: 4,890 units, 256 Compose cases and 39 E2E passes, zero failures, one explicitly disabled Settings skip, and zero findings in six static reports. Six release-gated migration jobs were skipped. The synthetic checkout tree exactly matches
a2c58f24; complete logs, nested diagnostics and all 1,531 sealed evidence files were inspected and verified. APK identity is bound by producer/consumer artifact ID and digest; hosted APK bytes were not independently downloaded. Three RNBackupClient list-file timeouts and one ActivityRepo cancellation are newly observed runtime categories with unchanged base emitters; their cause remains unproven. Earlier cursor/native/bootstrap warnings and the temporary nonterminal GitHub status discrepancy are retained. This does not establish terminal complete-WALLET or new authenticated J1/J2 acceptance. Evidence:work/validation/hosted-android1686-a2c5-20261104/inspection/report.md. On predecessorb93444c3, the sole authorized Settings infrastructure retry completed with 13 passes and one explicit skip; the final unique E2E result was 39 passes/one skip, alongside 4,889 units, 256 Compose passes and zero lint findings. The original Docker port collision, runtime diagnostics and six skipped migration jobs remain preserved; that result is not transferred to this new head.Evidence:
work/validation/android1686-admitted-status-final-audit-20261104/,work/validation/android1686-admitted-status-app-audit-20261104/andwork/validation/android1686-admitted-status-20261104/publication.json. Existing QA IDs, remaining authenticated cases and terminal complete-WALLET limitations below remain unchanged.Additional external review: 5773366561 reports 10 passing cases and one failure at this exact
a2c58f2head on an unfunded API35 fixture. It confirms queued/cancelled Settings status and recovery gates, while reproducing the existing terminal-identity complete-WALLET failure:identity_errorleaves new ordinary-wallet work pending and preserves remote bytes/version. The reviewer distinguishes pristine app runs from Debug fault controls and decoder checks from nonempty USDT import. Raw install/proxy/readback artifacts were not independently inspected by the author. This is attributed external evidence, not another author-run campaign or human approval; the existing HIGH remains open.Queued backup status — November 4
b93444c35fixes 4467512070: a scheduled backup now shows Running during debounce and payment wait instead of falsely displaying Failed/Retry. Status cleanup stays inside the original wallet admission, preserves another active/pending backup, and checks startup cleanup against current state inside the persisted update. This does not change backup contents or relax complete-WALLET refusal.Final required compile, full tests, lint, formatting and DevDebug APK assembly passed on 1,797 matching inputs: 4,889 tests /264 suites, zero failures/errors/skips, and eight fresh static reports with zero findings. Two independent affected concurrency reviews are clean. The negative control retained three expected failures on the original production code; the intermediate compile/format failures remain recorded. Complete logs and structured diagnostics retain the verified existing cursor/JVM/deprecation/native-strip notices. All 20 commits against live master
44bf50ecverify locally and on GitHub (verified=true,reason=valid); new-head hosted CI is pending complete inspection.Author-run J3 used a new unfunded API36 ARM64 emulator, the installed APK SHA256
6646ff3bfcc7bc27dbb59e4e5c71d94b439c6c0a753f8594be520a481f7196e6, and ordinary staging VSS/Electrum. Changing local currency showed Settings Running without Retry, then Latest Backup after the real SETTINGS put acknowledgement. Continuous video and complete diagnostics are retained; the first delayed still capture missed the interval and is not counted as a pass. Media offsets are not wall-clock measurements. No profile, recovery phrase, wallet reset or funds were used. This finite result does not complete J1/J2 or the terminal complete-WALLET finding. The complete recording also retains two brief Transaction Log Failed/Retry frames between ordinary updates and scheduling, with no ACTIVITY upload failure logged. The required-before-running state is representable in live master44bf50ectoo; the exact runtime interleaving is inferred, not reproduced on that base. This separate pre-scheduling presentation gap remains, so no all-category/no-flash claim is made.Evidence:
work/validation/android1686-backup-status-final-audit-20261104/report.mdandwork/validation/android1686-backup-status-app-audit-20261104/report.md. Earlier results below remain tied to their stated revisions.VSS operation ownership — November 4
Signed
4056d2c00keeps app and standalone LDK backup work with its original wallet generation. Identity replacement closes both client admissions, cancels and drains setup/native calls and their caller tails, shuts down the old slots, then holds admission closed through credential changes. Each client derives its store ID from the same captured mnemonic/passphrase as its signer. Setup and ordinary calls retain their existing concurrency and readiness behavior.Backup payload capture, retries, status callbacks, routing repairs and detached node restarts retain the original owner. A canceled identity transition can rearm observer setup and pending backups; stale scheduling cannot replace a newer generation's debounce token. Explicit first-WALLET scheduling still works before node observation starts. Shutdown failure leaves admission closed. The released SDK and server protocol are unchanged.
Required final
just compile, fulljust testandjust lintpassed on the same 1,796 frozen inputs: 4,887 tests /264 suites, zero failures/errors/skips, with fresh Detekt and Android Lint SARIF/XML showing zero findings. Final formatting is clean; a subsequent local flag rename has exact reverse-hash equivalence and was checked by final lint. Complete logs, test reports, embedded Gradle diagnostics and all earlier failures were inspected. Four existing cursor-close traces and three JVM notices remain recorded against actual-base sources; no introduced compiler/static finding remains. Two independent affected concurrency/security source reviews are clean. All 19 commits against live master44bf50ecverify locally and on GitHub. Evidence:work/validation/android-vss-owner-diagnostics-20261104/report.md.At
4056d2c0036e5a4e51698e26b3d1615825dd77f5, hosted CI attempt 2 passed after the one authorized Compose retry. Compose executed 256 tests across 60 classes, zero failures and zero skips; XML, all HTML case identities, raw instrumentation and both binary UTP result files agree. The required build aggregate passed. Existing exact-tree evidence remains 4,887 unit passes, zero Detekt/Android Lint findings, and 39 general E2E passes, zero failures, one source-declared skip. Migration jobs were release-gated skips. The checkout was synthetic merge3c8fc2745652d6eb1f624ff537ec35cbe0702faawith the same tree32b8d4633b0f12fc1b9ee7d94007824c766addbdas the published head, against master44bf50ecabefe4e91d41fedbcbbb14fb132bbebc.The authorized Compose retry is now fully audited: Compose job, aggregate, and test artifact. All 256 cases passed with no skips. The original attempt's
No service published for: inputstartup failure remains preserved as a before-tests infrastructure failure. Complete logs and all 356 artifact members were inspected; check annotations contain only runner-image notices. Repeated fixture Core/database/Paykit bootstrap errors and Android resource warnings remain visible, and the non-uploaded Gradle problems HTML limits deprecation attribution. This does not establish running-node persistence quiescence, deployed migration or complete-WALLET recovery. No retry authority remains. Owner verification matched all 447 new evidence hashes and reused the sealed 475-file original audit. Evidence:work/validation/android1686-authorized-compose-retry-20261104/inspection/report.md. Existing authenticated QA and terminal complete-WALLET gaps remain open.Current composition — November 3
Signed additive merge
43e0f3fe04705d397a81f493cf8e57239a0be73eincorporates live master44bf50ecabefe4e91d41fedbcbbb14fb132bbebc. Both restore branches preserve deferred identity initialization while forwarding master’s failed optional backup categories to the completion screen. Existing required-restore, correction and cancellation gates remain in place. No published history was rewritten.Final
just format,just compile,just testandjust lintpassed on the same 1,794 inputs: 4,873 unit tests across 263 suites, zero failures or skips; Detekt and Android Lint report zero findings. Complete logs, XML, SARIF, HTML and embedded Gradle reports were audited, and the affected independent source review is clean. All 18 live-base commits are locally and GitHub signature-verified.Two test-fixture repairs were necessary after composition: supply master’s new ledger-state Boolean in the mocked allowance executor, and use a plain Application in the mocked view-model suite. An earlier run stalled with 64 IO workers blocked by production auth registrars started by that test fixture. Its complete thread dump, 695 passing results, one interrupted case and stopped-worker failure are retained. The final run used a different test order; it is not a same-order starvation reproduction or a production dispatcher fix. The initial formatting finding and pre-execution sandbox failure are also retained. Existing Gradle deprecation and JVM/cursor diagnostics remain disclosed in the audit.
All current-head hosted runs are complete and inspected: 4,873 unit tests, 256 Compose tests and 39 external E2E cases passed; Detekt and Android Lint have zero findings. The seven E2E shards passed their first whole-shard attempts; one Settings case, six migration jobs and all 14 retry steps were explicitly skipped. Synthetic merge
79371a24has exactly the published tree. Complete logs, nested XML/HTML/protobuf/logcats and 10 digest/CRC-verified report archives were audited; the owner verified all 520 evidence hashes.Compose retains Core storage-initialization diagnostics in its Hilt fixture. General E2E retains RN backup-list/restore timeouts and a METADATA safety refusal; relevant source blocks match actual master, without a base runtime or historical-cause claim. Two multi-address tap-helper retries are distinct from whole-shard attempts. These passing suites do not establish full authenticated backup/recovery. Hosted evidence:
work/validation/hosted-android1686-43e-20261103/inspection/report.md. The older hosted and runtime results below remain tied to their original revisions. No new authenticated J1, funded-payment or terminal complete-WALLET acceptance is claimed. Evidence:work/validation/android1686-master44bf-final-diagnostics-20261103/inspection/report.md; publication and exact signature receipts:work/validation/android1686-master44bf-publication-20261103.Previous-head hosted results — November 2
All hosted jobs for
b6751e22956653c4f2a80112143880b47298e30dare now inspected: 4,825 unit tests pass, all six static reports have zero findings, and 39 distinct E2E cases eventually pass with one deliberately disabled Settings case. The exact synthetic checkout tree matches this published head; the external suite is611509ee.The LNURL/transfer shard first failed two activity-card assertions and then passed its one automatic shard retry. Both failed executions and the exit-1 annotation remain recorded. Failure screenshots show the expected values in the second card; the guest clock differs from the host/deposit dates on the failed attempt. This supports a clock/order investigation, but the cause is not established. No manual CI rerun occurred. Six skipped migration jobs are not passes.
Complete logs, structured results, nested runtime streams, checksum/CRC-verified archives and failure images were inspected; the owner verified all 438 terminal evidence payloads. Runtime backup, TLS, sync and cancellation diagnostics remain disclosed. The earlier
181d664crouting failure is not waived or claimed repaired. Existing authenticated acceptance and terminal complete-WALLET gaps below remain open. Evidence:work/validation/hosted-android1686-b675-20261102/E2E-TERMINAL-REPORT.md.Routing-test diagnostics — November 1
Signed
b6751e22956653c4f2a80112143880b47298e30dadds failure-only resolved-activity and component-state diagnostics to the existing routing test. Assertions, query flags, deadlines and production behavior are preserved. It reuses the exact independently reviewed diagnostic file already present in #1688. The earlier181d664chosted failure below remains unresolved; this is not a causal repair or a waived check.The final composed candidate passed required compile, 4,825 tests / 260 suites, formatting and static checks with zero findings. All 1,778 frozen files match. Complete logs, XML/HTML/SARIF and lint partial/model outputs were inspected: Detekt reports are fresh; aggregate Android lint reports were UP-TO-DATE, with fresh changed-unit analysis also inspected. Four retained CloseGuard events are not claimed fixed. The exact-file/API applicability review is clean. All 17 live-base commits verify locally and on GitHub. Current-head hosted results are recorded above. Evidence:
work/validation/android1686-manifest-diagnostics-20261101/final-diagnostic-audit/REPORT.md.Previous-head hosted unit failure — November 1, 23:24 UTC
CI run 41360316580 failed on exact head
181d664c38a40df156cad4388168b5ab2df132c4: 4,824 tests passed and one failed, with zero skips.PubkyAuthManifestTest.ktfailed its first default-disabled route assertion forpubkyring://signup?hs=homeserver; both structural manifest checks and the new allowance off/on regression passed. The failure output omits the resolved activity and component override, so the cause is unresolved. Source equality with the actual parent does not establish a pre-existing runtime failure or infrastructure cause.The completed lint job has zero findings across all six reports. Five complete logs, all unit HTML and both digest/CRC-verified report archives were inspected; 400 sealed payloads were independently hash-verified. Seven E2E shards were pending at this snapshot, and six migration jobs skipped. No unchanged CI rerun was made. The diagnostic descendant is being inspected before selecting a repair; this failed required check is not waived. Evidence:
work/validation/hosted-android1686-181d-20261101-current-a/REPORT.md.Allowance off/on recovery — November 1
Signed
181d664c38a40df156cad4388168b5ab2df132c4fixes the lost activation reported in 4437596764. Turning allowances off still revokes queued work immediately. A pause revision now makes the latest enabled contact/settings state distinct, so turning them back on during held admission schedules a fresh activation for the current identity. Old queued acceptance remains revoked; identity, deletion and live-settings checks are retained.The actual AppViewModel collector and real allowance repository reproduced the failure before the fix and pass afterward, using mocked SDK/executor resources. Final required compile, 4,825 tests /260 suites, formatting and six complete static reports passed with zero failures/skips/findings. All 1,778 frozen files match. Full logs and structured diagnostics were inspected; four CloseGuard warnings and earlier failed attempts remain recorded. Two independent concurrency reviews are clean. All 16 live-master range commits verify locally and on GitHub (
verified=true,reason=valid).The existing allowance-off journey now describes the Android delayed-contact-loading variant. The author has not run that held-boundary authenticated app case; component evidence is not a device pass. Current-head hosted CI is pending complete inspection. The separate terminal complete-WALLET finding remains open. Evidence:
work/validation/android1686-allowance-resume-final-audit/REPORT.mdandwork/validation/android1686-allowance-resume-publication/.Hosted validation update — November 1, 22:16 UTC
Exact-head hosted checks are complete: 4,824 unit tests pass, six static reports have zero findings, and 39 distinct end-to-end cases pass on their first executions.
settings_08remains an explicit disabled skip; skipped migration jobs are not passes. Complete logs and seven checksum/CRC-verified end-to-end archives were inspected. Nonfatal runtime diagnostics remain recorded, without a blanket clean-runtime claim. Terminal complete-WALLET availability and the existing authenticated acceptance gaps remain open.Setup-pending and activation follow-up — November 1
Signed
1b1426fbebeccd616c29311fa5bf652089727a84stops reconnect recovery from repeatedly fetching a deliberately absent profile while local profile setup is still pending. Once setup completes, missing restored profiles remain eligible for recovery. The actual repository regression failed before repair (six unexpected resolver calls over three reconnects) and passes afterward. This head also includes the reviewed shared allowance fixes: revocable contact/dispatcher activation and rejection before SDK backup mutation tracking.Final required compile, full unit tests, lint and formatting passed: 4,824 tests, zero failures/skips and six static reports with zero findings. All 1,778 frozen inputs match; the combined source review preserves the independent shared concurrency reviews. Complete diagnostics retain four structured CloseGuard warnings and all earlier test-fixture failures/sandbox refusal. The complete 15-commit actual-live-base range verifies locally and on GitHub. New-head hosted CI is pending; no new authenticated app acceptance is claimed. The existing terminal identity/complete-WALLET HIGH remains unresolved and is not repaired by these changes.
Description
Ordinary wallet restore finishes after required wallet and USDT recovery; optional Pubky activation and profile enrichment continue afterward. Scheduled setup preserves an identity already activated by metadata restoration, coalesces requests for the same revision, and rejects obsolete results.
The reconnect follow-up in
9ac9746aeretries a missing own profile from existing reconnect, resume and maintenance calls. It captures the original sign-in, returns without waiting for profile networking, avoids re-importing an active session, and reuses the existing profile-write and overlapping-load guards. A successful load stops these retries. The previous “Your Name” placeholder finding is addressed without adding contact refresh or payment work.Complete WALLET and METADATA capture still rejects unavailable or unreadable identity data instead of replacing a complete backup with an incomplete snapshot. Terminal identity failure can still leave newer ordinary WALLET state pending; the existing HIGH availability finding remains open.
Twin: synonymdev/bitkit-ios#1121. Parent #1685 and fee follow-up #1701 merged externally; this PR now targets
master.Out of Scope
journeys/allowances/allowances-turned-off.xml: clarify the delayed-contact variant's executable or manual steps in #1766, milestone 3.1.0. This nonblocking LOW review finding is deferred under the repository review policy. The existing seven actions do not exercise that extra boundary.Current validation — November 1
Head
78269d8a1cae1ac127be93a96fba16f7d68d1019, tree325f57e2e6f20211b805816026fa98463d1f74ad, targets live master1337f121cd2694718fb58e1c4f022d73104cccc1directly. The SDK admission callback still rejects work queued before allowance deactivation. Review 4433972339 additionally found ordinary contact sync replacing the activation for the same enabled identity. The correction now retains that activation; pause, deactivation and identity changes still invalidate it. Restore, spending and complete-backup guards are unchanged.Final required format, compile, full tests and lint pass: 4,817 tests / 260 suites, zero failures/errors/skips/retries and zero fresh Detekt/Android Lint findings. All 1,778 frozen inputs match. Complete logs, nested output, XML/HTML/SARIF were audited; the owner verified 1,651 final artifacts. Three JVM notices and four cursor-close warnings remain, with retained actual-base/earlier-run comparisons. Two shared independent concurrency reviews and one affected integration review are clean; source/test blobs exactly match the validated #1684 correction. Controlled manual and automatic regressions failed before the correction and passed afterward; these are component tests, not a new authenticated app pass.
All 14 live-base commits are locally and GitHub
true/valid. The first immediate post-push REST snapshot was stale; live-head reconciliation followed by one read-only verification completed successfully, without repeating the push. New-head hosted checks await complete inspection. Evidence:work/validation/android1686-stable-activation-20261101/andwork/validation/android1686-stable-activation-final-a/inspection/structured-report.json.The previous
7b795fdchosted CI, lint and E2E are fully audited on the exact published tree: 4,815 units, zero static findings, 39 first-attempt E2E passes and one disabled Settings case. Passing multi-address logs still contain native sync deadlines and WalletOperationTimeout; their causes remain unproven. All 462 sealed evidence files verified. These results certify only that prior head.Retained evidence and unresolved findings
The terminal complete-WALLET availability defect remains open. Review5724858087 reproduces it at predecessor
71fa609c; the complete report and unpushed Debug-control appendix were read. Its raw runtime artifacts were not independently audited and its controlled APK is not claimed identical to the published APK. No nil/stale SDK fallback, partial backup or closure is implied by this allowance repair.At predecessor
71fa609c, CI passed 4,814 units, lint had zero findings, and E2E reached 39 unique eventual passes with one disabled settings case. Multi-address attempt1 failed a 30-second ReceivedTransaction wait; attempt2 passed and skipped two already-completed cases. Complete logs, all attempts, artifacts and the exact synthetic tree were audited. The failure cause remains unproven; migration skips are not passes. Earlier missing-invoice, UI-timeout and setup failures retain their original receipts; no unchanged CI retry or causal-fix claim is made.Design / Preview
The Spark correction retains the existing Home/Spending and Send result layouts; it updates displayed balances and prevents an unrelated node-wait overlay from covering the payment result.
Existing layout is unchanged. The status correction uses the mapped
Back up wallet › Data Backupsscreen indocs/screens-map.md; an exact Figma frame URL is not recorded, so no node link is invented. Own-profile recovery still uses existing Home/profile presentation.QA Notes
Setup
For J3, use a separate unfunded dev wallet in a DevDebug build (
./gradlew assembleDevDebug, then install the matching ABI APK). Keep default staging VSS/Electrum available, English selected, and Debug developer mode enabled foradb shell am start -a android.intent.action.VIEW -d bitkit://screen/backup-settings to.bitkit.dev. Start at Home. A device-local recording captures the brief debounce interval when host command latency is too high; it changes no product timing. No reset, profile, seed access or funding is needed.Use the committed Debug dependencies: Core 0.8.0-rc11, Paykit 0.1.1-rc6, VSS 0.5.26-rc2, LDK 0.7.0-rc.79 and Breez Spark 0.28.0. These published pins come from master; they do not include the private #267/#36 corrections or LDK #132. J1 needs a disposable test-network wallet with a complete VSS backup and saved identity. Keep metadata credential replacement and required imports available; delay only final activation or optional enrichment after required recovery. Preserve existing wallets and use no live funds.
For the current correction, Case 5 needs a separate disposable Spark regtest wallet, synthetic funds, a test recipient, and a controlled way to stop only LDK while Spark remains connected. Native balance readback and the selected operation's acknowledgement must be observable. The standard journey capability table does not provide this controlled Spark setup. Keep the published dependency pins; no private SDK, wallet reset or live funds are part of this case.
For manual case 6, use an isolated disposable development wallet with known cached balances and receiving data, a controlled native-startup hold, and independently releasable cache loading. These controls are unavailable in the standard journey fixture. Display amounts are fixture data; no payment or wallet reset is needed.
Manual Tests
1. With two disposable linked identities and a pending allowance proposal, hold the receiver immediately before SDK acceptance admission. Tap Accept, synchronize a changed contact-key set while the same identity remains enabled, then release: the proposal accepts once. Repeat after disabling/re-enabling before release: the old queued attempt must be rejected. The standard journey environment lacks the controlled SDK-admission hold; deterministic repository coverage passes, but a fresh author-run authenticated app execution remains unperformed. The earlier before-fix runtime reproduction is attributed to its reviewed revision.
2. Hold an allowance activation during contact synchronization, switch Enable Allowances off and back on, then release: the current enabled identity activates once without restarting the app; the old queued acceptance stays revoked. The author’s controlled collector/repository test passes, but the authenticated app timing gate is not available in the standard fixture.
3. In an isolated unfunded Spark fixture, hold the backup-required status write before persistence, then fail an identity change without replacing credentials. After admission reopens, the pending readiness or exit-generation signal must still upload once. Also fail one status write with a storage error and verify that a later generation uploads without restarting observation. This requires controlled status-persistence and owner-transition faults unavailable in the standard journey environment; the three component regressions pass, but an authenticated app execution of these boundaries has not been performed.
4. With an isolated unfunded Spark/VSS fixture, retain a backup-required generation during restore, then clear the restore gate or allow its real timeout to expire. Verify one acknowledged upload without another Spark event. Repeat with a second restore interrupting the debounce and verify the pending upload resumes once. Three local repository controls pass; the external reviewer reported the clear/expiry portions on
acdd99c3. The interrupted-debounce installed-app case still needs the controlled fixture; no author-run authenticated pass is claimed.5. With LDK stopped and Spark ready, record the native Spark balance and the Home/Spending total. Complete a small Spark send to the test recipient, then a second send, and finally withdraw the remaining Spark balance using the fixture's authorized native operation. After each send, verify the payment result and its Close/Details actions remain visible without a Connecting to Network overlay, including when the remaining Spark balance is below the paid invoice amount. After each acknowledged balance change, verify Home/Spending reflects the current shown Spark amount while preserving any known LDK contribution and the on-chain balance. Check the zero-Spark result and reopen the cached screen. When Spark retains a displayed balance after a failed read, verify that display is not offered as spendable funds. Record the app revision, fixture configuration, native before/after amounts and acknowledgements. This is a prepared manual case, not an author-run app pass; local repository/observer controls and the earlier external reproduction remain separately attributed.
6. Cold-start the controlled wallet with native node startup held. Allow cached data to load while a balance refresh waits for the node. Verify Home shows the known cached balance and the already-validated cached address/invoice becomes available before releasing native startup. Release the node hold and verify a fresh balance replaces the cached value; a later refresh must remain current if another earlier refresh was delayed. Keep any receiving address that still needs reservation validation unavailable. Record app/build identity, holds and release order, and cached versus fresh readbacks. The repository regression covers cache publication and refresh ordering; a new author-run installed-app execution needs the controlled fixture. The external failed cold-start reproduction remains attributed to
ff9275d6.Journeys
J3 — new
scheduled-backup-status.xml: change a local currency and observe queued Running, followed by Latest Backup after acknowledgement. Android-only scheduling regression; author-run result is recorded above.J2 —
allowances/allowances-turned-off.xml: the seven executable actions cover ordinary off/on behavior and restoration of the Active row. The description-only delayed contact-loading variant is not exercised by those actions; its executable/manual documentation is deferred to #1766. That held-boundary case remains unexecuted as an author-run app journey.J1 —
restore-during-identity-outage.xml: optional activation outage after required restore, complete-backup protection, screen exit, missing-profile reconnect, stale enrichment after identity removal/replacement, restart, and required-recovery failures retaining spending/address gates.The new reconnect action expects wallet maintenance to continue while a real profile read is held, then Home to recover after release without manual Profile navigation. The final candidate has repository-level tests with mocked native/service resources; this is not a complete authenticated app journey. The author's isolated complete-app fault controls for J1 are not yet provisioned.
External review 5688838161 reports real SDK/VSS cases and reproduces both findings at predecessor
89e2702e. Its raw nonvisual artifacts have not been independently verified by the author, and it is not acceptance evidence for the new head. The matching iOS reconnect follow-up is published in #1121 at0b77f099; its iOS evidence does not establish Android acceptance.Automated Checks
WalletRepoTest.kt— keeps known balance contributions and original-wallet ownership through stopped-node Spark changes, cache hydration and retirement.SendSheetNavigationTest.kt— keeps payment results visible after the remaining balance falls below the paid invoice, and restores the wait when returning to Confirm.BackupRepoTest.kt— retains Spark readiness and generation notifications across owner retirement, and keeps observing after a status-write failure.LightningRepoTest.kt— supplies the existing coordinator to the upstream startup and cross-rail fixtures.Evidence and remaining gaps
PubkyRepoTestcovers the new retry and retained coalescing, cancellation, sign-in and profile-write guards. ExistingWalletViewModelTestandBackupRepoTestcover required recovery admission and complete-backup refusal. Full-suite success does not establish process-kill, authenticated service faults or funded payments.The terminal full-WALLET availability finding remains unresolved on both platforms. No stale SDK fallback, partial backup, independent-only writer, legacy migration activation, payment replay or authorization bypass is introduced. Full-wallet redesign and contact CAS are separate work, not substitutes for this PR's acceptance.
Models used
gpt-6-astra(reasoning:xhigh).gpt-6-astra(reasoning:xhigh).gpt-6-astra(reasoning:xhigh),gpt-6.1-sol(reasoning:high).Actual execution metadata and historical review scopes are retained.