Allow while and until repeat without a condition

Merged
RY
1mo ago
+68-34

Summary

repeat_policy with repeat: until or repeat: while and no condition or exit_code failed validation, even though spec 075 defines it (until repeats until the attempt succeeds, while repeats while it succeeds) and the runtime already handles it in evalUntilCondition / evalWhileCondition. This removes the validator check so the spec, the validator and the runtime agree.

Changes

  • Remove the "requires either 'condition' or 'exit_code'" check from buildStepRepeatPolicy (internal/spec/step.go)
  • Turn the while/until no-condition cases in builder_test.go and step_test.go from error cases into success cases
  • Add a spec 075 conformance case: an until step with no condition that fails once, repeats, and succeeds on the second attempt (the repro from the issue)
  • Add a spec 075 conformance case for while with no condition: a step that succeeds repeats until the limit

Related Issues

Closes #3250

Checklist

  • Code follows the project style guidelines
  • Self-review of the code has been performed
  • Tests have been added or updated as needed
  • Documentation has been updated as needed (the spec already describes this behavior)
  • Changes have been tested locally

Tested with go test ./internal/spec/... ./internal/runtime/, go test -run TestRepeatPolicy ./internal/intg/, and the spec075_repeat_policy conformance tests against a freshly built binary. All pass. On a root container, TestRunner_ErrorHandling/SetupError fails on main too (root can create /nonexistent/...), so I skipped that one subtest there.