Repository navigation
fix: ask for an update when paykit data is newer - #2023
Conversation
Verified: just compile, just test, just lint
Codex Review Summary: ✅ CompletedThis 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. |
Regtest APKDownload bitkit-dev-debug universal APK (expires in 30 days). |
talosmachina
left a comment
There was a problem hiding this comment.
No findings. Replaces the raw Paykit storage error on the Create Profile and Pubky choice toasts with an update prompt when the shared state was written by a newer Paykit. Reviewed 55f005d, full tier, static: per the repo's agent rules an auto review does not build the branch here, so this is reasoned from the code and CI.
What I checked, and 5 candidates I ruled out
Read in full: PaykitExceptionExt.kt, PubkyAuthErrorMessage.kt, CreateProfileViewModel.kt, PubkyChoiceViewModel.kt, the new test; paykit-rs state_blob.rs and errors.rs at v0.1.1-rc9 and at pubky/paykit-rs#267.
CI: build-and-test, lint, detekt green. compose-ui / ui-tests failed before any test ran: sdkmanager --install emulator hit Error reading Zip content from a SeekableByteChannel and the emulator never started; build is the gate that requires it. A runner fault, not this diff; a re-run should clear it.
Ruled out
- Context strings drift from Paykit: both match the pinned 0.1.1-rc9 (
paykit-sdk/src/storage/state_blob.rs:195and:203) and are unchanged on the head of pubky/paykit-rs#267 (:333,:341); the FFI keeps the context and sets codestorage_errorforPaykitSdkError::Storage(paykit-ffi/src/errors.rs:124-128). - Current-version corruption shown as "update required": the plain trailing-bytes context is only raised past an AEAD-authenticated decrypt, so it takes a writer that encoded more than this format, which is the newer-Paykit case. The per-version
SDK state blob version N contains trailing bytescontexts are correctly left out, and the test pins that. - rc6+ reading rc5 data: rc9 still decodes v1 (
state_blob.rs:140), so the older direction never hits these errors. - Typed error hidden by a wrapper:
isPaykitStateFromNewerVersionwalks the cause chain, and no repository or service on these paths rethrows with the message only. - A toast still showing the raw text: the one remaining
it.messageinCreateProfileViewModelis thederiveKeys()failure, which is local key derivation with no Paykit storage read (PubkyRepo.kt:996-1003). The string is in all 18values*directories.
Merge confidence: 3/5, CI is red for a reason outside the change (emulator install on the runner); with that job green it is 5/5, the matcher is covered by PaykitExceptionExtTest.kt.
Reviewer model: claude-opus-5-5
Reasoning effort: Not exposed (the run metadata available to this reviewer does not carry it)
Verified: just compile, just test, just lint
|
2bb6fb7: restoring a saved session on launch now shows the update message too, instead of "session expired". The earlier |
Verified: just compile, just test, just lint
Verified: just compile, just test, just lint
Verified: just compile, just test, just lint
Verified: just compile, just test, just lint
|
ad80852 shows the update message on Profile above Try Again while a restore needs an update, so the reason stays visible after the one-time toast. It matches the iOS change for synonymdev/bitkit-ios#1416 (synonymdev/bitkit-ios#1416 (comment)). |
Verified: just compile, just test, just lint
Verified: just compile, just test, just lint
Verified: just compile, just test, just lint
Verified: just compile, just test, just lint (ToastQueueManagerTest rerun after the lint wrap)
piotr-iohk
left a comment
There was a problem hiding this comment.
QA review
Scope: full PR diff against its merge base, at aa2d1a2.
1 actionable finding — resolve or provide an evidence-backed rebuttal.
A saved session whose Paykit state is newer stays in place, skips re-sign-in, and asks for an update once per saved identity, including the deferred retry after an offline start. Profile keeps that reason above Try Again. Earlier review threads on this PR match that behavior at this head. The queue change that lets the update warning finish, and that lets an address-type result replace its progress toast, also deletes a queued sticky explanation before it is shown.
Compared with bitkit-ios#1416 at 229faff, session handling matches. iOS waits until the app is active and unlocked before showing the one-shot warning; Android shows it when MainActivity resumes, including over the PIN screen, and then clears it. That iOS patch was the comparison source; this is not a review of the iOS PR.
Device testing: not performed in this review. The author reports manual cases 1–3 were not run because no newer Paykit state format was available. No unit suite was run for this review.
Suggested additional test cases
Android. Use a restored wallet that still has an in-flight Pubky swap claim, and a profile whose Paykit state was saved by a newer Paykit. Open Bitkit so the update warning is showing, let the claim finish, then let a later toast enqueue (for example go offline and back online so “Bitkit successfully reconnected” appears). Expected: after the update warning hides, “Payment returned to Savings” is shown and stays until it is dismissed.
Non-blocking consistency suggestions
iOS holds the update warning until the PIN is verified. Android shows the same one-shot toast as soon as the wallet activity resumes, so the three seconds can elapse while the PIN is on screen.
Findings
- [MEDIUM] Keep the returned-payment toast until the user dismisses it — inline at
app/src/main/java/to/bitkit/ui/shared/toast/ToastQueueManager.kt:50.
Reviewer model: grok-4.7
Reasoning effort: xhigh
Only the address-type progress toast is replaced by a later toast while it waits; the returned-payment toast keeps its place behind the update warning. Verified: just compile, just test, just lint
AppViewModel rebuilt toasts from ToastEventBus and dropped replacedByNext, so a queued address-type progress toast could hide its result. Verified: just compile, just test, just lint
piotr-iohk
left a comment
There was a problem hiding this comment.
QA review
Scope: changes since 2739903, including the affected toast-forwarding path, at 17b0f3c. Baseline: fe3c7316-9c0b-4a6c-8ffe-003fe5c2ae18. Unchanged Paykit matching, session restore, the resume prompt, profile retry, create-profile copy, and update strings stay covered by that baseline.
No new actionable code findings.
AppViewModel.toast(Toast) enqueues the original toast, so an address-type progress toast keeps replacedByNext and leaves the queue when a later toast arrives while the update warning is showing. Compared bitkit-ios#1416 at 229faff: iOS keeps the newest toast waiting behind a non-interruptible warning, and Android keeps non-progress toasts in order, which is what manual test 4 describes.
Device testing: not performed in this review. This pass is source analysis. The new AppViewModelSendFlowTest case and ToastQueueManagerTest were inspected and were not run. Author cases 1–4 still need a build that writes a newer Paykit state.
Suggested additional test cases
- Android, with the update warning visible from manual test 1: change address type and let it finish. After the warning hides, the address-type result shows, and “Applying changes” does not remain until dismissed. A toast already waiting, such as “Payment returned to Savings”, stays until the user dismisses it.
Earlier findings reconciled at this revision: 1 verified fixed.
Reviewer model: grok-4.7
Reasoning effort: xhigh
jvsena42
left a comment
There was a problem hiding this comment.
Approving at 17b0f3c8f: no findings from the code scan, and the device gate passes.
Fixture: newer Paykit state was written by the same app code built against Paykit v0.1.1-rc9 with pubky/paykit-rs#267 merged (state format 6), installed over the PR build on one emulator, staging homeserver, fresh identity. The PR build then logs unsupported SDK state blob version 6, expected 4.
- Case 1, restore the profile: "Failed to create profile / This profile needs a newer version of Bitkit. Update the app to use it.", no
storage_errortext. - Case 2, relaunch: the update toast shows once, no "session expired".
- Case 3, offline start then online: "Internet Connection Restored", then the update toast; Profile keeps the update reason above Try Again.
- Case 5, address type change during the warning: the warning stays, then "Applying changes…" and "Address Type Changed", nothing left on screen.
- Regression: a normal launch restores with no toast; Disconnect from the unrestored profile returns to Home and clears the owner.
⚠️ Case 4 not run: it needs a swaps-enabled build, a regtest swap provider and an interrupted claim that survives a restore. Also not run: case 1 through Pubky Ring, and the case 5 variant where the result arrives while the warning is still showing.
On skipping the re-sign-in: at v0.1.1-rc9 neither sign_in nor import_session reads the shared state; both go through activateBootstrapResult, which does. A re-sign-in would fail the same way after creating a new grant, so skipping it loses nothing. On device, sign-up and sign-in both failed with the version-6 error.
Note on case 3: the offline cold start logs identity_error for both the restore and the re-sign-in attempt, not a deferred restore, and the update toast came from the reconnect retry. The user sees the same result; the description's "deferred retry after an offline start" is not the path taken here.
Device gate: cases 1, 2, 3, 5 and both regression checks pass;
Reviewer model: claude-fable-5-2 (primary, device runbook), claude-opus-5-5 (coordinator)
Reasoning effort: Not exposed
|
Merging at 17b0f3c: approved on this head, CI green, no open threads. Case 4 stays unrun; it needs a swaps-enabled build with an interrupted claim that survives a restore. The description now says an offline start gets its update toast from the retry on reconnect, as the device run showed. |
Device QA resultsTested Four of five manual cases passed. Across manual cases, controls, and exploration, 11 passed, 2 failed, and none remained blocked.
Additional checks. Compatible-profile relaunch, ordinary address change and persistence, a completed address change behind the warning, background/foreground without a duplicate warning, and disconnecting the incompatible profile passed. S22 controls verified both the warning and the standalone payment notification. The second failure was a timing variant of case 4: starting an address change when the payment message was already visible displaced it before dismissal. The restored-swap recording, provider settlement log, queue timestamps, and reproduction steps are in #2030. |
@piotr-iohk Thanks, taking it in #2030. A shown toast is still replaced by the next one, as on master. The fix makes "Payment returned to Savings" hold later toasts behind it until it is closed, which covers both the reconnect and the address-change timing. |
Closes #2022
Twin: synonymdev/bitkit-ios#1416
Description
code=storage_error, context=…text shown when creating, restoring or connecting a profile whose Paykit shared state was saved by a newer Paykit, because the app passed the SDK message straight to the toastisPaykitStateFromNewerVersion(), which matches the typedPaykitException.Storage(codestorage_error, contextSDK state blob contains trailing bytesorunsupported SDK state blob version N) through the cause chain, andprofileErrorDescription(), which swaps in the newprofile__update_requiredstring on the Create Profile and Pubky choice toastsPubkyRepomapped it to a failed restore; it now keeps the saved session, skips the re-sign-in that cannot read the state either, and shows the update message, also when a retry after an offline start finds it; it asks once per saved identity, so the minute-by-minute restore polling stays silent; a prompt found while Bitkit is in the background waits and shows when it returns to the foreground; Profile keeps the update message above Try Again after the toast is gone; the warning shows only on the wallet screen, and a later toast such as Back online waits until it hides; toasts waiting behind it keep their place, except the address-type progress toast, which its result replacesPaykit keeps each identity's state on its homeserver, shared by every app and device on it. Paykit 0.1.1-rc5 and older fail on the current format with the trailing-bytes error, and this app's Paykit 0.1.1-rc9 will fail with the unsupported-version error once pubky/paykit-rs#267 moves the format to version 6. Both now read "This profile needs a newer version of Bitkit. Update the app to use it." under the existing error title.
Out of Scope
ui/utils/PubkyAuthErrorMessage.kt: other Paykit errors on these toasts keep their current textDesign
N/A — no design available.
Preview
N/A — the message only shows with Paykit state written by a newer Paykit; see Manual Tests.
QA Notes
Setup
Journeys
N/A — not drivable; see Manual Tests.
Manual Tests
storage_errortext — the journey environment cannot write a newer Paykit state formatAutomated Checks
PaykitExceptionExtTest.kt— newer-state storage errors match, older-version corruption and plain text do notPubkyRepoTest.kt— a saved session hitting newer state flags an update, not a failed restore, and keeps the session; the deferred retry flags it too, and later restores of the same identity do not repeat itEvidence
Local verification:
just compile,just test,just linton the final tree.Gaps
Models used
Claude Opus 5.5(reasoning:medium)Claude Opus 5.5(reasoning:medium)Claude Sonnet 5.5(reasoning:high)