beginStep function
Opens a step under the active context (plugin tier).
Runners that wrap framework hooks close the handle themselves. Without an active pin the handle is a no-op, so a step on an unpinned context is dropped rather than throwing.
Implementation
StepHandle beginStep(String title) {
final ctx = getContext();
if (ctx == null) return StepHandle._noop();
final parent = ctx._currentStep;
final node = _StepNode(
id: ctx._nextStepId,
section: ctx.section,
action: _emptyPmDoc(title),
expectation: _emptyPmDoc(''),
parent: parent,
parentId: parent?.id,
);
ctx._nextStepId++;
if (parent != null) {
parent.children.add(node);
} else {
ctx._roots[ctx.section]?.add(node);
}
ctx._stepStack.add(node);
return StepHandle._(ctx, node);
}