feat: sort ErrWorkflow output by execution finish order#73
Merged
Conversation
added 11 commits
May 5, 2026 05:57
- ErrWorkflow.Unwrap(): skip nil errors (fixes errors.Is/As correctness) - State.SetStepResult(): atomic write for Status+Err+FinishedAt under one lock - reset(): clear full StepResult (not just Status) to avoid stale FinishedAt - tests: guard strings.Index assertions with require >= 0
…efer SetStepResult
…Error deprecated-only
…s from SetStepResult
xuxife
pushed a commit
that referenced
this pull request
May 7, 2026
docs/superpowers/plans/2026-05-05-errworkflow-execution-order.md and openspec/changes/archive/2026-05-05-errworkflow-execution-order/ were introduced by PR #73 (sort ErrWorkflow by FinishedAt) and merged into main. The previous cleanup commit removed them by mistake — my diff-against-main check listed them as additions on this branch, but they were genuinely on main as well. Restore from 2c88ec2. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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
Fixes #68.
ErrWorkflow.Error()previously iterated amap[Steper]StepResultdirectly, producing non-deterministic output on every run. This makes failure traces hard to read and impossible to diff across runs.FinishedAt time.TimetoStepResult, recorded via the workflow's injectedclock.Clockat step terminationFinishedAtat both termination sites inworkflow.go: the step goroutine defer (running steps) and the condition-skip branch (steps skipped before running)ErrWorkflow.Error()andUnwrap()now sort byFinishedAtascending — earliest-finishing step first, zero-time steps last, tie-break by step name for stabilityTest plan
TestErrWorkflowOutputOrdering— 3-step serial chain (names chosen so alphabetical ≠ execution order), verifies output matches execution orderTestErrWorkflowTieBreakByName— two parallel steps finish at the same mock clock tick, verifies alphabetical tie-breakTestStepResultFinishedAtPopulated— verifiesFinishedAtis non-zero after a step runsgo test ./... -count=1— full suite passes🤖 Generated with Claude Code