One ranked row
campaign-slice
Check the scope of the brief. Make a child task. Run task-work. Merge that task onto the feature branch. Then run the checkpoint.
This routine has no Ganda command. A parent routine runs it.
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("scope-check", new Func<object?, Scope>(
_ => CheckScope(slice.Row?.Id, slice.RankedRows, slice.Kitchen, campaign.FrozenPaths)))
.Switch<Scope>(sw => sw
.When(Scope.InScope)
.When(Scope.OutOfScope, then => then
.Gate("human-scope")))
.Compute("mint", new Func<object?, SliceState>(_ => slice))
.Compute("task-work", new Func<object?, Task<SliceState>>(_ => WalkTaskAsync(slice)))
.Compute("merge-feature", new Func<object?, SliceState>(_ => slice))
.Compute("checkpoint", new Func<object?, Checkpoint>(
_ => DecideCheckpoint(slice.SliceNumber, slice.Remaining.Count, campaign.SliceBudget, campaign.CheckpointEvery)))
.Switch<Checkpoint>(sw => sw
.When(Checkpoint.Continue, then => then
.Compute("next-slice", new Func<object?, SliceState>(_ => slice)))
.When(Checkpoint.Review, then => then
.Compute("batch-review", new Func<object?, Task<BatchReview.BatchReviewState>>(_ => ReviewAsync(slice))))
.When(Checkpoint.Stop, then => then
.Compute("halt", new Func<object?, SliceState>(_ => slice))))
.Build();The file is source/timewarp-taratibu/routines/campaign-slice/campaign-slice.cs. Taratibu master 53de8c4.
Why this shape
human-scope must be a real gate. That gate can stop the campaign. A slice is its own routine for that reason. Scope is a compute node. The row can be out of scope in two cases. The row is not on the ranked list. Or ## Files names a frozen path that the row does not contain.
What you get
- Frozen paths are a host rule for each repo. A / at the end of a path is a prefix. The model does not make the freeze list.
- checkpoint is a compute node. It can continue, run batch-review, or stop. A stop comes from the budget or from red health.
- Each slice starts on the feature branch. Each slice merges back onto that branch.
Rules
- If the result is OutOfScope, the host stops at human-scope. After the gate, the host still makes the task.
- If the result is InScope, the host makes the task at once.
- Review at the checkpoint runs the child routine batch-review. Findings can add fix rows at the top of the list. Then the loop continues.
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.