Contract Authoring · Lesson 01 of 04
Tasks, workflows, and dependencies
Define tasks with explicit commands, declare dependencies between them, and understand how Ota resolves the execution order.
Learning objectives
- Write a minimal valid task definition
- Declare a task dependency chain
- Explain how Ota rejects cycles
Prerequisites
Tasks are named units of repository execution. Dependencies and workflows compose those units into an ordered closure. The contract should prefer Ota's structured task bodies when they express the truth and use shell only when shell semantics are genuinely required.
Choose the truthful task body
Use command for one finite executable and argument vector, launch for a long-running process, prepare for typed setup, aggregate for task grouping, and run or script only for shell-shaped work. A task normally owns one body.
tasks: setup: command: exe: npm args: [ci] effects: writes: [node_modules] network: true network_kind: dependency_hydration test: depends_on: [setup] command: exe: npm args: [test, --, --runInBand]Closure, not command spelling
Selecting test also selects its reachable dependencies and hooks. Admission, policy, agent safety, replay inputs, and proof must evaluate that complete closure. Ota rejects unknown references and dependency cycles rather than guessing execution order.
Model a two-stage verification lane
A repository installs dependencies before every test run and CI must use the same order.
- Declare setup with its writes and network posture.
- Declare test with depends_on: [setup].
- Run ota validate, then inspect ota run --dry-run --json test.
Completion criteria
- Validation passes.
- The dry-run selected closure contains setup before test.
Exercise boundary: A dry-run proves selection and admission only. It does not prove dependency installation or tests completed.
Canonical terminology
Commands and expected output
ota validateEvidence boundary for this lesson
Establishes
- The worked examples establish the lesson's canonical Ota distinctions for its stated scope.
Does not establish
- Reading the lesson does not validate a repository, execute its tasks, or establish organizational acceptance.
Knowledge check
Why does Ota evaluate a task dependency closure instead of only the requested command?
Dependencies and hooks can add requirements, effects, policy, or unsafe work. Admission and evidence would be bypassable if they inspected only the entrypoint.