Skip to content

feat(nomad devices): batched fetch messages per convo - pagination logic for request of older msgs - pt2 (WPB-24278)#3991

Merged
MohamadJaara merged 13 commits intodevelopfrom
feat/nomad/pagination-convos
Mar 26, 2026
Merged

feat(nomad devices): batched fetch messages per convo - pagination logic for request of older msgs - pt2 (WPB-24278)#3991
MohamadJaara merged 13 commits intodevelopfrom
feat/nomad/pagination-convos

Conversation

@yamilmedina
Copy link
Copy Markdown
Contributor

@yamilmedina yamilmedina commented Mar 25, 2026

https://wearezeta.atlassian.net/browse/WPB-24278


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?

This is phase 2, of batched nomad devices messages sync restore, per conversation restore.

follow up on #3990

This adds:

  • Nomad Pagination coordinator, that handles in memory state for each conversation as requested on demand.
  • Fetches older messages, only if nomad available.
  • Expose use case that can be called in case the end of the list is reached

Needs release with

Testing

Test Coverage (Optional)

  • I have added automated test to this contribution

Notes (Optional)

Attachments (Optional)

aaScreen.Recording.2026-03-25.at.13.46.56.mp4

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
Copy Markdown
Contributor

github-actions bot commented Mar 25, 2026

Test Results

3 897 tests   - 801   3 887 ✅  - 694   7m 32s ⏱️ + 4m 31s
    6 suites  - 771      10 💤  - 107 
    6 files    - 771       0 ❌ ±  0 

Results for commit 0535459. ± Comparison against base commit ee44560.

