Skip to content

feat(execution): add deterministic step display ordering#342

Merged
pocky merged 1 commit into
mainfrom
feature/F095-execution-order--common-abstraction-for-
May 13, 2026
Merged

feat(execution): add deterministic step display ordering#342
pocky merged 1 commit into
mainfrom
feature/F095-execution-order--common-abstraction-for-

Conversation

@pocky
Copy link
Copy Markdown
Contributor

@pocky pocky commented May 13, 2026

Summary

  • Fix non-deterministic step display in CLI execution summaries — steps were previously iterated from a Go map, producing inconsistent ordering across runs; display now follows the workflow-defined default path (Initial → transitions → OnSuccess)
  • Introduce ExecutionOrder(*Workflow) and NextDefaultStep(*Step) domain functions in graph.go as a single authoritative source for default-path graph traversal, replacing duplicated ordering logic in both CLI and TUI layers
  • Update all CLI display functions (showExecutionDetails, showStepOutputs, showEmptyStepFeedback, buildStepInfos) and the resume command to accept *workflow.Workflow and iterate via ExecutionOrder() instead of direct map access
  • Remove TUI-private orderedSteps/nextStepName helpers and delegate to the new domain functions, eliminating inconsistent parallel implementations

Changes

Domain — Graph traversal

  • internal/domain/workflow/graph.go: Add NextDefaultStep(*Step) (returns next step via unconditional transition, falling back to OnSuccess) and ExecutionOrder(*Workflow) (walk default path from Initial, stop at terminals, cycle-safe)

CLI — Deterministic display

  • internal/interfaces/cli/run.go: Thread *workflow.Workflow into showExecutionDetails, showStepOutputs, showEmptyStepFeedback, buildStepInfos; replace map iteration with ExecutionOrder() loop using thread-safe GetStepState per step
  • internal/interfaces/cli/resume.go: Load workflow from repository after execution; pass to all display helpers replacing previous map-based iteration

TUI — Remove duplicate ordering logic

  • internal/interfaces/tui/tab_monitoring.go: Delete private orderedSteps/nextStepName; delegate to workflow.ExecutionOrder() and workflow.NextDefaultStep()
  • internal/interfaces/tui/tab_monitoring_test.go: Remove tests that validated the now-deleted private TUI ordering helpers

Tests

  • internal/domain/workflow/graph_test.go: Add full unit test suite for NextDefaultStep (nil, default transition precedence, OnSuccess fallback, conditional-only) and ExecutionOrder (linear chains, cycle prevention, terminal stops, parallel steps, value copy safety)
  • internal/interfaces/cli/run_internal_test.go: Update showExecutionDetails, showStepOutputs, showEmptyStepFeedback, buildStepInfos tests to supply *workflow.Workflow; add ordering assertion coverage
  • tests/integration/features/execution_order_determinism_test.go: New integration test suite verifying deterministic step ordering across repeated runs, branching workflows, and parallel step scenarios

Documentation

  • docs/user-guide/commands.md: Document that execution summary steps always appear in workflow-defined order; add annotated example output
  • CHANGELOG.md: Add F095 entry under Unreleased

Project config

  • CLAUDE.md: Refine development pitfall and test convention rules based on lessons from this feature

Test plan

  • Run make test — all unit and integration tests pass, including new execution_order_determinism suite
  • Run make lint — zero violations
  • Execute a multi-step workflow with awf run <workflow> --verbose and confirm --- Execution Details --- steps appear in workflow-defined order, not random map order, across multiple invocations
  • Execute awf resume <id> on a completed workflow and verify execution summary uses the same deterministic ordering

Closes #341


Generated with awf commit workflow

- `CHANGELOG.md`: Document F095 deterministic step display ordering
- `CLAUDE.md`: Update pitfalls and test conventions with new rules
- `docs/user-guide/commands.md`: Document execution summary ordering behavior
- `internal/domain/workflow/graph.go`: Add `ExecutionOrder` and `NextDefaultStep` domain functions for default-path graph traversal
- `internal/domain/workflow/graph_test.go`: Add 460+ lines of unit tests for new graph traversal functions
- `internal/interfaces/cli/resume.go`: Accept `*workflow.Workflow` param and iterate via `ExecutionOrder()`
- `internal/interfaces/cli/run.go`: Update display functions to use domain-level ordering instead of map iteration
- `internal/interfaces/cli/run_internal_test.go`: Add 312+ lines of tests for CLI display helper functions
- `internal/interfaces/tui/tab_monitoring.go`: Replace private `orderedSteps`/`nextStepName` with delegation to domain functions
- `internal/interfaces/tui/tab_monitoring_test.go`: Remove tests for deleted TUI-private ordering logic
- `tests/integration/features/execution_order_determinism_test.go`: Add integration tests verifying deterministic ordering end-to-end

Closes #341
@pocky pocky marked this pull request as ready for review May 13, 2026 12:28
@pocky pocky merged commit 86f5158 into main May 13, 2026
5 checks passed
@pocky pocky deleted the feature/F095-execution-order--common-abstraction-for- branch May 13, 2026 12:29
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.

F095: Execution Order — Common Abstraction for Step Display Ordering

1 participant