Page MenuHomePhabricator

Consider what to do with validation
Closed, ResolvedPublic

Description

Description

Validation has been largely deprecated, except in the case of custom validator functions. Consider whether even those functions are adding value.

  • ensure that validation functions are run
  • ensure that these functions are run only once (i.e., once validated, an object is not validated again)

Completion checklist

Details

Related Changes in Gerrit:
Related Changes in GitLab:
TitleReferenceAuthorSource BranchDest Branch
Add support for validation in composition language v2.repos/abstract-wiki/wikifunctions/function-orchestrator!560apineapine-validation-v2main
Customize query in GitLab

Event Timeline

I’ve raised a couple of tickets relating to type-guarantee failures: T411565 and T417631. These guarantees are currently costly to enforce in user functions. See, for example apply two-argument function: validated arguments (Z31684), with this test.

I’ve raised a couple of tickets relating to type-guarantee failures: T411565 and T417631. These guarantees are currently costly to enforce in user functions. See, for example apply two-argument function: validated arguments (Z31684), with this test.

This is really helpful!!! We don't have a good way to assess how useful validation is, so examples like these are important.

In your experience, is validation mostly useful for inputs? Or do people expect it to be run on a function's return value, too?

Most critically, I would say it is at the interface between functions. A called function benefits from static guarantees provided by the composition itself, but if the interface is not strictly typed on both sides, that guarantee can fail at runtime, with downstream consequences that are difficult to trace (or even identify as having occurred), especially when the interface is encapsulated within another function.

At present, incorporating intermediate type-checking is particularly inefficient because there is no built-in type-equality function, nor a direct object-typing primitive. Our type of object (Z16829) function is currently implemented via value by key (safer) (Z22475) to avoid failures for string objects in Z803 T389487 but, not surprisingly, this has a noticeable performance impact.

I’ve raised a couple of tickets relating to type-guarantee failures: T411565 and T417631. These guarantees are currently costly to enforce in user functions. See, for example apply two-argument function: validated arguments (Z31684), with this test.

This is really helpful!!! We don't have a good way to assess how useful validation is, so examples like these are important.

In your experience, is validation mostly useful for inputs? Or do people expect it to be run on a function's return value, too?

cmassaro changed the task status from Open to In Progress.Feb 19 2026, 8:48 PM

Ah! I think I misunderstood something. The validator functions currently used in practice are not the same as what the backend formally defines as validators. I still plan to implement this functionality, but it looks like it's never used in practice.

Jdforrester-WMF subscribed.

Not-yet-deployed => let's just immediately consider for sign-off.

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

[operations/deployment-charts@master] wikifunctions: Upgrade orchestrator from 2026-02-18-140059 to 2026-02-25-124326

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

Change #1243831 merged by jenkins-bot:

[operations/deployment-charts@master] wikifunctions: Upgrade orchestrator from 2026-02-18-140059 to 2026-02-25-124326

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