Page MenuHomePhabricator

Implement “Shareable Function Calls” (using JSON ZObject encoding [TBD])
Closed, ResolvedPublic

Description

Description

This assumes we implement the feature using JSON ZObject encoding urls. Some requirements are up for discussion still in the WIP meetings!

Implement the frontend functionality to generate a shareable link to a function call that encodes the entire call as a URL-encoded JSON ZObject (Z7). This allows contributors to share, reproduce, and debug function calls easily.

When someone opens such a link, the frontend should parse the JSON ZObject, prefill the arguments, and (if configured) automatically run the function.

Requirements

  1. Add a "Share" button in:
    • Special:RunFunction , ... TBD by design
  2. Clicking “Share” should:
    • Create a JSON ZObject representing the current function call (type Z7), including:
      • Z7K1 – target function ID
      • Z7K2, Z7K3, … – argument values
    • URL-encode this JSON and append it as a query parameter (e.g. ?call=%7B...%7D).
    • Copy the full URL to clipboard and display a “Link copied!” message.
  3. On page load:
    • Detect the call= parameter. (name up for discussion)
    • Parse the JSON into a ZObject and prefill the function call interface.

Implementation Notes

  • JSON ZObject approach replaces plaintext or mixed encoding approaches.
  • Considers URL length limits — this approach is designed for longer and more complex function calls. We do nothing about this.
  • Must handle invalid JSON gracefully (show error message, don’t crash).

Acceptance Criteria

  • “Share” button present on supported pages.
  • Generated URL contains a valid Z7 JSON ZObject of the function call.
  • Opening the link pre-fills all arguments.
  • (Optional) Function auto-runs if configured.
  • Robust error handling and accessibility requirements met.

Details

Event Timeline

DSmit-WMF updated the task description. (Show Details)

Change #1194913 had a related patch set uploaded (by Daphne Smit; author: Daphne Smit):

[mediawiki/extensions/WikiLambda@master] Implement "Shareable Function Calls"

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

Very cool feature!

I understand from the gerrit description that the feature also works in Implementation and Tester page; the button appears and the link looks okay, however the pages don't load the data in the widget. Here are some demos for implementation:

shareable-links-implementation.gif (1,918×964 px, 1 MB)

And test:

shareable-links-tester.gif (1,918×964 px, 1 MB)

The calls are loaded successfully in Function and Special Run pages.


Also, we should extract and fetch the necessary zids from the call, so that when other functions and objects are used in the call they are loaded showing their labels instead of their zids:

shareable-links-fetch-zids.gif (1,918×964 px, 1 MB)

DSantamaria changed the task status from Open to In Progress.Nov 12 2025, 7:01 AM

I updated the Gerrit description and removed the button from those pages. We are not (yet) supposed to load this feature on those 2 pages.

fetched the zids

Change #1194913 merged by jenkins-bot:

[mediawiki/extensions/WikiLambda@master] Implement "Shareable Function Calls"

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