Page MenuHomePhabricator

function-schemata: Audit use of Z99/Quote in error types
Closed, ResolvedPublic

Description

Description

We have Z99/Quote specified as the type of some error type keys (examples below), but it's not clear whether this has been done consistently. Getting these types right is a prerequisite to doing some further work on errors.

  • Clarify and specify our criteria for using Z99/Quote as the type of error type keys.
  • Based on those criteria, update error-type ZObjects as needed (i.e., adding or removing the use of Z99/Quote).
    • E.g., consider adding quoting to: Z537K1 (debatable, but leave for now), Z508K2 (already quoted), Z518K2 (okay as is), Z531K1 (already quoted)
  • Update utility code (which creates Z5/Error ZObjects) as needed.
  • Update all other relevant function-schemata code & tests as needed.
  • Update all relevant orchestrator code & tests as needed.
  • Update all relevant evaluator code & tests as needed.
  • Update all relevant wikilambda code & tests as needed.

Possible criteria for quoting error type keys (taken mostly from discussions on slack):

  • Quote where we suspect the input is invalid in some way
  • But do not quote Z1K1 by itself. If its value is in doubt, quote the entire object that contains it.
  • Quote resolvable keys that might be ingested as the input to a function
  • Quote when resolving a value might cause a catastrophe (e.g. infinite recursion)
  • Quote the values of any key that might get a value containing Z7, Z9, or Z18. (See also T323158).
  • Quote more things if it lets us make backend APIs more consistent

Examples of possible inconsistency

  • Some error type keys called object or whole object are declared as type Z99/Quote, but others are not. (Currently only true for "object type mismatch", and that's okay.)
  • Z507K1/function call of Z507/error_in_evaluation is not declared as Z99/Quote, but the method createZErrorInstance() in errorFormatter.js (function-schemata) does quote values of Z507K1/function call. (T349026) (Corrected)
  • createZErrorInstance() also quotes values of Z507K2/propagated error, but other keys named propagated error are not quoted anywhere, or declared to be Z99/Quote. (Corrected)

Desired behavior/Acceptance criteria (returned value, expected error, performance expectations, etc.)

  • The uses of Z99/Quote in error types should be consistent.
  • Error-creation/handling code should be consistent with error type declarations .

Completion checklist

Event Timeline

Jdforrester-WMF moved this task from To triage to Backlog on the Abstract Wikipedia team board.
DMartin-WMF renamed this task from function-schemata: Audit use of Z99/Quote as type of errors to function-schemata: Audit use of Z99/Quote in error types.Jan 12 2024, 1:33 AM
DMartin-WMF updated the task description. (Show Details)

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

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

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

Change 991625 merged by jenkins-bot:

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

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

DMartin-WMF closed this task as Resolved.EditedJan 22 2024, 12:34 AM

I didn't find any error types that need the addition (or removal) of Z99 as a key's type (except for Z507, which was handled by T349026). In addition to updating the errors listed in errors.js, I updated the lists on these wiki pages:

Also added a brief new section about quoting here:

and updated this section:

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

[operations/deployment-charts@master] wikifunctions: Upgrade orchestrator from 2023-11-29-152839 to 2024-01-18-182456

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

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

[operations/deployment-charts@master] wikifunctions: Upgrade evaluators from 2023-11-29-143341 to 2024-01-18-182630

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

Change 992225 merged by jenkins-bot:

[operations/deployment-charts@master] wikifunctions: Upgrade orchestrator from 2023-11-29-152839 to 2024-01-18-182456

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

Change 992227 merged by jenkins-bot:

[operations/deployment-charts@master] wikifunctions: Upgrade evaluators from 2023-11-29-143341 to 2024-01-18-182630

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

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

[operations/deployment-charts@master] wikifunctions: Upgrade orchestrator from 2024-01-09-190638 to 2024-01-18-182456

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

Change 992756 merged by jenkins-bot:

[operations/deployment-charts@master] wikifunctions: Upgrade orchestrator from 2024-01-09-190638 to 2024-01-18-182456

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