Page MenuHomePhabricator

Unable to remove last alias from entity
Open, Needs TriagePublicBUG REPORT

Description

Steps to Reproduce:
Go to https://m.wikidata.beta.wmflabs.org/wiki/Q112
delete the last alias for a language
blur the field
click save

Actual Results:
The alias has not been deleted and the network request to wbeditentity still includes the supposedly deleted alias.

Expected Results:
The alias was deleted

Event Timeline

It seems to send the right request...Firefox told me he sends: {"labels":{"en":{"language":"en","value":"fdsfdssfd"}},"descriptions":{"en":{"language":"en","value":"fdsfds"},"de":{"language":"de","value":"test page"}},"aliases":{"en":[],"de":[]}} after I click on save.
RequestsHeader was:
Host: m.wikidata.beta.wmflabs.org
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0
Accept: application/json, text/plain, */*
Accept-Language: de,en-US;q=0.7,en;q=0.3
Accept-Encoding: gzip, deflate, br
Referer: https://m.wikidata.beta.wmflabs.org/wiki/Q112
Content-Length: 821
Content-Type: multipart/form-data; boundary=---------------------------14584605183559345201807037877
Cookie: WMF-Last-Access=07-May-2019; WMF-Last-Access-Global=07-May-2019; mwPhp7Seed=5c4; GeoIP=DE:TH:Abtsbessingen:51.25:10.77:v4
Connection: keep-alive

with Parameter:
-----------------------------14584605183559345201807037877
Content-Disposition: form-data; name="action"

wbeditentity
-----------------------------14584605183559345201807037877
Content-Disposition: form-data; name="id"

Q112
-----------------------------14584605183559345201807037877
Content-Disposition: form-data; name="baserevid"

1122525
-----------------------------14584605183559345201807037877
Content-Disposition: form-data; name="data"

{"labels":{"en":{"language":"en","value":"fdsfdssfd"}},"descriptions":{"en":{"language":"en","value":"fdsfds"},"de":{"language":"de","value":"test page"}},"aliases":{"en":[],"de":[]}}
-----------------------------14584605183559345201807037877
Content-Disposition: form-data; name="token"

+\
-----------------------------14584605183559345201807037877--

Thanks for adding this comment that I overlooked. I guess I made a mistake somewhere. Let me double check what happened again

Your observation is totally right - it will not the remove the last alias, but it sends the correct parameter like above. I guess the error is somewhere in the API. Sorry for the confusion.

The situation is as follows. Sending an empty array to wbeditentity for the aliases doesn't empty the aliases for that language. However, sending any other array acts as an "overwrite" of that field.

I'm unclear if this is a bug in wbeditentity that we should fix or if we should add the "remove" flag to the last remaining term when removing it. I'll now do some investigation on wbeditentity.

Looks like this is related: https://phabricator.wikimedia.org/T203337 i.e. it is unclear what the desired functionality should be

I think that the "right" solution is to fix up wbeditentity. Otherwise we start having to do some very nasty checking client side and lose the advantage of just bunging our edit entity to the server and not worrying about atomic changes. It looks like "fixing" wbeditentity to accept the empty set of aliases as blanking would be a good idea for other users too.

My yes model would be: given how busy camp is right now and the number of termbox related tickets we're already trying to get looked at we should take this on ourselves.

Thoughts from the team?

After canvassing developer opinion on IRC the conclusion was that fixing T203337 is the right thing to do. We're not yet sure who should do this though (us or camp) but don't have strong opinions either way.