feat(epic3): deliver the accepted Epic 3 scope through Story 3.17
CI / Rust Checks (pull_request) Failing after 13m41s
CI / UI Checks (pull_request) Skipped
CI / Frontend E2E (pull_request) Skipped
CI / Community Image Smoke (pull_request) Skipped
CI / Deploy (pull_request) Skipped
Community Release / release (push) Failing after 13m33s
CI / Rust Checks (pull_request) Failing after 13m41s
CI / UI Checks (pull_request) Skipped
CI / Frontend E2E (pull_request) Skipped
CI / Community Image Smoke (pull_request) Skipped
CI / Deploy (pull_request) Skipped
Community Release / release (push) Failing after 13m33s
Recovery delivery of the accumulated, TL-accepted Epic 3 work that had never been
committed to Git (stories 3.6-3.17, see the crank board). Story 3.18 is not accepted
yet and is deliberately excluded: its logging surface, its capability registration,
its oracle projections and its tests are not part of this tree.
Accepted scope
- 3.6 typed static Resource Drafts; 3.7 publication and exact binding of static
Resource Versions; 3.8 MCP discovery/read and revocation of static Resources;
- 3.9 Resource import/export in API and UI plus TLS dependency maintenance;
3.10 REST-backed Resource templates; 3.11 shared REST read runtime and the MCP
revision/capability foundation;
- 3.12 parameterised Prompt Drafts with preview; 3.13 Prompt publication and exact
version binding to Agents; 3.14 MCP prompts; 3.15 Prompt import/export;
- 3.16 composite Prompts with published Resources (dependency content scan plus
dynamic read through the accepted 3.11 runtime, admin preview and MCP prompts/get);
- 3.17 bounded MCP completion suggestions from typed published schemas and the
resources/list admission fix for bound template publications.
Accepted evidence being reused (unchanged code paths)
- 3.16 candidate: core 7, admin-api 22, registry 4, mcp-server 4, UI 6; one final
`just verify` run 1651 passed / 0 failed / 2 ignored.
- 3.17 candidate: full run 1672 passed / 0 failed / 2 ignored, QA targeted reruns and
a real MCP Inspector 2.12.0 client smoke.
Delivery engineering in this commit
- CI: one event per change (feature branches are gated by their pull request, push
runs only on main), story events run the changed packages, the full workspace suite
stays the feature/release gate; no cache/sharding without a measured runner check.
- Release: the packaged archives, checksums and SBOM are now uploaded to the Gitea
release entry of the tag instead of dying with the runner workspace.
Not included on purpose: Story 3.18 work, build caches, runtime databases, local
credentials and scratch evidence.
Refs: crank kanban t_e39d7263; baseline 1b6db09bd1.
This commit is contained in:
1 parent
1b6db09bd1
commit
54ce770682
357 files changed
+117394
-5115
No files matched your search
@@ -16,9 +16,7 @@ use futures_util::stream;
|
||||
use reqwest::Url;
|
||||
use serde_json::Value;
|
||||
|
||||
use crate::jsonrpc::{
|
||||
CURRENT_PROTOCOL_VERSION, DEFAULT_PROTOCOL_VERSION, negotiated_protocol_version,
|
||||
};
|
||||
use crate::jsonrpc::{LEGACY_PROTOCOL_VERSION, negotiated_protocol_version};
|
||||
|
||||
pub(super) const HEADER_MCP_SESSION_ID: &str = "MCP-Session-Id";
|
||||
pub(super) const HEADER_MCP_PROTOCOL_VERSION: &str = "MCP-Protocol-Version";
|
||||
@@ -99,13 +97,29 @@ pub(super) fn validate_origin(
|
||||
Err(StatusCode::FORBIDDEN)
|
||||
}
|
||||
|
||||
/// The media types of the `Accept` header, in the client's preference order.
|
||||
///
|
||||
/// `None` means the header is absent or not text; both are the caller's own admission decision.
|
||||
fn accepted_media_types(headers: &HeaderMap) -> Option<Vec<String>> {
|
||||
let accept = headers.get(ACCEPT)?.to_str().ok()?;
|
||||
Some(
|
||||
accept
|
||||
.split(',')
|
||||
.map(|part| {
|
||||
part.split(';')
|
||||
.next()
|
||||
.unwrap_or_default()
|
||||
.trim()
|
||||
.to_ascii_lowercase()
|
||||
})
|
||||
.collect(),
|
||||
)
|
||||
}
|
||||
|
||||
pub(super) fn negotiate_post_response_mode(
|
||||
headers: &HeaderMap,
|
||||
) -> Result<ResponseMode, StatusCode> {
|
||||
let Some(accept) = headers.get(ACCEPT) else {
|
||||
return Err(StatusCode::BAD_REQUEST);
|
||||
};
|
||||
let Ok(accept) = accept.to_str() else {
|
||||
let Some(media_types) = accepted_media_types(headers) else {
|
||||
return Err(StatusCode::BAD_REQUEST);
|
||||
};
|
||||
|
||||
@@ -113,14 +127,7 @@ pub(super) fn negotiate_post_response_mode(
|
||||
let mut saw_sse = false;
|
||||
let mut preferred = None;
|
||||
|
||||
for part in accept.split(',') {
|
||||
let media_type = part
|
||||
.split(';')
|
||||
.next()
|
||||
.unwrap_or_default()
|
||||
.trim()
|
||||
.to_ascii_lowercase();
|
||||
|
||||
for media_type in media_types {
|
||||
match media_type.as_str() {
|
||||
"application/json" => {
|
||||
saw_json = true;
|
||||
@@ -146,22 +153,12 @@ pub(super) fn negotiate_post_response_mode(
|
||||
}
|
||||
|
||||
pub(super) fn validate_get_accept_header(headers: &HeaderMap) -> Result<(), StatusCode> {
|
||||
let Some(accept) = headers.get(ACCEPT) else {
|
||||
return Err(StatusCode::BAD_REQUEST);
|
||||
};
|
||||
let Ok(accept) = accept.to_str() else {
|
||||
let Some(media_types) = accepted_media_types(headers) else {
|
||||
return Err(StatusCode::BAD_REQUEST);
|
||||
};
|
||||
|
||||
if accept
|
||||
.split(',')
|
||||
.map(|part| {
|
||||
part.split(';')
|
||||
.next()
|
||||
.unwrap_or_default()
|
||||
.trim()
|
||||
.to_ascii_lowercase()
|
||||
})
|
||||
if media_types
|
||||
.iter()
|
||||
.any(|media_type| media_type == "text/event-stream")
|
||||
{
|
||||
return Ok(());
|
||||
@@ -170,31 +167,50 @@ pub(super) fn validate_get_accept_header(headers: &HeaderMap) -> Result<(), Stat
|
||||
Err(StatusCode::NOT_ACCEPTABLE)
|
||||
}
|
||||
|
||||
pub(super) fn protocol_version_from_headers(headers: &HeaderMap) -> Result<String, StatusCode> {
|
||||
let Some(version) = headers.get(HEADER_MCP_PROTOCOL_VERSION) else {
|
||||
return Ok(DEFAULT_PROTOCOL_VERSION.to_owned());
|
||||
/// Read a singleton identity carrier.
|
||||
///
|
||||
/// Pinned HTTP semantics allow repeated header lines, so the ingress must decide what a repeated
|
||||
/// carrier means instead of silently reading the first value. Identical duplicates carry no ambiguity
|
||||
/// and collapse deterministically to one value; conflicting duplicates are an ambiguous identity and
|
||||
/// are rejected. A non-text value is rejected as well.
|
||||
pub(super) fn singleton_header<'a>(
|
||||
headers: &'a HeaderMap,
|
||||
name: &str,
|
||||
) -> Result<Option<&'a str>, StatusCode> {
|
||||
let mut values = headers.get_all(name).iter();
|
||||
let Some(first) = values.next() else {
|
||||
return Ok(None);
|
||||
};
|
||||
let Ok(version) = version.to_str() else {
|
||||
return Err(StatusCode::BAD_REQUEST);
|
||||
};
|
||||
|
||||
if negotiated_protocol_version(version).is_some() {
|
||||
return Ok(version.to_owned());
|
||||
let first = first.to_str().map_err(|_| StatusCode::BAD_REQUEST)?;
|
||||
for value in values {
|
||||
let value = value.to_str().map_err(|_| StatusCode::BAD_REQUEST)?;
|
||||
if value != first {
|
||||
return Err(StatusCode::BAD_REQUEST);
|
||||
}
|
||||
}
|
||||
|
||||
Err(StatusCode::BAD_REQUEST)
|
||||
Ok(Some(first))
|
||||
}
|
||||
|
||||
/// Negotiated revision carried by the request header.
|
||||
///
|
||||
/// A missing header is reported as `None` rather than being replaced by an implicit default: the
|
||||
/// withdrawn `2025-03-26` fallback is no longer served. Era resolution (header vs body identity,
|
||||
/// mismatch and unsupported handling) happens in the request pipeline. Conflicting duplicate
|
||||
/// carriers are rejected here, so no caller can resolve an ambiguous identity to the first value.
|
||||
pub(super) fn protocol_version_from_headers(
|
||||
headers: &HeaderMap,
|
||||
) -> Result<Option<String>, StatusCode> {
|
||||
Ok(singleton_header(headers, HEADER_MCP_PROTOCOL_VERSION)?.map(str::to_owned))
|
||||
}
|
||||
|
||||
pub(super) fn validate_session_protocol_version(
|
||||
headers: &HeaderMap,
|
||||
negotiated_session_version: &str,
|
||||
) -> Result<(), StatusCode> {
|
||||
let Some(version) = headers.get(HEADER_MCP_PROTOCOL_VERSION) else {
|
||||
let Some(version) = singleton_header(headers, HEADER_MCP_PROTOCOL_VERSION)? else {
|
||||
return Ok(());
|
||||
};
|
||||
let Ok(version) = version.to_str() else {
|
||||
return Err(StatusCode::BAD_REQUEST);
|
||||
};
|
||||
|
||||
if negotiated_protocol_version(version).is_none() {
|
||||
return Err(StatusCode::BAD_REQUEST);
|
||||
@@ -208,14 +224,7 @@ pub(super) fn validate_session_protocol_version(
|
||||
}
|
||||
|
||||
pub(super) fn session_id_from_headers(headers: &HeaderMap) -> Result<Option<String>, StatusCode> {
|
||||
let Some(session_id) = headers.get(HEADER_MCP_SESSION_ID) else {
|
||||
return Ok(None);
|
||||
};
|
||||
let Ok(session_id) = session_id.to_str() else {
|
||||
return Err(StatusCode::BAD_REQUEST);
|
||||
};
|
||||
|
||||
Ok(Some(session_id.to_owned()))
|
||||
Ok(singleton_header(headers, HEADER_MCP_SESSION_ID)?.map(str::to_owned))
|
||||
}
|
||||
|
||||
pub(super) fn json_response(
|
||||
@@ -242,7 +251,7 @@ pub(super) fn json_response(
|
||||
response.headers_mut().insert(
|
||||
HEADER_MCP_PROTOCOL_VERSION,
|
||||
HeaderValue::from_str(protocol_version)
|
||||
.unwrap_or_else(|_| HeaderValue::from_static(CURRENT_PROTOCOL_VERSION)),
|
||||
.unwrap_or_else(|_| HeaderValue::from_static(LEGACY_PROTOCOL_VERSION)),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -258,8 +267,7 @@ pub(super) fn transport_response(
|
||||
) -> Response {
|
||||
let outcome = payload_outcome(&payload);
|
||||
if status == StatusCode::OK && matches!(response_mode, ResponseMode::Sse) {
|
||||
let payload = payload.to_string();
|
||||
let stream = stream::once(async move { Ok(Event::default().data(payload)) });
|
||||
let stream = stream::iter([Ok(Event::default().data(payload.to_string()))]);
|
||||
|
||||
let mut response = sse_response(status, stream, session_id, protocol_version);
|
||||
if let Some(outcome) = outcome {
|
||||
@@ -319,7 +327,7 @@ where
|
||||
response.headers_mut().insert(
|
||||
HEADER_MCP_PROTOCOL_VERSION,
|
||||
HeaderValue::from_str(protocol_version)
|
||||
.unwrap_or_else(|_| HeaderValue::from_static(CURRENT_PROTOCOL_VERSION)),
|
||||
.unwrap_or_else(|_| HeaderValue::from_static(LEGACY_PROTOCOL_VERSION)),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user