This pull request removes 4698 and adds 3897 tests. Note that renamed tests count towards both.
com.wire.backup.BackupEndToEndTest ‑ givenBackedUpAssetMessage_whenRestoring_thenShouldReadTheSameContent[js, browser]
com.wire.backup.BackupEndToEndTest ‑ givenBackedUpAssetMessage_whenRestoring_thenShouldReadTheSameContent[jvm]
com.wire.backup.BackupEndToEndTest ‑ givenBackedUpLocationMessage_whenRestoring_thenShouldReadTheSameContent[js, browser]
com.wire.backup.BackupEndToEndTest ‑ givenBackedUpLocationMessage_whenRestoring_thenShouldReadTheSameContent[jvm]
com.wire.backup.BackupEndToEndTest ‑ givenBackedUpReactions_whenRestoring_thenShouldReadTheSameContent[js, browser]
com.wire.backup.BackupEndToEndTest ‑ givenBackedUpReactions_whenRestoring_thenShouldReadTheSameContent[jvm]
com.wire.backup.BackupEndToEndTest ‑ givenBackedUpTextMessages_whenRestoring_thenShouldReadTheSameContent[js, browser]
com.wire.backup.BackupEndToEndTest ‑ givenBackedUpTextMessages_whenRestoring_thenShouldReadTheSameContent[jvm]
com.wire.backup.BackupEndToEndTest ‑ givenBackupWithPassword_whenPeeking_thenShouldBeEncrypted[js, browser]
com.wire.backup.BackupEndToEndTest ‑ givenBackupWithPassword_whenPeeking_thenShouldBeEncrypted[jvm]
…
com.wire.kalium.cells.data.CellConversationRepositoryTest ‑ given_ConversationsWithNullAndEmptyNames_whenInvoked_thenFilterThemOut
com.wire.kalium.cells.data.CellConversationRepositoryTest ‑ given_EmptyConversations_whenInvoked_thenReturnEmptyList
com.wire.kalium.cells.data.CellConversationRepositoryTest ‑ given_GroupConversationsWithWireCell_whenInvoked_thenReturnConversationDetails
com.wire.kalium.cells.data.CellConversationRepositoryTest ‑ given_PrivateChannelWithWireCell_whenInvoked_thenReturnConversationDetail
com.wire.kalium.cells.domain.CellsApiTest ‑ givenNodeAPI_whenMoveNodeIsCalled_thenInvokeAPIOnce
com.wire.kalium.cells.domain.CellsApiTest ‑ given_existing_file_pre_check_then_existing_file_is_returned
com.wire.kalium.cells.domain.CellsApiTest ‑ given_new_file_pre_check_then_success_is_returned
com.wire.kalium.cells.domain.CellsApiTest ‑ given_pre_check_failure_then_failure_is_returned
com.wire.kalium.cells.domain.NodeUploadManagerTest ‑ given_FailedUpload_when_RetryInvoked_and_FileExists_then_UploadStarts
com.wire.kalium.cells.domain.NodeUploadManagerTest ‑ given_FailedUpload_when_RetryInvoked_and_FileMissing_then_UploadFails
…
This pull request removes 117 skipped tests and adds 10 skipped tests. Note that renamed tests count towards both.
com.wire.kalium.api.common.ACMEApiTest ‑ whenCallingGeTrustAnchorsApi_theResponseShouldBeConfigureCorrectly[jvm]
com.wire.kalium.api.common.ACMEApiTest ‑ whenCallingSendChallengeRequestApi_theResponseShouldBeConfigureCorrectly[jvm]
com.wire.kalium.api.v0.user.register.RegisterApiV0Test ‑ givenAValidEmail_whenActivationEmailWIthCode_theRequestShouldBeConfiguredCorrectly[jvm]
com.wire.kalium.api.v0.user.register.RegisterApiV0Test ‑ givenAValidEmail_whenRegisteringAccountWithEMail_theRequestShouldBeConfiguredCorrectly[jvm]
com.wire.kalium.api.v0.user.register.RegisterApiV0Test ‑ givenAValidEmail_whenSendingActivationEmail_theRequestShouldBeConfiguredCorrectly[jvm]
com.wire.kalium.api.v0.user.register.RegisterApiV0Test ‑ givenActivationCodeFail_thenErrorIsPropagated[jvm]
com.wire.kalium.api.v0.user.register.RegisterApiV0Test ‑ givenRegistrationFail_whenRegisteringAccountWithEMMail_thenErrorIsPropagated[jvm]
com.wire.kalium.api.v0.user.register.RegisterApiV0Test ‑ givenSendActivationCodeFail_thenErrorIsPropagated[jvm]
com.wire.kalium.cryptography.CryptoUtilsTest ‑ givenDummyText_whenEncryptedAndDecryptedWithAES256_returnsOriginalText[js, browser]
com.wire.kalium.cryptography.CryptoUtilsTest ‑ givenSomeDummyFile_whenEncryptedAndDecryptedWithAES256_returnsExpectedOriginalFile[js, browser]
…
com.wire.kalium.logic.data.conversation.ConversationRepositoryTest ‑ givenAGroupConversationHasNotNewMessages_whenGettingConversationDetails_ThenReturnZeroUnreadMessageCount
com.wire.kalium.logic.feature.backup.RestoreBackupUseCaseTest ‑ givenACorrectlyEncryptedBackup_whenRestoringWithWrongPassword_thenTheRightErrorIsThrown
com.wire.kalium.logic.feature.backup.RestoreBackupUseCaseTest ‑ givenAnEncryptedBackupFileFromDifferentUserID_whenRestoring_thenTheRightErrorIsThrown
com.wire.kalium.logic.feature.conversation.ObserveConversationInteractionAvailabilityUseCaseTest ‑ givenProteusConversationAndUserSupportsOnlyMLS_whenObserving_thenShouldReturnUnsupportedProtocol
com.wire.kalium.logic.feature.conversation.ObserveConversationListDetailsUseCaseTest ‑ null
com.wire.kalium.logic.feature.session.DeleteSessionUseCaseTest ‑ givenSuccess_WhenDeletingSessionLocally_thenSuccessAndResourcesAreFreed
com.wire.kalium.logic.sync.incremental.EventProcessingHistoryTest ‑ measureContainsTimeOverLargeAmountOfEvents
com.wire.kalium.persistence.dao.message.MessageDAOBenchmarkTest ‑ null
com.wire.kalium.persistence.dao.message.MessageSystemContentTest ‑ givenMultipleSystemMessages_whenMarkingAsDeleted_thenSystemContentIsCleared
com.wire.kalium.persistence.kmmSettings.EncryptedSettingsBuilderTest ‑ givenShouldEncryptDataIsTrue_whenEncryptingData_thenShouldEncryptWithoutFailing

♻️ This comment has been updated with latest results.

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Mar 25, 2026

Codecov Report

❌ Patch coverage is 8.47458% with 108 lines in your changes missing coverage. Please review.
✅ Project coverage is 59.47%. Comparing base (e8b86b2) to head (87199f8).
⚠️ Report is 2 commits behind head on develop.

