Page MenuHomePhabricator

Resetting a custom global preference via API does not work
Closed, ResolvedPublicBUG REPORT


This got lost due to my confusion in T203864: Resetting a global preference via API does not work:

I can set custom (i.e. prefixed with userjs-) options globally, but I can't make them local again:

  1. Save userjs-foo=foo as global preference:
  2. Confirm it is set properly:
  3. Remove userjs-foo as global preference:
  4. Repeat step 2.

(Don't forget to fill in the tokens in step 1 and 3.)

Expected: The preference should be gone.
Actual: It is still there, with the old value, even though step 3 complete with "success".

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

I've come across this with Convenient-Discussions trying to delete a property created for testing purposes, and I couldn't. I was lucky not to mess with the users' options (only faced this behavior while in the development stage)—they would have an undeletable junk option. A particularly unfortunate feature of this is that global preferences override local ones by default, so if there is a userjs- option with the same name locally, then, unless there is a local override set (which requires additional actions), it has no effect.

eprodromou subscribed.

I think we got automatically tagged because of the API but since this is GP probably better for Community Tech to handle. Re-tag us if we're needed.

I think we got automatically tagged because of the API but since this is GP probably better for Community Tech to handle. Re-tag us if we're needed.

@Niharika removed Community-Tech, so I assume they weren't interested in handling this though

@Pppery Jinx! :D

I'd like to add that reset for action=globalpreferences also doesn't work, whether resetkinds is specified or not.

So how may we get this solved? I tried poking at the code with Vagrant the other day but it quickly became clear it was above my pay grade...

I have just encountered this issue. A gadget migrated its options schema, and there are a bunch of old items to clean up. Currently, the best I can do is to set these to empty values, so that at least it takes little space.

But the stale items remain, so they can only accumulate over time… (imagine a gadget developer who ends up with dozens of items)

As a reminder, the items are included in the HTML of every pageview.

Od1n triaged this task as High priority.Oct 22 2023, 1:48 PM
MusikAnimal changed the subtype of this task from "Task" to "Bug Report".
MusikAnimal moved this task from Bug backlog to Needs Discussion on the Community-Tech board.

This ticket is clearly a bug, but are there clear workarounds? GlobealPreferences is in passive maintenance, and I'm not sure this qualifies as something we'd need to unbreak now.

MusikAnimal subscribed.

I've got a fix for this that I made a while back. I'll revisit it and get it submitted for review soon.

Moving to the Kanban board so I don't forget :)

Change #1018779 had a related patch set uploaded (by MusikAnimal; author: MusikAnimal):

[mediawiki/extensions/GlobalPreferences@master] ApiGlobalPreferences: allow resetting of preferences

Change #1018779 merged by jenkins-bot:

[mediawiki/extensions/GlobalPreferences@master] ApiGlobalPreferences: allow resetting of preferences

I totally forgot to move to this to QA! It's already live on all wikis and has been for a week.

dom_walden subscribed.

I cannot reproduce the bug in the description.

Test environment: GlobalPreferences 0.1.2 (d7d8016) 21:17, 23 April 2024.