⚓ T352799 Front end JS canonicalize() throws exception on some quoted zobject content
Page MenuHomePhabricator

Front end JS canonicalize() throws exception on some quoted zobject content
Closed, ResolvedPublicBUG REPORT

Description

Description

When running a function, there are cases in which neither a result nor an error nor any metadata is shown. These are cases in which the specified input is invalid for the function call, and the user should be informed of that. (I'm not sure whether the invalidity error should be detected by front-end code or should come back from the orchestrator, but either way, it should be shown.)

Update, 2024-02-11:
This behavior has been diagnosed as caused by an exception in schemata.js::canonicalize. This function is meant to handle a hybrid form of zobjects; not meant to handle all normal form zobjects. This behavior arises when the orchestrator (properly) returns quoted content (inside an error object) which is in normal form. It will be fixed with the following steps:

  • Rename canonicalize to hybridToCanonical.
  • Rename normalize to canonicalToHybrid.
  • Fix these functions so that they ignore quoted content (whatever is inside of a Z99K1).
  • Add JSdoc to these functions saying that the transformation works to/from hybrid form.

Steps to reproduce:

  1. Go to https://www.wikifunctions.org/wiki/Z811
  2. In the Try this function box, notice that the input is already initialized to be an empty list of Object, which is an invalid input for this particular function.
  3. Click Run function
  4. Notice the string Running appears momentarily
  5. Notice then that the word Result appears, but nothing else is there – no result, error, or metadata. (An error should be reported.)

Optional steps to try

  1. Before clicking Run function, enter a valid list of String, with a single element, and get back a valid result.
  2. Then remove the single element, so that you have an empty list as input.
  3. Then click Run function, and you will still observe the same problematic behavior (no result, error, or metadata)

Notes:

  • I observe the same behavior with latest-merged code in my local environment
  • In the past, when calling this function with an empty list, I would reliably see that an error was reported, and metadata made available.

Observed behavior:

  • As stated above

Expected behavior (Acceptance criteria):

  • As stated above

Completion checklist

Event Timeline

Jdforrester-WMF moved this task from To Triage to Backlog on the Abstract Wikipedia team board.

Change 1001868 had a related patch set uploaded (by David Martin; author: David Martin):

[mediawiki/extensions/WikiLambda@master] Update & rename front-end JS "canonicalize" & "normalize" functions

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

DMartin-WMF renamed this task from Function evaluator widget sometimes fails to report error condition to Front end JS canonicalize() throws exception on some quoted zobject content.Feb 11 2024, 9:43 PM

Change 1001868 merged by jenkins-bot:

[mediawiki/extensions/WikiLambda@master] schemata: Update & rename "canonicalize" & "normalize" functions

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