With an historical diff, it is currently not possible to distinguish between the auto-numbered reference nodes in the document. We can't compare their automatic numbers as that results in confusing diffs when a reference is inserted or deleted (T170235).
Ref nodes should instead be tied to a reference list diff, or at the very least compared based on the contents of the references.
See the discussion on this patch: https://gerrit.wikimedia.org/r/c/mediawiki/extensions/Cite/+/657606/
Test case
- Create the following doc:
<ref name="foo">Foo</ref><ref name="bar">Bar</ref> This is <ref name="foo"/> a sentence <ref name="bar"/>
- Edit the document to switch the placement of the two re-used references in the second paragraph.
- Observe that the diff shows no changes, because the order of the references has not changed, and all the reference nodes themselves are considered equal (after wmf29):