#!/usr/bin/env bash set -euo pipefail active_log="" cleanup() { if [[ -n "$active_log" ]]; then rm -f -- "$active_log" fi } trap cleanup EXIT run_atdd() { local description="$1" shift active_log="$(mktemp)" if cargo test "$@" >"$active_log" 2>&1; then if ! grep -Eq '^test result: ok\. [1-9][0-9]* passed' "$active_log"; then cat "$active_log" >&2 printf 'ATDD command selected zero passing tests: %s\n' "$description" >&2 return 1 fi grep '^test result:' "$active_log" rm -f -- "$active_log" active_log="" return 0 fi cat "$active_log" >&2 printf 'ATDD command failed: %s\n' "$description" >&2 return 1 } # Keep Story 3.16 prompt ATDD with Story 3.17 completion and its bound-template regression. run_atdd "MCP prompt composition" -p mcp-server --test integration mcp_prompts::composition -- --test-threads=1 run_atdd "MCP completion" -p mcp-server --test integration mcp_completion -- --test-threads=1 run_atdd "bound template resources/list regression" -p mcp-server --test integration static_resources::list::list_stays_available_when_a_published_template_is_bound -- --test-threads=1 # Story 3.18: safe structured logging — the closed level vocabulary, the endpoint ATDD, and the # capability projection the `logging` surface changes. run_atdd "MCP log level vocabulary" -p crank-community-mcp --lib protocol::logging -- --test-threads=1 run_atdd "MCP safe logging" -p mcp-server --test integration mcp_logging -- --test-threads=1 run_atdd "capability inventory projection" -p mcp-server --test integration inventory_projection -- --test-threads=1 # Story 3.19 (FR-19) and Story 3.5 (FR-14): a committed Resource/Prompt/Tool catalog change is # announced to the client that asked for the signal, in both revisions, and the authoritative list # methods (including `tools/list`) stay the recovery path. The advertisement projection is covered by # the `inventory_projection` entry above. run_atdd "Resource/Prompt/Tool change signals" -p mcp-server --test integration mcp_signals -- --test-threads=1 run_atdd "change signal wire oracles" -p crank-community-mcp --lib protocol::signals -- --test-threads=1 run_atdd "capability advertisement registry" -p crank-community-mcp --lib protocol::registry -- --test-threads=1 # Story 3.4 (FR-14): progress and cancellation of one synchronous tools/call, on both supported # revisions. The lifecycle bounds (token vocabulary, monotonic bounded queue, pinned frame shape, # cancellation ownership) are unit-level; the end-to-end behaviour (real progress stream, no token, # malformed/oversized/reused token, owner/foreign/late cancellation, ambiguous outbound, client # smoke) runs against the real endpoint, a real published catalog and a real counted upstream. run_atdd "tool call lifecycle bounds" -p crank-community-mcp --lib app::lifecycle -- --test-threads=1 run_atdd "tool call progress and cancellation" -p mcp-server --test integration tools_lifecycle -- --test-threads=1 # Story 4.1 (FR-21, FR-24): a published Tool execution policy and one authoritative admission gate. # The policy/JSON contract and the fair-scheduler arithmetic are unit-level; the authoritative store # (scoped permits, bounded queue, typed overload, durable decisions, version pinning, fail-closed # health) and the runtime wiring (one shared global budget across executors, typed refusals with no # outbound call, adaptive/synchronous fallback) run against a real PostgreSQL schema. run_atdd "execution policy contract" -p crank-core --lib operation::tests::execution_policy -- --test-threads=1 run_atdd "admission scheduler bounds" -p crank-core --lib admission:: -- --test-threads=1 run_atdd "execution policy validation" -p admin-api --lib operation_validation::tests:: -- --test-threads=1 run_atdd "execution admission store" -p crank-registry --test integration admission:: -- --test-threads=1 run_atdd "runtime admission budget" -p mcp-server --test admission_budget -- --test-threads=1 run_atdd "admission readiness" -p admin-api --lib routes::tests::readiness_checks -- --test-threads=1 # Story 4.2 (FR-22, FR-23): durable background Tasks. The lifecycle/envelope bounds are unit-level; the # authoritative store (one-transaction acceptance, replay/typed conflict, shared bounded capacity, # Task-linked intent guard, terminal CAS, retention, scope isolation, fail-closed health) and the # application entry (verified principal, exact publication pin, foreign-scope denial, readiness) run # against a real PostgreSQL schema. The migration suite proves a fresh and an already-migrated v25. run_atdd "durable task domain bounds" -p crank-core --lib task:: -- --test-threads=1 run_atdd "runtime task identity" -p crank-runtime --lib tasks:: -- --test-threads=1 run_atdd "durable task store" -p crank-registry --test integration tasks:: -- --test-threads=1 run_atdd "durable task application entry" -p mcp-server --test integration durable_tasks:: -- --test-threads=1 run_atdd "durable task migration" -p crank-registry --test integration migrations:: -- --test-threads=1 # Story 4.3 (FR-22, FR-23): fenced durable Task execution. The Story 4.2 selectors above already run # the lease/fencing/recovery store, the Task application entry and the migration guards; these two # oracles bound the rest of this story's AC: the process-level shutdown ordering (signal stops new # claims before a slow HTTP drain, not after it) and one child attempt span per adapter retry. run_atdd "task worker process shutdown" -p mcp-server --bin mcp-server -- --test-threads=1 run_atdd "durable task retry attempt spans" -p crank-runtime --test stages retry -- --test-threads=1 # Story 4.4 (FR-22, FR-23): safe retries, cancellation and outcome_unknown. No new selector is added # here on purpose: the Story 4.2 lines above already run `crank-core --lib task::` (attempt/retry # bounds), `crank-registry --test integration tasks::` (checkpoint, resolution, cancel and recovery # CAS) and `mcp-server --test integration durable_tasks::` (application → PG → worker attempts, # cancellation through the application entry and the composition oracles). Duplicating one of them # here would only run the same bounded set twice. # Story 4.5 (FR-25): input continuation. No new selector is needed: the Story 4.2 lines # above run `crank-core --lib task::` (input request bounds), `crank-registry --test # integration tasks::` (store/tasks suites) and `mcp-server --test integration # durable_tasks::` (the full application -> worker -> PG -> counted upstream input # continuation ATDD, including TTL/replay/conflict/scope races). Duplicating them here # would only run the same bounded set twice. # Isolated rmcp #106: real loopback HTTP Tools oracle, plus manager/handler contracts. run_atdd "isolated rmcp Tools adapter" --locked -p crank-community-mcp --lib rmcp_ -- --test-threads=1