Page MenuHomePhabricator

Fix Math extension to not require JS parser
Closed, ResolvedPublic

Description

git bisect determined that commit 7f430f142d caused T266496: Not possible to add new statements with any Math properties. Apparently, the Math datatype requires the JS parser which we stopped using in that commit; this task is find a proper fix for that.

The Score extension / Musical Notation datatype might also be affected, though that’s a bit unclear due to T257066: Extension:Score / Lilypond is disabled on all wikis.

Event Timeline

The request to change a math value has changed.

Old format

XHRPOSThttp://localhost/api.php
[HTTP/1.1 200 OK 1652ms]

    	
    action	"wbsetclaim"
    format	"json"
    claim	"{\"type\":\"statement\",\"mainsnak\":{\"snaktype\":\"value\",\"property\":\"P1\",\"hash\":\"c408412890e55496dc058f7c992d938487b9c028\",\"datavalue\":{\"type\":\"string\",\"value\":\"x+1\\\\sin(x)\"}},\"id\":\"Q1$0ef840f1-4e10-2953-3e38-0a0477369c9c\",\"rank\":\"normal\"}"
    baserevid	"16"
    bot	"1"
    errorformat	"plaintext"
    uselang	"en"
    token	"+\\"

  


    action=wbsetclaim&format=json&claim=%7B%22type%22%3A%22statement%22%2C%22mainsnak%22%3A%7B%22snaktype%22%3A%22value%22%2C%22property%22%3A%22P1%22%2C%22hash%22%3A%22c408412890e55496dc058f7c992d938487b9c028%22%2C%22datavalue%22%3A%7B%22type%22%3A%22string%22%2C%22value%22%3A%22x%2B1%5C%5Csin(x)%22%7D%7D%2C%22id%22%3A%22Q1%240ef840f1-4e10-2953-3e38-0a0477369c9c%22%2C%22rank%22%3A%22normal%22%7D&baserevid=16&bot=1&errorformat=plaintext&uselang=en&token=%2B%5C

new format

XHRPOSThttp://localhost/api.php
[HTTP/1.1 200 OK 44ms]

    	
    action	"wbsetclaim"
    format	"json"
    claim	"{\"type\":\"statement\",\"mainsnak\":{\"snaktype\":\"value\",\"property\":\"P1\",\"datavalue\":{\"type\":\"unknown\",\"value\":\"x+1\\\\sin(x)-1\"}},\"id\":\"Q1$0ef840f1-4e10-2953-3e38-0a0477369c9c\",\"rank\":\"normal\"}"
    baserevid	"17"
    bot	"1"
    errorformat	"plaintext"
    uselang	"en"
    token	"+\\"

     
       action=wbsetclaim&format=json&claim=%7B%22type%22%3A%22statement%22%2C%22mainsnak%22%3A%7B%22snaktype%22%3A%22value%22%2C%22property%22%3A%22P1%22%2C%22datavalue%22%3A%7B%22type%22%3A%22unknown%22%2C%22value%22%3A%22x%2B1%5C%5Csin(x)-1%22%7D%7D%2C%22id%22%3A%22Q1%240ef840f1-4e10-2953-3e38-0a0477369c9c%22%2C%22rank%22%3A%22normal%22%7D&baserevid=17&bot=1&errorformat=plaintext&uselang=en&token=%2B%5C

one can see type is now unknown and was string before. The old format works with the new API.

@ItamarWMDE is there something I can do to support you with this issue. My team urgently needs the editing functionality back.

Celenduin added a subscriber: Celenduin.EditedOct 30 2020, 5:50 PM

@Physikerwelt I spent a lunch-time and a bit and made a user script that allows you to create new math statements on items: https://www.wikidata.org/wiki/User:Zvpunry/MathWorkaround.js

It is a bit rough, but maybe it helps you over the time until the proper fix is deployed :)

@Celenduin thank you very much.

For the record. I added the user script to my common.js file via

importScript('User:Zvpunry/MathWorkaround.js');

this makes a little form appear at the very bottom of the page:


There you can specify for example the defining Formula property P2534 and a LaTeX string. After clicking submit you can reload the page and see the effect.

I think it is not possible to define has part formula annotations with this script, but that might be expanded. See https://commons.wikimedia.org/wiki/File:Annotating_the_Schr%C3%B6dinger_equation.webm for a typical use case of the Math Datatype.

@Physikerwelt Thank you for your offer to help, I have reverted the commit which introduced the bug in T266671, which should resolve the issue once it is merged.

@ItamarWMDE Thank you. However, the next release branch *-wmf15 will come.

No, wmf.15 will not come, it was cut during the past week, which was a no-deploy week due to the datacenter switch. wmf.16 will come this week (starting Wednesday, not Tuesday, because of the US election); we’ll probably backport the revert there as well while we continue to look for a proper fix on the master branch.

Change 639174 had a related patch set uploaded (by Itamar Givon; owner: Itamar Givon):
[mediawiki/extensions/Wikibase@master] Add a string data value parser

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

Change 639174 merged by jenkins-bot:
[mediawiki/extensions/Wikibase@master] Add a string data value parser

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

Maintenance_bot moved this task from incoming to in progress on the Wikidata board.Nov 6 2020, 9:15 AM
noarave closed this task as Resolved.Nov 6 2020, 9:16 AM