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

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:
bsodfather committed 2026-10-25 09:08:22 +00:00
1 parent 1b6db09bd1
commit 54ce770682
357 files changed
+117394 -5115

No files matched your search

+67 -6
View File
@@ -3,15 +3,47 @@ use std::{collections::BTreeSet, time::Duration};
use crank_metrics::{
CacheOutcome, ConfirmationOutcome, DbPoolState, Exporter, HttpMethod, HttpRoute,
HttpStatusClass, IdempotencyOutcome, InFlightGuard, InvocationSource, LimitStage, McpMethod,
McpOutcome, McpResponseMode, SignalType, ToolErrorKind, ToolInvocationMetrics, ToolOutcome,
UpstreamOperationKind, UpstreamOutcome, UpstreamRequestMetrics, initialize_gauges,
metric_schema, record_cache_outcome, record_confirmation_outcome, record_export_failure,
record_http_request, record_idempotency_outcome, record_invocation_history_lost,
record_limit_rejection, record_mcp_request, record_tool_invocation, record_upstream_request,
set_catalog, set_db_pool_connections, set_mcp_active_sessions, set_mcp_session_metrics_fresh,
McpOutcome, McpResponseMode, MetricService, SignalType, ToolErrorKind, ToolInvocationMetrics,
ToolOutcome, UpstreamOperationKind, UpstreamOutcome, UpstreamRequestMetrics,
bind_metric_service, initialize_gauges, metric_schema, record_cache_outcome,
record_confirmation_outcome, record_export_failure, record_http_request,
record_idempotency_outcome, record_invocation_history_lost, record_limit_rejection,
record_mcp_request, record_tool_invocation, record_upstream_request, set_catalog,
set_db_pool_connections, set_mcp_active_sessions, set_mcp_session_metrics_fresh,
};
use metrics_util::debugging::DebuggingRecorder;
/// Service binding is process-global (`OnceLock`), so every case that needs a
/// different service runs in a fresh child re-executed from this same test
/// binary instead of resetting a global.
const BINDING_ROLE_ENV: &str = "CRANK_METRICS_TEST_BINDING_ROLE";
fn route_to_child(role: &str, test: &str) -> bool {
match std::env::var(BINDING_ROLE_ENV).ok().as_deref() {
Some(actual) if actual == role => false,
Some(actual) => panic!("child for {test} runs with role {actual}, expected {role}"),
None => {
let output =
std::process::Command::new(std::env::current_exe().expect("current test binary"))
.args([test, "--exact", "--nocapture"])
.env(BINDING_ROLE_ENV, role)
.output()
.expect("re-executed binding child");
assert!(
output.status.success(),
"binding child {role}/{test} failed:\nstdout:\n{}\nstderr:\n{}",
String::from_utf8_lossy(&output.stdout),
String::from_utf8_lossy(&output.stderr)
);
true
}
}
}
fn bind(service: MetricService) {
bind_metric_service(service).expect("isolated metrics binding for this fixture");
}
#[test]
fn schema_names_are_unique_and_labels_are_closed() {
let schema = metric_schema();
@@ -82,6 +114,10 @@ fn application_outcomes_are_distinct_from_transport_success() {
#[test]
fn impossible_tool_outcome_pairs_are_normalized() {
if route_to_child("mcp_server", "impossible_tool_outcome_pairs_are_normalized") {
return;
}
bind(MetricService::McpServer);
let recorder = DebuggingRecorder::new();
let snapshotter = recorder.snapshotter();
metrics::with_local_recorder(&recorder, || {
@@ -102,6 +138,13 @@ fn impossible_tool_outcome_pairs_are_normalized() {
#[test]
fn dropped_product_guards_record_aborted_outcomes() {
if route_to_child(
"mcp_server",
"dropped_product_guards_record_aborted_outcomes",
) {
return;
}
bind(MetricService::McpServer);
let recorder = DebuggingRecorder::new();
let snapshotter = recorder.snapshotter();
@@ -131,6 +174,10 @@ fn has_label(key: &metrics::Key, name: &str, value: &str) -> bool {
#[test]
fn diverse_calls_cannot_create_unbounded_series() {
if route_to_child("mcp_server", "diverse_calls_cannot_create_unbounded_series") {
return;
}
bind(MetricService::McpServer);
let recorder = DebuggingRecorder::new();
let snapshotter = recorder.snapshotter();
@@ -178,6 +225,13 @@ fn diverse_calls_cannot_create_unbounded_series() {
#[test]
fn every_recording_api_matches_the_declared_schema() {
if route_to_child(
"mcp_server",
"every_recording_api_matches_the_declared_schema",
) {
return;
}
bind(MetricService::McpServer);
let recorder = DebuggingRecorder::new();
let snapshotter = recorder.snapshotter();
@@ -259,6 +313,13 @@ fn every_recording_api_matches_the_declared_schema() {
#[test]
fn admin_gauge_initialization_never_emits_mcp_only_series() {
if route_to_child(
"admin_api",
"admin_gauge_initialization_never_emits_mcp_only_series",
) {
return;
}
bind(MetricService::AdminApi);
let recorder = DebuggingRecorder::new();
let snapshotter = recorder.snapshotter();
metrics::with_local_recorder(&recorder, || {