Skip to content

fix: make diff snapshot export cancellable#7253

Closed
hanabi1224 wants to merge 1 commit into
mainfrom
hm/make-export-diff-cancellable
Closed

fix: make diff snapshot export cancellable#7253
hanabi1224 wants to merge 1 commit into
mainfrom
hm/make-export-diff-cancellable

Conversation

@hanabi1224

@hanabi1224 hanabi1224 commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Summary of changes

Our ChainStream implementation never returns Poll::Pending so we need some yield point for tokio to decide whether to discard the task. An alternative fix is implemented in #7254
Tested with #7252

Changes introduced in this pull request:

Reference issue to close (if applicable)

Closes

Other information and links

Change checklist

  • I have performed a self-review of my own code,
  • I have made corresponding changes to the documentation. All new code adheres to the team's documentation standards,
  • I have added tests that prove my fix is effective or that my feature works (if possible),
  • I have made sure the CHANGELOG is up-to-date. All user-facing changes should be reflected in this document.

Outside contributions

  • I have read and agree to the CONTRIBUTING document.
  • I have read and agree to the AI Policy document. I understand that failure to comply with the guidelines will lead to rejection of the pull request.

Summary by CodeRabbit

  • Performance
    • Improved responsiveness during export operations by periodically yielding execution while draining large data streams.
  • Bug Fixes
    • Reduced the chance of export tasks monopolizing the scheduler and making the app appear unresponsive during long-running operations.

@hanabi1224 hanabi1224 marked this pull request as ready for review June 29, 2026 14:19
@hanabi1224 hanabi1224 requested a review from a team as a code owner June 29, 2026 14:19
@coderabbitai

coderabbitai Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

In do_export's diff-export path, the stream-draining loop now counts try_next() iterations and yields to Tokio every 128 successful reads.

Changes

Async yield in diff-export stream drain loop

Layer / File(s) Summary
Stream drain loop with yield_now
src/tool/subcommands/archive_cmd.rs
Adds a counter to the try_next() drain loop and inserts tokio::task::yield_now().await every 128 iterations, replacing the prior tight loop.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: making diff snapshot export cancellable.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
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.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch hm/make-export-diff-cancellable
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch hm/make-export-diff-cancellable

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

@hanabi1224 hanabi1224 requested review from LesnyRumcajs and sudo-shashank and removed request for a team June 29, 2026 14:19
@codecov

codecov Bot commented Jun 29, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 64.10%. Comparing base (28d3c1c) to head (1578bab).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/tool/subcommands/archive_cmd.rs 0.00% 6 Missing ⚠️
Additional details and impacted files
Files with missing lines Coverage Δ
src/tool/subcommands/archive_cmd.rs 29.48% <0.00%> (-0.19%) ⬇️

... and 3 files with indirect coverage changes


Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 28d3c1c...1578bab. Read the comment docs.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@hanabi1224 hanabi1224 added the Snapshot Run snapshot tests label Jun 29, 2026
@hanabi1224 hanabi1224 force-pushed the hm/make-export-diff-cancellable branch from 2302ffd to 8f832d2 Compare June 29, 2026 15:03
@hanabi1224 hanabi1224 force-pushed the hm/make-export-diff-cancellable branch from 8f832d2 to 1578bab Compare June 29, 2026 15:08
@hanabi1224 hanabi1224 marked this pull request as draft June 29, 2026 15:19
@hanabi1224 hanabi1224 closed this Jun 29, 2026
@hanabi1224 hanabi1224 deleted the hm/make-export-diff-cancellable branch June 29, 2026 16:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Snapshot Run snapshot tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant