Automattic / wp-calypso

The JavaScript and API powered WordPress.com
https://developer.wordpress.com
GNU General Public License v2.0
12.43k stars 1.99k forks source link

Lossless import inconsistently incorrectly replacing media links / not bringing all settings over #86323

Open Nic-Sevic opened 9 months ago

Nic-Sevic commented 9 months ago

Quick summary

User case came up where only the media links in a site editor template were not changed correctly following a lossless import after atomic revert: p1704902458034259-slack-C03TY6J1A

In this case all other media links were changed as expected but images in the home template were reassigned to the original atomic location. Additionally, the template navigation block was not updated correctly

I then attempted to replicate this to see what was changed but got inconsistent results using my test sites

Test 1 (site was atomic for a while): aacm2345blog.wordpress.com

test 2 (site newly created, transferred, reverted): reverttesting1million.wordpress.com

Steps to reproduce

  1. on an atomic site with an FSE theme, set some images in the home page
  2. also create at least one post with images
  3. revert and perform a lossless import (done from BRC revert page)
  4. check simple site to see if image paths correctly updated

What you expected to happen

I expect to see all paths in the exported xml as atomic-temporary links which then get updated to the current simple address and file structure after import (ie atomic-temporary-{blogid}wpcomstaging.com -> site.files.wordpress.com)

What actually happened

In the user site media links in the home template (which was applied to the home page) were still reflecting the atomic structure (site.com/wp-content/uploads/...) In my test site the theme was not updated according to the changes made while atomic and none of the media links were updated correctly; all reflected the atomic structure

export file of test site 1: https://atomic-temporary-177677591.wpcomstaging.com/177677591.wordpress.000.xml site itself: aacm2345blog.wordpress.com

In one instance the theme of the site wasn't brought over (although it is in the import file) and media links throughout the posts (regardless of how they were added) were assigned to point at the original atomic location

2024-01-11 at 15 22

2024-01-11 at 15 04

Impact

Some (< 50%)

Available workarounds?

Yes, difficult to implement

Platform (Simple and/or Atomic)

No response

Logs or notes

No response

filipanoscampos commented 9 months ago

📌 REPRODUCTION RESULTS

– Tested on Atomic : Replicated

📌 FINDINGS

Here is my website before the revert:

https://github.com/Automattic/wp-calypso/assets/2540430/3c0c8510-39c2-48e3-b4c8-8ca9873377f3

And after the revert:

https://github.com/Automattic/wp-calypso/assets/2540430/83266699-fda9-420e-a48c-802cf8de0c8b

Notice how all the images added to the Homepage template are fine? Even my header is no longer sticky.

Missing images are using the wpcomstaging domain uploads folder URL: Screenshot 2024-01-16 at 15 23 20

📌 ACTIONS – Replicated.

📌 Message to Author

@Nic-Sevic Thanks for the report.

Do you think we should update P9HQHe-1sw-p2 and ask HEs to spot-check sites after reverts and look for these situations where the template element settings are also lost?

Nic-Sevic commented 9 months ago

@filipanoscampos It's already mentioned in that guide that theme settings are not imported, which in my mind would include templates. This bug seems to be more associated with the link replacer not understanding how to correctly replace things in templates so I can add a link to this issue in the broken images section

inaikem commented 2 weeks ago

@Automattic/reactor, do you know if this issue is being worked on by the Atomic Team in any regard?

It was tried in Jan and wasn't allocated or prioritised after that. We are group triaging the board and feel there may be related work recently finished/in-flight.

ash1eygrace commented 5 days ago

@inaikem, I couldn't find anything on Atomic P2, and this doesn't seem like Atomic team territory, so they're probably not working on. When a lossless revert happens we just export an XML and import it into a site, so this seems more like the core XML importer territory, and as Nic mentioned specifically handling the URL updates within FSE templates after an XML import.

I put this on my list of things to test next week to see if I'm understanding what's happening and expected. Also, to see if the same thing happened with imports from self-hosted, or if it's isolated to lossless reverts, WordPress.com, or reproducible in core.