Repository navigation
test: stabilize contact and Paykit unit tests - #1375
Conversation
[Low impact] The PR appears safe to merge. SummaryStabilizes contact-preview and Paykit queue-ordering tests without changing normal app behavior.
No actionable issues found. iOS tests were not run in this Linux environment. Reviews (1) · Last reviewed commit: "test: stabilize contact and Paykit unit ..." · Reviewed by Greptile |
talosmachina
left a comment
There was a problem hiding this comment.
No findings. Replaces fixed sleeps in two flaky unit tests with completion signals: a test-only completion callback on AddContactView's endpoint lookup, and waits on PaykitSdkOperationLock.waiterCountForTesting through an injected lock in PaykitSdkService. Reviewed c7e6b46, full tier, static.
What I checked, and 4 candidates I ruled out
Build skipped: iOS does not build on Linux, so this review is reasoned from the code and CI; the unit-test job was still pending when it was written.
Read in full: AddContactViewTests.swift, the withLock/acquire*/release paths of PaykitSdkOperationLock, PaykitSdkService.init and withSdk, the AddContactView endpoint task.
Call sites traced: PaykitSdkService( (the shared instance and every test construction use the default lock, so production behaviour is unchanged); AddContactView( (MainNavView.swift:608 and the preview pass no callback).
Ruled out
- Waiter count reached by something other than the queued operation:
receivePrivateMessagesFromLinkedPeers(priority:), the payment mutations andcontactRecordsall reachoperationLock.withLock(priority:)throughwithSdk, and only those tasks run against the fresh lock, so counts 1/2/3 map one-to-one onto intake, barrier and payment joining the queue, which is the ordering the assertion depends on. - Callback firing before the failure state renders:
hasPayableEndpointis set before the callback, andrenderedLabelsdraws withafterScreenUpdates: true, so the snapshot sees the post-lookup state. - Callback never firing on the failure path:
try?maps the thrown error tofalse, so the throwing stub still reaches the callback; it is skipped only when the task is cancelled or the profile changed, which should fail the test. - Scene-hosted window leaking key status: same pattern as
ProfileDestinationViewTestsandPaykitPaymentRequestServiceTests, with the previous key window restored in teardown.
Merge confidence: 4/5, no findings, but the unit-test job had not finished when I reviewed and I could not run the suite here.
Reviewer model: claude-opus-5-5
Reasoning effort: Not exposed (the run metadata available to this reviewer does not report it)
|
CI is green on |
There was a problem hiding this comment.
Verdict: ✅ Approve
Findings: None.
QA for c7e6b46:
Run the unit workflow selection ✅ The unchanged head built and both test targets passed with no failures.
Built with Xcode 27.0 and ran on an iPhone 17 Pro simulator with iOS 27.0, using the integration-test exclusions in unit-tests.yml. The XCTest result bundle confirms the unit and UI test results, including the contact-preview tests and payment-ordering test. Existing optional Spark regtest, USDT recovery, wake gateway, Trezor emulator and Arbitrum fork tests skipped because their opt-in prerequisites were absent.
suite-2x.small.mp4
Automated suite at 2× speed; outcomes checked in XCTest results.
Repeat contact preview and payment queue ordering ✅ The focused methods passed all ten iterations without failures or skips.
Relaunched the test host between iterations. The retained XCTest assertions checked the rendered preview while lookup is pending, after success and after failure; cancellation when leaving the preview; and payment priority with and without an ordered barrier, including ordered proof submission.
focused-2x.2x.mp4
Focused repetitions at 2× speed; rendering and queue order checked by the test assertions.
No manual journeys were listed or run: this change adds no user-visible behavior. The optional fixture skips do not cover the changed paths. SwiftFormat 0.64.6 on the changed files and git diff --check passed. The hosted unit run also passed at this head.
Full review of 602cd0e..c7e6b46, covering all four changed files, callers, endpoint cancellation, lock ordering and test isolation. The earlier static review also found no issues.
Android twin: none linked or found; the changes concern SwiftUI test hosting and the iOS SDK-operation queue tests.
Reviewed by gpt-6.1-sol-high
|
@piotr-iohk Merged, as it was approved and green. |
This PR stabilizes two iOS unit tests that failed intermittently on PR #1370.
Description
active → intake → paymentwhere it expectedactive → payment → intake. CI attempt 2Design
N/A. Test stabilization only.
Preview
N/A.
QA Notes
Setup
Run the
Bitkitscheme on the iPhone 17 simulator with the exclusions in.github/workflows/unit-tests.yml. The affected tests use stubbed SDK and endpoint calls.Journeys
N/A. The change adds no user-visible behavior.
Manual Tests
N/A.
Automated Checks
AddContactViewTests.swift— checks the rendered contact preview after the view handles an endpoint error and preserves coverage for the pending lookup and view removal.PaykitSdkOperationLockTests.swift— verifies the expected ordering once all operations have joined the queue, including an ordered barrier and ordered proof.Evidence
c7e6b46, Xcode 26.0.1 and iPhone 17 / iOS 26.0 ran theBitkitTestsunit selection with the workflow's integration-test exclusions. XCTest reported 4,133 passed, 5 skipped, and 0 failures.git diff --checkpassed.SparkExitSweepTests.swiftexpression. The file was restored after testing.Gaps
Hosted validation on the workflow's Xcode 26.6 / iOS 26.5 environment is provided by this PR's CI.
Models used
gpt-6.2-sol(reasoning:high)gpt-6.2-sol(reasoning:high)gpt-6.2-sol(reasoning:high)