Repository navigation
Closed
Labels
Description
Objective
Add dynamic progress updates to spinners for long-running operations to provide better user feedback during execution.
Context
Most spinner messages are static. The spinner library supports UpdateMessage() for dynamic updates, which is already used in one location (listWorkflowRunsWithPagination). Expanding this to other long-running operations will significantly improve UX.
Current Behavior
⠋ Downloading artifacts for run 12345...
[user waits with no progress indication]
Desired Behavior
⠋ Downloading artifacts... (45% - 2.3MB/5.1MB)
⠋ Downloading artifacts... (67% - 3.4MB/5.1MB)
⠋ Downloading artifacts... (89% - 4.5MB/5.1MB)
✓ Downloaded 3 artifacts successfully (5.1MB)
Approach
Add progress updates to key operations:
-
Download operations (
downloadRunArtifacts):- Show download progress percentage
- Display bytes downloaded / total size
- Update message as download progresses
-
Cancellation operations (
cancelWorkflowRuns):- Show count of runs cancelled
- Display "Cancelling runs... (3/10 completed)"
- Update after each successful cancellation
-
Retry operations (
getLatestWorkflowRunWithRetry):- Show retry attempt number
- Display "Waiting for run... (attempt 2/5)"
- Include elapsed time
Implementation Strategy
- Identify operations with measurable progress
- Add
spinner.UpdateMessage()calls within operation loops - Include relevant metrics (counts, percentages, sizes, attempts)
- Ensure updates don't add significant performance overhead
Files to Modify
pkg/cli/files containing:downloadRunArtifacts- Add download progresscancelWorkflowRuns- Add cancellation countgetLatestWorkflowRunWithRetry- Add retry attempt number
Example Implementation
// In download loop
for i, artifact := range artifacts {
progress := float64(i) / float64(len(artifacts)) * 100
downloaded := calculateSize(i)
total := calculateSize(len(artifacts))
spinner.UpdateMessage(fmt.Sprintf("Downloading artifacts... (%.0f%% - %s/%s)",
progress, formatSize(downloaded), formatSize(total)))
// ... download logic ...
}Acceptance Criteria
- Download operations show percentage and size progress
- Cancellation operations show count of completed cancellations
- Retry operations show attempt number and elapsed time
- Progress updates don't significantly impact performance
- Updates are smooth and not overly frequent (rate limit if needed)
- Existing tests pass
References
- Current example:
listWorkflowRunsWithPaginationusage - Spinner UpdateMessage() method documentation
Related to [plan] Improve spinner implementation based on go-fan analysis #5100
AI generated by Plan Command for discussion #5094
Reacted by Copilot
Activity