In this section: Hands-On Examples

Chapter 5 UMA code example

Post fetcher runtime tutorial

This tutorial shows what the UMA runtime layer owns around a pure service: validation, adapter selection, deterministic event ordering, and lifecycle evidence.

Tutorial route

Use the links below to move through the tutorial sequence without dropping to the footer first.

What you will learn

  • what belongs in service logic versus runtime logic
  • why validation should stop execution before side effects happen
  • how lifecycle metadata records the network.fetch adapter binding

Prerequisites

  • Rust 1.77 or newer
  • cargo
  • jq
  • Node.js and npm for TypeScript parity

Full tutorial

  1. Enter the example
    cd chapter-05-post-fetcher-runtime
  2. List the guided labs
    ./scripts/list_labs.sh
  3. Run the golden cloud host path
    ./scripts/run_lab.sh lab1-cloud-golden-path
  4. Run fail-fast header validation
    ./scripts/run_lab.sh lab2-header-validation-fail-fast
  5. Inspect adapter binding and wrappers
    ./scripts/run_lab.sh lab3-adapter-binding-and-wrappers
  6. Verify Rust and TypeScript parity
    ./scripts/run_lab.sh lab4-rust-ts-parity
  7. Run the chapter smoke path
    ./scripts/smoke_runtime_labs.sh

What to inspect

After each command, look for these proof points. They are the signals that connect the code example back to the UMA architecture claim.

  • output.events
  • lifecycle.bindings
  • final lifecycle.state

Acceptance check

The chapter-level validation path is:

./scripts/smoke_runtime_labs.sh

Return to the repository root for the final acceptance gate:

cd ..
./scripts/smoke_reader_paths.sh

Where to go next

Chapter 6 proves portability across native and WASI targets.