Repository navigation
fix: restore ios backups on android - #1736
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
[Medium impact] The PR changes behavior within the wallet backup restore workflow. The PR appears safe to merge, with a non-blocking gap in reporting failed widget saves. Findings
SummaryAdds an Android reader for iOS backup shapes and shows which backup categories could not be restored.
Acknowledged scope: ovitrif explicitly deferred moving both apps to Core's canonical JSON helpers, protecting failed categories from later ordinary uploads, and duplicate cross-platform activity IDs tracked in #1737. Diagram%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Download backup category] --> B[Decode backup]
B --> C[Save restored data]
B -->|Error| D[Record failed category]
C -->|Reported error| D
C -->|Success| E[Continue restore]
D --> E
E --> F[Completed with failed categories]
F --> G[Show complete or incomplete message]
Reviews (1) · Last reviewed commit: "fix: report restore categories that fail..." · Reviewed by Greptile |
Regtest APKDownload bitkit-dev-debug universal APK (expires in 30 days). |
|
Pushed d8372ad: a failed WIDGETS save is now reported among the categories that could not be restored, like BLOCKTANK and ACTIVITY, with a test. This answers the Greptile point on unreported widget save failures (#1736 (comment)). |
piotr-iohk
left a comment
There was a problem hiding this comment.
QA review
Scope: Full review of the whole PR diff against its merge base (02e6ae4), at d8372ad. No saved baseline was available. The iOS twin synonymdev/bitkit-ios#1173 at 5a87d1b was used only to compare parity and the backup format. It was not reviewed in full.
No new actionable code findings.
No new actionable code findings. What I traced:
- iOS backup decoding: the decode-only reader (
BackupJson.kt) handles Swift's missing optionals, enum cases with no values and enums with values. I traced it through the METADATA, BLOCKTANK and ACTIVITY callers. Android-written envelopes go through unchanged. Address-type strings use the same form on both platforms (nativeSegwit/taproot). - Settings: a SETTINGS envelope is decoded one setting at a time, then restored through
WalletConnectionRecovery.restoreSettings, which keeps the PIN reset and the native SegWit rule. - Pubky session:
PubkySessionBackupV1.kindcan now be null. That matches the iOS model (a raw-valueKind?), andrestoreSessionBackupStatealready handles a null kind. - Failure reporting: failed categories are carried through every restore path: the fresh-wallet, resume/retry, RN fallback and legacy USDT paths. Only
is RestoreState.Completedchecks remain, so changingCompletedfrom an object to a data class breaks no equality check. - Base comparison: at base, a failed category could already be overwritten in VSS later by this device's partial state, and the PR description lists it as out of scope. Turning save failures into throws does not make it worse.
Validation: the CI build job ran testDevDebugUnitTest successfully on this head, including the new BackupJsonTest and the updated BackupRepoTest, WalletViewModelTest and ContentViewTest. I did not run any tests myself. The relevant code was checked by reading the source. Some e2e-tests-local jobs were still pending when I checked.
Device testing: not performed in this review. The author reports manual case 1 passed at 2e0a8e3e4, an earlier commit than the reviewed head. The incomplete-restore line has not been shown on a device.
Non-blocking consistency suggestions
- iOS (5a87d1b,
BackupService.performRestore) still logs a non-fatal category failure, marks the category complete and shows an unconditional restore success. Android now names the categories that failed. Consider adding the same reporting on iOS later. - On Android, any METADATA failure is shown as "Profile, Contacts, Tags", even when only one part failed. For example, if the Pubky session fails, tags that were saved are still listed as not restored.
Suggested additional test cases
- Android regression, Android-made backup: back up a wallet on this build with non-default settings (Fiat primary display, Classic unit, Taproot monitored, custom Electrum), widgets, tags, a Blocktank order and activity. Wipe it and restore the recovery phrase on this build. Expected: WALLET RESTORED with
RestoreSuccessTextand no incomplete line, every setting and widget kept, and tags and activity present. - Android, incomplete restore shown on a device: restore a wallet whose METADATA holds a Pubky
localSeedsession while the Pubky homeserver is unreachable from the emulator. Expected: the restore screen showsRestoreIncompleteTextnaming Profile, Contacts and Tags; Continue reaches home; the wallet balance and activity are restored.
Reviewer model: claude-opus-5-5
Reasoning effort: high
|
Device run at d8372ad (current head, unmodified |
# Conflicts: # app/src/main/java/to/bitkit/repositories/BackupRepo.kt # app/src/test/java/to/bitkit/repositories/BackupRepoTest.kt
|
Merged master into this PR at 2441a8c to clear the conflicts in
|
|
Setting milestone 3.1.0: this PR closes #1733, which is in 3.1.0. |
jvsena42
left a comment
There was a problem hiding this comment.
Code scan of the full PR at 2441a8c: no findings. Reviewed as a backup/restore change. The merge's conflict resolutions keep master's public-address restore around METADATA and re-apply this PR's failedCategories and decodeSettingsBackup.
Checked and clean:
- Malformed input.
fromSwiftCodablerecurses along the targetSerialDescriptor, not the input depth. Unknown keys, unknown enum cases, out-of-range Swift labels (_5), non-object roots and non-JSON all throw insideperformRestore'srunSuspendCatchingand land infailedCategories. None of them crashes. Android envelopes pass through unchanged. None of the 41 bitkit-core enums collides under the strip-_-and-lowercase normalisation. - Field mapping against bitkit-ios master (
BackupPayloads.swift):- The metadata, Blocktank and activity fields match, as do
PubkyProfileData.Link,QuickPayLedger/QuickPayRecordPhaseand the nullablePubkySessionBackupV1.kind. - Swift
Activity{"onchain":{"_0":…}}maps toActivity.Onchain(v1). Core'smigrate_backup_activities_jsonaccepts old iOS envelopes withoutwalletId. - Settings: iOS already emits Android key names.
primaryDisplay,displayUnit,coinSelectPreference,usdtPreference,addressTypesToMonitorandelectrumServerall map.defaultTransactionSpeednormal/instantfall back toMedium.
- The metadata, Blocktank and activity fields match, as do
- No data loss. A partial METADATA restore sets
needsRewrite = false, so VSS is not rewritten with partial state. ACTIVITY, BLOCKTANK and WIDGETS save failures now report and skipupdateRestoredBackupStatus. A SETTINGS envelope withoutsettingsthrows instead of resetting every setting to default. - Failure reporting.
failedCategoriesreaches the fresh restore, retry, RN-fallback and legacy-USDT paths. All 16onboarding__restore_incomplete_texttranslations keep%1$s.
Performance: a one-off JsonElement walk per envelope on restore, on ioDispatcher. Not relevant beyond that.
Device gate (partial): 2441a8c — not run yet. Pending: an iOS wallet with tags, a contact, a profile and settings changes, backed up on the simulator and restored on Android (check RestoreSuccessText and the restored data). Then the same restore with the Pubky homeserver unreachable, where RestoreIncompleteText should name the failed categories. Device results will follow in a separate review.
jvsena42
left a comment
There was a problem hiding this comment.
Device gate: 2441a8c — iOS master f3e97b0 on the iPhone 17 simulator created a wallet and uploaded all 8 backup categories, then Pixel_9 with this PR's CI APK restored the same seed. perf: n/a. l10n: n/a.
Requesting changes for one MEDIUM, inline: every iOS on-chain send restores as two activity rows, not only a Paykit send.
Restore with the homeserver reachable: RestoreSuccessText, Full restore success. Compared field by field against the iOS wallet:
- Settings: currency, fiat primary, denomination, speed, warn-over-$100, clipboard and swipe-to-hide all match.
- Widgets: order, the deleted widgets, Price BTC/EUR 1W and Headlines with the date hidden all match.
- Activity: the receive, its contact and the send amounts match; the send shows twice (inline).
- Tags: tags on both transactions and on the unpaid pre-activity address match.
- Pubky profile, contact and contact tag match; balance 270,971 sats matches.
Restore with the homeserver unreachable: RestoreIncompleteText ("could not restore: Profile, Contacts, Tags"), Full restore incomplete, failed: 'METADATA'. Balance, activity, settings and widgets are usable; Profile shows "Unable to load your profile." with Try Again and Disconnect. After the homeserver came back, Try Again restored the session, the profile, the header name and the contact label, and METADATA uploaded.
Not posted as findings:
- Private contact payments and Settings › Tags (last-used tags) do not carry over, but the iOS SETTINGS envelope has neither key and the PR does not claim them.
- With the homeserver down, the incomplete text lists Tags as not restored, though transaction and address tags were restored; and
Restore success for: 'METADATA'is logged before METADATA is reported failed.
Skipped:
⚠️ Master comparison restore: after the first restore, Android re-uploaded five categories over the iOS envelopes in staging VSS, so a master restore would only read Android-written data. Master cannot decode the iOS ACTIVITY envelope (#1733), so it would show only the synced send row.
|
Pushed 0603b21: a restored on-chain activity now merges into the row the node sync already created for the same transaction, so a send made on iOS no longer shows twice after restoring on Android. This answers @jvsena42's changes request (thread) and fixes #1737. The description now lists the merge, the new |
piotr-iohk
left a comment
There was a problem hiding this comment.
QA review
Scope: Full reassessment of the whole PR at 0603b21 against its merge base 1337f12. The comparison base has changed (02e6ae4 → 1337f12) since the previous QA review at d8372ad, so no coverage was carried over from it. The merged iOS twin synonymdev/bitkit-ios#1173 at 03a1d5f was used only to compare the backup format and parity. It was not reviewed in full.
1 actionable finding — resolve or provide an evidence-backed rebuttal.
- Activity merge (0603b21): for the case in @jvsena42's device report, where the node sync row exists before ACTIVITY restores, the restored row now replaces the synced row. Later syncs update it in place through the
txIdfallback inprocessOnchainPayment. Its failure path has one issue, inline. The merge has unit tests but, per the author, no device run yet. - Re-traced with no new findings: iOS envelope decoding for METADATA, BLOCKTANK and ACTIVITY, Android envelopes passing through unchanged, per-setting SETTINGS decoding, the nullable Pubky session kind, and failed-category reporting through the fresh, resume/retry, RN-fallback and legacy-USDT paths. The earlier non-blocking suggestion still applies: any METADATA failure lists Profile, Contacts and Tags. @jvsena42 observed this with the homeserver unreachable.
Validation: at this head, the CI build built devDebug and ran testDevDebugUnitTest successfully. Lint and E2E also passed. I ran no tests myself; this review is source analysis only.
Device testing: not performed in this review. The author reports manual case 1 passed at d8372ad, and @jvsena42's device run was at 2441a8c. Both are earlier than the activity merge.
Suggested additional test cases
- Android, iOS-made backup with ordinary on-chain sends: on bitkit-ios, make at least three plain on-chain sends, tag one, and wait for all backup categories to sync. Restore the seed on this build. Expected: each send appears once, with the iOS address, fee rate and tag. After an app restart and a new block, each still appears once.
- Android, Android-made backup regression: back up a wallet with on-chain sends and receives, a transfer to spending and tags on this build, then wipe and restore it. Expected: no activity rows are removed or duplicated, the tags are kept, and
RestoreSuccessTextis shown.
Findings
- [LOW] Activity merge deletes synced rows before the restored rows are saved — inline at
app/src/main/java/to/bitkit/repositories/ActivityRepo.kt:1090.
Reviewer model: claude-opus-5-5
Reasoning effort: high
|
Pushed 94637b3: the activity restore now deletes a synced duplicate only after the restored rows are saved and its tags are carried over, and it waits for an active sync before looking the duplicates up. A failed save no longer drops those transactions from the list. This answers @piotr-iohk's thread. |
piotr-iohk
left a comment
There was a problem hiding this comment.
QA review
Scope: Follow-up review of 94637b32 since 0603b21, against merge base 1337f121. Inherited baseline: prior QA review. This pass covered the activity-restore delta, its callers, and the current 33-file PR inventory. Backup decoding, settings, category failure handling, Pubky session restore, restore UI copy, translations, the unchanged unit fixtures, and the iOS format comparison at 03a1d5fc remain from that baseline.
No new actionable code findings.
restoreFromBackup waits for an in-flight activity sync, records synced on-chain rows with the same txid and tx type, saves the restored rows, then copies tags onto the restored id and deletes the synced row. bitkit-core 0.8.0-rc11 identifies activities by (wallet_id, id) and indexes tx_id without a uniqueness constraint, so the restored txid row can be stored beside the payment-id row. If upsertList throws, the synced row stays. BackupRepo.restoreActivityBackup still fails the ACTIVITY category when this returns a failure. iOS BackupService upserts restored activities directly; the extra delete is Android-only because those iOS on-chain backup ids are the txid while Android sync uses the LDK payment id.
Validation: CI (testDevDebugUnitTest) and Lint succeeded at this revision. E2E was still in progress. This review inspected the changed tests and did not execute them or a device. The author reports just compile, just test, and just lint passed locally at this revision.
Device testing: not performed in this review. The author's device runs are on earlier commits; the PR says the activity merge itself has no device run.
Suggested additional test cases
- Android
devDebug, using the PR setup (iOS regtest wallet with a paid on-chain send, backups synced). Restore that recovery phrase and open activity after WALLET RESTORED. Expected: that send appears once, with the contact label and its tags, and the balance matches the iOS wallet.
Earlier findings reconciled at this revision: 3 verified fixed.
Reviewer model: grok-4.7
Reasoning effort: high
|
QA for 94637b3: Restoring an iOS backup on Android passes. Each iOS send shows once with its tag, after the restore and again after a new block and an app restart. 🟢 Restore an iOS backup on Android, Each iOS send once after a new blockRestore an iOS backup on Android The iOS source wallet had a Pubky profile "Restore 1736", the contact Fixed Price QA Issuer, a 500,000 sat receive, a 1,500 sat Paykit send for a paid request (tag
Each iOS send once after a new block After one more block and an app restart, both sends are Confirmed, each still once with its tag. The database still holds 3 rows, and the restore's replacement did not run again.
🟠 Restored Electrum server applies only after a restartRestored Electrum server applies only after a restart Out of scope: this PR does not change how restored settings reach the node.
|
jvsena42
left a comment
There was a problem hiding this comment.
Code scan of the delta 2441a8c..94637b3: no findings. My MEDIUM (iOS sends restored twice) is fixed in code.
Trace:
findSyncedOnchainDuplicateswaits for an in-flight activity sync, then looks up every restored on-chain row by(walletId, txId). It keeps a match only when the id differs and thetxTypematches.- After the activities, tags and closed-channels slices are saved, each duplicate's tags are appended to the restored row and the synced row is deleted. Core deletes its tags in the same transaction.
- A later sync finds the restored row through the txid fallback in
CoreServiceand updates it in place, keeping the restored address, fee rate and contact. So a restart or a second sync does not bring the duplicate back. - iOS receives share the payment id with Android and are skipped by the id check.
- Failure paths leave at worst the old duplicate, never a lost row:
upsertListfailing (new test);- a tag copy failing;
- a crash between save and delete.
- No wrong merges: Android keeps one on-chain row per wallet and txid. Boosts, RBF, transfers and closes are either separate txids or in-place flags.
- The merge also runs for Android-made backups, where sends are keyed by txid too, so the same duplicate on master is fixed there.
perf: relevant. Restore can now wait up to 40 s for an in-flight activity sync, and does one indexed query per restored on-chain row. I'll measure the time from Restore success for: 'BLOCKTANK' to Restore success for: 'ACTIVITY' with a sync in flight.
Device gate (partial): 94637b3 — not run yet; pending:
- an iOS-made backup with sends, receives and tags restored on this build: one row per transaction, tags kept, still one after a block and a restart;
- an Android-made backup with sends, a transfer and tags restored the same way;
- the restore timing above.
The device result will follow.
jvsena42
left a comment
There was a problem hiding this comment.
Device gate result. Requesting changes for one MEDIUM, inline: restore now waits about 10 s, up to 40 s, for an activity sync that is blocked on node start.
The merge itself works:
- iOS-made backup (fresh iOS master 831ec3e wallet: 1 receive, 2 sends, tags, a tagged unpaid address), restored on Pixel_9:
onchain_activityhas 3 rows, one per txid, matching the iOS rows field for field (address, value, fee 143, fee rate 1);- the tags are on the right rows, and the pre-activity address tag is kept;
- still 3 rows after a block and a relaunch.
- Log:
Replaced synced activity '701ba3bc…' with restored '6726f473…'.
- Android-made backup (sends at Normal and Fast, tags): restored the same way, with the same result. The merge fired there too, because the node keys sends by payment id and the backup by txid.
- Master restores of the same iOS seed also showed 3 rows, because the restore ran before the node synced. They failed BLOCKTANK on the iOS envelope, which this PR fixes.
Device gate: 94637b3 — restore of iOS-made and Android-made backups passed (one row per txid, tags and fields kept across a block and a relaunch); perf: BLOCKTANK → ACTIVITY 9.9 s and 10.8 s with a sync in flight, 0.29 s without (master 0.26–0.28 s); l10n: no UI text changed.
Skipped:
⚠️ Contact on restored sends: the fresh wallet had no Pubky profile.⚠️ Transfer to spending: Blocktank channel orders return 404 on staging.
Out of scope (same on master): ACTIVITY re-uploads about every 10 s, because each ONCHAIN_WALLET sync calls notifyActivitiesChanged().
|
Pushed fcdde0a: the restore no longer waits for an activity sync that is blocked on node start, which added about 10 s, up to 40 s, to "SETTING UP YOUR WALLET". It still waits while the node runs, when the sync may already have inserted rows the merge replaces. This answers the MEDIUM on the restore wait. |
|
QA for fcdde0a: Restoring an iOS backup on Android passes again on this head. Each iOS send shows once with its tag, after the restore and again after a new block and an app restart. 🟢 Restore an iOS backup on Android, Each iOS send once after a new blockRestore an iOS backup on Android The new iOS source wallet had:
Each iOS send once after a new block After one more block and an app restart, both sends are Confirmed, each still once with its tag, and the database still holds 3 rows.
|
piotr-iohk
left a comment
There was a problem hiding this comment.
QA review
Scope: Follow-up review of fcdde0a since the previously reviewed head 94637b3, against the unchanged merge base 1337f12. Inherited baseline: prior QA review. This pass covered the whole delta (ActivityRepo.findSyncedOnchainDuplicates and two new ActivityRepoTest cases), the sync and node-start paths it touches, and the current PR inventory (still the same 33 files). These areas are carried over from that baseline: backup decoding, settings, category failure reporting, Pubky session restore, restore UI copy and translations, the bitkit-core activity schema, the unchanged unit fixtures, and the iOS activity and backup-format comparison at 03a1d5f.
No new actionable code findings.
The restore now waits for an in-flight activity sync only while the node is Running. That resolves @jvsena42's restore-wait report. Node start waits for the restore in WalletViewModel.waitForRestoreIfNeeded, with a 30 s timeout. So in a normal restore the node is not running when ACTIVITY restores. The sync blocked in LightningRepo.executeWhenNodeRunning has not stored anything yet. When the node runs, CoreService.processOnchainPayment finds the restored row through its txId fallback and updates it in place. In the retry path the node is already running, so the wait still applies and the merge still sees rows the sync stored. Restoring only after a successful save is unchanged, so the earlier LOW stays fixed.
One small remaining window is not reported as a finding. The node check is a snapshot. If the restore runs past the 30 s node-start timeout and the node reaches Running in the few milliseconds between the duplicate lookups and upsertList, a resumed sync could insert its own row first, and that send would show twice. Node start takes seconds, so this window is very small.
Validation: the new and existing ActivityRepoTest restore cases were inspected; I did not run them locally. CI's build job, which includes "Run tests", passed at this head (run 41421785213).
Device testing: not performed in this review. @jvsena42's device run at 94637b3 is from the previous build; the restore timing change has not been run on a device at this head.
Suggested additional test cases
- Android, with a fresh iOS wallet that has at least one on-chain send and full backups: restore the seed on Android. Expected: restore moves from BLOCKTANK to ACTIVITY with no multi-second wait, and Activity shows one row per txid, still after a new block and a relaunch.
- Android, with an Android-made backup that has on-chain sends: interrupt the restore so that Retry restarts the node, then retry. Expected: the restore waits for the running node's sync, logs
Replaced synced activity, and each send appears once.
Reviewer model: claude-opus-5-5
Reasoning effort: high
piotr-iohk
left a comment
There was a problem hiding this comment.
Approving at fcdde0aeb0f0f00a39c0279dc7aae2ba3c4261e8 with the device timing gaps below.
The current-head QA Watch review has no actionable code findings. CI/unit tests, lint and all seven E2E shards passed. Earlier changes-requested reviews are dismissed and all inline threads are resolved.
Targeted device retest on the existing Pixel 6 emulator, Android 13/API 33, using the CI E2E APK (app source matches this head), local Docker regtest/local Pubky and staging VSS:
- #1733 passed: iOS-written backups restored successfully across METADATA, SETTINGS, WIDGETS, WALLET, BLOCKTANK and ACTIVITY. The profile, contact label, tags and paid/pending requests were present. The paid request showed Proof submitted. Savings 474,714 sats and Spending 502,998 sats matched the source.
- #1737 passed: a real iOS Paykit send and an ordinary on-chain send each appeared once with their metadata. Logs explicitly confirmed replacement of both node-created duplicate rows. Exactly three on-chain entries remained (one receive, two sends), still correct and confirmed after a new block and app restart.
- Partial failure passed: making the profile homeserver unreachable produced the explicit “Profile, Contacts, Tags” incomplete-restore warning while wallet/activity restoration completed.
- Recovery passed: ordinary retry and recovery after releasing a forced node-start delay completed successfully.
Remaining device coverage, accepted as non-blocking for this approval:
- ACTIVITY restore while an activity sync is still blocked on node startup. The normal run reached ACTIVITY after the node was running; the forced hold instead hit an earlier wallet-operation timeout.
- ACTIVITY restore while the node is Running and an activity sync is demonstrably unfinished. Ordinary running-node retry passed, but that precise overlap was not established.
The conditional waiting logic has unit coverage; neither condition above is claimed as a device pass. This was a targeted retest, not complete PR device coverage. The existing source wallet originated on Android, but iOS wrote the tested metadata/activity backups and made both new sends. No new product defect was confirmed.
|
Merging: approved by @piotr-iohk on the current head with his device retest, plus the case 1 device run on this head (#1736 (comment)), no open threads, CI green. Ships in 3.1.0. |




Fixes #1733
Fixes #1737
Twin: synonymdev/bitkit-ios#1173
This PR makes Android restore backups written by bitkit-ios, and reports the categories it could not restore instead of an unconditional WALLET RESTORED.
bitkit-ios encodes the bitkit-core types in its backups (
PreActivityMetadata,Activity,IBtInfo,IBtOrder, …) with Swift's synthesizedCodable, which differs from kotlinx in three ways:{"regtest":{}}, not"REGTEST"{"onchain":{"_0":{…}}}, not{"type":"com.synonym.bitkitcore.Activity.Onchain","v1":{…}}SETTINGS also carries iOS forms (
addressTypesToMonitoras"nativeSegwit,taproot",primaryDisplayas"Bitcoin"). The four errors in the issue are only the first failing field of each category. METADATA failing meant the Pubky session never restored, so the profile, Paykit history and contact labels were missing.The root cause sits in bitkit-core's generated bindings plus each app encoding Core types with its own platform encoder. Core already exports canonical
*_to_json/*_from_jsonhelpers; moving both apps onto them is the long-term fix. This PR fixes it on the app side for 3.1.0.Description
BackupJson.kt, a decode-only reader for METADATA, BLOCKTANK and ACTIVITY: it accepts missing nullable fields and, guided by each target type's serializer, rewrites Swift enum shapes into kotlinx's. Android envelopes pass through unchanged, and backups are still written with the app'sjson, so 3.0.x readers are unaffected.addressTypesToMonitoras a comma-separated string.PubkySessionBackupV1.kindoptional, matching iOS, which writes{}for a kind it no longer restores.performFullRestoreFromLatestBackupand shows them on the restore screen: "Your wallet and balance are back, but Bitkit could not restore: Profile, Contacts, Tags." A category counts as failed when it does not decode or when saving it fails: WIDGETS, BLOCKTANK and ACTIVITY saves, and METADATA's tags, Pubky session and contact overrides. The line is translated in every locale.settingsobject instead of restoring all defaults over the user's settings.Out of Scope
BackupRepo/ iOSBackupService: moving both apps onto bitkit-core's canonical*_to_json/*_from_jsonbackup serialization.BackupRepo: a category that fails to restore can later be overwritten in VSS by the restoring device's empty state for it. This PR now reports the failure but does not guard the upload.Design
N/A — no design available.
Preview
Restoring a wallet backed up on iOS: WALLET RESTORED, the iOS profile name, each iOS send once with its tag and contact, and the restored payment requests; then both sends again once after a new block and an app restart.
restore2x.mp4
restore-part22x.mp4
recheck2x.mp4
QA Notes
Setup
https://bitkit.stag0.blocktank.to/vss_rs_auth), staging Pubky/Homegate, Electrum frombitkit-docker(bitcoind,electrs) on127.0.0.1:60001.devDebugbuild on an emulator,adb reverse tcp:60001 tcp:60001.Journeys
N/A — not drivable; see Manual Tests.
Manual Tests
Automated Checks
BackupJsonTest.kt— decodes METADATA, SETTINGS, BLOCKTANK and ACTIVITY fixtures written by Swift'sJSONEncoderfrom the bitkit-ios models, keeps a default for an unreadable setting, rejects an envelope without settings, and round-trips Android envelopes unchangedBackupRepoTest.kt— an iOS METADATA envelope restores the Pubky session and tags; a failed session restore, a failed WIDGETS save, a failed BLOCKTANK save, a failed ACTIVITY save and an undecodable ACTIVITY are reported as failed categoriesActivityRepoTest.kt— a restored on-chain activity replaces the synced row with the same txid after it is saved and carries its tags; a failed save keeps the synced row; a synced row that already has the restored id stays; the restore waits for an in-flight sync only while the node runsWalletViewModelTest.kt,ContentViewTest.kt— followRestoreState.Completedcarrying the failed categoriesEvidence
devDebugbuild) with a fresh bitkit-ios master wallet (QA): WALLET RESTORED with every category restored, the iOS profile name, the contact-labelled Paykit send, both payment requests, and each iOS send once with its tag, still once after a new block and an app restart. ACTIVITY restored 66 ms after BLOCKTANK; the node was already running, so the run took the branch that waits for an in-flight sync.devDebugbuild), with a source wallet that also made a plain tagged on-chain send (QA): WALLET RESTORED with every category restored, the iOS profile name, the contact-labelled Paykit send, both payment requests, and each iOS send once with its tag. The node sync had stored both sends under its own payment ids; the restore replaced those rows, leaving exactly the 3 iOS rows, and after a new block and an app restart both sends were Confirmed and still shown once.devDebug), restoring a wallet whose METADATA, ACTIVITY and BLOCKTANK were written by bitkit-ios master, with an extra debug-only log line of each raw envelope that is not on head:Restore success, thenFull restore success; the screen showed WALLET RESTORED with no incomplete line.txId,channelIdorpaymentHash, the shape that failed in [Bug]: iOS backup restore reports success but loses profile and payment history #1733. ACTIVITY used{"onchain":{"_0":…}}with{"sent":{}}, BLOCKTANK{"regtest":{}}.Restore success, thenFull restore success; WALLET RESTORED with no incomplete line, the iOS profile name in the header, the contact-labelled send, the balance of 496,857 sats, and both payment requests. The restored settings point Electrum at the source's local server, so the first attempt timed out starting the node until that server was reachable again.addressTypesToMonitor: "nativeSegwit") restored the same data, with the profile screen showing the iOS pubky.just compile,just testandjust lintpassed locally at 2e0a8e3 and again at 94637b3;just lintandBackupRepoTest.ktagain at d8372ad, which only adds the WIDGETS save check.Gaps
ActivityRepoTestonly.Models used
claude-opus-5-5(reasoning:medium)claude-opus-5-5(reasoning:medium)claude-opus-5-5(reasoning: Not exposed)The review subagent's reasoning setting is not in the session metadata available here.