Skip to content

refactor(sftp): decouple transfers from SFTP panel lifecycle#43

Merged
iamazy merged 4 commits into
iamazy:mainfrom
CoolLoong:main
Jul 11, 2026
Merged

refactor(sftp): decouple transfers from SFTP panel lifecycle#43
iamazy merged 4 commits into
iamazy:mainfrom
CoolLoong:main

Conversation

@CoolLoong

Copy link
Copy Markdown
Contributor

Problem

Closing the SFTP page during an upload/download freezes the progress bar at InProgress and breaks the cancel button.

Root cause:

transfer task lifecycle was owned by SftpTable, and progress/completion/cancel were reported back through a WeakEntity<TableState>. Once the page closed and the entity was dropped, the reporting closures stopped running, so the global TransferCenterState stayed stuck at InProgress and the cancel token became unreachable.

Solution

Move transfer task ownership from SftpTable to the global TransferCenterState:

  • Removed Transfer / TransferEntry / SftpTable.transfers and the table/transfers.rs module.
  • Upload/download now write to the global center via AsyncApp; the copy loop no longer depends on a WeakEntity, so it survives panel close.
  • Failure reasons are written to TransferTask.detail, so the footbar tooltip still shows them after the panel is gone.
  • disconnect() no longer touches transfer tasks, so closing the page never cancels in-flight transfers.
  • Terminal-state tasks auto-dismiss after AUTO_DISMISS_AFTER.

@codecov

codecov Bot commented Jul 8, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 298 lines in your changes missing coverage. Please review.
✅ Project coverage is 54.56%. Comparing base (161e688) to head (8f59f96).

Files with missing lines Patch % Lines
crates/gpui_sftp/src/view/table/actions.rs 0.00% 298 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #43      +/-   ##
==========================================
+ Coverage   54.53%   54.56%   +0.02%     
==========================================
  Files         159      158       -1     
  Lines       54170    53906     -264     
==========================================
- Hits        29542    29413     -129     
+ Misses      24628    24493     -135     

☔ View full report in Codecov by Harness.
📢 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.

@iamazy

iamazy commented Jul 11, 2026

Copy link
Copy Markdown
Owner

Thanks a lot ♥️. However, there is still a small issue. Previously, only one group was allowed to upload at a time. When an upload task was already in progress, attempting to upload again would prompt you to wait for the previous task to finish. But now, it allows queuing and waiting for uploads. In this case, the "completed / total tasks" count displayed in the footer bar becomes incorrect—it still shows the file count from the initial group upload. However, this is a minor issue and can be fixed later. I'll go ahead and merge this PR for now.

@iamazy iamazy merged commit 31b0a01 into iamazy:main Jul 11, 2026
9 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants