Skip to content

Conversation

@JohnsonEricAtSalesforce
Copy link
Contributor

@JohnsonEricAtSalesforce JohnsonEricAtSalesforce commented Dec 17, 2025

🎸 Ready For Review! 🥁

This is the 13.1.1 back-port of #2807, which resolves issues when selecting Salesforce Welcome Discovery tiles that require browser-based auth using the device browser instead of the web view. That change is currently approved for 13.2.0 on dev.

Much of the description there applies here, since I cherry-picked those changes into 13.1.1 (master). We've reviewed and tested that logic extensively and the actual conflict between dev and master at this time is quite low. Also, the merge of 13.1.1 from master back to dev for 13.2.0 will be easier if the source is similar.

I rolled back any changes related to increasing code coverage to minimize the footprint for 13.1.1 and reduce risk.

Here's what looks like the exact same test video, now recorded against this pull request, which shows the server picker in action plus the switch to WSC Discovery and selection of a tile that requires the external browser custom tab. Note, I cannot actually sign in because of the still present consumer key restrictions for the internal app. I should be able to do that within the next day.

Screen_recording_20251217_171130.mp4

@github-actions
Copy link

1 Error
🚫 Please re-submit this PR to the dev branch, we may have already fixed your issue.

Generated by 🚫 Danger

@JohnsonEricAtSalesforce JohnsonEricAtSalesforce marked this pull request as ready for review December 18, 2025 00:15
@JohnsonEricAtSalesforce JohnsonEricAtSalesforce changed the title @W-20161958: [MSDK 13.1][Android] Cannot login GUS using Welcome endpoint @W-20618449: [MSDK 13.1][Android] Cannot login GUS using Welcome endpoint (13.1.1 Patch) Dec 18, 2025
@JohnsonEricAtSalesforce
Copy link
Contributor Author

I verified the two failed tests actually pass for me locally. To the best of my knowledge, current state on 13.1.0 did have known unreliable tests. Do we want to pull in the fixes for those as part of this?

@JohnsonEricAtSalesforce
Copy link
Contributor Author

This has passed testing by the app team plus my own testing. It ought to be good-to-go (G2G!)

Copy link
Contributor

@brandonpage brandonpage left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Lets wait until everyone is back in the new year before merging.

isUsingFrontDoorBridge: Boolean = viewModel.isUsingFrontDoorBridge,
singleServerCustomTabActivity: Boolean = viewModel.singleServerCustomTabActivity,
) {
if ((singleServerCustomTabActivity.or(isBrowserLoginEnabled)).and(!isUsingFrontDoorBridge)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it matters for this context, but it should be noted that or and and differ from || and && in that they do not short-circuit.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's true. Kotlin's methods are beneficial here since they increase code coverage. The short-circuit operators produce untestable logic branches which are revealed by CodeCov. That seems well documented online. In many cases I was able to retain the operators and still hit 100% coverage, but this one stumped even the AI tools and they recommended the methods - which worked.

We wouldn't want to use Kotlin's methods if the expressions were costly or had side-effects, obviously. In this case, they're simple booleans.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, interesting! Great use case, especially for non-nullable values.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks ☺️

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We wouldn't want to use Kotlin's methods if the expressions were costly or had side-effects, obviously. In this case, they're simple booleans.

Maybe there are cases where you specifically would want to ensure a side-effect happens? Like:

if (override.and(atomicInt.addAndGet(1) > MAX))

and guarantees the add happens no matter the value of override. Seems pretty niche though.

Comment on lines +302 to +305
val pendingLoginServerUnwrapped: String = pendingLoginServer ?: return

// Recall this pending login server for reference by future updates.
previousPendingServer = pendingLoginServerUnwrapped
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like this could be combined into one line?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method makes multiple references to the local variable previousPendingServerUnwrapped, so this statement assigns the member value previousPendingServer while the method only uses the thread-safe local. There's also the nullability of the value since it's derived from a nullable MediatorLiveData. Those two factors were what kept this assignment separate when I looked at it.

We've had a couple places in the code lately where multiple references to mutable members in a method scope caused issues, like crashes in tests. That's why I kept the logic referring only to the local.

Years ago on another project I had used a custom non-null LiveData that helped simplify this kind of logic. I haven't looked into something like that in our context, but it could be helpful someday.

@JohnsonEricAtSalesforce
Copy link
Contributor Author

I verified once again that the failed tests here actually do pass locally. We're aware the configuration on master at this point has known failures that will be fixed in an upcoming release.

@JohnsonEricAtSalesforce JohnsonEricAtSalesforce merged commit 7682fb1 into forcedotcom:master Jan 12, 2026
4 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants