Page MenuHomePhabricator

Display global usage tracking of charts to editors
Closed, ResolvedPublic3 Estimated Story Points

Description

As charts will be reusable just like files on various wikis, it would be great to see which ones are using it.
This would give an editor of the chart a feeling of how likely it might "break" the local usage, for example if switching from a bar to a line type.

Something like being supported by Special:GlobalUsage would be great, even better if it was automatically included in the bottom of the chart page, just like it is for files.

Event Timeline

This might be a duplicate of T383446 (I didn't see that one before creating this feature request).

CCiufo-WMF subscribed.

Definitely the same problem as outlined in T383446, but that task is meant to be an investigation in how to support this. For now I'll make it a subtask.

CCiufo-WMF renamed this task from Allow global usage tracking of charts to Display global usage tracking of charts to editors.Jan 13 2025, 6:43 PM
CCiufo-WMF set the point value for this task to 3.
CCiufo-WMF moved this task from Backlog to Sprint 15 on the Charts board.
CCiufo-WMF edited projects, added Charts (Sprint 15); removed Charts.

Change #1111690 had a related patch set uploaded (by Bvibber; author: Bvibber):

[mediawiki/extensions/JsonConfig@master] Initial implementation of Data: page global usage display

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

Code appears working but I'm not quite satisfied with the namespace handling; it has a known edge case with Polish and any other language using gendered user namespaces; if a female user has a chart on her user or user talk page the namespace will show the wrong grammatical form on the link.

If this is not acceptable we can make a small schema change to fix this but will have to deploy it.

Currently partway through updated implementation with the schema change and I prefer it so far. Adding schema-change tag to the task, as we will need to push that to the production table later.

@Ladsgroup recommends a different schema over in comments on T385917. I think I agree, the recommended version is better:

  • go back to our earlier design where namespace+namespace text is grouped with the wikis on globaljsonlinks_wiki
  • BUT make its index non-unique

This will allow us to correctly handle the case where namespace texts vary by individual title by linking to one of multiple wiki+namespace rows.

I recommend I go ahead and retool the patch for this, which should be done by the end of the week, before we deploy any updated schema. I'll need to double-check that it upgrades cleanly.

(It sounds like we dropped some schema review connections during the earlier schema design changes in Nov/Dec, and we probably could've saved ourselves some trouble if we'd double-checked it. Sorry @Ladsgroup !)

It will make the schema patch slightly bigger, but I think I can make it backwards-compatible with no trouble.

Hm, so this might work. @Ladsgroup please advise if this will work in line with your concerns:

  • globaljsonlinks_wiki
    • add nullable namespace text
    • add nullable namespace id (move from globaljsonlinks)
    • alter unique key to (dbname,id,ext)
    • null ns rows are back-compat entries
  • globaljsonlinks
    • deprecate: namespace id (obsolete copy, can be removed later optionally)

My main concern is over sorting with the namespaces: to match behavior elsewhere in MediaWiki we want the results sorted first by wiki, then by namespace id, then by title dbkey, without concern for the order of the namespace text. This would leave User pages on pl.wikipedia.org sorted by username, for instance, mixing male/unmarked and female users' pages together in the listing.

The way the keys work I'm pretty sure this all only works right if we filesort the results, but that's probably fine -- the result sets with this profile are expected to be small and fit in memory for HTML transformation. :D

If this sounds good I'll start reworking the patch tomorrow.

The way the keys work I'm pretty sure this all only works right if we filesort the results, but that's probably fine

I think it's fine. It doesn't take away anything important from users.

CCiufo-WMF edited projects, added Charts (Sprint 17); removed Charts (Sprint 15).
CCiufo-WMF moved this task from Incoming to Code Review on the Charts (Sprint 17) board.

It would be great if you catalog the tables (Context: T363581: Build a machine-readable catalogue of mariadb tables in production). Currently it's showing up in list of uncataloged tables:

globaljsonlinks ['testcommonswiki']
globaljsonlinks_target ['testcommonswiki']
globaljsonlinks_wiki ['testcommonswiki']

There are a lot of examples in patches connected to the ticket I posted above. Thanks!

It would be great if you catalog the tables (Context: T363581: Build a machine-readable catalogue of mariadb tables in production). Currently it's showing up in list of uncataloged tables:

aaaaand patch :D https://gerrit.wikimedia.org/r/c/operations/puppet/+/1123022

Change #1111690 merged by jenkins-bot:

[mediawiki/extensions/JsonConfig@master] Support for Data: page global usage display

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