Skip to content

Conversation

@hwbrzzl
Copy link
Contributor

@hwbrzzl hwbrzzl commented Jan 31, 2026

Greptile Overview

Greptile Summary

Enhanced spinner message handling to normalize multiline messages by trimming whitespace and joining with spaces, and added HTTP client mock support to the testing framework.

Changes

  • process/running.go: Improved spinner UX by normalizing multiline messages - splits on newlines, trims each line, and joins with single spaces
  • testing/mock/mock.go: Added Http() factory method returning *mockshttpclient.Factory to enable HTTP client mocking in tests

Both changes are straightforward improvements with no breaking changes or security concerns.

Confidence Score: 5/5

  • This PR is safe to merge with no concerns
  • Both changes are well-isolated improvements with clear intent - the spinner optimization improves UX by handling multiline messages cleanly, and the HTTP mock addition follows existing patterns perfectly
  • No files require special attention

Important Files Changed

Filename Overview
process/running.go Added multiline message normalization to spinner - splits on newlines, trims spaces, and joins with single space
testing/mock/mock.go Added Http() mock factory method for HTTP client testing with proper import

Sequence Diagram

sequenceDiagram
    participant User
    participant Running
    participant spinner
    participant collect
    participant huhspinner

    User->>Running: Call method that triggers loading
    Running->>Running: spinner(ctx, loading, loadingMessage, fn)
    
    alt loading is false
        Running->>Running: Execute fn() directly
        Running-->>User: Return result
    else loading is true
        Running->>spinner: Process message
        spinner->>spinner: strings.Split(message, "\n")
        spinner->>collect: Map(messageSlice, TrimSpace)
        collect-->>spinner: Trimmed message slice
        spinner->>spinner: strings.Join(messageSlice, " ")
        spinner->>huhspinner: New().Title(message).Style().TitleStyle()
        spinner->>huhspinner: Context(ctx).Action(fn)
        huhspinner->>huhspinner: Run()
        huhspinner-->>spinner: Result
        spinner-->>Running: Return result
        Running-->>User: Return result
    end
Loading

@hwbrzzl hwbrzzl requested a review from a team as a code owner January 31, 2026 01:05
@codecov
Copy link

codecov bot commented Jan 31, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 70.00%. Comparing base (7135899) to head (0560afa).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1362   +/-   ##
=======================================
  Coverage   69.99%   70.00%           
=======================================
  Files         284      284           
  Lines       17709    17714    +5     
=======================================
+ Hits        12396    12401    +5     
  Misses       4777     4777           
  Partials      536      536           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@hwbrzzl hwbrzzl merged commit 869f116 into master Jan 31, 2026
19 of 22 checks passed
@hwbrzzl hwbrzzl deleted the bowen/optimize-process-spinner branch January 31, 2026 01:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants