Repository navigation
fix: ask for an update when paykit data is newer - #1416
Conversation
Verified: BitkitTests unit selection on iOS 26.4 simulator, swiftformat --lint, validate-translations
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. |
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 910d0d5, full tier, static: iOS does not build on this reviewer's Linux host, so this is reasoned from the code and CI.
What I checked, and 5 candidates I ruled out
Read in full: PaykitError+NewerState.swift, the new test, the changed catch blocks in CreateProfileView.swift and PubkyChoiceView.swift, AppError in Errors.swift; paykit-rs state_blob.rs and errors.rs at v0.1.1-rc9 (the pinned revision 0b9c63d) and at pubky/paykit-rs#267.
CI: SwiftFormat and validate green; Run Tests, Run Integration Tests and build-local still running at review time.
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:
AppError(error:)keeps the original asunderlyingError, which the matcher unwraps; the profile manager paths rethrow the original error (PubkyProfileManager.swift, the adopt and create flows), and no service on them rethrows a string. - A toast still showing the raw text: every catch-all in both views now goes through
profileErrorDescription; the one remaininglocalizedDescriptionisPubkyAppProfileError.changedElsewhere, an app error. The key is in every.lproj.
Merge confidence: 4/5, no findings and the matcher is covered by PaykitNewerStateTests.swift, but the unit test job had not finished when I reviewed.
Reviewer model: claude-opus-5-5
Reasoning effort: Not exposed (the run metadata available to this reviewer does not carry it)
Verified: BitkitTests unit selection on iOS 26.4 simulator, swiftformat --lint
Verified: BitkitTests unit selection on iOS 26.4 simulator, swiftformat --lint
Verified: BitkitTests unit selection on iOS 26.4 simulator, swiftformat --lint
|
9cc6119: the update message now shows once per saved identity while the error lasts, matching the Android twin (raised in synonymdev/bitkit-android#2023 (comment)). Foreground polling of the same identity stays silent; a successful restore resets it, and a new sign-in asks again. |
The update toast waits until Bitkit is active and unlocked, and Profile shows the update message above Try Again while a restore needs an update. Verified: xcodebuild test (unit-tests.yml skips), swiftformat --lint
|
a824e9c also makes the update toast wait until Bitkit is active and unlocked, like the expiry toast, so a restore that finds newer Paykit state in the background no longer loses its one-time prompt. It matches synonymdev/bitkit-android#2023. |
…ofile Verified: xcodebuild test (unit-tests.yml skips), swiftformat --lint
|
7075244 also keeps the update warning on screen until it hides: a later toast such as Back online waits for it, and only the newest waiting toast shows next. It matches synonymdev/bitkit-android#2023. |
Verified: xcodebuild test (unit-tests.yml skips), swiftformat --lint
piotr-iohk
left a comment
There was a problem hiding this comment.
QA review
Scope: full PR diff against its merge base, at 229faff.
No new actionable code findings.
No actionable code findings. A saved session that hits either Paykit storage context from #1414 resolves to an update prompt, skips re-sign-in, stops the restore retry, and keeps the update reason on Profile above Try Again. The prompt is shown once per session revision, after the app is active and unlocked, and clearing the profile drops a prompt that has not been shown yet. A current-version blob with extra trailing bytes uses the same unversioned context that #1414 asks to treat as an update; versioned trailing-byte errors stay on the raw path.
The same flow on the twin bitkit-android#2023 at aa2d1a2 uses the same two contexts, a once-per-identity prompt, a non-interruptible toast, and the profile hint. That comparison is limited to this flow. The five existing review threads are resolved, and this head still contains the fixes they describe.
Device testing was not performed in this review. Manual cases 1–3 still need a Bitkit build that writes a newer Paykit state format; the author reports that build was not available. PaykitNewerStateTests and the recovery case in PubkyProfileManagerTests were inspected and not executed.
Suggested additional test cases:
- iOS, newer-state profile from case 1, update warning on screen: disconnect, then reconnect while the warning is visible or fading. The warning stays until it hides, Back online appears after it, and a connection warning that was waiting does not return.
Reviewer model: grok-4.7
Reasoning effort: xhigh
piotr-iohk
left a comment
There was a problem hiding this comment.
Device QA and approval
Approved at 229faff501af9eea5e55b06ce426dcaaaa636e20. Tested the Debug regtest build on an iPhone 17 simulator (iOS 27.2) and a separately signed build on an iPhone 13 (iOS 27.0.1). A newer Paykit SDK wrote version 6 state for the test profiles. The tested build expected version 4.
All four manual cases passed. Across manual cases, controls, and exploration, 7 passed, 1 failed, and none remained blocked.
| Case | Result | Device observation |
|---|---|---|
| 1. Interactive profile connection | PASS | Submitting a profile with newer state showed the localized update guidance. |
| 2. Cold launch with a saved profile | PASS | The same profile was readable before the version-6 write. On relaunch it showed the update warning. |
| 3. Offline start and retry | PASS | Cold-launched the iPhone with Airplane Mode on and Wi-Fi off. Reconnecting produced the warning. The update hint stayed above Try Again after a retry. |
| 4. Disconnect and reconnect during the warning | PASS | On the physical iPhone, the green “Back online” message followed the update warning. The previous connection warning stayed dismissed. |
Additional checks. A compatible profile remained accessible after relaunch. Recovery from an isolated homeserver outage preserved the update guidance after retry. Backgrounding and reopening the app produced no duplicate warning during the observation period.
Exploratory failure. Confirming Disconnect on the incompatible profile twice exposed a raw SDK storage error and left the profile in place. The sign-out error display and cleanup ordering also exist on the base revision. The recording, restore log, UI trace, and reproduction steps are tracked separately in #1427.
Closes #1414
Twin: synonymdev/bitkit-android#2023
Description
error.localizedDescriptionstraight to the toastisPaykitStateFromNewerVersion(), which matches the typedPaykitError.Storage(codestorage_error, contextSDK state blob contains trailing bytesorunsupported SDK state blob version N), also insideAppError, andprofileErrorDescription, which swaps in the newprofile__update_requiredstring on the Create Profile and Pubky choice toastsresolveSessionInitializationmapped it to.restorationFailed; it now returns.restorationNeedsUpdate, keeps the saved session, skips the re-sign-in that cannot read the state either, and shows the update message, automatic recovery and Retry included, once per saved identity so foreground polling stays silent; the background retry loop stops after that result; the toast waits until Bitkit is active and unlocked, and Profile keeps the update message above Try Again after the toast is gone; a later toast such as Back online waits until the warning hides, and clearing the profile drops a pending warningPaykit 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
Views/Sheets/PubkyAuthApproval: the auth approval sheet keeps its current error 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
PaykitNewerStateTests.swift— newer-state storage errors ask for an update, older-version corruption keeps its text, and a saved session hitting newer state needs an updatePubkyProfileManagerTests.swift— automatic recovery asks for the update once and the retry loop stopsEvidence
Local verification: BitkitTests (unit selection from
unit-tests.yml) on an iPhone 17 Pro simulator, iOS 26.4;swiftformat --linton the changed files;node scripts/validate-translations.js.Gaps
Models used
Claude Opus 5.5(reasoning:medium)Claude Opus 5.5(reasoning:medium)Claude Sonnet 5.5(reasoning:high)