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

chore: architectural fitness functions - use case implementation visibility pt1. (ACOL-123) #2152

Conversation

yamilmedina
Copy link
Contributor

@yamilmedina yamilmedina commented Oct 18, 2023


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?

Issues

We have failing tests for use case visibility after introducing Konsist in:

Causes (Optional)

Use case implementations can be instantiated from the outside world.

Solutions

Mark them as internal when possible or make their constructor internal to adhere to the rule.
Some tests will still fail, so I need to raise a part 2, or 3 after this.

Needs release

Testing

Test Coverage (Optional)

  • I have added automated test to this contribution

How to test

Tests for the following checks, should NOT fail.

useCaseImplementationsShouldBeInternalOrHaveInternalConstructor[jvm] - com.wire.kalium.logic.architecture.UseCaseRulesTest -


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.

@github-actions
Copy link
Contributor

github-actions bot commented Oct 18, 2023

Unit Test Results

102 files  102 suites   14s ⏱️
649 tests 559 ✔️ 89 💤 1

For more details on these failures, see this check.

Results for commit 02adee7.

♻️ This comment has been updated with latest results.

@datadog-wireapp
Copy link

datadog-wireapp bot commented Oct 18, 2023

Datadog Report

All test runs ae0a33d 🔗

2 Total Test Services: 1 Failed, 0 with New Flaky, 1 Passed

Test Services
Service Name Failed Known Flaky New Flaky Passed Skipped Wall Time Branch View
kalium-jvm 3 0 0 2429 52 11m 45.04s Link
kalium-ios 0 0 0 560 89 3m 36.04s Link

