Page MenuHomePhabricator

Allow functions to raise warnings
Closed, ResolvedPublicFeature

Description

Feature summary:
Functions on Wikifunctions should be able to raise warnings in their execution. A warning consists in an object of type Z5 that, instead of being raised and blocking the execution, is logged in a separate log that collects all the warnings generated by a function call (similarly to how currently the Debug log works).

Use case(s):
Functions could use warnings to signal that something went wrong in a context in which it is better not to completely interrupt the execution. One of the primary applications for this feature would be in Natural Language Generation functions for Abstract Wikipedia: for these functions, it is pretty common to encounter some problem (like missing lexemes, missing information on Wikidata, etc.), and the policy is not to interrupt the execution, but to try to implement a fallback behavior. While this behavior allows to produce a partially correct output even for languages with minor support, it has the drowback that it obscures completely all the issues that the function execution identified and had to circumvent. With warnings, these issues would not be completely lost.

Benefits:
Warnings could be very useful for diagnostics (I am thinking mainly about Abstract Wikipedia), in order to better guide the contributors to the right actions to do in order to improve the output of function calls.

Event Timeline

Jdforrester-WMF subscribed.

This needs some decisions around how Function calls that result in a warning will show up and how people will see/action the warnings. Thanks!

Some early ideas on this

Screenshot 2026-07-17 at 12.49.06 PM.png (1,452×890 px, 91 KB)
Screenshot 2026-07-17 at 12.49.26 PM.png (1,452×890 px, 79 KB)
Screenshot 2026-07-17 at 12.49.41 PM.png (1,452×782 px, 64 KB)
Screenshot 2026-07-17 at 12.49.58 PM.png (1,452×1,186 px, 190 KB)
1 Explicitly showing the warnings below the results2 Showing that there are warnings, but go to more details for the details, just like how we do for error messages.3 Not showing any warnings on the results page or any. But showing a subtle hint on the details button using the warning icon and the number of warnings, and then clicking on details to show the full warning

Based on the task description, it seems this is not something we want every single user to see every time they run a function with warnings. So prefer direction of a subtle hint and more info in details like in 3. My assumption is that the users who need such diagnostic information are familiar with the details page and will be able to find it there.

Let me know if my assumptions are incorrect or if something more explicit would be preferred. cc @Jdforrester-WMF @LMorgantini-WMF

Jdforrester-WMF changed the task status from Open to In Progress.EditedWed, Aug 5, 9:40 PM
Jdforrester-WMF claimed this task.

My plan:

  • Emit warnings in the evaluator when resource consumption is close to limits (shipped this week)
  • Display warnings in the Wikifunctions UX, following @gonyeahialam's designs (will ship in wmf.15 next week)
  • Emit warnings in the orchestrator when resource consumption is close to limits
  • (Maybe) Check that Z820 allows user-written code can add warnings, not just errors (works, but Z820 returns void so it'll look like an error unless you mix in other parts to the envelope).

The last of these might not be needed much, as it could be over-taken by the errors work elsewhere for feedback around missing Lexemes/etc., but I'm retaining it for clarity.

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

[mediawiki/extensions/WikiLambda@master] metadata: Show warnings raised by a function call and flag them, if present

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

Change #1321643 merged by jenkins-bot:

[mediawiki/extensions/WikiLambda@master] metadata: Show warnings raised by a function call and flag them, if present

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

Change #1326819 had a related patch set uploaded (by Cory Massaro; author: Cory Massaro):

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

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

Change #1326819 merged by jenkins-bot:

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

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

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

[operations/deployment-charts@master] wikifunctions: Upgrade evaluators from 2026-08-11-201322 to 2026-08-19-122930

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

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

[operations/deployment-charts@master] wikifunctions: Upgrade orchestrator from 2026-08-11-210638 to 2026-08-19-122639

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

Change #1327118 merged by jenkins-bot:

[operations/deployment-charts@master] wikifunctions: Upgrade evaluators from 2026-08-11-201322 to 2026-08-19-122930

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

Change #1327119 merged by jenkins-bot:

[operations/deployment-charts@master] wikifunctions: Upgrade orchestrator from 2026-08-11-210638 to 2026-08-19-122639

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

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

[operations/deployment-charts@master] wikifunctions: Upgrade orchestrator from 2026-08-19-165650 to 2026-09-01-120256

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

Change #1333858 merged by jenkins-bot:

[operations/deployment-charts@master] wikifunctions: Upgrade orchestrator from 2026-08-19-165650 to 2026-09-01-120256

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

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

[operations/deployment-charts@master] wikifunctions: Upgrade orchestrator from 2026-08-19-165650 to 2026-09-01-120256 (try 2)

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

Change #1334052 merged by jenkins-bot:

[operations/deployment-charts@master] wikifunctions: Upgrade orchestrator from 2026-08-19-165650 to 2026-09-01-120256 (try 2)

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

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

[operations/deployment-charts@master] wikifunctions: Upgrade orchestrator from 2026-08-19-165650 to 2026-09-03-172537

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

Change #1335068 merged by jenkins-bot:

[operations/deployment-charts@master] wikifunctions: Upgrade orchestrator from 2026-08-19-165650 to 2026-09-03-172537

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