Example — operators recipes

Compose fallback_chain or until_ok with small callables that return Ok/Err so behavior is testable offline.

Updated

Use case

Compose fallback_chain or until_ok with small callables that return Ok/Err so behavior is testable offline.

What it demonstrates

  • Operators as pure composition around results.
  • Same types as task runners use (forge_lcdl.result).

Source

examples/operators/fallback_chain_recipe.py

Command

PYTHONPATH=src python3 examples/operators/fallback_chain_recipe.py

fallback_chain takes a sequence of thunks () -> Result; the first Ok wins. See forge_lcdl.operators.

Expected output

Deterministic Ok when the first branch succeeds; no network.

Failure modes

  • Wrong callable arity — match operator docs for seq vs fallback_chain.
  • Swallowed errors — log or assert on Err in tests.

Next steps