Page MenuHomePhabricator

[Task] Migrate PropertySuggester away from assuming all entities are numeric
Closed, ResolvedPublic

Description

PropertySuggester is extensively build on the assumption that all entity IDs can be represented as integer numbers via getNumericId. https://github.com/wmde/WikibaseDataModel/pull/667 provides a simple migration path: All entity types PropertySuggester must support (only Properties and Items) do have a getNumericId method anyway. Add a proper interface for that. Add instanceof and is_int checks to a few critical places, and be done for now. Wait for the exceptions and continue working on a proper fix (which basically means rewriting the entirety of PropertySugester) when these checks start to fail (which will most probably never happen).

Patches:

  • https://github.com/wmde/WikibaseDataModel/pull/667 introduces a NumericEntityId interface as described above. Code assuming all entity IDs can be represented as 32 bit integer numbers will still fail, but this will not happen within the next 100 years. Main advantage: This does not require any breaking change in DataModel. Entity IDs implementing this interface are still allowed to be of any length.
  • https://github.com/wmde/WikibaseDataModel/pull/670 introduces a Int32EntityId interface. This requires a breaking change and an additional int32 check in all entity ID constructors implementing this interface. Stuff will break the same time in 100 years, but not caused by a caller of getNumericId but when constructing an ID that exceeds 32 bit.
Note: Seems there is no tag for the PropertySuggester project.

Related Objects

View Standalone Graph
This task is connected to more than 200 other tasks. Only direct parents and subtasks are shown here. Use View Standalone Graph to show more of the graph.

Event Timeline

Danny_B renamed this task from [Story] Migrate PropertySuggester away from assuming all entities are numeric to Migrate PropertySuggester away from assuming all entities are numeric.May 18 2016, 8:40 PM
Danny_B added a project: Story.
Lydia_Pintscher renamed this task from Migrate PropertySuggester away from assuming all entities are numeric to [Task] Migrate PropertySuggester away from assuming all entities are numeric.May 19 2016, 12:11 PM
Lydia_Pintscher moved this task from incoming to in progress on the Wikidata board.
Lydia_Pintscher removed projects: Story, Proposal.
thiemowmde changed the task status from Stalled to Open.May 23 2016, 7:46 AM
thiemowmde updated the task description. (Show Details)
thiemowmde moved this task from Review to Done on the Wikidata-Sprint-2016-07-19 board.

Setting this to done for now as the Int32EntityId interface is created and released with DataModel 6.1. Code can not safely type hint against this. Which code needs to do this now should be decided when the issue pops up again.