Skip to content

Studio Sync: Implement resumable uploads for studio sync using Node process - #2212

Merged
gavande1 merged 21 commits into
trunkfrom
stu-939-implement-resumable-uploads-for-studio-sync-take-2
Dec 29, 2025
Merged

Studio Sync: Implement resumable uploads for studio sync using Node process#2212
gavande1 merged 21 commits into
trunkfrom
stu-939-implement-resumable-uploads-for-studio-sync-take-2

Conversation

@gavande1

@gavande1 gavande1 commented Dec 8, 2025

Copy link
Copy Markdown
Contributor

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

github-actions Bot commented Dec 8, 2025

Copy link
Copy Markdown
Contributor

📊 Performance Test Results

Comparing 156aad9 vs trunk

site-editor

Metric trunk 156aad9 Diff Change
load 14633.00 ms 12224.00 ms -2409.00 ms 🟢 -16.5%

site-startup

Metric trunk 156aad9 Diff Change
siteCreation 14257.00 ms 15250.00 ms +993.00 ms 🔴 7.0%
siteStartup 5977.00 ms 5975.00 ms -2.00 ms 🟢 -0.0%

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] Dec 8, 2025

@fredrikekelund fredrikekelund left a comment

Copy link
Copy Markdown
Contributor

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)
Comment thread src/modules/sync/lib/ipc-handlers.ts
Comment thread src/modules/sync/lib/ipc-handlers.ts Outdated
Comment thread src/modules/sync/lib/ipc-handlers.ts Outdated
Comment thread src/modules/sync/lib/ipc-handlers.ts Outdated
Comment thread src/modules/sync/lib/ipc-handlers.ts Outdated
Comment thread src/ipc-utils.ts Outdated
Comment thread src/hooks/use-sync-states-progress-info.ts Outdated
Comment thread src/hooks/use-sync-states-progress-info.ts Outdated
Comment thread src/modules/sync/lib/ipc-handlers.ts
@gavande1
gavande1 requested a review from a team December 10, 2025 09:39

@fredrikekelund fredrikekelund left a comment

Copy link
Copy Markdown
Contributor

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.

Comment thread src/constants.ts Outdated
Comment thread src/modules/sync/lib/ipc-handlers.ts Outdated
Comment thread src/modules/sync/lib/ipc-handlers.ts Outdated
Comment thread src/modules/sync/lib/ipc-handlers.ts Outdated
@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
Comment thread src/modules/sync/lib/ipc-handlers.ts

@epeicher epeicher left a comment

Copy link
Copy Markdown
Contributor

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.

@gcsecsey gcsecsey left a comment

Copy link
Copy Markdown
Member

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.
Comment thread src/modules/sync/lib/ipc-handlers.ts
Comment thread src/modules/sync/lib/ipc-handlers.ts Outdated
@gavande1

Copy link
Copy Markdown
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 2 times, most recently from a9926c8 to 5aa55de Compare December 25, 2025 08:08
@gavande1
gavande1 force-pushed the stu-939-implement-resumable-uploads-for-studio-sync-take-2 branch from 5aa55de to 006ddcd Compare December 29, 2025 12:43
@gavande1
gavande1 merged commit 4ae5a8d into trunk Dec 29, 2025
9 checks passed
@gavande1
gavande1 deleted the stu-939-implement-resumable-uploads-for-studio-sync-take-2 branch December 29, 2025 14:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

4 participants