Skip to content

PR 6: Add expect field to engine for command step assertions - #44

Merged
5uck1ess merged 2 commits into
mainfrom
feat/deterministic-pr6-engine
Apr 10, 2026
Merged

PR 6: Add expect field to engine for command step assertions#44
5uck1ess merged 2 commits into
mainfrom
feat/deterministic-pr6-engine

Conversation

@5uck1ess

Copy link
Copy Markdown
Owner

Summary

Engine enhancement from the deterministic workflow conversion project.

Adds an expect field to command steps that controls exit code semantics:

- id: repro
  command: "npm test"
  expect: failure  # step fails if exit code is 0
Value Behavior
success (default) Non-zero exit is informational, output captured
failure Step fails if exit code is 0 (command unexpectedly succeeded)

Use 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 — Add Expect field to WfStep, validation (command-only, success/failure values)
  • src/engine/engine.go — Check expect condition after command execution
  • src/engine/engine_test.go — 6 new tests covering parse, validate, and runtime behavior
  • skills/creating-workflows/SKILL.md — Document the expect field

Test results

ok  github.com/5uck1ess/devkit/engine  1.720s
ok  github.com/5uck1ess/devkit/loops   4.047s

All existing tests pass. 6 new tests added.

Test plan

  • expect: failure with non-zero exit → step succeeds (repro confirmed)
  • expect: failure with zero exit → step fails with "expected failure" error
  • No expect field → default behavior unchanged (non-zero is informational)
  • expect on prompt step → validation error
  • expect: maybe → validation error (invalid value)
  • Full suite: go test ./... passes

5uck1ess added 2 commits April 9, 2026 20:01
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
@5uck1ess
5uck1ess merged commit c30f6bf into main Apr 10, 2026
3 checks passed
@5uck1ess
5uck1ess deleted the feat/deterministic-pr6-engine branch April 10, 2026 00:06
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.

1 participant