MCP: send progress through SDK Peer with private trace tokens
CI / UI Checks (pull_request) Successful in 9s
CI / Rust Checks (pull_request) Successful in 41m28s
CI / Rust Feature Validation (pull_request) Skipped
CI / Frontend E2E (pull_request) Skipped
CI / Community Image Smoke (pull_request) Skipped
CI / Required Checks (pull_request) Successful in 1s
CI / Deploy (pull_request) Skipped
CI / UI Checks (pull_request) Successful in 9s
CI / Rust Checks (pull_request) Successful in 41m28s
CI / Rust Feature Validation (pull_request) Skipped
CI / Frontend E2E (pull_request) Skipped
CI / Community Image Smoke (pull_request) Skipped
CI / Required Checks (pull_request) Successful in 1s
CI / Deploy (pull_request) Skipped
This commit is contained in:
1 parent
8f494679b8
commit
48436538f1
12 files changed
+974
-83
No files matched your search
@@ -2,13 +2,14 @@
|
||||
//! progress queue, the pinned frame shape and the ownership of the in-flight cancellation table.
|
||||
|
||||
use super::*;
|
||||
use serde_json::json;
|
||||
|
||||
fn token(value: Value) -> Option<ProgressToken> {
|
||||
progress_token(&json!({ "_meta": { "progressToken": value } }))
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn rmcp_progress_cancel_frame_preserves_serialized_numbers_and_omissions() {
|
||||
#[tokio::test]
|
||||
async fn rmcp_progress_cancel_frame_preserves_serialized_numbers_and_omissions() {
|
||||
for wire_token in [
|
||||
"\"token\"",
|
||||
"-7",
|
||||
@@ -19,13 +20,9 @@ fn rmcp_progress_cancel_frame_preserves_serialized_numbers_and_omissions() {
|
||||
] {
|
||||
let value: Value = serde_json::from_str(wire_token).unwrap();
|
||||
for progress in [2, 9_007_199_254_740_993, u64::MAX] {
|
||||
let frame = progress_frame(
|
||||
&token(value.clone()).unwrap(),
|
||||
&ProgressEvent {
|
||||
progress,
|
||||
message: "execution_dispatched",
|
||||
},
|
||||
);
|
||||
let mut peer = super::super::rmcp_progress_peer::ProgressPeer::start(value.clone());
|
||||
let frame = peer.notify(progress, "execution_dispatched").await.unwrap();
|
||||
peer.finish().await;
|
||||
assert_eq!(frame["params"]["progressToken"].to_string(), wire_token);
|
||||
assert_eq!(
|
||||
frame["params"]["progress"].to_string(),
|
||||
@@ -123,14 +120,15 @@ async fn without_a_token_no_progress_is_produced_at_all() {
|
||||
/// The pinned `notifications/progress` frame (schema `ProgressNotification`, both supported
|
||||
/// revisions): `progressToken` echoed verbatim, `progress` increasing, `message` optional and
|
||||
/// `total` absent because this server never invents one.
|
||||
#[test]
|
||||
fn the_progress_frame_matches_the_pinned_notification_shape() {
|
||||
#[tokio::test]
|
||||
async fn the_progress_frame_matches_the_pinned_notification_shape() {
|
||||
let event = ProgressEvent {
|
||||
progress: 2,
|
||||
message: Phase::Authorized.message(),
|
||||
};
|
||||
let mut peer = super::super::rmcp_progress_peer::ProgressPeer::start(json!("tok-2"));
|
||||
assert_eq!(
|
||||
progress_frame(&ProgressToken::Text("tok-2".to_owned()), &event),
|
||||
peer.notify(event.progress, event.message).await.unwrap(),
|
||||
json!({
|
||||
"jsonrpc": "2.0",
|
||||
"method": "notifications/progress",
|
||||
@@ -141,10 +139,13 @@ fn the_progress_frame_matches_the_pinned_notification_shape() {
|
||||
}
|
||||
})
|
||||
);
|
||||
peer.finish().await;
|
||||
let mut peer = super::super::rmcp_progress_peer::ProgressPeer::start(json!(7));
|
||||
assert_eq!(
|
||||
progress_frame(&ProgressToken::Number(7.into()), &event)["params"]["progressToken"],
|
||||
peer.notify(event.progress, event.message).await.unwrap()["params"]["progressToken"],
|
||||
json!(7)
|
||||
);
|
||||
peer.finish().await;
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
|
||||
Reference in new issue
Block a user