❌ Failed Tests (3)

  • repositoriesShouldNotAccessFeaturePackageClasses[jvm] - com.wire.kalium.logic.architecture.LayerAccessRulesTest - Details

    Expand for error
     com.lemonappdev.konsist.core.exception.KoAssertionFailedException: Assert 'repositoriesShouldNotAccessFeaturePackageClasses' was violated (26 times). Invalid files:
     /__w/kalium/kalium/logic/src/commonMain/kotlin/com/wire/kalium/logic/data/auth/login/LoginRepository.kt (LoginRepository FileDeclaration)
     /__w/kalium/kalium/logic/src/commonMain/kotlin/com/wire/kalium/logic/data/call/CallMetadataProfile.kt (CallMetadataProfile FileDeclaration)
     /__w/kalium/kalium/logic/src/commonMain/kotlin/com/wire/kalium/logic/data/call/CallRepository.kt (CallRepository FileDeclaration)
     /__w/kalium/kalium/logic/src/commonMain/kotlin/com/wire/kalium/logic/data/call/CallingParticipantsOrder.kt (CallingParticipantsOrder FileDeclaration)
     /__w/kalium/kalium/logic/src/commonMain/kotlin/com/wire/kalium/logic/data/call/mapper/CallMapper.kt (CallMapper FileDeclaration)
     /__w/kalium/kalium/logic/src/commonMain/kotlin/com/wire/kalium/logic/data/client/E2EIClientProvider.kt (E2EIClientProvider FileDeclaration)
     /__w/kalium/kalium/logic/src/commonMain/kotlin/com/wire/kalium/logic/data/client/MLSClientProvider.kt (MLSClientProvider FileDeclaration)
     /__w/kalium/kalium/logic/src/commonMain/kotlin/com/wire/kalium/logic/data/client/UserClientRepositoryProvider.kt (UserClientRepositoryProvider FileDeclaration)
     /__w/kalium/kalium/logic/src/commonMain/kotlin/com/wire/kalium/logic/data/conversation/ConversationGroupRepository.kt (ConversationGroupRepository FileDeclaration)
     ...
    
  • useCasesShouldNotAccessDaoLayerDirectly[jvm] - com.wire.kalium.logic.architecture.LayerAccessRulesTest - Details

    Expand for error
     com.lemonappdev.konsist.core.exception.KoAssertionFailedException: Assert 'useCasesShouldNotAccessDaoLayerDirectly' was violated (25 times). Invalid files:
     /__w/kalium/kalium/logic/src/androidMain/kotlin/com/wire/kalium/logic/feature/UserSessionScope.kt (UserSessionScope FileDeclaration)
     /__w/kalium/kalium/logic/src/androidMain/kotlin/com/wire/kalium/logic/feature/UserSessionScopeProviderImpl.kt (UserSessionScopeProviderImpl FileDeclaration)
     /__w/kalium/kalium/logic/src/appleMain/kotlin/com/wire/kalium/logic/feature/UserSessionScope.kt (UserSessionScope FileDeclaration)
     /__w/kalium/kalium/logic/src/appleMain/kotlin/com/wire/kalium/logic/feature/UserSessionScopeProviderImpl.kt (UserSessionScopeProviderImpl FileDeclaration)
     /__w/kalium/kalium/logic/src/commonMain/kotlin/com/wire/kalium/logic/feature/ProteusClientProvider.kt (ProteusClientProvider FileDeclaration)
     /__w/kalium/kalium/logic/src/commonMain/kotlin/com/wire/kalium/logic/feature/TimestampKeyRepository.kt (TimestampKeyRepository FileDeclaration)
     /__w/kalium/kalium/logic/src/commonMain/kotlin/com/wire/kalium/logic/feature/UserSessionScope.kt (UserSessionScope FileDeclaration)
     /__w/kalium/kalium/logic/src/commonMain/kotlin/com/wire/kalium/logic/feature/asset/ScheduleNewAssetMessageUseCase.kt (ScheduleNewAssetMessageUseCase FileDeclaration)
     /__w/kalium/kalium/logic/src/commonMain/kotlin/com/wire/kalium/logic/feature/backup/BackupScope.kt (BackupScope FileDeclaration)
     ...
    
  • useCasesShouldNotAccessNetworkLayerDirectly[jvm] - com.wire.kalium.logic.architecture.LayerAccessRulesTest - Details

    Expand for error
     com.lemonappdev.konsist.core.exception.KoAssertionFailedException: Assert 'useCasesShouldNotAccessNetworkLayerDirectly' was violated (24 times). Invalid files:
     /__w/kalium/kalium/logic/src/androidMain/kotlin/com/wire/kalium/logic/feature/UserSessionScope.kt (UserSessionScope FileDeclaration)
     /__w/kalium/kalium/logic/src/androidMain/kotlin/com/wire/kalium/logic/feature/UserSessionScopeProviderImpl.kt (UserSessionScopeProviderImpl FileDeclaration)
     /__w/kalium/kalium/logic/src/appleMain/kotlin/com/wire/kalium/logic/feature/UserSessionScope.kt (UserSessionScope FileDeclaration)
     /__w/kalium/kalium/logic/src/appleMain/kotlin/com/wire/kalium/logic/feature/UserSessionScopeProviderImpl.kt (UserSessionScopeProviderImpl FileDeclaration)
     /__w/kalium/kalium/logic/src/commonMain/kotlin/com/wire/kalium/logic/feature/SessionManagerExt.kt (SessionManagerExt FileDeclaration)
     /__w/kalium/kalium/logic/src/commonMain/kotlin/com/wire/kalium/logic/feature/UserSessionScope.kt (UserSessionScope FileDeclaration)
     /__w/kalium/kalium/logic/src/commonMain/kotlin/com/wire/kalium/logic/feature/appVersioning/ObserveIfAppUpdateRequiredUseCase.kt (ObserveIfAppUpdateRequiredUseCase FileDeclaration)
     /__w/kalium/kalium/logic/src/commonMain/kotlin/com/wire/kalium/logic/feature/auth/AuthenticationScope.kt (AuthenticationScope FileDeclaration)
     /__w/kalium/kalium/logic/src/commonMain/kotlin/com/wire/kalium/logic/feature/auth/sso/SSOSettingsUseCase.kt (SSOSettingsUseCase FileDeclaration)
     ...
    

