One step

mission-step

Ask for the next task, or repair a red health check. Then make a kitchen, run task-work, and merge to master.

This routine has no Ganda command. A parent routine runs it.

TaskRepairCompleteTask

Select a node, or run the path that the host uses.

How you write it

You write the routine in C#. Each call adds one node. Build makes the intermediate representation.

return Routine.Named(RoutineId)
  .Compute("kind", new Func<object?, StepKind>(_ => step.Kind))
  .Switch<StepKind>(kind => kind
    .When(StepKind.Task, task => task
      .Oracle<Next>("next", schema: "Next.ClosedEnum", pack: Pack.Mission, budget: Budget.Small)
      .Switch<Next>(sw => sw
        .When(Next.Complete, then => then
          .Compute("done-marker", new Func<object?, StepState>(_ => step)))
        .When(Next.Task, then => then
          .Compute("mint", new Func<object?, StepState>(_ => minted))
          .Compute("task-work", new Func<object?, Task<StepState>>(_ => WalkTaskAsync(minted)))
          .Compute("merge", new Func<object?, StepState>(_ => minted)))))
    .When(StepKind.Repair, "mint"))
  .Build();

The file is source/timewarp-taratibu/routines/mission-step/mission-step.cs. Taratibu master 53de8c4.

Why this shape

walk-mission runs this routine one time for each step. Then the same switch label does not appear two times in one run. The cycle check stays quiet. The intermediate representation is the same for each step. The host gives each compute node the state for that step.

What you get

  • kind is a compute node. The host already chose Task or Repair in Mission.Evaluate. The model does not vote on Repair.
  • next reads the mission text, a short board text, and the Results of the last task. The pack name is Pack.Mission. next writes a brief, or it says Complete. next does not choose the next node.
  • The host continues the child gate on task-work. stacked-task-set continues a child gate in the same way. The merge to master is a decision in the design.

Rules

  • This graph has no gate.
  • Next.Task makes a normal kanban task. That task has no parent.
  • Next.Complete goes to done-marker. Then the mission loop stops.
  • If next is Blocked, this step stops and the mission above it stops. There is no Blocked line. The mark for this rule is ParksOnBlocked.

This routine starts

The drawing follows the D2 file in the repo. Node ids do not change. Ganda connects the commands. Ganda does not change the graph.