Page MenuHomePhabricator

Z6839: Difficult to compare sitelinks in some tests
Closed, ResolvedPublicBUG REPORT

Description

Description

From Telegram on March 20, 2026:

I think I found a problem with Z6839 when trying to get https://en.wikipedia.org/wiki/Victoria_(state) from Q36687. I've added some tests. The NSW one just fails because I can't make the same sitelink synthetically to compare to. But the Vic one returns nothing. I wonder if it's to do with the brackets in the URL?

Steps to reproduce
Please see these 2 failing tests

Observed behavior

  • See above

Expected behavior/Acceptance criteria (returned value, expected error, performance expectations, etc.)

  • It should be possible to retrieve any site link, for a given item, which is present in Wikidata.

Completion checklist

Event Timeline

Thanks again, @99of9 , for bringing this to light. I tweaked both tests so the expected values are lists, and also the language element in the expected sitelink is a literal (because Z6839 returns literal language elements). With these tweaks the test failures for both of these tests are the same – and they happen because of the inability to construct a matching value for the language element of the expected sitelink. Z6839 returns a literal language element with Z60K1 only, whereas the UI only allows to construct a reference, or a literal element with Z60K1 and Z60K2.

Update – After disconnecting one implementation of Z31988/same Wikidata sitelink and changing the language element of the expected values, in both of these tests, to references, both tests are now passing.

Ideally, one day Z60K2 will be marked as an optional key (Optional keys are discussed frequently and on the roadmap for future work).

Going forward, I think we need a new equality function for Z60 that allows for compared languages to be either reference or literal, and also allows for a missing Z60K2, as proposed in T421468, and that should be used for Z31988/same Wikidata sitelink. We also need for Z6839 to include Z60K2 in the language elements it produces.

DMartin-WMF renamed this task from Z6839: Unable to retrieve certain sitelinks to Z6839: Impossible to compare sitelinks in some tests.Apr 4 2026, 5:40 PM
DMartin-WMF renamed this task from Z6839: Impossible to compare sitelinks in some tests to Z6839: Difficult to compare sitelinks in some tests.Apr 6 2026, 6:20 AM

Update: because of post-V2-release fixes, both tests are now passing for https://www.wikifunctions.org/view/en/Z31992 ( the implementation of Z31988/same Wikidata sitelink that was disconnected above). However, let's keep this ticket open for the following:

Closing; upon reconsideration those last 3 changes aren't really needed.