Page MenuHomePhabricator

Usability: Unclear input format and error handling for the "Age" function hinder successful use
Closed, ResolvedPublic

Description

Unclear input format and error handling for the "Age" function hinder successful use
Participants encountered significant and repeated difficulties when attempting to use the "Age" function, with all participants failing to insert it. Participants were unsure of the required input format and repeatedly failed to enter an accepted format. The error message shown was generic and didn’t give any information on what the user did wrong and how to fix it. There is even a comment on the Age function talk page about this.

Recommendations
Goal 1: Improve the usability of function input fields, exemplified by the "Age" function, so that users clearly understand required data formats, receive actionable feedback on errors, and can successfully input data.

Ideas:
Show the accepted input format. Provide concrete examples of expected input formats preferably "YYYY-MM-DD" or “DD-MM-YYYY” formats.
Add input field descriptions to explain the input requirements if necessary.
Consider using structured input controls like date pickers where appropriate.

Goal 2: Rewrite error messages to be specific, state what is wrong and how to fix it.


Acceptance criteria

  • Editors are able to create and use custom error types in their implementations using Wikifunctions.Error()
  • Custom errors are surfaced in FunctionMetadataDialog
  • Custom errors are surfaced in ZObjectStringRenderer field
  • Custom errors are surfaced in FunctionParserInput field
  • We have created content in the Wikifunctions.org Gregorian calendar date parser to exemplify this usage

for FY26Q2

  • Error advocacy: we have communicated with the community about this feature using examples

Event Timeline

gengh changed the task status from Open to In Progress.Aug 18 2025, 1:36 PM

Change #1181726 had a related patch set uploaded (by Jforrester; author: Jforrester):

[mediawiki/extensions/WikiLambda@master] Update function-schemata sub-module to HEAD (4df73e6)

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

Change #1181726 merged by jenkins-bot:

[mediawiki/extensions/WikiLambda@master] Update function-schemata sub-module to HEAD (4df73e6)

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

Change #1182534 had a related patch set uploaded (by Jforrester; author: Jforrester):

[operations/deployment-charts@master] wikifunctions: Upgrade evaluators from 2025-08-20-203801 to 2025-08-26-213211

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

Change #1182535 had a related patch set uploaded (by Jforrester; author: Jforrester):

[operations/deployment-charts@master] wikifunctions: Upgrade orchestrator from 2025-08-20-210742 to 2025-08-25-145906

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

Change #1182534 merged by jenkins-bot:

[operations/deployment-charts@master] wikifunctions: Upgrade evaluators from 2025-08-20-203801 to 2025-08-26-213211

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

What's the next steps here? Do we need to document/advocate use of Wikifunctions.Error? Do we want to edit the Age function specifically?

Change #1182535 merged by jenkins-bot:

[operations/deployment-charts@master] wikifunctions: Upgrade orchestrator from 2025-08-20-210742 to 2025-08-25-145906

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

@Jdforrester-WMF I suggest we do:

  • Create documentation for Wikifunctions.Error (same place as Wikifunctions.Debug, if it exists)
  • Edit content and include Wikifunctions.Error for calendar date parser, this will address the specific issue that triggered this task
  • Use this example to communicate this improvement with the community through the newsletter

If this sounds good, I'll work on the content example locally and share a demo with the team. What do you think?

Oops, sorry, I never replied!

@Jdforrester-WMF I suggest we do:

  • Create documentation for Wikifunctions.Error (same place as Wikifunctions.Debug, if it exists)

Yes, that sounds good. As mentioned in our chat, I think https://www.wikifunctions.org/wiki/Wikifunctions:How_to_create_implementations would be a good place for both.

  • Edit content and include Wikifunctions.Error for calendar date parser, this will address the specific issue that triggered this task

+1

  • Use this example to communicate this improvement with the community through the newsletter

Excellent idea.

If this sounds good, I'll work on the content example locally and share a demo with the team. What do you think?

