In T389363: Fix attribute order round-tripping for sub-references (dirty diff) we see that references like <ref name="a" details="b">c</ref> are scrambled by VE when saving the page, and the "name" attribute moves around. Our hypothesis is that this is caused by the name attribute being deleted on subrefs (to trigger unnamed ref logic), causing what looks like a changed attribute for selective serialization.
This subtask is to fix selective serialization detection on these refs, which will almost entirely reduce the impact of dirty diffs.
Steps to implement:
- Write a test (probably for Converter, including document store) which shows how subrefs are reserialized even when there were no changes inside the ref.
- Fix change detection, making sure that: editing outside a ref never triggers a change, but editing any part of a main+details triggers a reserialization, as dos editing any non-main part of a subref without the main content.
Steps to replicate the issue:
- Edit a page in visual editor, which has subrefs. For example, https://test.wikipedia.org/wiki/CiteDetailsTests?veswitched=1&oldid=663291&action=edit
- Make a small change outside of the refs, eg. add a character.
- Review the wikitext changes which will be saved.
What happens?:
Lots of unrelated, dirty diffs are produced:
What should have happened instead?:
Only the "a" was added, this should have been the only diff.
