morphir-mck

Install and use morphir-mck, the Morphir Compatibility Kit .NET runner

Morphir Compatibility Kit runner (morphir-mck)

morphir-mck is the .NET runner for the Morphir Compatibility Kit (MCK). It provides the MCK vNext commands (check, prepare, run, verify, render) as well as the wasm-host and bounded-generation runners.

Installation

Install Morphir.Mck globally from NuGet (requires the .NET SDK / runtime):

dotnet tool install --global Morphir.Mck --prerelease
morphir-mck --help

Or install it locally in a repository using a .NET tool manifest:

dotnet new tool-manifest   # if you do not already have .config/dotnet-tools.json
dotnet tool install Morphir.Mck --prerelease
dotnet tool run morphir-mck -- --help

Once morphir-mck is on PATH, the Morphir CLI delegates morphir mck <args> to it automatically:

morphir mck --help
morphir mck check path/to/kit

See mck for how morphir mck locates morphir-mck (MORPHIR_MCK and PATH resolution).

Build from source

Build Morphir.Mck with the .NET SDK pinned in global.json:

dotnet build src/Morphir.Mck/Morphir.Mck.csproj -c Release
dotnet exec src/Morphir.Mck/bin/Release/net11.0/morphir-mck.dll --help

Keep the complete build output together. The product CLI can forward to the development apphost when MORPHIR_MCK names its absolute path. Use the .exe on Windows and the executable without that suffix on macOS or Linux.

MCK vNext commands

All MCK vNext commands follow the CLI stream and exit-code contract:

  • stdout: command output only (JSON report, JSON summary, or written path)
  • stderr: diagnostics and progress messages
  • Exit codes: 0 = valid / qualified success, 1 = validation, verification, or execution failure (or unqualified report), 2 = CLI usage error (writes no report)

morphir-mck check <path>

Validates .mck files, directives, capability vocabulary membership, and confined fixture references offline without executing any target.

morphir-mck check spec/mck/vnext/ir/values.mck
morphir-mck check spec/mck/vnext/ir --vocab spec/mck/capabilities.toml --json
Argument / OptionRequiredDescription
<path>YesPath to a .mck file or kit directory to check.
--vocab <path>NoOptional path to a capabilities.toml vocabulary registry.
--jsonNoEmit structured JSON summary to stdout.

morphir-mck prepare

Materializes cases matching an explicit claims file (claims.toml or claims.json) into raw input files under <out>/in/<caseId>/... and a path-only <out>/index.json with all #!expect blocks stripped. Prints the path to index.json on stdout.

morphir-mck prepare --kit spec/mck/vnext/ir --claims claims.toml --out .mck-work
OptionRequiredDescription
--kit <path>YesPath to the .mck kit file or directory.
--claims <path>YesPath to the claims.toml or claims.json file.
--out <dir>YesOutput workspace directory for index.json and in/.
--vocab <path>NoOptional path to a capabilities.toml vocabulary registry.

morphir-mck run

Runs kit drivers against an explicit target executable or WASM extension module, or wraps the inverted-control prepare → external command → verify flow. Prints the report.json payload to stdout.

Specify exactly one of --target, --wasm, or --exec:

# Embedded JS driver against a CLI executable
morphir-mck run \
  --kit spec/mck/vnext/runtime \
  --claim runtime.cli.compile-json \
  --target /abs/path/to/morphir \
  --out .mck-work \
  --report report.json

# Embedded JS driver against a MEP extension executable (claims projected from describe when omitted)
morphir-mck run \
  --kit spec/mck/vnext/mep \
  --target /abs/path/to/extension \
  --out .mck-work \
  --report report.json

# Embedded JS driver against an in-process WASM extension module
morphir-mck run \
  --kit spec/mck/vnext/mep \
  --wasm /abs/path/to/extension.wasm \
  --out .mck-work \
  --report report.json

# Inverted-control wrapper (prepare -> external binding harness with MCK_WORK_DIR -> verify)
morphir-mck run \
  --kit spec/mck/vnext/ir \
  --claims claims.toml \
  --out .mck-work \
  --exec "cargo test --test mck" \
  --report report.json
