Repository navigation
chore(deps): bump tokio-tungstenite to 0.29 in the Rust SDK - #273
Conversation
Unifies the WebSocket stack with the openhuman core, which pins 0.29; the duplicate 0.24 major (plus its thiserror 1.x tail) drops out of the kernel-floor graph. tungstenite 0.29's Message::Text wraps Utf8Bytes rather than String, so the single send call site gains .into(). Co-authored-by: Medulla <medulla@tinyhumans.ai>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughWalkthroughThe Rust SDK upgrades ChangesWebSocket compatibility
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@sdk/rust/Cargo.toml`:
- Line 15: Update all five test-side Message::Text constructors and the
Message::Ping(Vec::new()) call to convert their existing values with .into() for
tokio-tungstenite 0.29’s Utf8Bytes and Bytes types. Regenerate the Cargo.lock
dependency entry so tokio-tungstenite is no longer pinned to 0.24.0.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 7cc28564-6fe9-4a1a-af52-04b92720b12b
📒 Files selected for processing (2)
sdk/rust/Cargo.tomlsdk/rust/src/websocket.rs
| reqwest = { version = "0.12", default-features = false, features = ["json", "rustls-tls"] } | ||
| tokio = { version = "1", features = ["time", "rt", "sync", "macros"] } | ||
| tokio-tungstenite = { version = "0.24", default-features = false, features = ["connect", "rustls-tls-webpki-roots"] } | ||
| tokio-tungstenite = { version = "0.29", default-features = false, features = ["connect", "rustls-tls-webpki-roots"] } |
There was a problem hiding this comment.
🎯 Functional Correctness | 🔴 Critical | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/usr/bin/env bash
set -euo pipefail
rg -n 'Message::Text' sdk/rust --glob '*.rs'Repository: tinyhumansai/tiny.place
Length of output: 813
🏁 Script executed:
#!/usr/bin/env bash
set -euo pipefail
printf '%s\n' '--- dependency declarations and lock entries ---'
rg -n -C 2 'tokio-tungstenite|tungstenite' sdk/rust/Cargo.toml sdk/rust/Cargo.lock 2>/dev/null || true
printf '%s\n' '--- all Message::Text call sites ---'
rg -n -C 2 'Message::Text' sdk/rust --glob '*.rs'
printf '%s\n' '--- relevant test-module context ---'
sed -n '230,390p' sdk/rust/tests/websocket.rs
sed -n '500,540p' sdk/rust/tests/websocket.rs
printf '%s\n' '--- source-side context ---'
sed -n '235,270p' sdk/rust/src/websocket.rs
sed -n '330,350p' sdk/rust/src/websocket.rsRepository: tinyhumansai/tiny.place
Length of output: 14192
🏁 Script executed:
#!/usr/bin/env bash
set -euo pipefail
printf '%s\n' '--- all WebSocket Message constructors ---'
rg -n -C 1 'Message::[A-Za-z]+' sdk/rust --glob '*.rs'
printf '%s\n' '--- lockfile package ranges and workspace metadata ---'
sed -n '1,80p' sdk/rust/Cargo.toml
sed -n '1618,1640p' sdk/rust/Cargo.lock
sed -n '1717,1740p' sdk/rust/Cargo.lock
printf '%s\n' '--- repository state summary ---'
git diff --stat -- sdk/rust/Cargo.toml sdk/rust/Cargo.lock sdk/rust/tests/websocket.rs
git status --short -- sdk/rust/Cargo.toml sdk/rust/Cargo.lock sdk/rust/tests/websocket.rsRepository: tinyhumansai/tiny.place
Length of output: 5633
🌐 Web query:
tokio-tungstenite 0.29 Message::Text Utf8Bytes Message::Ping Bytes API
💡 Result:
In tokio-tungstenite 0.29.0 (which relies on tungstenite 0.29.0), the Message enum API underwent a significant refactor to improve performance by utilizing the Bytes crate [1][2]. Key changes in the Message enum include: 1. Message::Text(Utf8Bytes): The Text variant now carries a Utf8Bytes payload instead of a String [3][4]. Utf8Bytes is a wrapper around Bytes that guarantees UTF-8 validity, allowing for more efficient, shared-memory handling of text messages [5]. You can create a Message::Text by passing any type that implements Into, such as a String or &str, using.into [3][4]. 2. Message::Ping(Bytes): The Ping variant (along with Pong and Binary) now directly uses the Bytes type [4][6]. This allows for cheap cloning of the payload, which is beneficial when sending the same message to multiple clients [1][5]. These changes were part of a broader effort to reduce allocations and align with higher-performance WebSocket implementations [5][7]. Because these types implement Into conversions, updating code from older versions typically involves replacing String or Vec usages with.into, which performs the necessary conversion to the new Bytes-backed types [3].
Citations:
- 1: https://docs.rs/crate/tungstenite/latest/source/CHANGELOG.md
- 2: https://docs.rs/crate/tokio-tungstenite/latest/source/CHANGELOG.md
- 3: semnil/urx-router@8901351
- 4: https://doc.servo.org/tungstenite/protocol/message/enum.Message.html
- 5: Update tungstenite to 0.26 tokio-rs/axum#3082
- 6: https://docs.rs/stream-tungstenite/latest/stream_tungstenite/tokio_tungstenite/tungstenite/enum.Message.html
- 7: https://docs.rs/crate/tokio-tungstenite/latest
Update all WebSocket message constructors and the lockfile.
tokio-tungstenite 0.29 uses Utf8Bytes for Message::Text and Bytes for Message::Ping. Update all five test-side Message::Text calls and the Message::Ping(Vec::new()) call to use .into(). Regenerate sdk/rust/Cargo.lock, which still pins version 0.24.0.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@sdk/rust/Cargo.toml` at line 15, Update all five test-side Message::Text
constructors and the Message::Ping(Vec::new()) call to convert their existing
values with .into() for tokio-tungstenite 0.29’s Utf8Bytes and Bytes types.
Regenerate the Cargo.lock dependency entry so tokio-tungstenite is no longer
pinned to 0.24.0.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2b5bb1da53
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| reqwest = { version = "0.12", default-features = false, features = ["json", "rustls-tls"] } | ||
| tokio = { version = "1", features = ["time", "rt", "sync", "macros"] } | ||
| tokio-tungstenite = { version = "0.24", default-features = false, features = ["connect", "rustls-tls-webpki-roots"] } | ||
| tokio-tungstenite = { version = "0.29", default-features = false, features = ["connect", "rustls-tls-webpki-roots"] } |
There was a problem hiding this comment.
Regenerate the committed Rust lockfile
When this checkout is used with --locked, the manifest now requires tokio-tungstenite 0.29 while the committed sdk/rust/Cargo.lock still selects tokio-tungstenite and tungstenite 0.24. Cargo documents --locked as asserting that the lockfile remains unchanged, so reproducible builds must fail rather than resolve the new dependency; ordinary builds instead silently dirty the checkout and leave the stated removal of the 0.24/thiserror 1.x dependency tail absent from the committed graph. Regenerate and commit Cargo.lock with this bump.
Useful? React with 👍 / 👎.
Bumps `tokio-tungstenite` 0.24 → 0.29 in `sdk/rust`, aligning with tinychannels (already on 0.29). In tinyhumansai/openhuman this removes the duplicate `tungstenite` 0.24 major and the `thiserror` 1.x + `thiserror-impl` 1.x proc-macro compile from the kernel dependency profile.
Code updated for the 0.29 API (`Message::Text`/`Binary` now wrap `Utf8Bytes`/`Bytes`). `cargo fmt --check` and a standalone `cargo check` pass in `sdk/rust`.
Companion openhuman PR bumps the gitlink alongside its own tokio-tungstenite bump.
Summary by CodeRabbit