@yamilmedina yamilmedina requested review from a team, gongracr, borichellow, vitorhugods, ohassine and saleniuk and removed request for a team October 18, 2023 15:45
@yamilmedina yamilmedina merged commit df987f3 into chore/arch-fitness-functions Oct 24, 2023
6 checks passed
@yamilmedina yamilmedina deleted the chore/fix-usecase-implementation-visibility branch October 24, 2023 09:48
github-merge-queue bot pushed a commit that referenced this pull request Nov 7, 2023
* chore: introduce architecture fitness functions

* chore: introduce architecture fitness functions

* chore: introduce architecture fitness functions

* chore: introduce architecture fitness functions

* chore: architectural fitness functions - use case implementation visibility pt1. (ACOL-123) (#2152)

* chore: fix visibility of use cases, implementations must be internal to create instances

* chore: fix detekt

* fix: broken use case rule

* fix: broken use case rule

* chore: architectural fitness functions - misc dtos inverted layer access pt2. (ACOL-123) (#2187)

* fix: broken inversed layer rule

* fix: broken inversed layer rule

* fix: test adj

* Revert "fix: broken inversed layer rule"

This reverts commit 2153cea.

* fix: test adj

* fix: auth dto in wrong package

* fix: session establisher dto in wrong package

* fix: session establisher dto in wrong package

* fix: message releated dtos in wrong package

* chore: architectural fitness functions - inverted layer access calling pt3. (ACOL-123) (#2188)

* fix: calling releated dtos in wrong package

* fix: calling references with internal usecases

* fix: calling references with internal usecases

* chore: architectural fitness functions - inverted layer access msg and conversations pt4. (ACOL-123) (#2190)

* fix: messages and conversation references with internal usecases

* fix: messages and conversation references with internal usecases

* fix: messages and conversation references with internal usecases

* chore: architectural fitness functions - baseline final pt5. (ACOL-123) (#2196)

* chore: ignore suppresed baseline of rule

* chore: ignore suppresed baseline of rule

* chore: ignore suppresed baseline of rule

* fix: dependency resolutino

* fix: dependency resolution
augustocdias pushed a commit that referenced this pull request Nov 9, 2023
* chore: introduce architecture fitness functions

* chore: introduce architecture fitness functions

* chore: introduce architecture fitness functions

* chore: introduce architecture fitness functions

* chore: architectural fitness functions - use case implementation visibility pt1. (ACOL-123) (#2152)

* chore: fix visibility of use cases, implementations must be internal to create instances

* chore: fix detekt

* fix: broken use case rule

* fix: broken use case rule

* chore: architectural fitness functions - misc dtos inverted layer access pt2. (ACOL-123) (#2187)

* fix: broken inversed layer rule

* fix: broken inversed layer rule

* fix: test adj

* Revert "fix: broken inversed layer rule"

This reverts commit 2153cea.

* fix: test adj

* fix: auth dto in wrong package

* fix: session establisher dto in wrong package

* fix: session establisher dto in wrong package

* fix: message releated dtos in wrong package

* chore: architectural fitness functions - inverted layer access calling pt3. (ACOL-123) (#2188)

* fix: calling releated dtos in wrong package

* fix: calling references with internal usecases

* fix: calling references with internal usecases

* chore: architectural fitness functions - inverted layer access msg and conversations pt4. (ACOL-123) (#2190)

* fix: messages and conversation references with internal usecases

* fix: messages and conversation references with internal usecases

* fix: messages and conversation references with internal usecases

* chore: architectural fitness functions - baseline final pt5. (ACOL-123) (#2196)

* chore: ignore suppresed baseline of rule

* chore: ignore suppresed baseline of rule

* chore: ignore suppresed baseline of rule

* fix: dependency resolutino

* fix: dependency resolution
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.

3 participants