Page MenuHomePhabricator

schemata.js: Determine how hybridToCanonical should handle normal inputs, implement & provide tests
Closed, ResolvedPublic

Description

Description

hybridToCanonical is not meant to handle normal-form inputs in general, but there are still some situations in which it might receive a normal-form input. These need to be handled carefully to avoid improper translations, and exceptions that can lead to undiagnosed errors downstream.

  • If a programming language exception is raised, should hybridToCanonical return a ZError? If so, which one?
  • Should hybridToCanonical perform any checks to see if it receives a normal-form input which is not meant to be handled?
    • Note the nested function listifyArray has the potential to return incorrect results for a normal-form input (because it does not put the type at the beginning of the canonical list that it returns). Let's make sure no improper translations are possible.

Note: Converting all normal-form inputs properly to canonical could be a nontrivial effort (based on comparison to function-schemata's canonicalize() method), and would result in additional code functionality that duplicates function-schemata. It may make sense to hold off on that objective until we've arranged for function-schemata's canonicalize() method to be available.

Desired behavior/Acceptance criteria

  • ...

Completion checklist

Event Timeline

DMartin-WMF renamed this task from schemata.js: Determine how hybridToCanonical should handle normal-form inputs, implement & provide tests to schemata.js: Determine how hybridToCanonical should handle normal inputs, implement & provide tests.Feb 14 2024, 11:09 PM
DMartin-WMF created this task.
Mcastro moved this task from To triage to Backlog on the Abstract Wikipedia team board.

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

[mediawiki/extensions/WikiLambda@master] Clean up the handling of normal forms in hybridToCanonical

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

Jdforrester-WMF changed the task status from Open to In Progress.Mar 11 2024, 7:09 PM
Jdforrester-WMF assigned this task to DMartin-WMF.
Jdforrester-WMF moved this task from Backlog to In Progress on the Abstract Wikipedia team board.

Change 1009940 merged by jenkins-bot:

[mediawiki/extensions/WikiLambda@master] Clean up the handling of normal form in hybridToCanonical

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