Files with missing lines Patch % Lines
...ta/message/paging/NomadMessagePagingCoordinator.kt 0.00% 95 Missing ⚠️
.../logic/data/message/MessageRepositoryExtensions.kt 18.18% 9 Missing ⚠️
...e/kalium/persistence/dao/message/MessageDAOImpl.kt 20.00% 4 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #3991      +/-   ##
===========================================
- Coverage    59.58%   59.47%   -0.12%     
===========================================
  Files         2023     2025       +2     
  Lines        65070    65216     +146     
  Branches      7095     7116      +21     
===========================================
+ Hits         38771    38784      +13     
- Misses       23122    23250     +128     
- Partials      3177     3182       +5     
Files with missing lines Coverage Δ
.../wire/kalium/persistence/dao/message/MessageDAO.kt 73.33% <ø> (ø)
.../wire/kalium/nomaddevice/NomadAllMessagesMapper.kt 77.53% <100.00%> (ø)
...ire/kalium/logic/data/message/MessageRepository.kt 47.78% <100.00%> (+0.72%) ⬆️
...e/kalium/persistence/dao/message/MessageDAOImpl.kt 67.80% <20.00%> (-0.79%) ⬇️
.../logic/data/message/MessageRepositoryExtensions.kt 23.80% <18.18%> (-5.23%) ⬇️
...ta/message/paging/NomadMessagePagingCoordinator.kt 0.00% <0.00%> (ø)

... and 6 files with indirect coverage changes


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 425ff19...87199f8. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Base automatically changed from feat/nomad/paging/pt1 to develop March 25, 2026 14:56
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 25, 2026

🐰 Bencher Report

Branchfeat/nomad/pagination-convos
Testbedubuntu-latest

⚠️ WARNING: No Threshold found!

Without a Threshold, no Alerts will ever be generated.

Click here to create a new Threshold
For more information, see the Threshold documentation.
To only post results if a Threshold exists, set the --ci-only-thresholds flag.

Click to view all benchmark results
BenchmarkLatencymicroseconds (µs)
com.wire.kalium.benchmarks.logic.CoreLogicBenchmark.createObjectInFiles📈 view plot
⚠️ NO THRESHOLD
902.52 µs
com.wire.kalium.benchmarks.logic.CoreLogicBenchmark.createObjectInMemory📈 view plot
⚠️ NO THRESHOLD
359,185.28 µs
com.wire.kalium.benchmarks.persistence.MessageReadBenchmark.inboxPagingDeepPageBenchmark📈 view plot
⚠️ NO THRESHOLD
131,711.09 µs
com.wire.kalium.benchmarks.persistence.MessageReadBenchmark.inboxPagingFirstPageBenchmark📈 view plot
⚠️ NO THRESHOLD
127,437.56 µs
com.wire.kalium.benchmarks.persistence.MessageReadBenchmark.localMarkAsReadBenchmark📈 view plot
⚠️ NO THRESHOLD
3,404.88 µs
com.wire.kalium.benchmarks.persistence.MessageReadBenchmark.messagePagingDeepPageBenchmark📈 view plot
⚠️ NO THRESHOLD
26,871.96 µs
com.wire.kalium.benchmarks.persistence.MessageReadBenchmark.messagePagingFirstPageBenchmark📈 view plot
⚠️ NO THRESHOLD
11,323.09 µs
com.wire.kalium.benchmarks.persistence.MessagesNoPragmaTuneBenchmark.messageInsertionBenchmark📈 view plot
⚠️ NO THRESHOLD
1,358,343.79 µs
com.wire.kalium.benchmarks.persistence.MessagesNoPragmaTuneBenchmark.queryMessagesBenchmark📈 view plot
⚠️ NO THRESHOLD
21,770.41 µs
🐰 View full continuous benchmarking report in Bencher

yamilmedina and others added 2 commits March 26, 2026 11:17
…stance

Refactor nomadMessagePagingCoordinator to use a getter instead of lazy initialization.
@MohamadJaara MohamadJaara merged commit 0e36a0a into develop Mar 26, 2026
11 checks passed
@MohamadJaara MohamadJaara deleted the feat/nomad/pagination-convos branch March 26, 2026 11:49
@sonarqubecloud
Copy link
Copy Markdown

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