OptionRequiredDescription
--kit <path>YesPath to the .mck kit file or directory.
--claims <path>ConditionalPath to claims.toml or claims.json (optional for MEP targets that answer describe, or when --claim is supplied).
--claim <id>NoExplicit included capability ID (repeatable).
--exclude-claim <id>NoExplicit excluded capability ID (repeatable).
--target <path>One of 3Path to target executable for embedded driver execution.
--target-arg <arg>NoArgument passed to --target (repeatable).
--wasm <path>One of 3Path to WASM extension module for in-process MEP execution.
--exec <command>One of 3Convenience wrapper: run external binding command (MCK_WORK_DIR set) between prepare and verify.
--out <dir>NoWorkspace directory for materialized inputs, actual outputs, and observations.json (defaults to a temporary directory).
--report <path>NoOptional path to write report.json.
--check-underclaimsNoProbe and report passing unclaimed cases as under-claims.
--vocab <path>NoOptional path to a capabilities.toml vocabulary registry.

morphir-mck verify

Independently reloads a kit, verifies its SHA-256 kit digest, grades observations.json and actual/ against #!expect blocks, and prints the JSON report to stdout (and optionally writes --report).

morphir-mck verify --kit spec/mck/vnext/ir --work .mck-work --report report.json
morphir-mck verify --kit spec/mck/vnext/ir --work .mck-work --report report.json --check-underclaims
OptionRequiredDescription
--kit <path>YesPath to the .mck kit file or directory.
--work <dir>YesWorkspace directory containing observations.json and actual/.
--report <path>NoOptional path to write report.json.
--check-underclaimsNoGrade observed unclaimed cases and flag passing ones as under-claims.
--vocab <path>NoOptional path to a capabilities.toml vocabulary registry.

morphir-mck render <path>

Renders a .mck file or kit directory (and optional validated report.json) to a standalone offline HTML document. Prints the written output path to stdout.

morphir-mck render spec/mck/vnext/ir/values.mck --output spec.html
morphir-mck render spec/mck/vnext/ir --report report.json --output report.html
Argument / OptionRequiredDescription
<path>YesPath to a .mck file or kit directory.
--output <file.html>YesDestination path for standalone offline HTML.
--report <path>NoOptional validated report.json to overlay onto the living specification.
--vocab <path>NoOptional path to a capabilities.toml vocabulary registry.

Bounded-generation receipt replay

Supply the receipt schema and control file from the parent Morphir repository. The runner checks their exact digests and takes the case expectation from the control file.

$parent = "C:/code/morphir"
morphir-mck bounded-generation report-check `
  --schema "$parent/website/static/schemas/bounded-generation-kit/0.1.0-draft.1/receipt.schema.json" `
  --controls "$parent/spec/mck/bounded-generation/receipt.controls.json" `
  --receipt "./receipt.json"

The command prints one JSON document with separate correctness and resource decisions. Exit 0 means both decisions passed. Exit 1 means the receipt was refused or one of the decisions failed or did not run. Exit 2 means a usage or local input error. --controls replays the frozen synthetic case. Collect execution and resource evidence separately.

Use morphir-mck wasm-host run --help and morphir-mck wasm-host report-check --help for the crafted WASM host worker commands.

Real orders scale A/B receipts

Replace --controls with --scale-cases to replay a real scale receipt:

morphir-mck bounded-generation report-check `
  --schema "$parent/website/static/schemas/bounded-generation-kit/0.1.0-draft.1/receipt.schema.json" `
  --scale-cases "./orders-scale.cases.json" `
  --receipt "./orders-scale-a.receipt.json"

Supply exactly one of --controls and --scale-cases. The scale case source is pinned to SHA-256 cde3dc58b49c229bac45af57126c2aa8b2f62c6e06766c84dd7f99bb8b0c4910 from finos/morphir PR #1198, head 305623ec52a96868a5a2e9cac7e80951b6030f73. Whitespace or other byte changes are refused. The receipt’s kit.caseId selects orders-scale/a or orders-scale/b; kit.suiteSha256 must equal that case-file hash, and kit.contractSha256 must match the case source.

Admission checks the case’s fixture scale, expanded input bytes, largest document, WASM execution, complete tuple, target, guest digest and comparison kind. Ordinary optional fixture.modelSha256 and fixture.documentCount must match when emitted. They do not change the published receipt schema. Output expectations come from the pinned case source, never from a receipt’s expected digest.

The existing receipt checker validates shape, contradictions and claimed outcomes, then replays correctness and resources separately. Correct output with missing measurements or unenforced limits can pass correctness while resources stay not-run, yielding exit 1. Replaying a pilot receipt does not collect evidence or qualify resource bounds. The schema and synthetic controls remain unchanged.