Skip to content

Commit 03dfe35

Browse files
I-am-nothingclaude
andcommitted
feat(dev/tunnel): WSS client + frame protocol (Phase 1, no integration yet)
Adds the WebSocket side of `mirrorstack dev`: - Frame envelope (type, id, corr_id, stream_id, payload) — wire-shape matches api-platform's internal/dispatch/ws/frames.go - Connect: opens wss_url?token=ttok, sends register, awaits register_ack - Background task: pings every 30s, replies to server pings, sends close frame on shutdown signal Deferred frame types (rpc.*, sql.*) are enumerated in the FrameType enum so server frames of those shapes deserialize without forcing a reconnect once those planes go live. This module is `#[allow(dead_code)]` for now — it compiles + tests but isn't wired into the dev lifecycle yet. End-to-end integration requires two pieces still in flight elsewhere: - api-platform AWS Sender impl (apigatewaymanagementapi.PostToConnection) - IaC for the WS API GW + Lambda routing Once those land, a small follow-up PR plugs this module into dev::run and adds a --tunnel flag that gates the connect. Deps added (used only inside this module): - tokio (rt + macros + time + sync + net + io-util) - tokio-tungstenite (connect + rustls-tls-webpki-roots) - futures-util (sink + std) Test plan: - [x] cargo test (4 new round-trip + uniqueness tests) - [x] cargo clippy --all-targets -- -D warnings clean - [x] cargo fmt --all -- --check clean Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 20ccff7 commit 03dfe35

4 files changed

Lines changed: 438 additions & 8 deletions

File tree

Cargo.lock

Lines changed: 127 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ dialoguer = { version = "0.11", default-features = false }
2929
console = "0.15"
3030
indicatif = "0.17"
3131
ctrlc = "3"
32+
tokio = { version = "1", features = ["rt", "macros", "time", "sync", "net", "io-util"] }
33+
tokio-tungstenite = { version = "0.24", default-features = false, features = ["connect", "rustls-tls-webpki-roots"] }
34+
futures-util = { version = "0.3", default-features = false, features = ["sink", "std"] }
3235

3336
[dev-dependencies]
3437
mockito = "1.6"

src/commands/dev/mod.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ use super::{ok_mark, warn_prefix};
2222

2323
mod compose;
2424
mod process;
25+
// Used in a follow-up PR that integrates WSS into the dev lifecycle.
26+
// Compiled + tested now so the wire format and protocol stay correct
27+
// while the AWS Sender impl + IaC for the WS API GW catch up.
28+
#[allow(dead_code)]
29+
mod tunnel;
2530

2631
#[derive(Args)]
2732
pub struct DevArgs {

0 commit comments

Comments
 (0)