Skip to content

Sort current-workflow activities by execution order#15

Open
nomis52 wants to merge 2 commits into
masterfrom
worktree-activities-execution-order
Open

Sort current-workflow activities by execution order#15
nomis52 wants to merge 2 commits into
masterfrom
worktree-activities-execution-order

Conversation

@nomis52

@nomis52 nomis52 commented Jul 7, 2026

Copy link
Copy Markdown
Owner

Problem

On the web UI's Current Workflow tab, activities appeared in a seemingly random order — they were actually sorted alphabetically by activity type name, which bears no relation to the order activities ran.

Fix

Sort by execution order (start_time) client-side, since the browser already has start_time on every activity. The API keeps its existing stable output; ordering is a display concern handled at render time.

  • New sortByExecutionOrder(executions) helper in server/static/index.html, applied in both the current-workflow tab and the history detail view.
  • Started activities sort by start_time; not-yet-started / skipped activities (no or zero start time) sort last, by type.
  • Uses Date.parse rather than lexicographic string comparison so mixed fractional-second timestamps order correctly.

Testing

  • go build ./... and go test ./server/runner/ pass (Go code unchanged).
  • Ran the JS helper through node against by-time / not-started-last / fractional-seconds / ties cases — all correct.

🤖 Generated with Claude Code

nomis52 and others added 2 commits July 7, 2026 19:31
The current workflow tab rendered activities in whatever order
buildActivityExecutions produced, which was alphabetical by activity
type name (the results come from a Go map, then were sorted by Type).
That bears no relation to the order activities actually ran, so the
list looked arbitrary to users.

Sort by StartTime instead so the list reflects execution order.
Activities that never started (pending/not-started/skipped) have a zero
StartTime and sort last, ordered by type for stable output; ties from
parallel activities with identical start times also fall back to type.

Extract the comparator into sortByExecutionOrder and unit-test it.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Revert the server-side sort change: the API now leaves activity ordering
to the client (it keeps its existing stable alphabetical-by-type output),
and the web UI sorts by execution order at render time using the
start_time already present on each activity.

Applied in both the current-workflow tab and the history detail view via
a shared sortByExecutionOrder helper. Started activities sort by
start_time; not-yet-started/skipped activities (no or zero start time)
sort last, by type. Uses Date.parse rather than lexicographic string
comparison so mixed fractional-second timestamps order correctly.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@nomis52
nomis52 marked this pull request as ready for review July 7, 2026 12:18
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