Conversation
|
Claude finished @insipx's task —— View job PR Review - April 15, 2026 20:16 UTCI've reviewed this PR focusing on areas not already covered by the automated review. Here are my findings: ✅ Strengths
|
ApprovabilityVerdict: Needs human review 2 blocking correctness issues found. This PR enables a new migration client feature that changes default backend connection behavior across mobile, Node, and WASM bindings. The changes affect runtime behavior by switching from optional D14n to migration-enabled builds, introducing new environment types, and enabling migration in docker config. An unresolved review comment raises concerns about potential breaking changes when gateway_host is None. You can customize Macroscope's approvability policy. Learn more. |
| // switch v3/d14n based on presence of gateway host to preserve | ||
| // previous behavior and avoid breaking changes | ||
| let client_bundle = client_bundle.build_optional_d14n()?; | ||
| let client_bundle = client_bundle.build()?; |
There was a problem hiding this comment.
🟡 Medium src/mls.rs:166
build() returns an error when gateway_host is None, but the surrounding comment explicitly states the intent is to "switch v3/d14n based on presence of gateway host to preserve previous behavior and avoid breaking changes." Since gateway_host is Option<String>, callers passing None (the previous default behavior) will now receive an error instead of a V3 client. This contradicts the documented intent. Consider reverting to build_optional_d14n() or updating the comment to reflect the new requirement.
// switch v3/d14n based on presence of gateway host to preserve
// previous behavior and avoid breaking changes
- let client_bundle = client_bundle.build()?;
+ let client_bundle = client_bundle.build_optional_d14n()?;🚀 Reply "fix it for me" or copy this AI Prompt for your agent:
In file bindings/mobile/src/mls.rs around lines 166-168:
`build()` returns an error when `gateway_host` is `None`, but the surrounding comment explicitly states the intent is to "switch v3/d14n based on presence of gateway host to preserve previous behavior and avoid breaking changes." Since `gateway_host` is `Option<String>`, callers passing `None` (the previous default behavior) will now receive an error instead of a V3 client. This contradicts the documented intent. Consider reverting to `build_optional_d14n()` or updating the comment to reflect the new requirement.
Evidence trail:
bindings/mobile/src/mls.rs:139-141 (function signature with `gateway_host: Option<String>`), bindings/mobile/src/mls.rs:167-169 (comment and `build()` call), crates/xmtp_api_d14n/src/queries/client_bundle.rs:247-250 (`build()` method calling `inner_build_d14n()`), crates/xmtp_api_d14n/src/queries/client_bundle.rs:170-176 (`inner_build_d14n()` erroring on missing gateway_host), crates/xmtp_api_d14n/src/queries/client_bundle.rs:255-265 (`build_optional_d14n()` method that implements the behavior the comment describes)
5d679cb to
4601db9
Compare
5ea7efe to
c338984
Compare
| kotlin | ||
| ktlint | ||
| jdk17 | ||
| swiftformat | ||
| kotlin-language-server |
There was a problem hiding this comment.
🟠 High shells/local.nix:98
swiftformat is included unconditionally at line 101, but it's a Darwin-only package that downloads a pre-built macOS binary. On Linux systems, nix develop will fail because the shell tries to include a macOS Mach-O executable that cannot run. Consider removing the unconditional swiftformat since it's already correctly added via lib.optionals isDarwin at line 124.
ktlint
jdk17
- swiftformat
kotlin-language-server
# Misc dev🚀 Reply "fix it for me" or copy this AI Prompt for your agent:
In file nix/shells/local.nix around lines 98-102:
`swiftformat` is included unconditionally at line 101, but it's a Darwin-only package that downloads a pre-built macOS binary. On Linux systems, `nix develop` will fail because the shell tries to include a macOS Mach-O executable that cannot run. Consider removing the unconditional `swiftformat` since it's already correctly added via `lib.optionals isDarwin` at line 124.
…x swiftformat The migration client PR (#3354) changed connect_to_backend to require both v3_host and gateway_host. All test code was passing gatewayHost=null, causing MissingGatewayHost errors. Changes: - Add TestGateway constants object to Android TestHelpers.kt - Update all ClientOptions.Api calls in Android test files with gateway host - Update iOS TestHelpers.swift and all iOS test files with gateway host - Remove unconditional swiftformat from nix/shells/local.nix (Darwin-only) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…x swiftformat The migration client PR (#3354) changed connect_to_backend to require both v3_host and gateway_host. All test code was passing gatewayHost=null, causing MissingGatewayHost errors. Changes: - Add TestGateway constants object to Android TestHelpers.kt - Update all ClientOptions.Api calls in Android test files with gateway host - Update iOS TestHelpers.swift and all iOS test files with gateway host - Remove unconditional swiftformat from nix/shells/local.nix (Darwin-only) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…x swiftformat The migration client PR (#3354) changed connect_to_backend to require both v3_host and gateway_host. All test code was passing gatewayHost=null, causing MissingGatewayHost errors. Changes: - Add TestGateway constants object to Android TestHelpers.kt - Update all ClientOptions.Api calls in Android test files with gateway host - Update iOS TestHelpers.swift and all iOS test files with gateway host - Remove unconditional swiftformat from nix/shells/local.nix (Darwin-only) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
| Client.connectToApiBackendExclusive( | ||
| ClientOptions.Api(XMTPEnvironment.DEV, true, gatewayHost = TestGateway.DEV), | ||
| ) | ||
| } |
There was a problem hiding this comment.
🟢 Low library/PerformanceTest.kt:154
The test calls Client.connectToApiBackendExclusive() to pre-warm the API client cache, but Client.create() internally uses connectToApiBackend() (non-exclusive). The updated toCacheKey() function includes the exclusive parameter in the cache key, so these generate different keys (|true vs |false suffix). The pre-warmed client is never reused, making the performance measurement invalid.
- runBlocking {
- Client.connectToApiBackendExclusive(
- ClientOptions.Api(XMTPEnvironment.DEV, true, gatewayHost = TestGateway.DEV),
- )
- }
+ runBlocking {
+ Client.connectToApiBackend(
+ ClientOptions.Api(XMTPEnvironment.DEV, true, gatewayHost = TestGateway.DEV),
+ )
+ }🚀 Reply "fix it for me" or copy this AI Prompt for your agent:
In file sdks/android/library/src/androidTest/java/org/xmtp/android/library/PerformanceTest.kt around lines 154-157:
The test calls `Client.connectToApiBackendExclusive()` to pre-warm the API client cache, but `Client.create()` internally uses `connectToApiBackend()` (non-exclusive). The updated `toCacheKey()` function includes the `exclusive` parameter in the cache key, so these generate different keys (`|true` vs `|false` suffix). The pre-warmed client is never reused, making the performance measurement invalid.
Evidence trail:
sdks/android/library/src/main/java/org/xmtp/android/library/Client.kt lines 152-153: `toCacheKey()` implementation shows `|$exclusive` suffix in key
sdks/android/library/src/main/java/org/xmtp/android/library/Client.kt line 221: `connectToApiBackend()` calls `api.toCacheKey()` (exclusive defaults to false)
sdks/android/library/src/main/java/org/xmtp/android/library/Client.kt line 270: `connectToApiBackendExclusive()` calls `api.toCacheKey(exclusive = true)`
sdks/android/library/src/main/java/org/xmtp/android/library/Client.kt line 585: `createClient` (in Client.create) uses `connectToApiBackend(options.api)`
sdks/android/library/src/androidTest/java/org/xmtp/android/library/PerformanceTest.kt lines 154-167: Test pre-warms with `connectToApiBackendExclusive()` then calls `Client.create()`
…x swiftformat The migration client PR (#3354) changed connect_to_backend to require both v3_host and gateway_host. All test code was passing gatewayHost=null, causing MissingGatewayHost errors. Changes: - Add TestGateway constants object to Android TestHelpers.kt - Update all ClientOptions.Api calls in Android test files with gateway host - Update iOS TestHelpers.swift and all iOS test files with gateway host - Remove unconditional swiftformat from nix/shells/local.nix (Darwin-only) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…x swiftformat The migration client PR (#3354) changed connect_to_backend to require both v3_host and gateway_host. All test code was passing gatewayHost=null, causing MissingGatewayHost errors. Changes: - Add TestGateway constants object to Android TestHelpers.kt - Update all ClientOptions.Api calls in Android test files with gateway host - Update iOS TestHelpers.swift and all iOS test files with gateway host - Remove unconditional swiftformat from nix/shells/local.nix (Darwin-only) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Enable migration client path in mobile and WASM bindings
MigrationLocal,MigrationStaging, andMigrationProductionenvironment variants to the WASM and Node bindings; when selected, the backend builder callsbuild()(migration-capable) instead ofbuild_optional_d14n().connect_to_backendin the mobile bindings into a non-exclusive (build()) path andconnect_to_backend_exclusive(build_optional_d14n()), reversing the previous default behavior.connectToApiBackendExclusiveandconnectToSyncApiBackendExclusiveto the Android and iOS clients, using a separate cache namespace keyed by anexclusiveflag.gatewayHost(local, dev, or production) when constructingClientOptions.Api, and switches relevant tests toconnectToApiBackendExclusive.--api.enable-migrationand a far-future cutover timestamp.connect_to_backendin mobile bindings now usesbuild()(auto-migration) by default; callers that relied on the old non-migrating behavior must switch toconnect_to_backend_exclusive.Macroscope summarized fda9664.