Page MenuHomePhabricator

Editing label and description simultaneously conflicts with existing items which have the new label and old description
Open, Needs TriagePublic

Description

If you try to edit both the label and the description of an item simultaneously, and there is an item which has the new label but the old description, it gives an error.

To reproduce it:
create an item with label "some label" and description "some description" (which I did at https://test.wikidata.org/wiki/Q1458)
create another item with no label and description "some description" (which I did at https://test.wikidata.org/wiki/Q1459)
edit the second one, set the label to "some label" and the description to "some other description"
try to save

Expected result: It saves the changes, because the new label and new description are unique.
Actual result: It gives an error on the label field because the new label and the old description are not unique. The error message is:

An error occurred while saving. Your changes could not be completed.
Details
Item some string (Q1458) already has label "some string" associated with language code en, using the same description text.

I did find T76703 but that doesn't seem to be the same. I haven't edited the description first and tried to edit the label separately after that, I'm editing both simultaneously.

Event Timeline

Nikki raised the priority of this task from to Needs Triage.
Nikki updated the task description. (Show Details)
Nikki added a project: Wikidata.
Nikki subscribed.

When I wrote T76703 the user interface didn't support simultaneous editing. The simultaneous editing is currently just an UI gimmick. On saving there are several separate request for every value. When a request fails the processing is stopped and an error message is shown. To avoid the constraint check problematic all changes must be saved in a single atomic transaction.

Is it currently possible to make several edits in one session and avoid manually the constraint by using a unproblematic order? In T76703 I had to reload the page.

Bump. I run into this quite a lot and it's quite annoying. Easy way to prevent this is probably to change the save order from label -> description, to description -> label. That won't eliminate, but should reduce the chance of actually running into this a lot. That is probably quite easy to implement.

Change 510872 had a related patch set uploaded (by Ladsgroup; owner: Ladsgroup):
[mediawiki/extensions/Wikibase@master] Save descriptions first in the UI

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

My patch doesn't fully fix the issue, updating baserevid is also needed :(

Change 510872 abandoned by Ladsgroup:
Save descriptions first in the UI

Reason:
This needs to be fixed by saving everything at the same time. Which needs T220696 that will be fixed soon

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

I think the best approach to implement this would be:

  1. try to edit the label, then the description (just like now); if that fails,
  2. try to edit the description, then the label (works better for some conflicts; if that fails,
  3. try to edit both at once, only as a last resort, because it makes for a less granular edit with (until T220696) a worse edit summary;
  4. only if all of them fail, show an error to the user

But that might be tricky to implement.

I ran into this today see https://github.com/LeMyst/WikibaseIntegrator/discussions/507

trying to modify https://www.wikidata.org/wiki/Q116472444

with:

{'Scholar': 'Xiao Liu',
 'creationDate': datetime.datetime(2023, 1, 29, 5, 55, 3),
 'dblpId': None,
 'description': 'Researcher ORCID(0000-0002-9226-4569)',
 'firstName': 'Xiao',
 'gndId': None,
 'homepage': None,
 'label': 'Xiao Liu',
 'lastEditor': 'User:Mf',
 'linkedInId': None,
 'modificationDate': datetime.datetime(2023, 1, 29, 11, 42, 10),
 'name': 'Liu',
 'orcid': '0000-0002-9226-4569',
 'researchGate': 'Xiao_Liu114',
 'smartCRMId': 'wf04004317',
 'wikiDataId': 'Q116472444'}
json
dict: {
    'labels': {
      'en': {
        'language': 'en',
        'value': 'Xiao Liu'
      }
    },
    'descriptions': {
      'en': {
        'language': 'en',
        'value': 'Researcher ORCID(0000-0002-9226-4569)'
      }
    },
...
`

Does such a problem really have to persist for 8 and a half years without a solution? Isn't it possible to turn off the block completely if it doesn't work and prevents normal editing?