Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: new login use case chooser for context enterprise vs fallback (WPB-15966) #3287

Merged

Conversation

yamilmedina
Copy link
Contributor

@yamilmedina yamilmedina commented Feb 7, 2025

TaskWPB-15966 [Android] Create use case to select old vs new login flow


PR Submission Checklist for internal contributors

  • The PR Title

    • conforms to the style of semantic commits messages¹ supported in Wire's Github Workflow²
    • contains a reference JIRA issue number like SQPIT-764
    • answers the question: If merged, this PR will: ... ³
  • The PR Description

    • is free of optional paragraphs and you have filled the relevant parts to the best of your ability

What's new in this PR?

  • Creates use case to fetch and observe the LoginContext (Enterprise or Fallback) according to conditions
    • Api version negotiated
    • Proxy authenticated or not
    • Possible errors in these scenarios
  • Create extension of Server config repository, removing duplication and extended.

Testing

Test Coverage (Optional)

  • I have added automated test to this contribution

PR Post Submission Checklist for internal contributors (Optional)

  • Wire's Github Workflow has automatically linked the PR to a JIRA issue

PR Post Merge Checklist for internal contributors

  • If any soft of configuration variable was introduced by this PR, it has been added to the relevant documents and the CI jobs have been updated.

References
  1. https://sparkbox.com/foundry/semantic_commit_messages
  2. https://github.com/wireapp/.github#usage
  3. E.g. feat(conversation-list): Sort conversations by most emojis in the title #SQPIT-764.

@yamilmedina yamilmedina requested a review from saleniuk February 7, 2025 15:47
@yamilmedina yamilmedina changed the title feat: enterprise login create use case to decide which Context to use or fallback (WPB-15966) feat: new login use case chooser for context enterprise vs fallback (WPB-15966) Feb 7, 2025
Copy link
Contributor

github-actions bot commented Feb 7, 2025

Test Results

3 442 tests   3 334 ✅  5m 22s ⏱️
  591 suites    108 💤
  591 files        0 ❌

Results for commit 70d4290.

♻️ This comment has been updated with latest results.

@datadog-wireapp
Copy link

datadog-wireapp bot commented Feb 7, 2025

Datadog Report

Branch report: feat/new-login-oldnewversion-usecase
Commit report: 2ad6dfc
Test service: kalium-jvm

✅ 0 Failed, 3334 Passed, 108 Skipped, 1m 0s Total Time

@codecov-commenter
Copy link

codecov-commenter commented Feb 12, 2025

Codecov Report

Attention: Patch coverage is 66.34615% with 35 lines in your changes missing coverage. Please review.

Please upload report for BASE (epic/new-sso-login-flow@872c7a8). Learn more about missing BASE report.

Files with missing lines Patch % Lines
.../persistence/daokaliumdb/ServerConfigurationDAO.kt 0.00% 11 Missing ⚠️
...guration/server/ServerConfigRepositoryExtension.kt 85.71% 0 Missing and 7 partials ⚠️
...gic/configuration/server/ServerConfigRepository.kt 61.53% 5 Missing ⚠️
.../kotlin/com/wire/kalium/logic/GlobalKaliumScope.kt 0.00% 4 Missing ⚠️
.../network/api/base/unbound/versioning/VersionApi.kt 0.00% 4 Missing ⚠️
...etwork/networkContainer/UnboundNetworkContainer.kt 0.00% 2 Missing ⚠️
...nfiguration/server/CustomServerConfigRepository.kt 93.33% 1 Missing ⚠️
...e/kalium/logic/feature/auth/AuthenticationScope.kt 0.00% 1 Missing ⚠️
Additional details and impacted files
@@                    Coverage Diff                     @@
##             epic/new-sso-login-flow    #3287   +/-   ##
==========================================================
  Coverage                           ?   53.98%           
==========================================================
  Files                              ?     1324           
  Lines                              ?    37638           
  Branches                           ?     3789           
==========================================================
  Hits                               ?    20318           
  Misses                             ?    15903           
  Partials                           ?     1417           
Files with missing lines Coverage Δ
...m/logic/feature/auth/ObserveLoginContextUseCase.kt 100.00% <100.00%> (ø)
...nfiguration/server/CustomServerConfigRepository.kt 85.29% <93.33%> (ø)
...e/kalium/logic/feature/auth/AuthenticationScope.kt 0.00% <0.00%> (ø)
...etwork/networkContainer/UnboundNetworkContainer.kt 0.00% <0.00%> (ø)
.../kotlin/com/wire/kalium/logic/GlobalKaliumScope.kt 0.00% <0.00%> (ø)
.../network/api/base/unbound/versioning/VersionApi.kt 77.27% <0.00%> (ø)
...gic/configuration/server/ServerConfigRepository.kt 41.17% <61.53%> (ø)
...guration/server/ServerConfigRepositoryExtension.kt 85.71% <85.71%> (ø)
.../persistence/daokaliumdb/ServerConfigurationDAO.kt 52.89% <0.00%> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 872c7a8...70d4290. Read the comment docs.

@yamilmedina yamilmedina requested a review from saleniuk February 13, 2025 12:31
@yamilmedina yamilmedina marked this pull request as ready for review February 13, 2025 12:31
/**
* Common operations for the server configuration repository.
*/
internal abstract class ServerConfigRepositoryExtension(
Copy link
Member

Choose a reason for hiding this comment

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

We missed to cover this class with test

Copy link
Contributor Author

@yamilmedina yamilmedina Feb 13, 2025

Choose a reason for hiding this comment

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

Good point, in fact these are covered by the classes extending this one ServerConfigDataSource and CustomServerConfigDataSource, so they are covered as can be seen here. https://app.codecov.io/gh/wireapp/kalium/pull/3287/blob/logic/src/commonMain/kotlin/com/wire/kalium/logic/configuration/server/ServerConfigRepositoryExtension.kt

But, there is one actually missing for the new function in CustomServerConfigDataSource observeServerConfigByLinks I will add one to cover this.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah but it's unclear exactly what is being tested, we are only sure that the test runs through those lines of code.

We need to isolate the class during testing. This way, we can validate its behavior independently, without interference from external classes/dependencies, ensuring that it behaves correctly in all cases.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can take a look at a later point since this is the epic still, but the problem with this is, given is an abstract class, it is not straight forward to test, and the functions are covered indeed by the inherited testable classes

@yamilmedina yamilmedina merged commit acf70f0 into epic/new-sso-login-flow Feb 14, 2025
20 checks passed
@yamilmedina yamilmedina deleted the feat/new-login-oldnewversion-usecase branch February 14, 2025 10:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants