Skip to content

[plan] Add dynamic progress updates to long-running spinner operations #5104

Closed

Description

@github-actions

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:

  1. Download operations (downloadRunArtifacts):

    • Show download progress percentage
    • Display bytes downloaded / total size
    • Update message as download progresses
  2. Cancellation operations (cancelWorkflowRuns):

    • Show count of runs cancelled
    • Display "Cancelling runs... (3/10 completed)"
    • Update after each successful cancellation
  3. Retry operations (getLatestWorkflowRunWithRetry):

    • Show retry attempt number
    • Display "Waiting for run... (attempt 2/5)"
    • Include elapsed time

Implementation Strategy

  1. Identify operations with measurable progress
  2. Add spinner.UpdateMessage() calls within operation loops
  3. Include relevant metrics (counts, percentages, sizes, attempts)
  4. Ensure updates don't add significant performance overhead

Files to Modify

  • pkg/cli/ files containing:
    • downloadRunArtifacts - Add download progress
    • cancelWorkflowRuns - Add cancellation count
    • getLatestWorkflowRunWithRetry - 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

AI generated by Plan Command for discussion #5094

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions