Page MenuHomePhabricator

Wikifunctions client: Remove all usage of ZObjectFactory::create or ZErrorFactory::create.. and other methods that might fallback to zid fetches
Closed, ResolvedPublic

Description

Description

Wikifunctions clients should not perform any ZObjectStore::fetch operations (or other ZObjectStore methods at all)

We should:

  • Detect those places in the client classes (WikifunctionsClientRequestJob, WikifunctionsPFHandler, etc) where we are doing this
  • Lock ZObjectStore methods in some way so that, in case something is fetched, it won't cause unexpected failures

Some preliminary ideas

  • ZError and ZErrorException could work in a static way and build ZErrors and wrapping exceptions with the hardcoded ZError structure, without fetching labels.
  • Create a localization service that builds the error messages whenever RepoMode returns these exceptions to the user.

Completion checklist

Event Timeline

@gengh What is the main goal of this and why is Essential?

@DSantamaria The main goal is to avoid causing failures in client wikis.
Client and server code are together in the same repo, however if we perform server operations (fetch ZObjects) from client or client-called code, it will generate unexpected and potentially very dangerous breakages.
This work is Essential and high priority.

Change #1248016 had a related patch set uploaded (by Genoveva Galarza; author: Genoveva Galarza):

[mediawiki/extensions/WikiLambda@master] [WIP] Remove risk to make local fetches when producing exceptions in clients

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

Change #1248016 merged by jenkins-bot:

[mediawiki/extensions/WikiLambda@master] Remove risk to make local fetches when producing exceptions in clients

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

DSantamaria changed the task status from Open to In Progress.Mar 23 2026, 10:17 AM

We removed from WikifunctionCallException as part of abstract exception work, but we still need to make sure that ZObjectFactory::create is not called from clients wikis (abstract or other)
Moving this back to ready and marking it as fixit (no emergency work, but would be good to have some dedicated eyes making this check soon)

gengh removed gengh as the assignee of this task.Mar 23 2026, 10:25 AM
gengh lowered the priority of this task from High to Medium.
DSantamaria changed the task status from In Progress to Open.Mar 25 2026, 2:31 PM
ecarg removed ecarg as the assignee of this task.Jun 15 2026, 5:54 PM
ecarg subscribed.

Un-assigning myself bc this is much lower priority than what is remaining for the current Q (discussed w/ Geno). Can revisit during a fix-it week.

Detect those places in the client classes (WikifunctionsClientRequestJob, WikifunctionsPFHandler, etc) where we are doing this

Doesn't look like this is happening anywhere (anymore?)

But the caveat is that the safety is per-caller, not structural, as in ZObjectStore itself has no guard, it's just safe right now because the current callers have a check

Yes, I *think* this might now be done. And yeah, nothing stops us mis-wiring things together later, but let's all hope that stays that way. d67180fe7 and 8b007cc7b set a clear style for how we should do this.

Let's call this complete.