Perfect.

Lovely, I've added documentation and content to this patch so that we remember that before we close it.
Communication and advocacy will come on FY26Q2

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

[mediawiki/extensions/WikiLambda@master] Surface custom errors on ZObjectStringRenderer and FunctionInputParser fields

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

To demonstrate usage of custom errors in function implementations, see:

The new implementation, based fully on Z25739 but refactored so that:

  • undefined result or any possible errors are caught and followed by throwing our new error type Z28131 by doing:
Wikifunctions.Error( 'Z28131', [ input ] );

Any interface that runs this particular read function (according to the Gregorian date readers, English, British English, Simple English and Australian English interfaces) will emit an error of type Z28131 with bad input. For example:

Input "non valid input" will fail and throw, in the metadata, the following error:

{
    "Z1K1": "Z5",
    "Z5K1": "Z28131",
    "Z5K2": {
        "Z1K1": {
            "Z1K1": "Z7",
            "Z7K1": "Z885",
            "Z885K1": "Z28131"
        },
        "Z28131K1": "non valid input"
    }
}

This will be surfaced in the date field like this (once https://gerrit.wikimedia.org/r/c/mediawiki/extensions/WikiLambda/+/1187451 is merged):

Screenshot from 2025-09-11 16-24-02.png (361×519 px, 18 KB)

gengh updated the task description. (Show Details)

This will be surfaced in the date field like this (once https://gerrit.wikimedia.org/r/c/mediawiki/extensions/WikiLambda/+/1187451 is merged):

Screenshot from 2025-09-11 16-24-02.png (361×519 px, 18 KB)

@gengh Would this show up in embedded functions for Age and other related functions?

This will be surfaced in the date field like this (once https://gerrit.wikimedia.org/r/c/mediawiki/extensions/WikiLambda/+/1187451 is merged):

Screenshot from 2025-09-11 16-24-02.png (361×519 px, 18 KB)

@gengh Would this show up in embedded functions for Age and other related functions?

Yes, it will. But sadly we won't be able to see it till https://gerrit.wikimedia.org/r/c/mediawiki/extensions/WikiLambda/+/1187451 is merged and deployed.

See this demo for the age function in Visual Editor:

some-bad-value-age-function-2.gif (769×1 px, 279 KB)

When is it likely to be deployed? @gengh

Hopefully next week.

Change #1187451 merged by jenkins-bot:

[mediawiki/extensions/WikiLambda@master] Surface custom errors on ZObjectStringRenderer and FunctionInputParser fields

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

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

[mediawiki/extensions/WikiLambda@wmf/1.45.0-wmf.18] Surface custom errors on ZObjectStringRenderer and FunctionInputParser fields

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

Change #1187553 merged by jenkins-bot:

[mediawiki/extensions/WikiLambda@wmf/1.45.0-wmf.18] Surface custom errors on ZObjectStringRenderer and FunctionInputParser fields

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

Mentioned in SAL (#wikimedia-operations) [2025-09-11T23:15:48Z] <jforrester@deploy1003> Started scap sync-world: Backport for [[gerrit:1187553|Surface custom errors on ZObjectStringRenderer and FunctionInputParser fields (T395475)]]

Mentioned in SAL (#wikimedia-operations) [2025-09-11T23:21:19Z] <jforrester@deploy1003> jforrester: Backport for [[gerrit:1187553|Surface custom errors on ZObjectStringRenderer and FunctionInputParser fields (T395475)]] synced to the testservers (see https://wikitech.wikimedia.org/wiki/Mwdebug). Changes can now be verified there.

Mentioned in SAL (#wikimedia-operations) [2025-09-11T23:28:49Z] <jforrester@deploy1003> Finished scap sync-world: Backport for [[gerrit:1187553|Surface custom errors on ZObjectStringRenderer and FunctionInputParser fields (T395475)]] (duration: 13m 01s)