Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
22637861c3 |
No files matched your search
@@ -41,6 +41,7 @@ mod rmcp_http;
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
#[path = "rmcp_http_tests.rs"]
|
#[path = "rmcp_http_tests.rs"]
|
||||||
mod rmcp_http_tests;
|
mod rmcp_http_tests;
|
||||||
|
mod rmcp_logging;
|
||||||
mod rmcp_negotiation;
|
mod rmcp_negotiation;
|
||||||
mod rmcp_notifications;
|
mod rmcp_notifications;
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
|||||||
@@ -82,6 +82,8 @@ pub(crate) struct CounterSet {
|
|||||||
sdk_logging_dispatch: AtomicUsize,
|
sdk_logging_dispatch: AtomicUsize,
|
||||||
sdk_logging_level: AtomicUsize,
|
sdk_logging_level: AtomicUsize,
|
||||||
sdk_logging_notification: AtomicUsize,
|
sdk_logging_notification: AtomicUsize,
|
||||||
|
sdk_logging_handler_completed: AtomicUsize,
|
||||||
|
sdk_logging_handler_consumed: AtomicUsize,
|
||||||
sdk_progress_notification: AtomicUsize,
|
sdk_progress_notification: AtomicUsize,
|
||||||
sdk_cancelled_params: AtomicUsize,
|
sdk_cancelled_params: AtomicUsize,
|
||||||
sdk_subscriptions_listen: AtomicUsize,
|
sdk_subscriptions_listen: AtomicUsize,
|
||||||
@@ -260,6 +262,14 @@ impl CounterSet {
|
|||||||
self.sdk_logging_notification.load(Ordering::SeqCst)
|
self.sdk_logging_notification.load(Ordering::SeqCst)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub(crate) fn sdk_logging_handler_completed(&self) -> usize {
|
||||||
|
self.sdk_logging_handler_completed.load(Ordering::SeqCst)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(crate) fn sdk_logging_handler_consumed(&self) -> usize {
|
||||||
|
self.sdk_logging_handler_consumed.load(Ordering::SeqCst)
|
||||||
|
}
|
||||||
|
|
||||||
pub(crate) fn sdk_completion_dispatch(&self) -> usize {
|
pub(crate) fn sdk_completion_dispatch(&self) -> usize {
|
||||||
self.sdk_completion_dispatch.load(Ordering::SeqCst)
|
self.sdk_completion_dispatch.load(Ordering::SeqCst)
|
||||||
}
|
}
|
||||||
@@ -563,9 +573,23 @@ pub(crate) fn sdk_logging_notification_serialized() {
|
|||||||
increment(|counters| &counters.sdk_logging_notification);
|
increment(|counters| &counters.sdk_logging_notification);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Mark after the real logging handler has completed its awaited operation and built its result.
|
||||||
|
pub(crate) fn sdk_logging_handler_completed() {
|
||||||
|
increment(|counters| &counters.sdk_logging_handler_completed);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Mark only after the caller consumes the actual SDK handler Result.
|
||||||
|
pub(crate) fn sdk_logging_handler_consumed() {
|
||||||
|
increment(|counters| &counters.sdk_logging_handler_consumed);
|
||||||
|
}
|
||||||
|
|
||||||
#[path = "../rmcp_logging_runtime_tests.rs"]
|
#[path = "../rmcp_logging_runtime_tests.rs"]
|
||||||
mod rmcp_logging_runtime_tests;
|
mod rmcp_logging_runtime_tests;
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
#[path = "../rmcp_logging_handler_runtime_tests.rs"]
|
||||||
|
mod rmcp_logging_handler_runtime_tests;
|
||||||
|
|
||||||
/// Mark only after successfully serializing real SDK ProgressNotificationParam params.
|
/// Mark only after successfully serializing real SDK ProgressNotificationParam params.
|
||||||
pub(crate) fn sdk_progress_notification_serialized() {
|
pub(crate) fn sdk_progress_notification_serialized() {
|
||||||
increment(|counters| &counters.sdk_progress_notification);
|
increment(|counters| &counters.sdk_progress_notification);
|
||||||
|
|||||||
@@ -31,11 +31,11 @@ use crate::{
|
|||||||
auth::VerifiedMachineCredential,
|
auth::VerifiedMachineCredential,
|
||||||
jsonrpc::{LEGACY_PROTOCOL_VERSION, jsonrpc_error, jsonrpc_result, params, request_id},
|
jsonrpc::{LEGACY_PROTOCOL_VERSION, jsonrpc_error, jsonrpc_result, params, request_id},
|
||||||
protocol::{
|
protocol::{
|
||||||
CompletionCommand, CompletionOutcome, ContinuationSupport, DispatchDecision,
|
CompletionCommand, CompletionOutcome, ContinuationSupport, DispatchDecision, INVALID_LEVEL,
|
||||||
EVENT_LEVEL_APPLIED, INVALID_LEVEL, Kind, LoggingOutcome, MethodHandler, PromptGetCommand,
|
Kind, MethodHandler, PromptGetCommand, PromptsCommand, PromptsListCommand, PromptsOutcome,
|
||||||
PromptsCommand, PromptsListCommand, PromptsOutcome, RequestIdentity, ResourceReadCommand,
|
RequestIdentity, ResourceReadCommand, ResourcesCommand, ResourcesListCommand,
|
||||||
ResourcesCommand, ResourcesListCommand, ResourcesOutcome, ServiceContext, SetLevelCommand,
|
ResourcesOutcome, ServiceContext, SetLevelCommand, ToolCallCommand, ToolsCommand,
|
||||||
ToolCallCommand, ToolsCommand, ToolsListCommand, handle_logging_command,
|
ToolsListCommand,
|
||||||
},
|
},
|
||||||
tool_error::execution_locale,
|
tool_error::execution_locale,
|
||||||
transport::{ResponseMode, session_id_from_headers, transport_response},
|
transport::{ResponseMode, session_id_from_headers, transport_response},
|
||||||
@@ -727,30 +727,23 @@ pub(super) async fn handle_legacy_request(
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
match handle_logging_command(&state.logging_levels, &session.id, command) {
|
let request = match command.validate() {
|
||||||
LoggingOutcome::Applied(level) => {
|
Ok(request) => request,
|
||||||
crate::protocol::set_active_level(Some(level));
|
Err(detail) => {
|
||||||
crate::protocol::note(
|
return super::dispatch::sdk_error_response(
|
||||||
crate::protocol::LogLevel::Notice,
|
message,
|
||||||
EVENT_LEVEL_APPLIED,
|
|
||||||
"applied",
|
|
||||||
);
|
|
||||||
transport_response(
|
|
||||||
StatusCode::OK,
|
|
||||||
jsonrpc_result(request_id(message), json!({})),
|
|
||||||
response_mode,
|
response_mode,
|
||||||
None,
|
&session.protocol_version,
|
||||||
Some(&session.protocol_version),
|
rmcp::ErrorData::invalid_params(detail, None),
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
LoggingOutcome::InvalidParams(detail) => transport_response(
|
};
|
||||||
StatusCode::OK,
|
super::rmcp_logging::response(
|
||||||
jsonrpc_error(request_id(message), -32602, detail),
|
message,
|
||||||
response_mode,
|
response_mode,
|
||||||
None,
|
&session.protocol_version,
|
||||||
Some(&session.protocol_version),
|
super::rmcp_logging::set_level(&state, &session.id, request).await,
|
||||||
),
|
)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// A notification whose method the registration does not map to this adapter's handlers is
|
// A notification whose method the registration does not map to this adapter's handlers is
|
||||||
// acknowledged without being dispatched, exactly as before.
|
// acknowledged without being dispatched, exactly as before.
|
||||||
|
|||||||
@@ -0,0 +1,107 @@
|
|||||||
|
//! Request-owned SDK implementation of the legacy `logging/setLevel` handler.
|
||||||
|
// The pinned legacy revision still requires this deprecated SDK method.
|
||||||
|
#![allow(deprecated)]
|
||||||
|
use super::AppState;
|
||||||
|
use crate::protocol::{self, LogLevel};
|
||||||
|
use rmcp::{ErrorData, RoleServer, ServerHandler, model::*, service::RequestContext};
|
||||||
|
use std::sync::Arc;
|
||||||
|
|
||||||
|
#[derive(Clone)]
|
||||||
|
struct LoggingHandler {
|
||||||
|
store: Arc<protocol::LogLevelStore>,
|
||||||
|
session_id: String,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl ServerHandler for LoggingHandler {
|
||||||
|
async fn set_level(
|
||||||
|
&self,
|
||||||
|
request: SetLevelRequestParams,
|
||||||
|
_context: RequestContext<RoleServer>,
|
||||||
|
) -> Result<(), ErrorData> {
|
||||||
|
#[allow(deprecated)]
|
||||||
|
let level: LogLevel = request.level.into();
|
||||||
|
self.store.set(&self.session_id, level);
|
||||||
|
protocol::set_active_level(Some(level));
|
||||||
|
protocol::note(LogLevel::Notice, protocol::EVENT_LEVEL_APPLIED, "applied");
|
||||||
|
#[cfg(test)]
|
||||||
|
super::dispatch_observer::sdk_logging_handler_completed();
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async fn request_context() -> Result<RequestContext<RoleServer>, ErrorData> {
|
||||||
|
let ping: ClientJsonRpcMessage = serde_json::from_value(serde_json::json!({
|
||||||
|
"jsonrpc":"2.0", "id":1, "method":"ping"
|
||||||
|
}))
|
||||||
|
.map_err(|_| ErrorData::internal_error("logging handler unavailable", None))?;
|
||||||
|
let (transport, receiver) = rmcp::transport::OneshotTransport::<RoleServer>::new(ping);
|
||||||
|
let info = InitializeRequestParams::new(
|
||||||
|
ClientCapabilities::default(),
|
||||||
|
Implementation::new("crank-logging-context", "1"),
|
||||||
|
);
|
||||||
|
#[derive(Clone)]
|
||||||
|
struct Bootstrap;
|
||||||
|
impl ServerHandler for Bootstrap {}
|
||||||
|
let mut running = rmcp::service::serve_directly(Bootstrap, transport, Some(info));
|
||||||
|
let peer = running.peer().clone();
|
||||||
|
running
|
||||||
|
.close()
|
||||||
|
.await
|
||||||
|
.map_err(|_| ErrorData::internal_error("logging handler unavailable", None))?;
|
||||||
|
drop(receiver);
|
||||||
|
Ok(RequestContext::new(RequestId::Number(1), peer))
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(super) async fn set_level(
|
||||||
|
state: &Arc<AppState>,
|
||||||
|
session_id: &str,
|
||||||
|
request: SetLevelRequestParams,
|
||||||
|
) -> Result<(), ErrorData> {
|
||||||
|
let handler = LoggingHandler {
|
||||||
|
store: Arc::clone(&state.logging_levels),
|
||||||
|
session_id: session_id.to_owned(),
|
||||||
|
};
|
||||||
|
let context = request_context().await?;
|
||||||
|
invoke(&handler, request, context).await
|
||||||
|
}
|
||||||
|
|
||||||
|
async fn invoke(
|
||||||
|
handler: &impl ServerHandler,
|
||||||
|
request: SetLevelRequestParams,
|
||||||
|
context: RequestContext<RoleServer>,
|
||||||
|
) -> Result<(), ErrorData> {
|
||||||
|
ServerHandler::set_level(handler, request, context).await
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(super) fn response(
|
||||||
|
message: &serde_json::Value,
|
||||||
|
mode: crate::transport::ResponseMode,
|
||||||
|
revision: &str,
|
||||||
|
result: Result<(), ErrorData>,
|
||||||
|
) -> axum::response::Response {
|
||||||
|
match result {
|
||||||
|
Ok(()) => {
|
||||||
|
#[cfg(test)]
|
||||||
|
super::dispatch_observer::sdk_logging_handler_consumed();
|
||||||
|
crate::transport::transport_response(
|
||||||
|
axum::http::StatusCode::OK,
|
||||||
|
crate::jsonrpc::jsonrpc_result(
|
||||||
|
crate::jsonrpc::request_id(message),
|
||||||
|
serde_json::json!({}),
|
||||||
|
),
|
||||||
|
mode,
|
||||||
|
None,
|
||||||
|
Some(revision),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
Err(error) => {
|
||||||
|
#[cfg(test)]
|
||||||
|
super::dispatch_observer::sdk_logging_handler_consumed();
|
||||||
|
super::dispatch::sdk_error_response(message, mode, revision, error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
#[path = "../rmcp_logging_handler_tests.rs"]
|
||||||
|
mod tests;
|
||||||
@@ -186,7 +186,8 @@ impl SetLevelCommand {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A neutral outcome of the shared `logging/setLevel` service.
|
/// Compatibility outcome for the original protocol unit tests; runtime uses the SDK handler.
|
||||||
|
#[cfg(test)]
|
||||||
pub(crate) enum LoggingOutcome {
|
pub(crate) enum LoggingOutcome {
|
||||||
/// The level of this client context was accepted.
|
/// The level of this client context was accepted.
|
||||||
Applied(LogLevel),
|
Applied(LogLevel),
|
||||||
@@ -394,6 +395,7 @@ impl LogLevelStore {
|
|||||||
///
|
///
|
||||||
/// The command has already been parsed from the wire form, so this function only validates and
|
/// The command has already been parsed from the wire form, so this function only validates and
|
||||||
/// records; it never reads the registry, the catalog or any stored value.
|
/// records; it never reads the registry, the catalog or any stored value.
|
||||||
|
#[cfg(test)]
|
||||||
pub(crate) fn handle_logging_command(
|
pub(crate) fn handle_logging_command(
|
||||||
store: &LogLevelStore,
|
store: &LogLevelStore,
|
||||||
session_id: &str,
|
session_id: &str,
|
||||||
|
|||||||
@@ -48,9 +48,8 @@ pub(crate) use completion::{
|
|||||||
pub(crate) use lifecycle_sdk::{initialize_params, initialized_notification};
|
pub(crate) use lifecycle_sdk::{initialize_params, initialized_notification};
|
||||||
pub(crate) use logging::{
|
pub(crate) use logging::{
|
||||||
CarriedScope, EVENT_FAILED, EVENT_LEVEL_APPLIED, EVENT_REJECTED, EVENT_SERVED, INVALID_LEVEL,
|
CarriedScope, EVENT_FAILED, EVENT_LEVEL_APPLIED, EVENT_REJECTED, EVENT_SERVED, INVALID_LEVEL,
|
||||||
LogLevel, LogLevelStore, LoggingOutcome, SetLevelCommand, carry_scope, handle_logging_command,
|
LogLevel, LogLevelStore, SetLevelCommand, carry_scope, in_carried_scope, modern_request_level,
|
||||||
in_carried_scope, modern_request_level, note, scoped as logging_scope, set_active_level,
|
note, scoped as logging_scope, set_active_level, set_sse_acceptable, take_notifications,
|
||||||
set_sse_acceptable, take_notifications,
|
|
||||||
};
|
};
|
||||||
pub(crate) use prompts::{
|
pub(crate) use prompts::{
|
||||||
PromptGetCommand, PromptsCommand, PromptsListCommand, PromptsOutcome, handle_prompts_command,
|
PromptGetCommand, PromptsCommand, PromptsListCommand, PromptsOutcome, handle_prompts_command,
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
//! Handler-specific acceptance oracle, distinct from existing wire-level GREEN controls.
|
||||||
|
use super::rmcp_logging_runtime_tests;
|
||||||
|
|
||||||
|
#[tokio::test]
|
||||||
|
async fn legacy_logging_http_completes_and_consumes_the_sdk_handler() {
|
||||||
|
// Existing real build_app HTTP control proves the JSON/SSE contract independently.
|
||||||
|
assert_eq!(
|
||||||
|
rmcp_logging_runtime_tests::control("2025-11-25").await,
|
||||||
|
[1, 1, 1, 1, 1],
|
||||||
|
"legacy wire succeeded but the awaited SDK handler was not completed/consumed"
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,155 @@
|
|||||||
|
#![allow(deprecated)]
|
||||||
|
use super::*;
|
||||||
|
use crate::protocol::SetLevelCommand;
|
||||||
|
use serde_json::json;
|
||||||
|
use std::sync::atomic::{AtomicUsize, Ordering};
|
||||||
|
|
||||||
|
fn request(level: &str) -> SetLevelRequestParams {
|
||||||
|
serde_json::from_value(json!({"level": level})).expect("valid SDK logging level")
|
||||||
|
}
|
||||||
|
fn handler(store: &Arc<protocol::LogLevelStore>) -> LoggingHandler {
|
||||||
|
LoggingHandler {
|
||||||
|
store: store.clone(),
|
||||||
|
session_id: "current".into(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[tokio::test]
|
||||||
|
async fn typed_sdk_level_is_the_applied_level_and_execution_is_single() {
|
||||||
|
let store = Arc::new(protocol::LogLevelStore::new());
|
||||||
|
store.set("other", LogLevel::Debug);
|
||||||
|
let counters = Arc::new(super::super::dispatch_observer::CounterSet::default());
|
||||||
|
let events = super::super::dispatch_observer::observe(
|
||||||
|
counters.clone(),
|
||||||
|
protocol::logging_scope(async {
|
||||||
|
// Mutate the typed value after validation: no raw command may override it later.
|
||||||
|
let mut typed = SetLevelCommand {
|
||||||
|
level: "critical".into(),
|
||||||
|
}
|
||||||
|
.validate()
|
||||||
|
.unwrap();
|
||||||
|
typed.level = LoggingLevel::Info;
|
||||||
|
let result = invoke(&handler(&store), typed, request_context().await.unwrap()).await;
|
||||||
|
assert!(result.is_ok());
|
||||||
|
protocol::set_sse_acceptable();
|
||||||
|
let events = protocol::take_notifications();
|
||||||
|
let response = response(
|
||||||
|
&json!({"id":91}),
|
||||||
|
crate::transport::ResponseMode::Json,
|
||||||
|
crate::jsonrpc::LEGACY_PROTOCOL_VERSION,
|
||||||
|
result,
|
||||||
|
);
|
||||||
|
assert_eq!(response.status(), 200);
|
||||||
|
assert_eq!(store.get("current"), Some(LogLevel::Info));
|
||||||
|
assert_eq!(store.get("other"), Some(LogLevel::Debug));
|
||||||
|
events
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
.await;
|
||||||
|
assert_eq!(counters.sdk_logging_handler_completed(), 1);
|
||||||
|
assert_eq!(counters.sdk_logging_handler_consumed(), 1);
|
||||||
|
assert_eq!(events.len(), 1);
|
||||||
|
assert_eq!(
|
||||||
|
events[0]["params"]["data"],
|
||||||
|
json!({
|
||||||
|
"event": protocol::EVENT_LEVEL_APPLIED, "outcome": "applied"
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
struct Controlled {
|
||||||
|
inner: LoggingHandler,
|
||||||
|
entered: AtomicUsize,
|
||||||
|
error: Option<ErrorData>,
|
||||||
|
pending: bool,
|
||||||
|
}
|
||||||
|
impl ServerHandler for Controlled {
|
||||||
|
async fn set_level(
|
||||||
|
&self,
|
||||||
|
request: SetLevelRequestParams,
|
||||||
|
context: RequestContext<RoleServer>,
|
||||||
|
) -> Result<(), ErrorData> {
|
||||||
|
self.entered.fetch_add(1, Ordering::SeqCst);
|
||||||
|
if let Some(error) = &self.error {
|
||||||
|
return Err(error.clone());
|
||||||
|
}
|
||||||
|
if self.pending {
|
||||||
|
std::future::pending::<()>().await;
|
||||||
|
}
|
||||||
|
ServerHandler::set_level(&self.inner, request, context).await
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[tokio::test]
|
||||||
|
async fn actual_trait_error_controls_the_http_response_without_store_effect() {
|
||||||
|
let store = Arc::new(protocol::LogLevelStore::new());
|
||||||
|
let error = ErrorData::invalid_params("controlled handler error", None);
|
||||||
|
let controlled = Controlled {
|
||||||
|
inner: handler(&store),
|
||||||
|
entered: AtomicUsize::new(0),
|
||||||
|
error: Some(error),
|
||||||
|
pending: false,
|
||||||
|
};
|
||||||
|
for mode in [
|
||||||
|
crate::transport::ResponseMode::Json,
|
||||||
|
crate::transport::ResponseMode::Sse,
|
||||||
|
] {
|
||||||
|
let result = invoke(
|
||||||
|
&controlled,
|
||||||
|
request("notice"),
|
||||||
|
request_context().await.unwrap(),
|
||||||
|
)
|
||||||
|
.await;
|
||||||
|
let reply = response(
|
||||||
|
&json!({"id":"controlled"}),
|
||||||
|
mode,
|
||||||
|
crate::jsonrpc::LEGACY_PROTOCOL_VERSION,
|
||||||
|
result,
|
||||||
|
);
|
||||||
|
assert_eq!(reply.status(), 200);
|
||||||
|
let bytes = axum::body::to_bytes(reply.into_body(), 4096).await.unwrap();
|
||||||
|
let raw = std::str::from_utf8(&bytes).unwrap();
|
||||||
|
let raw = raw
|
||||||
|
.lines()
|
||||||
|
.find_map(|l| l.strip_prefix("data:"))
|
||||||
|
.unwrap_or(raw);
|
||||||
|
let body: serde_json::Value = serde_json::from_str(raw).unwrap();
|
||||||
|
assert_eq!(body["id"], "controlled");
|
||||||
|
assert_eq!(body["error"]["code"], -32602);
|
||||||
|
assert_eq!(body["error"]["message"], "controlled handler error");
|
||||||
|
assert!(body.get("result").is_none());
|
||||||
|
}
|
||||||
|
assert_eq!(controlled.entered.load(Ordering::SeqCst), 2);
|
||||||
|
assert_eq!(store.get("current"), None);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[tokio::test]
|
||||||
|
async fn dropping_pending_await_before_store_effect_does_not_detach_work() {
|
||||||
|
let store = Arc::new(protocol::LogLevelStore::new());
|
||||||
|
let controlled = Controlled {
|
||||||
|
inner: handler(&store),
|
||||||
|
entered: AtomicUsize::new(0),
|
||||||
|
error: None,
|
||||||
|
pending: true,
|
||||||
|
};
|
||||||
|
let context = request_context().await.unwrap();
|
||||||
|
let mut future = Box::pin(invoke(&controlled, request("alert"), context));
|
||||||
|
assert!(futures_util::poll!(future.as_mut()).is_pending());
|
||||||
|
assert_eq!(controlled.entered.load(Ordering::SeqCst), 1);
|
||||||
|
drop(future);
|
||||||
|
tokio::task::yield_now().await;
|
||||||
|
assert_eq!(store.get("current"), None);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn invalid_command_maps_to_safe_invalid_params_error_data() {
|
||||||
|
let error = SetLevelCommand {
|
||||||
|
level: "not-a-level".to_owned(),
|
||||||
|
}
|
||||||
|
.validate()
|
||||||
|
.unwrap_err();
|
||||||
|
assert_eq!(error, protocol::INVALID_LEVEL);
|
||||||
|
let sdk_error = ErrorData::invalid_params(error, None);
|
||||||
|
assert_eq!(sdk_error.code.0, -32602);
|
||||||
|
assert_eq!(sdk_error.message, protocol::INVALID_LEVEL);
|
||||||
|
}
|
||||||
@@ -78,7 +78,7 @@ fn opted(level: Value) -> Value {
|
|||||||
meta[LEVEL] = level;
|
meta[LEVEL] = level;
|
||||||
json!({"_meta":meta})
|
json!({"_meta":meta})
|
||||||
}
|
}
|
||||||
async fn control(revision: &str) -> [usize; 3] {
|
pub(super) async fn control(revision: &str) -> [usize; 5] {
|
||||||
let h = Endpoint::started().await;
|
let h = Endpoint::started().await;
|
||||||
let session = h.session(revision).await;
|
let session = h.session(revision).await;
|
||||||
let session = session.as_deref();
|
let session = session.as_deref();
|
||||||
@@ -131,6 +131,11 @@ async fn control(revision: &str) -> [usize; 3] {
|
|||||||
assert_eq!(h.counters.sdk_logging_notification(), 0);
|
assert_eq!(h.counters.sdk_logging_notification(), 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
assert_eq!(
|
||||||
|
handlers(&h.counters),
|
||||||
|
[0, 0],
|
||||||
|
"rejected input must not invoke the handler"
|
||||||
|
);
|
||||||
let before = counts(&h.counters);
|
let before = counts(&h.counters);
|
||||||
let (method, params, expected) = if revision == LEGACY_REVISION {
|
let (method, params, expected) = if revision == LEGACY_REVISION {
|
||||||
(
|
(
|
||||||
@@ -155,7 +160,7 @@ async fn control(revision: &str) -> [usize; 3] {
|
|||||||
assert_eq!(events, vec![expected]);
|
assert_eq!(events, vec![expected]);
|
||||||
assert!(raw.len() < 4096);
|
assert!(raw.len() < 4096);
|
||||||
let after = counts(&h.counters);
|
let after = counts(&h.counters);
|
||||||
let delta = std::array::from_fn(|i| after[i] - before[i]);
|
let delta: [usize; 3] = std::array::from_fn(|i| after[i] - before[i]);
|
||||||
// Legacy severity persists, modern opt-in does not leak into the next request.
|
// Legacy severity persists, modern opt-in does not leak into the next request.
|
||||||
let (body, events, _) = reply(h.post(revision, session, "tools/list", json!({})).await).await;
|
let (body, events, _) = reply(h.post(revision, session, "tools/list", json!({})).await).await;
|
||||||
assert!(body["result"]["tools"].is_array());
|
assert!(body["result"]["tools"].is_array());
|
||||||
@@ -169,6 +174,7 @@ async fn control(revision: &str) -> [usize; 3] {
|
|||||||
.await
|
.await
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let before = counts(&h.counters);
|
let before = counts(&h.counters);
|
||||||
|
let before_handlers = handlers(&h.counters);
|
||||||
let era = h.counters.snapshot();
|
let era = h.counters.snapshot();
|
||||||
let response = h
|
let response = h
|
||||||
.post(
|
.post(
|
||||||
@@ -186,13 +192,20 @@ async fn control(revision: &str) -> [usize; 3] {
|
|||||||
let raw = response.text().await.unwrap();
|
let raw = response.text().await.unwrap();
|
||||||
assert!(!raw.contains("notifications/message"));
|
assert!(!raw.contains("notifications/message"));
|
||||||
assert_eq!(counts(&h.counters), before);
|
assert_eq!(counts(&h.counters), before);
|
||||||
|
assert_eq!(handlers(&h.counters), before_handlers);
|
||||||
let after = h.counters.snapshot();
|
let after = h.counters.snapshot();
|
||||||
assert_eq!(after.era_modern, era.era_modern);
|
assert_eq!(after.era_modern, era.era_modern);
|
||||||
assert_eq!(after.era_legacy, era.era_legacy);
|
assert_eq!(after.era_legacy, era.era_legacy);
|
||||||
eprintln!(
|
eprintln!(
|
||||||
"existing GREEN logging HTTP {revision}: safe SSE, result, opt-in/invalid/era/auth controls passed; SDK positive delta={delta:?}"
|
"existing GREEN logging HTTP {revision}: safe SSE, result, opt-in/invalid/era/auth controls passed; SDK positive delta={delta:?}"
|
||||||
);
|
);
|
||||||
delta
|
[
|
||||||
|
delta[0],
|
||||||
|
delta[1],
|
||||||
|
delta[2],
|
||||||
|
h.counters.sdk_logging_handler_completed(),
|
||||||
|
h.counters.sdk_logging_handler_consumed(),
|
||||||
|
]
|
||||||
}
|
}
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn rmcp_logging_wire_legacy() {
|
async fn rmcp_logging_wire_legacy() {
|
||||||
@@ -206,7 +219,7 @@ async fn rmcp_logging_wire_modern() {
|
|||||||
async fn rmcp_logging_sdk_legacy() {
|
async fn rmcp_logging_sdk_legacy() {
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
control(LEGACY_REVISION).await,
|
control(LEGACY_REVISION).await,
|
||||||
[1, 1, 1],
|
[1, 1, 1, 1, 1],
|
||||||
"missing SDK legacy request/level/notification after successful HTTP wire assertions"
|
"missing SDK legacy request/level/notification after successful HTTP wire assertions"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -214,7 +227,7 @@ async fn rmcp_logging_sdk_legacy() {
|
|||||||
async fn rmcp_logging_sdk_modern() {
|
async fn rmcp_logging_sdk_modern() {
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
control(MODERN_REVISION).await,
|
control(MODERN_REVISION).await,
|
||||||
[0, 1, 1],
|
[0, 1, 1, 0, 0],
|
||||||
"missing SDK modern level/notification after successful HTTP wire assertions"
|
"missing SDK modern level/notification after successful HTTP wire assertions"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -256,3 +269,140 @@ async fn rmcp_logging_observer_scope_control() {
|
|||||||
assert_eq!(counts(&a), [1, 1, 1]);
|
assert_eq!(counts(&a), [1, 1, 1]);
|
||||||
assert_eq!(counts(&b), [0, 0, 1]);
|
assert_eq!(counts(&b), [0, 0, 1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn handlers(c: &CounterSet) -> [usize; 2] {
|
||||||
|
[
|
||||||
|
c.sdk_logging_handler_completed(),
|
||||||
|
c.sdk_logging_handler_consumed(),
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
#[tokio::test]
|
||||||
|
async fn rmcp_logging_all_levels_json_sse_and_ignored_extensions() {
|
||||||
|
let h = Endpoint::started().await;
|
||||||
|
let session = h.session(LEGACY_REVISION).await.unwrap();
|
||||||
|
for accept in ["application/json", "text/event-stream, application/json"] {
|
||||||
|
for level in [
|
||||||
|
"debug",
|
||||||
|
"info",
|
||||||
|
"notice",
|
||||||
|
"warning",
|
||||||
|
"error",
|
||||||
|
"critical",
|
||||||
|
"alert",
|
||||||
|
"emergency",
|
||||||
|
] {
|
||||||
|
let before = handlers(&h.counters);
|
||||||
|
let response = h.post_with_accept(LEGACY_REVISION, Some(&session), "logging/setLevel",
|
||||||
|
json!({"level":level,"extension":{"CANARY":"ignored"},"_meta":{"extension":true}}), accept).await;
|
||||||
|
assert_eq!(response.headers()["MCP-Protocol-Version"], LEGACY_REVISION);
|
||||||
|
assert_eq!(
|
||||||
|
response.headers()["x-request-id"],
|
||||||
|
"logging-handler-control"
|
||||||
|
);
|
||||||
|
let (body, events, raw) = reply(response).await;
|
||||||
|
assert_eq!(body["result"], json!({}));
|
||||||
|
assert!(!raw.contains("CANARY"));
|
||||||
|
if accept == "application/json" || !["debug", "info", "notice"].contains(&level) {
|
||||||
|
assert!(events.is_empty());
|
||||||
|
} else {
|
||||||
|
let mut expected = vec![notification(
|
||||||
|
"notice",
|
||||||
|
"mcp.logging.level_applied",
|
||||||
|
"applied",
|
||||||
|
)];
|
||||||
|
if ["debug", "info"].contains(&level) {
|
||||||
|
expected.push(notification("info", "mcp.request.served", "ok"));
|
||||||
|
}
|
||||||
|
assert_eq!(events, expected);
|
||||||
|
}
|
||||||
|
assert_eq!(handlers(&h.counters), before.map(|n| n + 1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let before = handlers(&h.counters);
|
||||||
|
let response = h
|
||||||
|
.post(
|
||||||
|
LEGACY_REVISION,
|
||||||
|
Some(&session),
|
||||||
|
"logging/setLevel",
|
||||||
|
json!({"level":"info","_meta":7}),
|
||||||
|
)
|
||||||
|
.await;
|
||||||
|
assert!(response.status().is_client_error());
|
||||||
|
assert!(!response.text().await.unwrap().contains("CANARY"));
|
||||||
|
assert_eq!(handlers(&h.counters), before);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[tokio::test]
|
||||||
|
async fn rmcp_logging_session_guards_do_not_enter_the_handler() {
|
||||||
|
use crate::session::TransportSessionStore;
|
||||||
|
let h = Endpoint::started().await;
|
||||||
|
let uninitialized = h
|
||||||
|
.sessions
|
||||||
|
.create(
|
||||||
|
LEGACY_REVISION,
|
||||||
|
WORKSPACE_SLUG,
|
||||||
|
AGENT_SLUG,
|
||||||
|
false,
|
||||||
|
time::OffsetDateTime::now_utc(),
|
||||||
|
None,
|
||||||
|
)
|
||||||
|
.await
|
||||||
|
.unwrap();
|
||||||
|
let foreign = h
|
||||||
|
.sessions
|
||||||
|
.create(
|
||||||
|
LEGACY_REVISION,
|
||||||
|
WORKSPACE_SLUG,
|
||||||
|
"another-agent",
|
||||||
|
false,
|
||||||
|
time::OffsetDateTime::now_utc(),
|
||||||
|
None,
|
||||||
|
)
|
||||||
|
.await
|
||||||
|
.unwrap();
|
||||||
|
h.sessions
|
||||||
|
.mark_initialized(&foreign, time::OffsetDateTime::now_utc())
|
||||||
|
.await
|
||||||
|
.unwrap();
|
||||||
|
for session in [
|
||||||
|
None,
|
||||||
|
Some("unknown"),
|
||||||
|
Some(uninitialized.as_str()),
|
||||||
|
Some(foreign.as_str()),
|
||||||
|
] {
|
||||||
|
let response = h
|
||||||
|
.post(
|
||||||
|
LEGACY_REVISION,
|
||||||
|
session,
|
||||||
|
"logging/setLevel",
|
||||||
|
json!({"level":"debug"}),
|
||||||
|
)
|
||||||
|
.await;
|
||||||
|
let status = response.status();
|
||||||
|
let raw = response.text().await.unwrap();
|
||||||
|
if session == Some(uninitialized.as_str()) {
|
||||||
|
assert_eq!(status, 200);
|
||||||
|
let body: Value = serde_json::from_str(&raw).unwrap();
|
||||||
|
assert_eq!(body["error"]["code"], -32002);
|
||||||
|
} else {
|
||||||
|
assert_eq!(status.as_u16(), if session.is_none() { 400 } else { 404 });
|
||||||
|
}
|
||||||
|
assert!(!raw.contains("mcp.logging.level_applied"));
|
||||||
|
assert_eq!(handlers(&h.counters), [0, 0]);
|
||||||
|
assert_eq!(h.counters.sdk_logging_dispatch(), 0);
|
||||||
|
}
|
||||||
|
let session = h.session(LEGACY_REVISION).await;
|
||||||
|
let (body, _, _) = reply(
|
||||||
|
h.post(
|
||||||
|
LEGACY_REVISION,
|
||||||
|
session.as_deref(),
|
||||||
|
"logging/setLevel",
|
||||||
|
json!({"level":"notice"}),
|
||||||
|
)
|
||||||
|
.await,
|
||||||
|
)
|
||||||
|
.await;
|
||||||
|
assert_eq!(body["result"], json!({}));
|
||||||
|
assert_eq!(handlers(&h.counters), [1, 1]);
|
||||||
|
}
|
||||||
@@ -7,6 +7,7 @@ use crank_runtime::{
|
|||||||
pub(super) struct Endpoint {
|
pub(super) struct Endpoint {
|
||||||
pub registry: crank_registry::PostgresRegistry,
|
pub registry: crank_registry::PostgresRegistry,
|
||||||
pub counters: Arc<CounterSet>,
|
pub counters: Arc<CounterSet>,
|
||||||
|
pub sessions: Arc<crate::session::InMemorySessionStore>,
|
||||||
key: String,
|
key: String,
|
||||||
url: String,
|
url: String,
|
||||||
server: tokio::task::JoinHandle<()>,
|
server: tokio::task::JoinHandle<()>,
|
||||||
@@ -18,7 +19,7 @@ impl Drop for Endpoint {
|
|||||||
}
|
}
|
||||||
impl Endpoint {
|
impl Endpoint {
|
||||||
pub async fn started() -> Self {
|
pub async fn started() -> Self {
|
||||||
crank_test_support::postgres_schema_url_for_task("logging_owner", "t_c28c3800").await;
|
crank_test_support::postgres_schema_url_for_task("logging_handler", "t_dbf2bdff").await;
|
||||||
let registry = test_registry().await;
|
let registry = test_registry().await;
|
||||||
let operation = test_operation("http://127.0.0.1:9");
|
let operation = test_operation("http://127.0.0.1:9");
|
||||||
registry
|
registry
|
||||||
@@ -38,6 +39,7 @@ impl Endpoint {
|
|||||||
publish_agent(®istry, &operation).await;
|
publish_agent(®istry, &operation).await;
|
||||||
let key = create_api_key(®istry).await;
|
let key = create_api_key(®istry).await;
|
||||||
let counters = Arc::new(CounterSet::default());
|
let counters = Arc::new(CounterSet::default());
|
||||||
|
let sessions = Arc::new(crate::session::InMemorySessionStore::default());
|
||||||
let app = crate::build_app(
|
let app = crate::build_app(
|
||||||
registry.clone(),
|
registry.clone(),
|
||||||
Duration::ZERO,
|
Duration::ZERO,
|
||||||
@@ -49,7 +51,7 @@ impl Endpoint {
|
|||||||
.build(),
|
.build(),
|
||||||
RequestRateLimiter::new(RequestRateLimitConfig::new(10_000, 10_000).unwrap()),
|
RequestRateLimiter::new(RequestRateLimitConfig::new(10_000, 10_000).unwrap()),
|
||||||
Arc::new(InMemoryCoordinationStateStore::default()),
|
Arc::new(InMemoryCoordinationStateStore::default()),
|
||||||
Arc::new(crate::session::InMemorySessionStore::default()),
|
sessions.clone(),
|
||||||
Arc::new(crate::auth::CommunityMachineCredentialVerifier),
|
Arc::new(crate::auth::CommunityMachineCredentialVerifier),
|
||||||
);
|
);
|
||||||
let scope = counters.clone();
|
let scope = counters.clone();
|
||||||
@@ -73,22 +75,41 @@ impl Endpoint {
|
|||||||
Self {
|
Self {
|
||||||
registry,
|
registry,
|
||||||
counters,
|
counters,
|
||||||
|
sessions,
|
||||||
key,
|
key,
|
||||||
url,
|
url,
|
||||||
server,
|
server,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pub async fn post(
|
pub async fn post(
|
||||||
|
&self,
|
||||||
|
revision: &str,
|
||||||
|
session: Option<&str>,
|
||||||
|
method: &str,
|
||||||
|
params: Value,
|
||||||
|
) -> reqwest::Response {
|
||||||
|
self.post_with_accept(
|
||||||
|
revision,
|
||||||
|
session,
|
||||||
|
method,
|
||||||
|
params,
|
||||||
|
"text/event-stream, application/json",
|
||||||
|
)
|
||||||
|
.await
|
||||||
|
}
|
||||||
|
pub async fn post_with_accept(
|
||||||
&self,
|
&self,
|
||||||
revision: &str,
|
revision: &str,
|
||||||
session: Option<&str>,
|
session: Option<&str>,
|
||||||
method: &str,
|
method: &str,
|
||||||
mut params: Value,
|
mut params: Value,
|
||||||
|
accept: &str,
|
||||||
) -> reqwest::Response {
|
) -> reqwest::Response {
|
||||||
let mut request = reqwest::Client::new()
|
let mut request = reqwest::Client::new()
|
||||||
.post(&self.url)
|
.post(&self.url)
|
||||||
.bearer_auth(&self.key)
|
.bearer_auth(&self.key)
|
||||||
.header("Accept", "text/event-stream, application/json")
|
.header("Accept", accept)
|
||||||
|
.header("x-request-id", "logging-handler-control")
|
||||||
.header("MCP-Protocol-Version", revision);
|
.header("MCP-Protocol-Version", revision);
|
||||||
if let Some(session) = session {
|
if let Some(session) = session {
|
||||||
request = request.header("MCP-Session-Id", session);
|
request = request.header("MCP-Session-Id", session);
|
||||||
|
|||||||
@@ -41,6 +41,8 @@ Completion-срез #107 на базе rc.20/rmcp3.9.0 подключает `com
|
|||||||
|
|
||||||
Logging-срез #107 на базе rc.22/rmcp3.9.0 использует существующий общий `protocol/logging.rs`, уже подключённый к штатному `build_app` HTTP: legacy `logging/setLevel` после прежней bounded string boundary декодируется в настоящий `SetLevelRequestParams`, а modern `_meta[io.modelcontextprotocol/logLevel]` — в SDK `LoggingLevel`. Неизвестные legacy поля, включая `_meta`, остаются игнорируемыми; неверные уровни дают прежний безопасный `INVALID_LEVEL`, modern отсутствие/неверное значение не включает logging. Domain severity ordering/store сохраняются явно: SDK enum не задаёт Ord. `notifications/message.params` сериализуется через `LoggingMessageNotificationParam` только из закрытого safe vocabulary; JSON-RPC envelope остаётся прежним. HTTP ATDD наблюдает реальные SDK decode/serialization обеих revisions и revoked-auth rejection; существующая logging-матрица и streamed progress regression сохраняют opt-in/isolation/filtering/JSON silence и carried scope. Очереди, try_lock/drop, transport/session/auth/lifecycle/capabilities не меняются; собственного runtime parsing уровня и handwritten params builder больше нет. Потребитель — действующий MCP HTTP клиент; signals/progress/cancel/subscriptions/прочие notifications и envelopes/transport/lifecycle ещё не объявляются перенесёнными. Полный #107, feature qualification и production deployment этим срезом не завершены.
|
Logging-срез #107 на базе rc.22/rmcp3.9.0 использует существующий общий `protocol/logging.rs`, уже подключённый к штатному `build_app` HTTP: legacy `logging/setLevel` после прежней bounded string boundary декодируется в настоящий `SetLevelRequestParams`, а modern `_meta[io.modelcontextprotocol/logLevel]` — в SDK `LoggingLevel`. Неизвестные legacy поля, включая `_meta`, остаются игнорируемыми; неверные уровни дают прежний безопасный `INVALID_LEVEL`, modern отсутствие/неверное значение не включает logging. Domain severity ordering/store сохраняются явно: SDK enum не задаёт Ord. `notifications/message.params` сериализуется через `LoggingMessageNotificationParam` только из закрытого safe vocabulary; JSON-RPC envelope остаётся прежним. HTTP ATDD наблюдает реальные SDK decode/serialization обеих revisions и revoked-auth rejection; существующая logging-матрица и streamed progress regression сохраняют opt-in/isolation/filtering/JSON silence и carried scope. Очереди, try_lock/drop, transport/session/auth/lifecycle/capabilities не меняются; собственного runtime parsing уровня и handwritten params builder больше нет. Потребитель — действующий MCP HTTP клиент; signals/progress/cancel/subscriptions/прочие notifications и envelopes/transport/lifecycle ещё не объявляются перенесёнными. Полный #107, feature qualification и production deployment этим срезом не завершены.
|
||||||
|
|
||||||
|
Logging-handler-срез #107 поверх rc.38/rmcp3.9.0 подключает legacy `LoggingSetLevel` в `app/legacy_dispatch.rs` к прямому request-owned await `ServerHandler::set_level` в `app/rmcp_logging.rs`. Override применяет именно typed level к прежнему session store, активирует request-local level и записывает safe event; actual Result/ErrorData определяет JSON/SSE ответ. Bounded command validation остаётся до инертного bootstrap, bootstrap закрыт до рабочего handler. DTO-only execution оставлен только для старых protocol unit tests. HTTP completion/consumption, восемь levels, ignored extensions/admission, session/revocation guards и modern rejection дополняются direct typed mutation/error/single-execution/pending-drop controls; logging matrix и streamed carried scope сохраняются. try_lock skip по-прежнему не подтверждается readback и не превращается в blocking write; drop до эффекта не обещает rollback выполненного store.set. SDK Peer callbacks/transport/SessionManager не подключены; #107 остаётся partial, full/load/external-client qualification и production не входят в срез.
|
||||||
|
|
||||||
Progress/cancel-срез #107 на базе rc.23/rmcp3.9.0 подключает штатный SSE `lifecycle::progress_frame` обеих revisions к сериализации `ProgressNotificationParam`, а legacy `handle_cancelled_notification` — к декодированию `CancelledNotificationParam.request_id`. Локальная projection+restore сохраняет исходные JSON numbers токена/ID и целочисленный u64 progress, включая значения вне i64/exact-f64; message и omissions берутся из SDK. Decoder передаёт SDK только requestId, не валидируя reason/_meta/extensions. Session+credential ownership, bounded queues/slots, transport, auth и modern stream-close cancellation не меняются. Runtime ATDD подтверждает SDK seams отдельно от wire; unit regression проверяет точную числовую форму. Decoder ignore действует только после HTTP admission: `_meta:[]` сохраняет прежний HTTP400/-32020 до SDK decoder. Отдельная HTTP-регрессия проверяет отказ без отмены активного вызова, а допустимый `_meta:{}` с reason/extensions — успешную SDK-отмену. Это частичная миграция params, не завершение #107, feature qualification или production deployment.
|
Progress/cancel-срез #107 на базе rc.23/rmcp3.9.0 подключает штатный SSE `lifecycle::progress_frame` обеих revisions к сериализации `ProgressNotificationParam`, а legacy `handle_cancelled_notification` — к декодированию `CancelledNotificationParam.request_id`. Локальная projection+restore сохраняет исходные JSON numbers токена/ID и целочисленный u64 progress, включая значения вне i64/exact-f64; message и omissions берутся из SDK. Decoder передаёт SDK только requestId, не валидируя reason/_meta/extensions. Session+credential ownership, bounded queues/slots, transport, auth и modern stream-close cancellation не меняются. Runtime ATDD подтверждает SDK seams отдельно от wire; unit regression проверяет точную числовую форму. Decoder ignore действует только после HTTP admission: `_meta:[]` сохраняет прежний HTTP400/-32020 до SDK decoder. Отдельная HTTP-регрессия проверяет отказ без отмены активного вызова, а допустимый `_meta:{}` с reason/extensions — успешную SDK-отмену. Это частичная миграция params, не завершение #107, feature qualification или production deployment.
|
||||||
|
|
||||||
Catalog-change signals/subscriptions-срез #107 на базе rc.24/rmcp3.9.0 использует прежний `protocol/signals.rs` watcher: штатный modern `subscriptions/listen` декодирует notifications через `SubscriptionsListenRequestParams`/`SubscriptionFilter`, а acknowledgment и три list-change notification сериализуются настоящими SDK notification types в `protocol/signals_sdk.rs`. Тонкая входная projection сохраняет прежний запрет explicit null известных filter fields и игнорирование extensions; `_meta` по-прежнему проверяется только HTTP admission до decoder. SDK `NotificationMetaObject` хранит исходный JSON subscriptionId без сужения через RequestId; legacy frames остаются без params, modern ack первым сообщает только true accepted subset. URI-content subscriptions остаются unsupported, bounds32/2048 и64-byte id bound сохранены. Ближайший потребитель уже подключён: действующий `build_app` modern listen SSE и legacy GET SSE после committed catalog changes. HTTP ATDD независимо проверяет SDK execution и wire обеих revisions; прежние signals integration сохраняют Resource/Prompt/Tool delivery, scope, coalescing/recovery. Handwritten filter field DTO и frame builders заменены; fingerprint, watcher timing/queue/drop, auth/session/ownership/TTL/capabilities и transport не меняются. Полный #107, external-client/feature qualification и production deployment этим срезом не завершены.
|
Catalog-change signals/subscriptions-срез #107 на базе rc.24/rmcp3.9.0 использует прежний `protocol/signals.rs` watcher: штатный modern `subscriptions/listen` декодирует notifications через `SubscriptionsListenRequestParams`/`SubscriptionFilter`, а acknowledgment и три list-change notification сериализуются настоящими SDK notification types в `protocol/signals_sdk.rs`. Тонкая входная projection сохраняет прежний запрет explicit null известных filter fields и игнорирование extensions; `_meta` по-прежнему проверяется только HTTP admission до decoder. SDK `NotificationMetaObject` хранит исходный JSON subscriptionId без сужения через RequestId; legacy frames остаются без params, modern ack первым сообщает только true accepted subset. URI-content subscriptions остаются unsupported, bounds32/2048 и64-byte id bound сохранены. Ближайший потребитель уже подключён: действующий `build_app` modern listen SSE и legacy GET SSE после committed catalog changes. HTTP ATDD независимо проверяет SDK execution и wire обеих revisions; прежние signals integration сохраняют Resource/Prompt/Tool delivery, scope, coalescing/recovery. Handwritten filter field DTO и frame builders заменены; fingerprint, watcher timing/queue/drop, auth/session/ownership/TTL/capabilities и transport не меняются. Полный #107, external-client/feature qualification и production deployment этим срезом не завершены.
|
||||||
|
|||||||
Reference in new issue
Block a user