Page MenuHomePhabricator

[Refactor] Replace MWReferenceNode.mainRefKey with an index to the main ref InternalItemNode
Open, Needs TriagePublic

Description

Context

Currently, a sub-reference is distinguished by the MWReferenceNode mainRefKey property. This property is null for a normal reference, but for a sub-reference it holds the "list key" of the main ref. In order to make this linkage less fragile and less dependent on a "synthetic" main ref node, we will replace this property with the listIndex of the main ref's InternalItemNode.

We anticipate that this will eliminate the need for the synthetic main ref. It's also a small step towards deprecating the keyIndexes and listKey mechanisms, while still limiting the scope of the change to only affect sub-references.

Especially watch out for copy-paste use cases, which involve merging and regeneration of parts of the InternalList. Does the InternalItemNode survive these transformations?

Implementation
  • Create a mainListIndex key for the main content of subref
  • Replace usages of mainRefKey with the new mainListIndex key
  • Keep mainRefKey mechanism as fallback and track usages
  • Deprecate mainRefKey mechanism

Event Timeline

Change #1235061 had a related patch set uploaded (by WMDE-Fisch; author: WMDE-Fisch):

[mediawiki/extensions/Cite@master] VE: Add mainListIndex key to refer to main content

https://gerrit.wikimedia.org/r/1235061

WMDE-Fisch renamed this task from Replace MWReferenceNode.mainRefKey with an index to the main ref InternalItemNode to [Refactor] Replace MWReferenceNode.mainRefKey with an index to the main ref InternalItemNode.Feb 3 2026, 3:40 PM

Change #1236763 had a related patch set uploaded (by WMDE-Fisch; author: WMDE-Fisch):

[mediawiki/extensions/Cite@master] VE: Reflect mainListIndex change in test fixture

https://gerrit.wikimedia.org/r/1236763

Change #1235061 merged by jenkins-bot:

[mediawiki/extensions/Cite@master] VE: Add mainListIndex key to refer to main content

https://gerrit.wikimedia.org/r/1235061

Change #1236763 merged by jenkins-bot:

[mediawiki/extensions/Cite@master] VE: Reflect mainListIndex change in test fixture

https://gerrit.wikimedia.org/r/1236763