PR 6: Add expect field to engine for command step assertions - #44
Merged
Conversation
New `expect` field on command steps: - `expect: failure` — step fails if exit code is 0 (bug not reproducible) - `expect: success` (default) — non-zero exit is informational Enables bugfix reproduction gates: repro must fail before fix, pass after. Validated only on command steps. - src/engine/workflow.go: Add Expect field to WfStep, validation - src/engine/engine.go: Check expect condition after command execution - src/engine/engine_test.go: 6 new tests (parse, validate, runtime) - skills/creating-workflows: Document expect field
Review consensus: expect: success must fail on non-zero exit (symmetric with expect: failure failing on zero exit). Default (no expect) remains informational. - engine.go: Add expect:success check (fail on non-zero) - engine.go: Fix fmt.Sprintf with no format args - engine_test.go: Add expect:success pass/fail tests, strengthen expect:failure test with output assertion - creating-workflows SKILL.md: Update docs for symmetric semantics
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Engine enhancement from the deterministic workflow conversion project.
Adds an
expectfield to command steps that controls exit code semantics:success(default)failureUse case: Bugfix reproduction gates. The repro step must fail (bug exists) before the fix step runs, then the verify step must succeed (bug fixed).
Changes
src/engine/workflow.go— AddExpectfield toWfStep, validation (command-only, success/failure values)src/engine/engine.go— Check expect condition after command executionsrc/engine/engine_test.go— 6 new tests covering parse, validate, and runtime behaviorskills/creating-workflows/SKILL.md— Document the expect fieldTest results
All existing tests pass. 6 new tests added.
Test plan
expect: failurewith non-zero exit → step succeeds (repro confirmed)expect: failurewith zero exit → step fails with "expected failure" errorexpectfield → default behavior unchanged (non-zero is informational)expecton prompt step → validation errorexpect: maybe→ validation error (invalid value)go test ./...passes