Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
99 commits
Select commit Hold shift + click to select a range
50dbffd
Renamed SessionSnodeKit to SessionNetworkingKit
mpretty-cyro Aug 7, 2025
baafb92
Fixed some missing renames
mpretty-cyro Aug 7, 2025
4ae24f8
Fixed a couple of build issues
mpretty-cyro Aug 7, 2025
08d01a5
Moved all migrations into one target, simplified migration logic
mpretty-cyro Aug 8, 2025
994be24
[WIP] Initial work on integrated refactored libSession networking
mpretty-cyro Aug 8, 2025
cb6b5aa
Fixed a few issues
mpretty-cyro Aug 8, 2025
ad42281
Made a bunch of QoL changes
mpretty-cyro Aug 22, 2025
d14cf60
Removed a redundant extension
mpretty-cyro Aug 22, 2025
43585db
Added an event to notify of any conversation deletion
mpretty-cyro Aug 22, 2025
2adac28
Added code to schedule a missing recurring job (could be lost)
mpretty-cyro Aug 22, 2025
dc24dca
Removed database usage from SnodeAPI
mpretty-cyro Aug 22, 2025
8fc4ed2
Updated actor-based networking wrapper
mpretty-cyro Aug 25, 2025
baee6a3
Updated the SessionNetworkScreen to use async/await and ObservationMa…
mpretty-cyro Aug 26, 2025
ecc472b
Updated path status observations to use async/await
mpretty-cyro Aug 26, 2025
ae9e35b
Added some missing SessionNetworkScreen changes
mpretty-cyro Aug 26, 2025
c386223
Refactored 'SwarmDrainBehaviour' into 'SwarmDrainer'
mpretty-cyro Aug 26, 2025
bb9bfb1
Cleaned up the SnodeAPI, updated getSessionId to async/await
mpretty-cyro Aug 26, 2025
266d142
Refactored the PushNotificationAPI to be async/await
mpretty-cyro Aug 26, 2025
fb9c224
Updated NukeDataModel to do some async/await
mpretty-cyro Aug 26, 2025
99f5b88
Initial dev settings screen updates
mpretty-cyro Aug 26, 2025
04ba13c
Rework AppSetup process to be async/await
mpretty-cyro Aug 26, 2025
d44704b
Refactored the CheckForAppUpdatesJob to use async/await
mpretty-cyro Aug 26, 2025
da6c4d4
Updated usage of the getSessionId function
mpretty-cyro Aug 26, 2025
922218f
Odds and ends
mpretty-cyro Aug 26, 2025
ecf3e82
Refactored Onboarding to be an actor and use async/await
mpretty-cyro Aug 26, 2025
5f0ad10
Merge remote-tracking branch 'upstream/dev' into feature/refactored-n…
mpretty-cyro Aug 27, 2025
da39851
Moved network settings to it's own screen, added devnet support
mpretty-cyro Aug 27, 2025
4b41a29
Fixed an issue where the libSession loggers weren't setup correctly
mpretty-cyro Aug 27, 2025
4bbee07
Fixed a couple of networking bugs
mpretty-cyro Aug 28, 2025
7e7c969
Merge remote-tracking branch 'upstream/dev' into feature/refactored-n…
mpretty-cyro Sep 2, 2025
98bcadb
Fixed an issue where attachment files may not get deleted immediately
mpretty-cyro Sep 2, 2025
7893944
Fixed build issues and bumped version number
mpretty-cyro Sep 2, 2025
e848640
Fixed some issues with archiving `Compile_LibSessionUtil` builds
mpretty-cyro Sep 3, 2025
ca4c763
Fixed a bug where we weren't excluding the prefix when getting a swar…
mpretty-cyro Sep 3, 2025
5bed51e
Fixed an issue where combine streams which sent requests would never …
mpretty-cyro Sep 3, 2025
8d41ab4
Fixed a couple of issues found when testing
mpretty-cyro Sep 4, 2025
a728a95
Fixed an issue where group creation was broken
mpretty-cyro Sep 4, 2025
aae7bfe
Updated mocking setup, working through fixing tests
mpretty-cyro Sep 5, 2025
2d0d88c
Fixed unit test build errors (tests still broken)
mpretty-cyro Sep 8, 2025
b6086c1
Fixed a number of test crashes, updated MockCrypto to be Mockable
mpretty-cyro Sep 8, 2025
6606ffa
Added dev setting to configure router, fixed a couple of other issues
mpretty-cyro Sep 9, 2025
d0f3cf9
Fixed an issue where settings could be set before the local config ex…
mpretty-cyro Sep 9, 2025
5eb99ed
Updated MockNotificationsManager to use new Mockable convention (was …
mpretty-cyro Sep 9, 2025
85184ba
Fixed a bunch of broke unit tests (still some left)
mpretty-cyro Sep 10, 2025
2ad95f4
Updated MockGeneralCache and MockUserDefaults to use new Mockable
mpretty-cyro Sep 10, 2025
04fb9d4
Fixed a few more tests and updated more code to the new mocking system
mpretty-cyro Sep 10, 2025
b596de2
Fixed more failing unit tests, updated more mock types to Mockable
mpretty-cyro Sep 11, 2025
20feb15
Finished fixing up broken tests
mpretty-cyro Sep 14, 2025
fa51244
Fixes for SOGS downloads and network status observations
mpretty-cyro Sep 16, 2025
cec5d80
Merge remote-tracking branch 'upstream/dev' into feature/refactored-n…
mpretty-cyro Sep 17, 2025
6381a34
Removed the legacy get/send message requests
mpretty-cyro Sep 17, 2025
63f17a5
Refactored the OGMCache to be part of the OpenGroupManager
mpretty-cyro Sep 17, 2025
6a89039
Renamed Network.SnodeAPI to Network.StorageServer for consistency
mpretty-cyro Sep 17, 2025
a828c86
Removed StorageServerCache, cleaning up DSL, async/await tweaks
mpretty-cyro Sep 18, 2025
b35e48c
Fixed broken tests
mpretty-cyro Sep 18, 2025
2eeed6b
Enabled "Direct" routing mode, fixed a bug from network offset changes
mpretty-cyro Sep 22, 2025
fe1515c
Merge remote-tracking branch 'upstream/dev' into feature/refactored-n…
mpretty-cyro Sep 23, 2025
3662c69
Fixed issues from merge
mpretty-cyro Sep 23, 2025
2dc3bfc
Fixes for a few issues that cropped up during testing
mpretty-cyro Sep 24, 2025
fee13a0
Merge remote-tracking branch 'upstream/dev' into feature/refactored-n…
mpretty-cyro Sep 24, 2025
0cb8665
Bumped build number
mpretty-cyro Sep 24, 2025
889e5e8
Better iOS 15 support for network changes
mpretty-cyro Sep 25, 2025
502b166
Minor copy and warning tweaks
mpretty-cyro Sep 30, 2025
1c2cf98
Merge remote-tracking branch 'upstream/dev' into feature/refactored-n…
mpretty-cyro Sep 30, 2025
6f8c3d3
Bumped build number
mpretty-cyro Sep 30, 2025
1910708
Renamed Lokinet to SessionRouter
mpretty-cyro Feb 3, 2026
7d0563d
Updated request categories for latest code
mpretty-cyro Feb 3, 2026
af2e90e
Missed a couple of categories, added some dev settings for network co…
mpretty-cyro Feb 4, 2026
490ac8f
Merge remote-tracking branch 'upstream/dev' into feature/refactored-n…
mpretty-cyro Feb 6, 2026
e9c08e3
Fixed build issues, other minor tweaks
mpretty-cyro Feb 9, 2026
f55778d
Cleaned up a bunch of code
mpretty-cyro Feb 9, 2026
9712d6b
Fixed a few issues found while testing, cleaned up some code
mpretty-cyro Feb 10, 2026
70e218c
Refactored failure toasts for group invites/promotions to async/await
mpretty-cyro Feb 10, 2026
211da1e
Added code to remove a false warning from the logs
mpretty-cyro Feb 10, 2026
1a8bf66
Cleaned up a little code
mpretty-cyro Feb 10, 2026
63bd8a0
Updates to support latest libSession network changes
mpretty-cyro Feb 20, 2026
71e02a1
Fixed a couple of memory leaks, a swift warning and logs
mpretty-cyro Feb 20, 2026
7f0b3ee
Fix bug where home screen settings button wouldn't update correctly
mpretty-cyro Feb 22, 2026
ed80f41
Simplified Network.PreparedRequest and cleaned up message sender logic
mpretty-cyro Feb 23, 2026
a87bc3f
Fixed unit tests and issues uncovered during testing
mpretty-cyro Feb 25, 2026
1a3c6db
Updated to latest libSession, fixed crashes and unit tests
mpretty-cyro Feb 26, 2026
2d5d719
Removed CChar45 (no longer needed)
mpretty-cyro Feb 26, 2026
87bc82b
Merge remote-tracking branch 'upstream/dev' into feature/refactored-n…
mpretty-cyro Feb 26, 2026
1e1b6d6
Merge remote-tracking branch 'upstream/dev' into feature/refactored-n…
mpretty-cyro Feb 27, 2026
7f4cc1a
Fixed build error
mpretty-cyro Feb 27, 2026
ea4ee5e
Added static node list as a fallback option when failing to bootstrap
mpretty-cyro Feb 27, 2026
39a1610
Fixed a bug where the users display name and picture could be removed
mpretty-cyro Feb 27, 2026
0c0c32c
Fixed a crash when swapping between network routers
mpretty-cyro Feb 27, 2026
c78a56b
Added handing for a couple of libSession network errors
mpretty-cyro Mar 2, 2026
036d56f
Fixed a couple of bugs found when testing
mpretty-cyro Mar 2, 2026
4f4a188
Fixed some linker issues
mpretty-cyro Mar 5, 2026
c5c4b41
Fix CI build errors
mpretty-cyro Mar 5, 2026
61cd3a3
More CI fixes
mpretty-cyro Mar 5, 2026
03a994e
[raw] Added support for 'raw' arg in commit message to disable log be…
mpretty-cyro Mar 5, 2026
2e05bc5
[raw] Tweaks to previous change
mpretty-cyro Mar 5, 2026
ad77ca3
[raw] Just removed the drone side of the change
mpretty-cyro Mar 5, 2026
a8fb32f
[raw] debugging new command
mpretty-cyro Mar 5, 2026
f5f4387
[raw] Tweaks for new command detection
mpretty-cyro Mar 5, 2026
3d85d26
[raw] Tweaks to resilience tests to fix CI compiler crash
mpretty-cyro Mar 5, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fixed a few more tests and updated more code to the new mocking system
• Added a mechanism to ignore the type comparison when comparing against `any` values (for things like `MockEndpoint.any`)
• Fixed an issue where `any` values weren't being compared recursively (so it would fail to match if an argument of an argument was a wildcard)
• Updated MockNetwork to use Mockable
• Updated MockExtensionHelper to be Mockable
  • Loading branch information
mpretty-cyro committed Sep 10, 2025
commit 04fb9d471e9c2e3e7360f5370742c4379eebc6c3
266 changes: 142 additions & 124 deletions SessionMessagingKitTests/Database/Models/MessageDeduplicationSpec.swift

Large diffs are not rendered by default.

51 changes: 26 additions & 25 deletions SessionMessagingKitTests/Jobs/DisplayPictureDownloadJobSpec.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,22 +40,7 @@ class DisplayPictureDownloadJobSpec: AsyncSpec {
"673120e153a5cb6b869380744d493068ebc418266d6596d728cfc60b30662a089376" +
"f2761e3bb6ee837a26b24b5"
)
@TestState(singleton: .network, in: dependencies) var mockNetwork: MockNetwork! = MockNetwork(
initialSetup: { network in
network
.when {
$0.send(
endpoint: MockEndpoint.any,
destination: .any,
body: .any,
category: .any,
requestTimeout: .any,
overallTimeout: .any
)
}
.thenReturn(MockNetwork.response(data: encryptedData))
}
)
@TestState var mockNetwork: MockNetwork! = .create()
@TestState(singleton: .fileManager, in: dependencies) var mockFileManager: MockFileManager! = MockFileManager(
initialSetup: { $0.defaultInitialSetup() }
)
Expand Down Expand Up @@ -104,6 +89,20 @@ class DisplayPictureDownloadJobSpec: AsyncSpec {
try await mockCrypto
.when { $0.generate(.signatureBlind15(message: .any, serverPublicKey: .any, ed25519SecretKey: .any)) }
.thenReturn("TestSogsSignature".bytes)

try await mockNetwork
.when {
$0.send(
endpoint: MockEndpoint.any,
destination: .any,
body: .any,
category: .any,
requestTimeout: .any,
overallTimeout: .any
)
}
.thenReturn(MockNetwork.response(data: encryptedData))
dependencies.set(singleton: .network, to: mockNetwork)
}

// MARK: - a DisplayPictureDownloadJob
Expand Down Expand Up @@ -510,17 +509,18 @@ class DisplayPictureDownloadJobSpec: AsyncSpec {
using: dependencies
)

expect(mockNetwork)
.to(call(.exactly(times: 1), matchingParameters: .all) { network in
network.send(
await mockNetwork
.verify {
$0.send(
endpoint: expectedRequest.endpoint,
destination: expectedRequest.destination,
body: expectedRequest.body,
category: .download,
requestTimeout: expectedRequest.requestTimeout,
overallTimeout: expectedRequest.overallTimeout
)
})
}
.wasCalled(exactly: 1)
}

// MARK: -- generates a SOGS download request correctly
Expand Down Expand Up @@ -575,17 +575,18 @@ class DisplayPictureDownloadJobSpec: AsyncSpec {
using: dependencies
)

expect(mockNetwork)
.to(call(.exactly(times: 1), matchingParameters: .all) { network in
network.send(
await mockNetwork
.verify {
$0.send(
endpoint: expectedRequest.endpoint,
destination: expectedRequest.destination,
body: expectedRequest.body,
category: .download,
requestTimeout: expectedRequest.requestTimeout,
overallTimeout: expectedRequest.overallTimeout
)
})
}
.wasCalled(exactly: 1)
}

// MARK: -- checking if a downloaded display picture is valid
Expand Down Expand Up @@ -1092,7 +1093,7 @@ class DisplayPictureDownloadJobSpec: AsyncSpec {
)

// SOGS doesn't encrypt it's images so replace the encrypted mock response
mockNetwork
try await mockNetwork
.when {
$0.send(
endpoint: MockEndpoint.any,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import Foundation
import GRDB
import TestUtilities

import Quick
import Nimble
Expand All @@ -23,47 +24,7 @@ class RetrieveDefaultOpenGroupRoomsJobSpec: AsyncSpec {
using: dependencies
)
@TestState var mockUserDefaults: MockUserDefaults! = .create()
@TestState(singleton: .network, in: dependencies) var mockNetwork: MockNetwork! = MockNetwork(
initialSetup: { network in
network.when { $0.networkStatus }.thenReturn(.singleValue(value: .connected))
network
.when {
$0.send(
endpoint: MockEndpoint.any,
destination: .any,
body: .any,
category: .any,
requestTimeout: .any,
overallTimeout: .any
)
}
.thenReturn(
MockNetwork.batchResponseData(
with: [
(
OpenGroupAPI.Endpoint.capabilities,
OpenGroupAPI.Capabilities(capabilities: [.blind, .reactions]).batchSubResponse()
),
(
OpenGroupAPI.Endpoint.rooms,
[
OpenGroupAPI.Room.mock.with(
token: "testRoom",
name: "TestRoomName"
),
OpenGroupAPI.Room.mock.with(
token: "testRoom2",
name: "TestRoomName2",
infoUpdates: 12,
imageId: "12"
)
].batchSubResponse()
)
]
)
)
}
)
@TestState var mockNetwork: MockNetwork! = .create()
@TestState(singleton: .jobRunner, in: dependencies) var mockJobRunner: MockJobRunner! = MockJobRunner(
initialSetup: { jobRunner in
jobRunner
Expand Down Expand Up @@ -103,6 +64,45 @@ class RetrieveDefaultOpenGroupRoomsJobSpec: AsyncSpec {
try await mockUserDefaults.defaultInitialSetup()
try await mockUserDefaults.when { $0.bool(forKey: .any) }.thenReturn(true)
dependencies.set(defaults: .appGroup, to: mockUserDefaults)

try await mockNetwork.when { $0.networkStatus }.thenReturn(.singleValue(value: .connected))
try await mockNetwork
.when {
$0.send(
endpoint: MockEndpoint.any,
destination: .any,
body: .any,
category: .any,
requestTimeout: .any,
overallTimeout: .any
)
}
.thenReturn(
MockNetwork.batchResponseData(
with: [
(
OpenGroupAPI.Endpoint.capabilities,
OpenGroupAPI.Capabilities(capabilities: [.blind, .reactions]).batchSubResponse()
),
(
OpenGroupAPI.Endpoint.rooms,
[
OpenGroupAPI.Room.mock.with(
token: "testRoom",
name: "TestRoomName"
),
OpenGroupAPI.Room.mock.with(
token: "testRoom2",
name: "TestRoomName2",
infoUpdates: 12,
imageId: "12"
)
].batchSubResponse()
)
]
)
)
dependencies.set(singleton: .network, to: mockNetwork)
}

// MARK: - a RetrieveDefaultOpenGroupRoomsJob
Expand Down Expand Up @@ -188,7 +188,7 @@ class RetrieveDefaultOpenGroupRoomsJobSpec: AsyncSpec {

// MARK: -- creates an inactive entry in the database if one does not exist
it("creates an inactive entry in the database if one does not exist") {
mockNetwork
try await mockNetwork
.when {
$0.send(
endpoint: MockEndpoint.any,
Expand Down Expand Up @@ -221,7 +221,7 @@ class RetrieveDefaultOpenGroupRoomsJobSpec: AsyncSpec {

// MARK: -- does not create a new entry if one already exists
it("does not create a new entry if one already exists") {
mockNetwork
try await mockNetwork
.when {
$0.send(
endpoint: MockEndpoint.any,
Expand Down Expand Up @@ -302,22 +302,23 @@ class RetrieveDefaultOpenGroupRoomsJobSpec: AsyncSpec {
using: dependencies
)

expect(mockNetwork)
.to(call { network in
network.send(
await mockNetwork
.verify {
$0.send(
endpoint: OpenGroupAPI.Endpoint.sequence,
destination: expectedRequest.destination,
body: expectedRequest.body,
category: .standard,
requestTimeout: expectedRequest.requestTimeout,
overallTimeout: expectedRequest.overallTimeout
)
})
}
.wasCalled(exactly: 1)
}

// MARK: -- permanently fails if it gets an error
it("permanently fails if it gets an error") {
mockNetwork
try await mockNetwork
.when {
$0.send(
endpoint: MockEndpoint.any,
Expand All @@ -344,16 +345,18 @@ class RetrieveDefaultOpenGroupRoomsJobSpec: AsyncSpec {

expect(error).to(matchError(NetworkError.parsingFailed))
expect(permanentFailure).to(beTrue())
expect(mockNetwork).to(call(.exactly(times: 1)) { network in
network.send(
endpoint: MockEndpoint.any,
destination: .any,
body: .any,
category: .any,
requestTimeout: .any,
overallTimeout: .any
)
})
await mockNetwork
.verify {
$0.send(
endpoint: MockEndpoint.any,
destination: .any,
body: .any,
category: .any,
requestTimeout: .any,
overallTimeout: .any
)
}
.wasCalled(exactly: 1)
}

// MARK: -- stores the updated capabilities
Expand Down Expand Up @@ -415,7 +418,7 @@ class RetrieveDefaultOpenGroupRoomsJobSpec: AsyncSpec {
)
.insert(db)
}
mockNetwork
try await mockNetwork
.when {
$0.send(
endpoint: MockEndpoint.any,
Expand Down Expand Up @@ -552,7 +555,7 @@ class RetrieveDefaultOpenGroupRoomsJobSpec: AsyncSpec {

// MARK: -- does not schedule a display picture download if there is no imageId
it("does not schedule a display picture download if there is no imageId") {
mockNetwork
try await mockNetwork
.when {
$0.send(
endpoint: MockEndpoint.any,
Expand Down
Loading