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(offline-backends): users and conversations without metadata refetch pt1. (AR-3123) #1736

Conversation

yamilmedina
Copy link
Contributor

@yamilmedina yamilmedina commented May 15, 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 need to refetch users and conversations without metadata.

Causes (Optional)

In case we don't have data due to a remote backend being offline, the clients will be able to refetch this data on demand.

Solutions

This PR adds:

  • Persist of failed conversations with defailt values, so we can refetch them later
  • Logic and use case to refetch users without metadata on demand.

Testing

Test Coverage (Optional)

  • I have added automated test to this contribution

Notes (Optional)

Will raise a new PR to add a new mechanism for refetch every 3 hours if the app comes to foreground.


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 May 15, 2023

Unit Test Results

   358 files  ±0     358 suites  ±0   1m 10s ⏱️ -31s
1 892 tests +2  1 810 ✔️ +2  82 💤 ±0  0 ±0 

Results for commit cc2e829. ± Comparison against base commit 2c3998d.

♻️ This comment has been updated with latest results.

@codecov-commenter
Copy link

codecov-commenter commented May 15, 2023

Codecov Report

Merging #1736 (cc2e829) into feat/epic-federation-offline-messages (2c3998d) will increase coverage by 0.23%.
The diff coverage is 68.57%.

@@                             Coverage Diff                             @@
##             feat/epic-federation-offline-messages    #1736      +/-   ##
===========================================================================
+ Coverage                                    53.44%   53.68%   +0.23%     
+ Complexity                                    1494     1492       -2     
===========================================================================
  Files                                          931      924       -7     
  Lines                                        34501    34509       +8     
  Branches                                      3039     3032       -7     
===========================================================================
+ Hits                                         18439    18526      +87     
+ Misses                                       14840    14759      -81     
- Partials                                      1222     1224       +2     

@yamilmedina yamilmedina removed the WIP work in progress label May 16, 2023
@yamilmedina yamilmedina changed the title feat(offline-backends): users and conversations without metadata refetch (AR-3123) feat(offline-backends): users and conversations without metadata refetch pt1. (AR-3123) May 16, 2023
Copy link
Contributor

@alexandreferris alexandreferris left a comment

Choose a reason for hiding this comment

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

Great work! I just have one tiny comment about function naming :)

@@ -347,6 +349,24 @@ internal class ConversationMapperImpl(
)
}

override fun fromFailedConversationToEntity(conversationId: NetworkQualifiedId): ConversationEntity = ConversationEntity(
Copy link
Contributor

Choose a reason for hiding this comment

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

as we are hardcoding the conversation type to group maybe we can rename the function name to fromFailedGroupConversationToEntity just so its a bit more clear whats the goal?

Copy link
Member

Choose a reason for hiding this comment

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

Sorry, missed this PR and only commented on part 2.

I think we should consider adding field like hasIncompleteMetadata = true in this case. This way we don't need to rely on a heuristic like name being null to figure out that conversation needs to be re-fetched.

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 for the suggestions, done !

@@ -347,6 +349,24 @@ internal class ConversationMapperImpl(
)
}

