Skip to content

fix(git): parse git clone progress as log messages - #799

Merged
skevetter merged 2 commits into
mainfrom
fix/git-clone-progress
Jul 29, 2026
Merged

fix(git): parse git clone progress as log messages#799
skevetter merged 2 commits into
mainfrom
fix/git-clone-progress

Conversation

@skevetter

@skevetter skevetter commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

git clone already runs with --progress (added in #590), but its \r-delimited "Receiving objects: NN% (x/y)" frames were logged verbatim, producing a wall of near-duplicate lines for large clones.

progressWriter splits git's output on \r as well as \n (git overwrites its progress line with \r rather than emitting a new one), logs percentage updates thinned to one per 10 points, and passes any other line through unchanged.

Rebased off main directly — no longer stacked on #798, and doesn't depend on its status/Reporter model. Progress is logged directly via pkg/log instead of routed through a shared reporter abstraction, so this can merge independently.

Summary by CodeRabbit

  • New Features

    • Improved Git clone progress reporting by displaying meaningful updates at regular intervals.
    • Reduced duplicate and overly frequent progress messages for a cleaner output experience.
  • Bug Fixes

    • Preserved informational messages and trailing output during Git operations, including progress updates split across lines.

@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Adds a buffered git progress writer that parses carriage-return and newline output, suppresses duplicate or intermediate progress frames, forwards retained lines, and integrates the writer into clone stdout and stderr handling with tests.

Changes

Git progress output handling

Layer / File(s) Summary
Progress writer parsing and validation
pkg/git/progress.go, pkg/git/progress_test.go
Progress output is split, tracked per label, thinned at percentage intervals, and tested alongside passthrough lines, duplicate suppression, and trailing-buffer flushing.
Clone command integration
pkg/git/repo.go
Clone stdout and stderr are routed through the progress writer, which is closed after execution.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant cloneWith
  participant gitRunner
  participant progressWriter
  participant logWriter
  cloneWith->>progressWriter: create from logWriter
  cloneWith->>gitRunner: run clone with filtered stdout/stderr
  gitRunner->>progressWriter: write git progress and informational output
  progressWriter->>logWriter: forward retained lines
  cloneWith->>progressWriter: close and flush buffered output
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: parsing git clone progress and logging it as messages.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@skevetter
skevetter force-pushed the fix/git-clone-progress branch 3 times, most recently from 63333b3 to e9d149c Compare July 28, 2026 22:32
…passthrough

git clone already runs with --progress (added in #590), but its
\r-delimited "Receiving objects: NN% (x/y)" frames were logged
verbatim, producing a wall of near-duplicate lines for large clones.

progressWriter splits on \r as well as \n (git overwrites its progress
line with \r rather than emitting a new one), logs percentage updates
thinned to one per 10 points, and passes any other line through
unchanged.
@skevetter
skevetter force-pushed the fix/git-clone-progress branch from e9d149c to dff17d6 Compare July 28, 2026 23:10
@skevetter
skevetter changed the base branch from feat/async-workspace-up to main July 28, 2026 23:10
@skevetter skevetter changed the title fix(git): report clone progress through structured status events fix(git): parse clone progress into thinned log lines instead of raw passthrough Jul 28, 2026
@skevetter
skevetter marked this pull request as ready for review July 29, 2026 00:10

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
pkg/git/progress_test.go (1)

34-77: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Assert the progress log cadence, not only forwarding suppression.

These tests cannot detect broken throttling because all progress frames are intentionally excluded from out. Capture progress reports and assert the expected 0%, 10%, …, 100% entries and independent labels.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pkg/git/progress_test.go` around lines 34 - 77, Update
TestProgressWriter_ThinsIntermediatePercentages,
TestProgressWriter_DropsExactDuplicateFrame, and
TestProgressWriter_TracksLabelsIndependently to capture progress reports through
the writer’s progress-report mechanism instead of asserting only that out is
empty. Assert the expected throttled 0%, 10%, through 100% cadence, verify exact
duplicate frames are suppressed, and confirm Receiving objects and Resolving
deltas maintain independent progress state.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@pkg/git/progress.go`:
- Around line 30-40: Update progressWriter.Write so a flush failure returns the
number of bytes processed through the current delimiter, not len(p). Track the
delimiter’s index while iterating over p and return its delimiter-inclusive
offset alongside the error; preserve the existing successful return behavior.

In `@pkg/git/repo.go`:
- Around line 265-266: Update the clone flow around newProgressWriter and Run so
pw.Close() is called explicitly after Run, and return its error when the clone
succeeds. Remove the deferred Close that discards the trailing flush failure,
while preserving the clone error when Run fails.

---

Nitpick comments:
In `@pkg/git/progress_test.go`:
- Around line 34-77: Update TestProgressWriter_ThinsIntermediatePercentages,
TestProgressWriter_DropsExactDuplicateFrame, and
TestProgressWriter_TracksLabelsIndependently to capture progress reports through
the writer’s progress-report mechanism instead of asserting only that out is
empty. Assert the expected throttled 0%, 10%, through 100% cadence, verify exact
duplicate frames are suppressed, and confirm Receiving objects and Resolving
deltas maintain independent progress state.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 26d196a9-3f75-47bc-b026-fc9f55a8bedd

📥 Commits

Reviewing files that changed from the base of the PR and between dcb0ace and dff17d6.

📒 Files selected for processing (3)
  • pkg/git/progress.go
  • pkg/git/progress_test.go
  • pkg/git/repo.go

Comment thread pkg/git/progress.go
Comment thread pkg/git/repo.go Outdated
- progressWriter.Write now returns the byte offset through the
  delimiter it flushed at on a flush error, instead of len(p) --
  satisfies the io.Writer contract that n reflects bytes actually
  consumed when err != nil.
- cloneWith now calls progressWriter.Close() explicitly after Run and
  surfaces its error when the clone itself succeeded, instead of
  discarding a trailing-flush failure via a bare deferred Close.
- Progress-writer tests now capture actual log output (via
  pkg/log.AddSink) and assert the real 0/10/.../100 thinning cadence,
  duplicate-frame suppression, and independent per-label state,
  instead of only asserting that percentage frames don't reach `next`.
@netlify

netlify Bot commented Jul 29, 2026

Copy link
Copy Markdown

Deploy Preview for devsydev canceled.

Name Link
🔨 Latest commit 93caac0
🔍 Latest deploy log https://app.netlify.com/projects/devsydev/deploys/6a6946f8eb52a20008b71ad1

@netlify

netlify Bot commented Jul 29, 2026

Copy link
Copy Markdown

Deploy Preview for images-devsy-sh canceled.

Name Link
🔨 Latest commit 93caac0
🔍 Latest deploy log https://app.netlify.com/projects/images-devsy-sh/deploys/6a6946f84098c900088ed18d

@skevetter skevetter changed the title fix(git): parse clone progress into thinned log lines instead of raw passthrough fix(git): parse clone progress as log messages Jul 29, 2026
@skevetter skevetter changed the title fix(git): parse clone progress as log messages fix(git): parse git clone progress as log messages Jul 29, 2026
@skevetter
skevetter merged commit b5be4b9 into main Jul 29, 2026
113 of 115 checks passed
@skevetter
skevetter deleted the fix/git-clone-progress branch July 29, 2026 03:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant