fix(auth): guard migrateRefreshToken dispatch_async against stale sessions (W-23992574) - #4146
Merged
wmathurin merged 1 commit intoAug 26, 2026
Conversation
…sions (W-23992574) Pending main-queue blocks from testDowngradeFromDPoP_* tests fired during testLogin's waitForExpectations, triggering NSInternalInconsistencyException in SFRestAPI. Add session-alive check in both the outer and inner block of the dispatch_async in migrateRefreshToken:. Also fix testLogin's empty failure block to report errors via XCTFail.
Clang Static Analysis Issues
Generated by 🚫 Danger |
|
||||||||||||||
Codecov Report❌ Patch coverage is
❌ Your patch check has failed because the patch coverage (50.00%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## dev #4146 +/- ##
==========================================
- Coverage 71.62% 69.21% -2.41%
==========================================
Files 254 254
Lines 22837 22839 +2
==========================================
- Hits 16356 15809 -547
- Misses 6481 7030 +549
🚀 New features to boost your workflow:
|
|
||||||||||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
testDowngradeFromDPoP_*tests queue adispatch_async(dispatch_get_main_queue(), ...)inmigrateRefreshToken:then immediately clean up the auth session; the pending block fires duringtestLogin'swaitForExpectations:timeout:20, triggeringNSInternalInconsistencyException: Use SFRestAPI sharedInstance for authenticated requests(seen in Actions run 32898781351)authSessions[authSession.sceneId]) in both the outer and innerdispatch_asyncblock so stale sessions are silently skippedtestLogin's empty failure block to surface errors viaXCTFail— previously silent failures masked real timeoutsTest plan
SFUserAccountManagerTestslocally: 24 tests, 0 failures (includingtestLoginpassing in ~0.9 s with a real network token refresh)testDowngradeFromDPoP_*tests run beforetestLoginwith no crash