Page MenuHomePhabricator

Create a code abstraction for "display entity link" use-case
Closed, ResolvedPublic

Description

Create a set of classes/interfaces that will be used for display purposes only.
Cache would be used instead of using the secondary wb_terms SQL table.

Input: EntityId
Output: Data that is enough to display HTML/wikitext link to the Entity page (probably including things like label, description, if language fallback was used)

This task focuses on items, and properties.
Similar approach would be likely also used for Lexeme and MediaInfo entities - this is left out for the follow up work.

Details

Related Gerrit Patches:

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJun 11 2018, 10:29 AM

Change 439885 had a related patch set uploaded (by Aleksey Bekh-Ivanov (WMDE); owner: Aleksey Bekh-Ivanov (WMDE)):
[mediawiki/extensions/Wikibase@master] Separate HTML link formatter for ItemIds

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

Change 439927 had a related patch set uploaded (by Aleksey Bekh-Ivanov (WMDE); owner: Aleksey Bekh-Ivanov (WMDE)):
[mediawiki/extensions/Wikibase@master] Refactor ItemIdHtmlLinkFormatterTest

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

Change 439885 merged by jenkins-bot:
[mediawiki/extensions/Wikibase@master] Separate HTML link formatter for ItemIds

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

Change 439927 merged by jenkins-bot:
[mediawiki/extensions/Wikibase@master] Refactor ItemIdHtmlLinkFormatterTest

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

Change 441019 had a related patch set uploaded (by Aleksey Bekh-Ivanov (WMDE); owner: Aleksey Bekh-Ivanov (WMDE)):
[mediawiki/extensions/Wikibase@master] Add ControlledFallbackEntityIdFormatter to be able to replace formatter gracefully

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

Change 441019 merged by jenkins-bot:
[mediawiki/extensions/Wikibase@master] Add ControlledFallbackEntityIdFormatter to be able to replace formatter gracefully

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

Change 442260 had a related patch set uploaded (by WMDE-leszek; owner: WMDE-leszek):
[mediawiki/extensions/Wikibase@master] Added CachingFallbackLabelDescriptionLookup

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

Change 442861 had a related patch set uploaded (by WMDE-leszek; owner: WMDE-leszek):
[mediawiki/extensions/Wikibase@master] WIP DRAFT Document decision about not using wb_terms for "display" of items/properties

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

Change 442879 had a related patch set uploaded (by WMDE-leszek; owner: WMDE-leszek):
[mediawiki/extensions/Wikibase@master] WIP DRAFT ADR document about using PSR-16 Cache interface

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

Ladsgroup moved this task from incoming to in progress on the Wikidata board.Jun 28 2018, 3:47 PM
Vvjjkkii renamed this task from Create a code abstraction for "display entity link" use-case to dabaaaaaaa.Jul 1 2018, 1:04 AM
Vvjjkkii triaged this task as High priority.
Vvjjkkii updated the task description. (Show Details)
Vvjjkkii removed subscribers: gerritbot, Aklapper.
CommunityTechBot renamed this task from dabaaaaaaa to Create a code abstraction for "display entity link" use-case.Jul 2 2018, 2:55 PM
CommunityTechBot raised the priority of this task from High to Needs Triage.
CommunityTechBot updated the task description. (Show Details)
CommunityTechBot added subscribers: gerritbot, Aklapper.

Change 442879 merged by jenkins-bot:
[mediawiki/extensions/Wikibase@master] ADR document about using PSR-16 Cache interface

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

Change 442260 merged by jenkins-bot:
[mediawiki/extensions/Wikibase@master] Added CachingFallbackLabelDescriptionLookup

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

WMDE-leszek updated the task description. (Show Details)Aug 9 2018, 2:38 PM

Change 452931 had a related patch set uploaded (by Aleksey Bekh-Ivanov (WMDE); owner: Aleksey Bekh-Ivanov (WMDE)):
[mediawiki/extensions/Wikibase@master] Add internal assertions to ensure the code works correctly

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

Found the problem with current solution.

lib/includes/Store/Sql/WikiPageEntityRevisionLookup.php:142

if ( $row && $row->page_latest && !$row->page_is_redirect ) {
	return (int)$row->page_latest;
}

return false;

That means that we don't get correct revision ID if the target entity is redirect.
That leads to invalid cache record (or Exception being thrown if the patch 452931 is merged) and essentially means that the code is not production ready.

It still can be deployed as soon as this code is disabled using configuration value.

Change 454857 had a related patch set uploaded (by Aleksey Bekh-Ivanov (WMDE); owner: Aleksey Bekh-Ivanov (WMDE)):
[mediawiki/extensions/Wikibase@master] Handle redirects in CachingFallbackLabelDescriptionLookup

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

Change 452931 merged by jenkins-bot:
[mediawiki/extensions/Wikibase@master] Add internal assertions to ensure the code works correctly

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

Change 454857 merged by jenkins-bot:
[mediawiki/extensions/Wikibase@master] Handle redirects in CachingFallbackLabelDescriptionLookup

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

Change 456401 had a related patch set uploaded (by Aleksey Bekh-Ivanov (WMDE); owner: Aleksey Bekh-Ivanov (WMDE)):
[mediawiki/extensions/Wikibase@master] Return redirect result from WikiPageEntityRevisionLookup::getLatestRevisionId

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

Change 456401 merged by jenkins-bot:
[mediawiki/extensions/Wikibase@master] Return redirect result from WikiPageEntityRevisionLookup::getLatestRevisionId

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

Do we know what's left to do here?

Except T205192 there is also the issue that EntityInfoBuilder is also involved when generating the links on the item etc page, and it is still hitting wb_terms. That is T198868, or T205193 in particular.
Arguably, changing this is not blocking this is not required to consider this use case solved, but it would be really nasty to leave not changed.

I believe T205192 is now done?

Addshore closed this task as Resolved.Mon, Nov 18, 1:19 PM
Addshore claimed this task.

Done, ControlledFallbackEntityIdFormatter

Restricted Application added a project: User-Addshore. · View Herald TranscriptMon, Nov 18, 1:19 PM

Change 442861 merged by jenkins-bot:
[mediawiki/extensions/Wikibase@master] Document decision about not using wb_terms for "display" of items/properties

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