Page MenuHomePhabricator

Create basic equality and validator builtins for Z89
Closed, ResolvedPublic

Description

Description:
We need to implement a built-in validator and equality function for Z89 (HTML fragment) in Wikifunctions.

Why this is needed:
Now that Z89 is a supported type, function outputs may include HTML fragments. In order for the platform to properly support:

  • Validation of function outputs (e.g., during evaluation or editing)
  • Comparison of outputs for test cases and equality checks
  • Safe internal usage of Z89 values in other built-ins or orchestrator logic

...we need native support for:

Validation: Ensure that a Z89K1 value is a valid string (and optionally contains only allowed HTML elements.)
Equality: Allow comparison of two Z89 values based on normalized HTML (e.g., ignoring whitespace differences or ordering of attributes).

Update, 15 June 2025

  • For the validator, we decided to just create a placeholder for now (Z189 with implementation Z289), and that's been done.

Equality function creation steps:

  • Choose a ZID for the equality function
    • possibly Z877, because the other equality functions have double digits, this is the next double digit number after string equality, Z866, and there's nothing more obvious
  • In function-schemata:
    • Define the equality function
    • Define the built-in implementation (Z977)
    • Update dependencies.js
  • In the orchestrator:
    • Write the orchestrator code for the implementation, in builtins.js
    • Add the ZIDs to the relevant lists in builtins.js
    • Add tests

Next quarter work

  • equality function now just checks 1.Z89K1 === 2.Z89K2. But with html two html strings can be valid but differently indented. This needs some work in the future.
// this equals
<strong><i>equal</i></strong>
// this
<strong>
  <i>equal</i>
</strong>
  • validator is an builtin empty validator. might need more work.

Details

Related Changes in Gerrit:
Related Changes in GitLab:
TitleReferenceAuthorSource BranchDest Branch
builtins: Add orchestrator code for Z877/Same HTML fragmentrepos/abstract-wiki/wikifunctions/function-orchestrator!388dmartinT396606main
Update function-schemata sub-module to HEAD (371122b)repos/abstract-wiki/wikifunctions/wikilambda-cli!77jforrestersync-function-schematamain
Update function-schemata sub-module to HEAD (371122b)repos/abstract-wiki/wikifunctions/function-evaluator!352jforrestersync-function-schematamain
Update function-schemata sub-module to HEAD (371122b)repos/abstract-wiki/wikifunctions/function-orchestrator!387jforrestersync-function-schematamain
Definitions: add equality function & implementation for Z89 repos/abstract-wiki/wikifunctions/function-schemata!239dmartinT396606main
Customize query in GitLab

Event Timeline

DSantamaria removed a project: Workstreams.

I thought that we agreed we weren't going to do this? Why the change of plans?

I thought we discussed in the meeting to go with the simplest version there is . Or is that out of the box and no work needed for that?

DSantamaria changed the task status from Open to In Progress.Jun 16 2025, 12:58 PM
DSmit-WMF updated the task description. (Show Details)

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

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

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

Change #1160213 merged by jenkins-bot:

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

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

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

[operations/deployment-charts@master] wikifunctions: Update evaluators from 2025-06-09-163022 to 2025-06-17-205547

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

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

[operations/deployment-charts@master] wikifunctions: Update orchestrator from 2025-06-10-144243 to 2025-06-17-204731

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

Change #1160759 merged by jenkins-bot:

[operations/deployment-charts@master] wikifunctions: Update evaluators from 2025-06-09-163022 to 2025-06-17-205547

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

Change #1160760 merged by jenkins-bot:

[operations/deployment-charts@master] wikifunctions: Update orchestrator from 2025-06-10-144243 to 2025-06-18-130945

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