Skip to content

Add counted repeat and value conditions on when - #164

Merged
bitomule merged 1 commit into
mainfrom
worktree-t-mav-155-flow-control
Dec 3, 2026
Merged

bitomule merged 1 commit into
mainfrom
worktree-t-mav-155-flow-control

Conversation

@bitomule

@bitomule bitomule commented Dec 2, 2026

Copy link
Copy Markdown
Owner

Closes #155.

What changes

  • repeat: { times: N, do: [...] } runs a block a fixed number of times, so flows no longer unroll "do this three times" by hand.
    • times is 1-1000, or a binding such as ${params.n} (a binding may be 0, which runs nothing). Out-of-range or non-numeric values fail with repeat_times_invalid.
    • do follows the same rules as when/whileNotVisible (no open or exec children). Repeats nest and can hold when steps.
    • A failing child stops the loop; the fail line carries iteration, child_step, child_action. The trail records every child as repeat.<action> with its iteration; skipped optional children are counted in skipped_children.
  • when accepts equals / notEquals (exactly two strings each) to branch on a value bound by exec or extract, e.g. when: { equals: ["${exec.item.exists}", "false"] }.
    • Exact string comparison. A missing binding fails the step (exec_binding_missing / exec_json_path_missing) rather than comparing as empty.
    • Comparisons alone never read the accessibility tree; combined with visible/text/id/value/any, both must hold.
  • mav flow lint accepts a when that only has comparisons.
  • README, skills/mav/SKILL.md and an Unreleased CHANGELOG entry document the syntax. No release is cut.

The change is local: new flow_control.go, small hooks in flow.go, flow_lint.go and cli.go (dispatch, header substitution, one call in the when executor).

Validation

  • make check passes on the rebased tree.
  • New tests in flow_control_test.go cover parsing and refusals, lint, run-time counting, nesting, bindings as times, first-failure behavior, skipped optional children, branching on exec values, no screen read for value-only when, combined conditions and missing bindings.
  • Mutation check: making comparisons always pass and shifting the loop bound by one fails 6 of the new tests; reverted, they pass.

@bitomule
bitomule force-pushed the worktree-t-mav-155-flow-control branch from 615cd9f to b8e9aaf Compare December 2, 2026 23:49
@bitomule
bitomule force-pushed the worktree-t-mav-155-flow-control branch 4 times, most recently from 6f0e45b to 192612f Compare December 3, 2026 10:07
@bitomule
bitomule force-pushed the worktree-t-mav-155-flow-control branch from 192612f to 22e3f40 Compare December 3, 2026 10:17
@bitomule
bitomule merged commit 44b6152 into main Dec 3, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Flow control: counted repeat and conditions on bindings

1 participant