Skip to content

Conversation

@gavande1
Copy link
Contributor

@gavande1 gavande1 commented Dec 8, 2025

Related issues

Proposed Changes

  • Implements resumable uploads for sync archives using Tus Protocol.
  • Now it uploads the file first using new Tus protocal enabled endpoint, then it makes another request to initiate the import using attachment ID.

Testing Instructions

Note

There are quite a number of steps to test this PR fully. I am happy to pair with you or help you out with the setup if you need.

  • Checkout 196922-ghe-Automattic/wpcom your sandbox.
  • Sandbox public-api.wordpress.com and make it in FULL ACCESS mode.
  • Above PR has been deployed to production.
  • Checkout this branch in Studio
  • run npm install & install start
  • Connect your wordpress.com account
  • Add site for sync
  • Run following tests
  1. Do a full sync
  2. Do a partial sync with different options
  3. Start sync, go offline, wait few seconds, come online again. Make sure sync doesn't fail. This is to confirm resumable capability.
  • Checkout to master branch on Studio
  • Run above tests again. Everything should work. The code handles backward compatibility.
CleanShot.2025-12-09.at.11.45.16.mp4

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?

@gavande1 gavande1 force-pushed the stu-939-implement-resumable-uploads-for-studio-sync-take-2 branch from 26ac7f4 to 3dd4a62 Compare December 8, 2025 12:36
@gavande1 gavande1 self-assigned this Dec 8, 2025
@gavande1 gavande1 requested a review from a team December 8, 2025 12:47
@github-actions
Copy link
Contributor

github-actions bot commented Dec 8, 2025

📊 Performance Test Results

Comparing 0f3f1be vs trunk

site-editor

Metric trunk 0f3f1be Diff Change
load 7931.00 ms 10038.00 ms +2107.00 ms 🔴 26.6%

site-startup

Metric trunk 0f3f1be Diff Change
siteCreation 14327.00 ms 15436.00 ms +1109.00 ms 🔴 7.7%
siteStartup 5966.00 ms 6946.00 ms +980.00 ms 🔴 16.4%

Results are median values from multiple test runs.

Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change

@gavande1 gavande1 changed the title Studio Sync: Implement resumable uploads for studio sync using node process [Take 2] Studio Sync: Implement resumable uploads for studio sync using Node process Dec 8, 2025
Copy link
Contributor

@fredrikekelund fredrikekelund left a comment

Choose a reason for hiding this comment

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

This looks very promising! I left a couple of comments, but overall, the architecture is clear and makes sense 👍

I wasn't able to test the changes, though, because the upload keeps failing, and I get errors like this in my Studio terminal session:

Upload request error tus: unexpected response while creating upload, originated from request (method: POST, url: https://public-api.wordpress.com/rest/v1.1/studio-file-uploads/241885143, response code: 500, response text: , request id: n/a)

@gavande1 gavande1 requested a review from a team December 10, 2025 09:39
Copy link
Contributor

@fredrikekelund fredrikekelund left a comment

Choose a reason for hiding this comment

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

Looks good, and works great 👍 I left a couple of final comments that would be good to address, but nothing blocking.

@gavande1 gavande1 force-pushed the stu-939-implement-resumable-uploads-for-studio-sync-take-2 branch from 7a4b9ac to 9514c63 Compare December 10, 2025 09:57
Copy link
Contributor

@epeicher epeicher left a comment

Choose a reason for hiding this comment

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

Thanks @gavande1 for implementing this functionality! I have tested it, and it works as expected, I can see the file upload resuming after disconnecting and re-connecting the wifi. This is a great functionality for the user 🙌

I have tested also the trunk version and it works fine, while I can reproduce the previous error in trunk if there is a disconnection.

Trunk with disconnection Trunk successful upload
Image Image

Video with an upload and a disconnection while uploading

CleanShot.2025-12-11.at.12.29.27.mp4

One question for a possible follow-up: do you think that once these changes are merged, we could work on resuming uploads even if the user closes Studio and reopens it? That would be another step toward improving the Sync functionality.

Copy link
Contributor

@gcsecsey gcsecsey left a comment

Choose a reason for hiding this comment

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

Thanks @gavande1 for working on this feature, it'll be a great improvement for the upload experience!

I tested this together with the backend changes, and can confirm that the upload continues as described after disconnecting the wifi:

CleanShot.2025-12-11.at.12.20.21.mp4

One thing I noticed while testing this is that if the disconnect happens after the upload step, the renderer crashes. In a follow-up, we can ensure that we handle the offline states for the whole sync flow.

CleanShot.2025-12-11.at.12.22.15.mp4
hook.js:608 A non-serializable value was detected in the state, in the path: `wpcomSitesApi.queries.getWpComSites({"connectedSiteIds":[249663985],"userId":37463824}).error.data`. Value: Error: Request has been terminated
Possible causes: the network is offline, Origin is not allowed by Access-Control-Allow-Origin, the page is being unloaded, etc.

@gavande1
Copy link
Contributor Author

@gcsecsey and @epeicher Thanks for the review and suggesting follow up tasks.

do you think that once these changes are merged, we could work on resuming uploads even if the user closes Studio and reopens it?

Yes. that's one of the suggestion I received from Wojtek as well. It would greatly improve experience for the user. I will create follow up tasks for that once this is merged.

@gavande1 gavande1 force-pushed the stu-939-implement-resumable-uploads-for-studio-sync-take-2 branch 2 times, most recently from 6977914 to 47a7170 Compare December 17, 2025 08:36
@gavande1 gavande1 force-pushed the stu-939-implement-resumable-uploads-for-studio-sync-take-2 branch from 0ff0e36 to a9926c8 Compare December 23, 2025 09:09
@gavande1 gavande1 force-pushed the stu-939-implement-resumable-uploads-for-studio-sync-take-2 branch from a9926c8 to 5aa55de Compare December 25, 2025 08:08
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.

5 participants