From 28c840656e36d3308f59312724c8ead19c34aed3 Mon Sep 17 00:00:00 2001 From: Kinflou Date: Wed, 2 Sep 2026 03:14:35 +0800 Subject: [PATCH] =?UTF-8?q?test:=20end-to-end=20handshake=20=E2=80=94=20dr?= =?UTF-8?q?iver=20uses=20ChatClient::connect=20/=20Dispatcher::serve?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps comline-codegen-rust to comline-rust main (through #6, the handshake codegen) and switches the end_to_end driver from `Client::new` / `Server::serve` to the generated `ChatClient::connect(transport, MsgPack)` and `ChatDispatcher(svc).serve(&mut transport, MsgPack)` helpers — so the connection handshake (IR_HASH + format name, exchanged + checked) runs through the whole schema -> CLI -> compile -> run pipeline. Also picks up #5 (@timeout_ms codegen). --- Cargo.lock | 2 +- Cargo.toml | 2 +- tests/cli/end_to_end.rs | 11 ++++++----- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 13ea968..aba8563 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -398,7 +398,7 @@ dependencies = [ [[package]] name = "comline-codegen-rust" version = "0.1.0" -source = "git+https://github.com/ComlineProject/comline-rust?rev=1191e76068eca75ea7c4148d58ab127bb005e81a#1191e76068eca75ea7c4148d58ab127bb005e81a" +source = "git+https://github.com/ComlineProject/comline-rust?rev=a0ade3bceeb51876be7565601b3b9c9c3d807196#a0ade3bceeb51876be7565601b3b9c9c3d807196" dependencies = [ "comline-codegen", "comline-core", diff --git a/Cargo.toml b/Cargo.toml index f933aaf..1f96fd4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -31,7 +31,7 @@ comline-core = { git = "https://github.com/ComlineProject/core", rev = "47ac5f10 # `generation` tip (only `conformance/`, which this crate never touches, # differs), so matching it here keeps one `comline-codegen` in the tree. comline-codegen = { git = "https://github.com/ComlineProject/generation", rev = "1f8c5e290eba72a578860ebb6dc33453a2f0726b" } -comline-codegen-rust = { git = "https://github.com/ComlineProject/comline-rust", rev = "1191e76068eca75ea7c4148d58ab127bb005e81a", optional = true } +comline-codegen-rust = { git = "https://github.com/ComlineProject/comline-rust", rev = "a0ade3bceeb51876be7565601b3b9c9c3d807196", optional = true } comline-codegen-typescript = { git = "https://github.com/ComlineProject/comline-typescript", rev = "86fc4eb586529ef92041f8dd3c46ff9340103411", optional = true } [features] diff --git a/tests/cli/end_to_end.rs b/tests/cli/end_to_end.rs index ca82226..84a6eef 100644 --- a/tests/cli/end_to_end.rs +++ b/tests/cli/end_to_end.rs @@ -18,10 +18,8 @@ use std::sync::{Arc, Mutex}; use std::thread; use chat_e2e::chat::{Chat, ChatClient, ChatDispatcher, ChatSendError, Message, Rejected}; -use comline_runtime::client::Client; use comline_runtime::contract::CallError; use comline_runtime::format::MsgPack; -use comline_runtime::serve::Server; use comline_runtime::transport::duplex; struct Svc { @@ -46,14 +44,17 @@ fn client_and_provider_over_duplex() { let notes = Arc::new(Mutex::new(Vec::new())); let notes_for_svc = notes.clone(); + // Provider: the generated `serve` helper runs the connection handshake + // (IR_HASH + format name) before serving. let provider = thread::spawn(move || { let mut provider_side = provider_side; - Server::new(ChatDispatcher(Svc { notes: notes_for_svc }), MsgPack) - .serve(&mut provider_side) + ChatDispatcher(Svc { notes: notes_for_svc }) + .serve(&mut provider_side, MsgPack) .unwrap(); }); - let mut client = ChatClient::new(Client::new(client_side, MsgPack)); + // Client: the generated `connect` helper does the matching handshake. + let mut client = ChatClient::connect(client_side, MsgPack).expect("handshake"); assert_eq!(client.send("hi").unwrap().body, "echo: hi");