override fun fromFailedConversationToEntity(conversationId: NetworkQualifiedId): ConversationEntity = ConversationEntity(
Copy link
Member

Choose a reason for hiding this comment

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

Sorry, missed this PR and only commented on part 2.

I think we should consider adding field like hasIncompleteMetadata = true in this case. This way we don't need to rely on a heuristic like name being null to figure out that conversation needs to be re-fetched.

Copy link
Member

@typfel typfel left a comment

Choose a reason for hiding this comment

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

👍

@Garzas Garzas requested a review from alexandreferris May 18, 2023 09:12
@yamilmedina yamilmedina merged commit 53114bd into feat/epic-federation-offline-messages May 19, 2023
@yamilmedina yamilmedina deleted the feat/federation-usersmetadata-refetch branch May 19, 2023 09:43
github-merge-queue bot pushed a commit that referenced this pull request Jun 23, 2023
* Revert "feat: feature federation msg failed to send handling (AR-3015) (#1547)"

This reverts commit 6011673.

* chore(migration): out of conflict

* chore: more code documentation

* chore: recover small improv for uneeded call

* chore: detekt

* fix: sq migration updated after a really long time =/

* feat: offline backends - handling list-prekeys failed to list (AR-3171) (#1662)

* feat: remove unused code, add mapping of proto contentc

* feat: expand message target to include users to ignore

* feat: resetting intentions on message targets

* feat: resetting intentions on message targets

* feat: test adjustment for target change

* feat: adjusting signatures and simplify message sender mapping

* feat: adjusting signatures and simplify message sender mapping

* feat: adjusting signatures and simplify message sender mapping

* feat: adjusting signatures and simplify message sender mapping

* feat: clean code, and fallback for clients targets

* feat: ignoring failed recipients mapping for non regular messages

* feat: ignoring failed recipients mapping for non regular messages

* feat: ignoring failed recipients mapping for non regular messages

* feat: adding test coverage

* feat: adding test coverage

* feat: adding test coverage

* chore: tmp for merge

* feat: wip, merge sqw

* feat: offline backends - users metadata (AR-3124) (#1698)

* feat: adjust query to hide 1:1 convos without metadata

* feat: adjustment query to consider deleted users logic as it is now

* feat: tests for query conversations details

* feat: pr comments single quotes

* feat(offline-backends): users and conversations without metadata refetch pt1. (AR-3123) (#1736)

* feat: adjust query to hide 1:1 convos without metadata

* feat: adjustment query to consider deleted users logic as it is now

* feat: tests for query conversations details

* feat: persistence for getting users out of sync

* feat: persistence for getting users out of sync

* feat: pr comments single quotes

* feat: invok operator

* feat: persist failed convos

* feat: cleanup

* feat: tests cov

* feat: tests cov

* feat: tests cov

* feat: tests cov

* feat: refactor, persist users withoutmetadata with dedicated field

* feat: refactor, relay on missing metadata field for refetch usres

* feat: refactor, relay on missing metadata field for refetch conversations

* feat: refactor, relay on missing metadata field for refetch conversations

* feat: refactor, relay on missing metadata field for refetch conversations

* feat: refactor, fixing tests

* chore: add migration tests

* feat(offline-backends): users and conversations without metadata refetch pt2. (AR-3123) (#1740)

* feat: adjust query to hide 1:1 convos without metadata

* feat: adjustment query to consider deleted users logic as it is now

* feat: tests for query conversations details

* feat: persistence for getting users out of sync

* feat: persistence for getting users out of sync

* feat: pr comments single quotes

* feat: invok operator

* feat: persist failed convos

* feat: skeleton classes to build upon

* feat: skeleton classes to build upon

* feat: skeleton classes to build upon

* feat: queries and metadata for syncing metadata

* feat: provider di

* feat: cleanup

* feat: cleanup, clock instant

* feat: tests cov

* feat: tests cov

* feat: tests cov

* feat: tests cov

* feat: refactor, persist users withoutmetadata with dedicated field

* feat: refactor, relay on missing metadata field for refetch usres

* feat: refactor, relay on missing metadata field for refetch conversations

* feat: refactor, relay on missing metadata field for refetch conversations

* feat: refactor, relay on missing metadata field for refetch conversations

* feat: refactor, fixing tests

* chore: add migration tests

* chore: ddetekt

* chore: new query

* chore: test for use case

* chore: test cov

* chore: test cov

* chore: change strategy to run sync after inc

* chore: logging

* chore: logging

* chore: logging ref

* fix: db ops

* fix: db ops, user persistence fixed

* chore: test cov

* feat: test coverage

* chore: wip for merge

* fix: handle edge case error when no sessions

* fix: tests

* feat: wip merge

* feat: wip merge

* feat: conversation creation with offline backends (WPB-364) (#1774)

* feat: add new response handling create convo v4

* feat: add new response handling create convo v4 test

* feat: add new response handling create convo v4 test

* feat: add tests cases and persitence of msg for failed to add

* feat: add tests cases and persitence of msg for failed to add

---------

Co-authored-by: Mohamad Jaara <[email protected]>

* chore: preparing for rebase

* chore: preparing merge

* chore: preparing merge, better naming for func

* chore: preparing merge, coverage

* chore: preparing merge, coverage

---------

Co-authored-by: Mohamad Jaara <[email protected]>
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.

4 participants