Page MenuHomePhabricator

Ensure That Executed/Dereferenced Objects (Z18s, Z7s, Z9s) Validate as the Expected Type
Closed, ResolvedPublic

Description

For example: let us say that one of the Z14/Implementations in the list held in Z8K4 of a Z8/Function is a Z9/Reference. Even if that Reference points to something that's not actually a Z14, no error will be propagated.

The mutate function should validate the result against the expected type, which can be determined by looking at the key of the object being mutated.

I see two possible ways to implement this:

  1. Create a copy of the input ZObject; set the key corresponding to the original reference to the resolved/mutated element; re-run validation on the top-level object. This is incredibly wasteful, since it means re-running validation on the entire object multiple times, even for the keys that haven't changed.
  2. Create intermediate-level references in all of the JSON schemata corresponding to builtin types. For example, instead of saying that Z7K1 of a Z7 is a Z8, define in the JSON schema a nonterminal node Z7K1 which Z7.Z7K1 must validate as. Then a schema for Z7K1 can be created independently so that, if mutate(Z7K1) is called on a Z8, the result can be validated as Z7K1. In this way, we won't re-run the same validation on any objects, but we'll have to rewrite all of the builtin schemata. Note that this will be much easier when validating generic or builtin types (basically anything where we create the validator directly from a Z4), since the GenericSchema class already maintains a mapping from an object's keys to the corresponding sub-validators.

Event Timeline

cmassaro updated the task description. (Show Details)

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

[mediawiki/services/function-schemata@master] Create separate sub-validators for the keys of a type.

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

Change 762960 merged by jenkins-bot:

[mediawiki/services/function-schemata@master] Create separate sub-validators for the keys of a type.

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

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

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

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

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

[mediawiki/services/function-orchestrator@master] Update function-schemata sub-module to HEAD (9930c82)

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

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

[mediawiki/services/function-evaluator@master] Update function-schemata sub-module to HEAD (9930c82)

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

Change 763251 merged by jenkins-bot:

[mediawiki/services/function-orchestrator@master] Update function-schemata sub-module to HEAD (9930c82)

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

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

[mediawiki/services/function-orchestrator@master] After dereferencing/running function calls, validate that the return value is of the expected type.

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

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

[mediawiki/services/function-schemata@master] Remove Z7_backend. Add individual validators for Z10.

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

Change 763250 merged by jenkins-bot:

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

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

Change 763253 merged by jenkins-bot:

[mediawiki/services/function-evaluator@master] Update function-schemata sub-module to HEAD (bd3c52f)

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

Change 763772 abandoned by Cory Massaro:

[mediawiki/services/function-schemata@master] Remove Z7_backend. Add individual validators for Z10.

Reason:

Replaced by two other patches

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

Change 763771 merged by jenkins-bot:

[mediawiki/services/function-orchestrator@master] After dereferencing/running function calls, validate that the return value is of the expected type.

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