Starting from,
https://en.wikipedia.org/w/index.php?title=User:Arlolra/sandbox&oldid=880024323
copy(ve.init.target.doc.body.outerHTML)
<body id="mwAA" lang="en" class="mw-content-ltr sitedir-ltr ltr mw-body-content parsoid-body mediawiki mw-parser-output" dir="ltr"><ul class="gallery mw-gallery-packed" typeof="mw:Extension/gallery" about="#mwt3" data-mw="{"name":"gallery","attrs":{"mode":"packed"},"body":{}}" id="mwAg"> <li class="gallerybox" style="width: 202px;"><div class="thumb" style="width: 200px;"><figure-inline typeof="mw:Image"><a href="./File:Test.jpg"><img resource="./File:Test.jpg" src="//upload.wikimedia.org/wikipedia/commons/thumb/5/5b/Name.jpg/300px-Name.jpg" data-file-width="350" data-file-height="210" data-file-type="bitmap" height="120" width="200" srcset="//upload.wikimedia.org/wikipedia/commons/5/5b/Name.jpg 2x, //upload.wikimedia.org/wikipedia/commons/5/5b/Name.jpg 1.5x"></a></figure-inline></div><div class="gallerytext">123</div></li> </ul> <p id="mwAw">456</p></body>
and making an edit to an unrelated portion of the page result in,
copy(ve.init.target.docToSave.body.outerHTML)
<body id="mwAA" lang="en" class="mw-content-ltr sitedir-ltr ltr mw-body-content parsoid-body mediawiki mw-parser-output" dir="ltr"><ul class="gallery" typeof="mw:Extension/gallery" data-mw="{"name":"gallery","attrs":{"mode":"packed"},"body":{}}" about="#mwt3" id="mwAg"> <li class="gallerybox" style="width: 202px;"><div><div class="thumb"><div><a><img resource="File:Test.jpg" src="//upload.wikimedia.org/wikipedia/commons/thumb/5/5b/Name.jpg/300px-Name.jpg"></a></div></div></div><div class="gallerytext">123</div></li> </ul> <p id="mwAw">456</p><p id="mwAw">789</p></body>
For one, the class list changed.
The internal structure from,
https://github.com/wikimedia/mediawiki-extensions-VisualEditor/blob/6291dff109f4a04ed1432e78234b7db34dc7d9eb/modules/ve-mw/dm/nodes/ve.dm.MWGalleryImageNode.js#L90-L96
doesn't match the spec,
https://www.mediawiki.org/wiki/Specs/HTML/2.0.0/Extensions/Gallery
For a while, this was just causing attribute normalization,
https://phabricator.wikimedia.org/T211246#4829298
because the "extsrc" was present so the body would be serialized from that.
In https://github.com/wikimedia/parsoid/commit/e748b8ec831bf6c86487ca8e551274d62be16b1d, that was removed and now the normalizations are getting a little more drastic,
https://en.wikipedia.org/w/index.php?title=Kashubian_language&curid=17254&diff=880004780&oldid=879154010&diffmode=source .
That was reverted in https://gerrit.wikimedia.org/r/c/mediawiki/services/parsoid/+/486395
However, there's a hitch. Parsoid doesn't have special handling for galleries in selser so fixing this would cause edits to disappear (for the details, see T214648).