Repository navigation
fix: retry rn tags after restore - #852
piotr-iohk wants to merge 7 commits into
Conversation
Tags whose activity had not synced were cleared after one attempt. Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
|
talosmachina
left a comment
There was a problem hiding this comment.
1 finding (1 P1). Keeps React Native tags whose activity has not synced yet and retries them on later syncs. Reviewed 0423fb3, full tier, from the code and CI: iOS does not build on this reviewer's Linux host.
What I checked, and 3 candidates I ruled out
Read in full: MigrationsService.swift (post-sync path, cleanup gate, remote restore), the syncCompleted handler in AppViewModel.swift, the isShowingMigrationLoading observer in AppScene.swift
Call sites traced: reapplyMetadataAfterSync, canCleanupAfterMigration, needsPostMigrationSync
CI: Run Tests, Run Integration Tests and build-local were still pending at review time; validate green
Ruled out
- MMKV path loses tags:
applyAllMetadatastill ignores the unapplied set, but MMKV metadata is re-extracted from disk on every pass until cleanup, so nothing is lost. lastUsedTagsdropped: they are written toUserDefaultsbefore the retained metadata strips them.- Retained metadata survives a wipe:
clearPendingMigrationDatastill nilspendingMetadata.
Merge confidence: 3/5, the unbounded tag retry above.
|
@greptileai Please re-review latest head c99cac1. All three findings have fixes and direct replies with validation evidence. Tag retries use only persisted pendingMetadata, migration completion clears its one-time suppression flag while retained data retries independently, and the two-pass persisted retry plus failed-write tests pass. The iOS test build succeeded; all five RNMigrationTagRetentionTests passed. |
|
This PR is set for a Plus review. TREX isn't supported with Plus or Apex reviews yet, so Greptile reviews this PR at Base while TREX is on. |
This comment has been minimized.
This comment has been minimized.
|
@greptileai Please review latest head 96f5ca3. The Android twin review identified a shared late transfer/boost retry gap, so this companion fix now persists unfinished local markers before clearing completion and retains missing activities or failed updates for later syncs. All seven migration regression tests passed, including two-pass persistence/reload for transfer and boost markers and failed writes. |
jvsena42
left a comment
There was a problem hiding this comment.
Code scan at 0423fb3: nothing new from me. The open points on this PR are already raised by other reviewers and are still unfixed at this head, so I am not approving and not repeating them:
- an orphan tag keeps
needsPostMigrationSyncset, so every sync reruns the full metadata reapply andmarkAllUnseenActivitiesAsSeen, and migration cleanup never runs; - the MMKV tag replay re-adds tags the user removed while cleanup is held.
The Android side, synonymdev/bitkit-android#1396, changed both in its latest commit: it clears the flag after the first pass, retries leftover tags outside the migration gate, and drops the MMKV replay. Porting that split here would close both threads.
Checked and clean:
- Retained tags cannot cross wallets: a wipe removes the persisted pending metadata.
- Resolved ids are removed from the pending set,
lastUsedTagsis applied once, and a cancelledupsertTagskeeps its id for the next pass. - No channel code is touched, and the new log lines carry ids and counts only.
|
Following up on the review that says it scanned 0423fb3: both reported paths changed in c99cac1 and are present in latest head 96f5ca3. AppViewModel.swift:1614 captures the one-time completion flag, :1620 sweeps activities only for that first pass, :1622 passes includeLocalMetadata: completingMigration, and :1623 clears needsPostMigrationSync regardless of the cleanup gate. MigrationsService retries tags only from persisted remaining pendingMetadata; the full MMKV tag replay was removed. Cleanup remains deferred while data is pending, while migration UI and notice-suppression flags are cleared. The new two-pass persistence and failed-write tests pass. Please check the current diff; the original findings were fixed rather than deferred. |
talosmachina
left a comment
There was a problem hiding this comment.
Re-review of 96f5ca3 after 0423fb3. 1 earlier finding: fixed. 0 new findings. The two new commits split the one-time migration completion from the background retries, keep unresolved transfer and boost markers alongside the tags, and add two-pass persistence tests. Full tier, reasoned from the code and CI: iOS does not build on this reviewer's Linux host.
- Bound the tag retry (P1): fixed in
c99cac1c.AppViewModel.swift:1623now clearsneedsPostMigrationSyncafter the first pass whatevercanCleanupAfterMigrationsays, soshouldPresentConfirmedOnlyReceivestops suppressing new receives,markAllUnseenActivitiesAsSeenruns once (completingMigration), and the network-required toast inAppScene.swift:537no longer fires on later launches. An unresolvable id still holds the RN keychain and file cleanup, which the PR states as the intent.
What I checked, and 4 candidates I ruled out
Read in full: the post-sync path of MigrationsService.swift (reapplyMetadataAfterSync, applyRemoteTransfers, applyBoostTransactions, retryPendingMetadata, applyPendingTags, canCleanupAfterMigration, hasPendingMigrationRetries), the syncCompleted handler in AppViewModel.swift, RNMigrationTagRetentionTests.swift
Call sites traced: needsPostMigrationSync (AppScene.swift:537, AppViewModel.swift:1332, the two writers in MigrationsService), isRestoringFromRNRemoteBackup, isShowingMigrationLoading
Compared with: the Android twin synonymdev/bitkit-android#1396 at 10f1435, whose canCleanupAfterMigration gates on the same pending sets
CI: build-local, Run Integration Tests, validate green; Run Tests and e2e-tests-local still pending at review time
Ruled out
- Overlapping
syncCompletedevents repeat the sweep:isSyncingMigrationis claimed on the main actor before theTaskstarts and released by itsdefer; a dropped event is followed by the next background sync. - Unconditional
isRestoringFromRNRemoteBackup = falsechanges behaviour: nothing inBitkit/reads that flag, onlyrestoreFromRNRemoteBackupand this handler write it. - Local activity metadata no longer replays on later passes:
applyOnchainMetadatacreates the activity when it is missing, so the single local pass loses nothing; onmastercleanup also ended the replay after the first successful pass. - Lightning sync completes the migration before on-chain history exists: the pinned ldk-node only emits
SyncCompletedwithSyncType::OnchainWallet.
Merge confidence: 4/5, no open findings, but Run Tests had not finished and the restore path has no device run with an unresolvable marker.
|
Scheduled the standard migration test matrix, including
I will inspect the results and investigate any failed scenarios. Slack reporting is disabled. |
|
Migration matrix passed on current app head Completed migration run. All scenario checkout logs confirm E2E Retry caveat: native restore passed on attempt 2 and RN restore on attempt 3. I inspected both failed-shard artifacts, all available simulator logs, Appium logs, the RN failure screenshot and sampled recording. Both attempt-1 failures were Appium session-creation timeouts before migration assertions (infra). RN attempt 2 remained on Terms of Use after the automated Continue tap and timed out waiting for SkipIntro; the same scenario passed unchanged on attempt 3 (flake). No migration defect is established, and this is a passing matrix with recovered failures. Attempt-1 screenshots/recordings and separate app-log bundles were not supplied. @jvsena42 The current-head fixes were explained in the earlier reply to your stale-head findings; the migration and remaining regular CI evidence is now available. Please confirm your review against this exact head. |
Related to synonymdev/bitkit-android#1258
Twin: synonymdev/bitkit-android#1396
Companion: synonymdev/bitkit-e2e-tests#263
This PR keeps React Native activity tags until the matching activity exists. It does not change when the node starts. The channel wait and the restart in #1258 are Android-only, in the twin.
Description
Out of Scope
MigrationsService: no change to when the node starts, and no change to how channel monitors are applied. iOS already waits for the React Native channel backup before start.Design
N/A — no UI changes.
Preview
N/A
Migration runs
Runs of this change:
rn_restorestill failed in both. Android stopped on the receive celebration. iOS passed the first balance check and stopped on the QuickPay intro after relaunch. Those two are covered by the companion.QA Notes
Journeys
N/A — not drivable; see Manual Tests.
Manual Tests
Automated Checks
RNMigrationTagRetentionTests.swift— two sync passes retain and reload missing tags, block cleanup until applied, avoid replaying applied tags, and keep failed tag writes pending