feat(xmtp_api_d14n): XmtpMlsBidiStreams trait + v3 Subscribe transport#3771
feat(xmtp_api_d14n): XmtpMlsBidiStreams trait + v3 Subscribe transport#3771tylerhawkes wants to merge 1 commit into
Conversation
|
Claude finished @tylerhawkes's task —— View job Code Review CompleteReview Date: 2026-06-16 21:06 UTC SummaryThe implementation is straightforward and follows established patterns. However, there are two critical issues that need to be addressed for consistency with the rest of the codebase: 🔴 Critical Issues1. Missing blanket implementations for Location: The new Impact: Any code that wraps the client in Fix needed in #[xmtp_common::async_trait]
impl<T> XmtpMlsBidiStreams for Box<T>
where
T: XmtpMlsBidiStreams + Sync + ?Sized,
{
type Error = <T as XmtpMlsBidiStreams>::Error;
type SubscribeStream = <T as XmtpMlsBidiStreams>::SubscribeStream;
async fn subscribe_bidi(
&self,
requests: futures::stream::BoxStream<'static, crate::mls_v1::SubscribeRequest>,
) -> Result<Self::SubscribeStream, Self::Error> {
(**self).subscribe_bidi(requests).await
}
}
#[xmtp_common::async_trait]
impl<T> XmtpMlsBidiStreams for Arc<T>
where
T: XmtpMlsBidiStreams + ?Sized,
{
type Error = <T as XmtpMlsBidiStreams>::Error;
type SubscribeStream = <T as XmtpMlsBidiStreams>::SubscribeStream;
async fn subscribe_bidi(
&self,
requests: futures::stream::BoxStream<'static, crate::mls_v1::SubscribeRequest>,
) -> Result<Self::SubscribeStream, Self::Error> {
(**self).subscribe_bidi(requests).await
}
}Note: These impls also need 2. Test Coverage Missing Location: Codecov reports 0% coverage on the new Recommendation: Add at least a basic integration test that:
Minor Observations
Non-Issues
|
| &self, | ||
| requests: futures::stream::BoxStream<'static, SubscribeRequest>, | ||
| ) -> Result<Self::SubscribeStream, Self::Error> { | ||
| tracing::debug!("opening bidirectional subscription"); |
There was a problem hiding this comment.
could annotate with #[xmtp_common::rpc_span] when this makes it to xmtp_api to capture the perf span
libxmtp/crates/xmtp_api/src/mls.rs
Line 97 in f6823a0
5329964 to
ba3c4de
Compare
22b2c8b to
a9ffc28
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## tyler/xip83-2-bidi-transport #3771 +/- ##
===============================================================
Coverage ? 84.41%
===============================================================
Files ? 409
Lines ? 59908
Branches ? 0
===============================================================
Hits ? 50573
Misses ? 9335
Partials ? 0 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
ba3c4de to
cf43cdd
Compare
249cf99 to
13bce00
Compare
cf43cdd to
7ef18f0
Compare
| requests: futures::stream::BoxStream<'static, crate::mls_v1::SubscribeRequest>, | ||
| ) -> Result<Self::SubscribeStream, Self::Error>; | ||
| } | ||
| } |
There was a problem hiding this comment.
🟡 Medium src/api_client.rs:192
Adding XmtpMlsBidiStreams without blanket impls for Box<T> and Arc<T> breaks the boxed/arced client pattern used throughout xmtp_proto. Callers that erase concrete clients into Box<dyn XmtpMlsBidiStreams> or Arc<dyn XmtpMlsBidiStreams> will get a compile error when calling subscribe_bidi because the wrapper types don't implement the new trait. Consider adding the standard blanket impls: impl<T: XmtpMlsBidiStreams + ?Sized> XmtpMlsBidiStreams for Box<T> and Arc<T>.
🚀 Reply "fix it for me" or copy this AI Prompt for your agent:
In file @crates/xmtp_proto/src/api_client.rs around line 192:
Adding `XmtpMlsBidiStreams` without blanket impls for `Box<T>` and `Arc<T>` breaks the boxed/arced client pattern used throughout `xmtp_proto`. Callers that erase concrete clients into `Box<dyn XmtpMlsBidiStreams>` or `Arc<dyn XmtpMlsBidiStreams>` will get a compile error when calling `subscribe_bidi` because the wrapper types don't implement the new trait. Consider adding the standard blanket impls: `impl<T: XmtpMlsBidiStreams + ?Sized> XmtpMlsBidiStreams for Box<T>` and `Arc<T>`.
…#3769) **Stack 1/4** of the XIP-83 bidi client lane: #3769 → #3770 → #3771 → #3772. Regenerated `xmtp.mls.api.v1` from xmtp/proto#337: the bidirectional `Subscribe` RPC with versioned `SubscribeRequest`/`SubscribeResponse`, id-based `Mutate` (cursors, `history_only`), `Ping`/`Pong`, `TopicsLive`, `CATCHUP_COMPLETE`, and STARTED `capabilities`. Purely additive (+1,896 generated lines); `proto_version` pinned to that branch's sha — draft until the proto PR merges.
…t (XIP-83, native-only) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
7ef18f0 to
af6ab11
Compare
13bce00 to
0f1cead
Compare
Stack 3/4 of the XIP-83 bidi client lane: #3769 → #3770 → #3771 → #3772.
Native-only
XmtpMlsBidiStreamstrait inxmtp_proto::api_client—subscribe_bidi(BoxStream<SubscribeRequest>) -> Stream<Result<SubscribeResponse>>— and itsV3Clientimplementation: prost-encode outbound frames overbidi_stream("/xmtp.mls.api.v1.MlsApi/Subscribe"), decode inbound via the existingXmtpStream. Browsers stay onXmtpMlsStreams+ watchdog (gRPC-Web cannot full-duplex).🤖 Generated with Claude Code
Note
Add
XmtpMlsBidiStreamstrait and V3 bidirectional Subscribe transport for native targetsXmtpMlsBidiStreamstrait inapi_client.rswith asubscribe_bidimethod that accepts aBoxStream<SubscribeRequest>and returns a stream ofSubscribeResponse.V3Clientin a newbidi.rsmodule, opening a long-lived bidirectional stream at/xmtp.mls.api.v1.MlsApi/Subscribeand mapping transport errors to include the endpoint.cfg(not(target_arch = "wasm32"))and are not available in WASM builds.📊 Macroscope summarized 0f1cead. 2 files reviewed, 0 issues evaluated, 0 issues filtered, 0 comments posted
🗂️ Filtered Issues
No issues evaluated.