Page MenuHomePhabricator

Track which options are used in the Wikibase API
Open, Needs TriagePublic

Description

The Wikibase API gives users full control over the FormatterOptions and ParserOptions using the options parameter of the wbformatvalue and wbparsevalue modules, respectively. For instance, you can customize the strings used to format coordinates:

wbformatvalue without options

40°25'5.3000"N, 20°29'47.3000"E

wbformatvalue with options {"north": "<script>alert('hi')</script>","degree": "GRAAAAAAD"}

40GRAAAAAAD25&#39;5.3000&#34;&#60;script&#62;alert(&#39;hi&#39;)&#60;/script&#62;, 20GRAAAAAAD29&#39;47.3000&#34;E

I’d like to know if anybody actually specifies options – other than lang, which the Wikibase UI sets by default (even though it’s redundant with uselang, which it also sets). If, as I suspect, nobody makes use of this flexibility, it’s probably best to get rid of it, frankly. (I hope the rest of the team agrees with me, but I’m writing in first person singular not plural just in case ;) )

Event Timeline

Change 620708 had a related patch set uploaded (by Lucas Werkmeister (WMDE); owner: Michael Große):
[mediawiki/extensions/Wikibase@master] Track FormatterOptions+ParserOptions API usage

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

If we merge this let's make a ticket to remove it again in a few months and add it to [DEPRECATED] wdwb-tech

Change 620708 merged by jenkins-bot:
[mediawiki/extensions/Wikibase@master] Track FormatterOptions+ParserOptions API usage

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

This task accidentally fell off the radar, but I made a Grafana dashboard for it now: https://grafana.wikimedia.org/d/h-hXQTtIz/wikibase-api-wbformatvalue

Over the past year:

  • lang is very very widely used – 669 million times
  • applyRounding and applyUnit are both used occasionally – 1 million times (and basically the same number for both); this probably comes from our ApiValueFormatterFactory (the options are defined in QuantityFormatter, where they default to true, whereas ApiValueFormatterFactory sets a default of false)
  • showcalendar is used rarely – 9 thousand times; this is used by the ShowCalendarModelDecider, introduced in T323568 (T323568#8421255)
  • everything else is utterly negligible:
    • geoformat 15
    • north 3 (probably from trying out T323778)
    • domain, layout, titile (sic!) 1
    • _proto, constructor, language 0 (presumably they show up in Graphite because they were used at some point but it was more than a year ago)