Page MenuHomePhabricator

Special:NewLexeme should have validation for language and lexical category
Closed, ResolvedPublic

Description

Right now, it doesn't check the itemId is valid and also it doesn't check if the item of the itemId actually exist or not. Pointed out by @Aleksey_WMDE in gerrit:329338

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptDec 28 2016, 6:58 AM

This should be done by using ChangeOps to apply the lexical category to the Lexeme. The ChangeOp would perform all required validation.

I believe that it should be done in both places.
As I understood ChangeOp is more (correct me if I'm wrong) Data Access Layer thingy and responsible for persistence: generate Summary and ensure that we won't get inconsistent data in DB.
But in this case, I would say, we want to show a nice message to user that item id he entered in the field simply does not exist (or may be he entered something unparsable, then we can also tell him to check the input).
I think it is different responsibility and should be done separately.

Lydia_Pintscher triaged this task as Normal priority.Mar 22 2017, 11:40 AM
Lydia_Pintscher moved this task from incoming to ready to go on the Wikidata board.

To clarify: Conceptually, ChangeOp does not belong to the persistence layer. They are basically plug-ins to an "interactor". The represent a "modification" to the Entity, and their main purpose is to apply that modification to the data model, after validation. Their secondary duty is to provide a human readable description of the modification. They have nothing to do with storage.

If we have an input constraint "a Lexeme's lexical category must be an existing item", then this is exactly the right place to do it: preserving the logical integrity(*) of the data model is indeed the job of ChangeOps.

(*) Note that these constraints are "soft" in the sense that they are checked on input, but may be broken later - e.g. the referenced Item is deleted. This means that we do not have a strong guarantee that this constraint remains true, but we enforce it for input from users and bots.

Ladsgroup closed this task as Resolved.Mar 2 2018, 1:07 PM
Ladsgroup claimed this task.

I'm pretty sure it's resolved.

Restricted Application added a project: User-Ladsgroup. · View Herald TranscriptMar 2 2018, 1:07 PM