feat(epic3): безопасное structured logging MCP (Story 3.18)
CI / UI Checks (pull_request) Successful in 11s
CI / Rust Checks (pull_request) Failing after 4m11s
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) Failing after 1s
CI / Deploy (pull_request) Skipped
CI / UI Checks (pull_request) Successful in 11s
CI / Rust Checks (pull_request) Failing after 4m11s
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) Failing after 1s
CI / Deploy (pull_request) Skipped
Story 3.18 (#25) surface: клиент получает только закрытые structured `notifications/message` выбранного уровня, без запросов, секретов и internal causes. - `logging` capability advertising в обеих поддерживаемых revisions; `logging/setLevel` — legacy-only dispatch (modern — `_meta` per request); - закрытый словарь LoggingLevel (RFC 5424), malformed → -32602 с одним safe detail; закрытый набор safe events, task-local request scope; bounded in-memory opt-in, без миграций; - `notifications/message` идут перед ответом в SSE; JSON-режим их не несёт; - ATDD в `scripts/ci-story-checks.sh`: mcp_logging (10), inventory projection (3), protocol::logging unit (12); - проекция capability inventory/frozen oracle переведена на `logging`. Story ATDD и affected проверки пройдены на этом дереве (fmt, clippy, python oracle 56 OK, capability inventory valid). Полный `just verify` — NOT_RUN на story по validation-policy, остаётся на собранной фиче.
This commit is contained in:
1 parent
aed83268a0
commit
a438c1df42
24 files changed
+1883
-38
No files matched your search
@@ -36,6 +36,7 @@ fn static_registration_is_unique_and_advertises_only_the_registered_capability()
|
||||
registry.advertised_capabilities(revision),
|
||||
json!({
|
||||
"completions": {},
|
||||
"logging": {},
|
||||
"prompts": {"listChanged": false},
|
||||
"resources": {"listChanged": false, "subscribe": false},
|
||||
"tools": {"listChanged": false}
|
||||
@@ -46,6 +47,7 @@ fn static_registration_is_unique_and_advertises_only_the_registered_capability()
|
||||
advertised_server_capabilities(revision),
|
||||
json!({
|
||||
"completions": {},
|
||||
"logging": {},
|
||||
"prompts": {"listChanged": false},
|
||||
"resources": {"listChanged": false, "subscribe": false},
|
||||
"tools": {"listChanged": false}
|
||||
@@ -259,6 +261,7 @@ fn an_inert_test_descriptor_changes_both_projections_and_is_never_registered_in_
|
||||
without.advertised_capabilities(MODERN_PROTOCOL_VERSION),
|
||||
json!({
|
||||
"completions": {},
|
||||
"logging": {},
|
||||
"prompts": {"listChanged": false},
|
||||
"resources": {"listChanged": false, "subscribe": false},
|
||||
"tools": {"listChanged": false}
|
||||
@@ -269,6 +272,7 @@ fn an_inert_test_descriptor_changes_both_projections_and_is_never_registered_in_
|
||||
json!({
|
||||
"inert_test_capability": {"enabled": true},
|
||||
"completions": {},
|
||||
"logging": {},
|
||||
"prompts": {"listChanged": false},
|
||||
"resources": {"listChanged": false, "subscribe": false},
|
||||
"tools": {"listChanged": false}
|
||||
@@ -279,6 +283,7 @@ fn an_inert_test_descriptor_changes_both_projections_and_is_never_registered_in_
|
||||
json!({
|
||||
"inert_test_capability": {"enabled": true},
|
||||
"completions": {},
|
||||
"logging": {},
|
||||
"prompts": {"listChanged": false},
|
||||
"resources": {"listChanged": false, "subscribe": false},
|
||||
"tools": {"listChanged": false}
|
||||
@@ -462,6 +467,7 @@ fn a_single_era_descriptor_never_leaks_into_the_other_era_advertisement() {
|
||||
other_era_advertisement,
|
||||
json!({
|
||||
"completions": {},
|
||||
"logging": {},
|
||||
"prompts": {"listChanged": false},
|
||||
"resources": {"listChanged": false, "subscribe": false},
|
||||
"tools": {"listChanged": false}
|
||||
@@ -654,6 +660,56 @@ fn story317_completion_is_advertised_and_dispatchable_in_both_revisions() {
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn story318_logging_is_advertised_on_both_revisions_and_set_level_is_legacy_only() {
|
||||
let registry = production_registry();
|
||||
for revision in [MODERN_PROTOCOL_VERSION, LEGACY_PROTOCOL_VERSION] {
|
||||
assert!(
|
||||
registry.advertise_for(CapabilityId::Logging, revision),
|
||||
"the implemented logging surface must be advertised in {revision}"
|
||||
);
|
||||
assert_eq!(
|
||||
registry.advertised_capabilities(revision)["logging"],
|
||||
json!({}),
|
||||
"the pinned advertisement is an empty `logging` object in {revision}"
|
||||
);
|
||||
}
|
||||
|
||||
// `logging/setLevel` is a legacy request only: the pinned modern revision replaces it with the
|
||||
// per-request `_meta` log level, so the modern era must never serve it.
|
||||
assert_eq!(
|
||||
registry.dispatch_decision("logging/setLevel", LEGACY_PROTOCOL_VERSION),
|
||||
DispatchDecision::Allowed {
|
||||
handler: MethodHandler::LoggingSetLevel,
|
||||
kind: Kind::Method,
|
||||
}
|
||||
);
|
||||
assert_eq!(
|
||||
registry.dispatch_decision("logging/setLevel", MODERN_PROTOCOL_VERSION),
|
||||
DispatchDecision::WrongEra {
|
||||
handler: MethodHandler::LoggingSetLevel,
|
||||
kind: Kind::Method,
|
||||
},
|
||||
"a method the modern schema does not declare must never reach a handler there"
|
||||
);
|
||||
let descriptor = METHOD_DESCRIPTORS
|
||||
.iter()
|
||||
.find(|descriptor| descriptor.name == "logging/setLevel")
|
||||
.expect("logging/setLevel is a registered method");
|
||||
assert_eq!(
|
||||
descriptor.required_headers.0,
|
||||
&["Mcp-Method"],
|
||||
"the request declares a level, not a server-side name"
|
||||
);
|
||||
assert!(
|
||||
CAPABILITY_DESCRIPTORS
|
||||
.iter()
|
||||
.filter(|descriptor| descriptor.id == CapabilityId::LoggingSetLevel)
|
||||
.all(|descriptor| descriptor.advertised.is_none()),
|
||||
"the client request must never be advertised as a server capability"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn adding_and_removing_a_method_descriptor_changes_the_dispatch_decision() {
|
||||
// The inert capability owns one inert method. With the method descriptor registered the
|
||||
@@ -702,6 +758,7 @@ fn adding_and_removing_a_method_descriptor_changes_the_dispatch_decision() {
|
||||
json!({
|
||||
"inert_test_capability": {"enabled": true},
|
||||
"completions": {},
|
||||
"logging": {},
|
||||
"prompts": {"listChanged": false},
|
||||
"resources": {"listChanged": false, "subscribe": false},
|
||||
"tools": {"listChanged": false}
|
||||
|
||||
Reference in new issue
Block a user