Page MenuHomePhabricator

Consider Stronger Post-Conditions on `realize()` and `fullyRealize()` Operations
Open, In Progress, HighPublic

Description

Description

The result of realize() or fullyRealize() is not always guaranteed to be a WFBase instance. This has ramifications for further applications of these operations, including idempotence. We also have to implement point-solutions to address downstream code that expects a WFBase but instead receives bare JSON. T426336 is probably a manifestation of this; also see TODOs tagged against this here task in function-orchestrator.

Desired behavior/Acceptance criteria (returned value, expected error, performance expectations, etc.)

  • consider enforcing the post-condition that realize() and fullyRealize() must always return a WFBase instance
  • no more broken
  • make WFReference.fullyRealize call fullyRealize on its result
    • audit other WFBase types in like fashion
  • setRealized() should enforce the same guarantees as resolve(), especially on sub-elements of complex types (WFObject, WFList)
    • setRealized should then be re-enabled for WFLists

Completion checklist

Event Timeline

DSantamaria changed the task status from Open to In Progress.Jun 15 2026, 1:25 PM
DSantamaria added a project: Essential-Work.
cmassaro raised the priority of this task from Medium to High.Jun 17 2026, 6:18 PM
cmassaro updated the task description. (Show Details)

A new test inspired by https://phabricator.wikimedia.org/T428914 has shown us a subtle source of bugs.

Calling setRealized on WFLists introduces problems when the internal objects have not been turned into WFBase objects. However, if we try to make the list elements into WFBase objects upon list creation, some scoping issues arise. We are relying on list elements being bound to a scope later in the function call. For now, I am writing a test that exercises this behavior, then "fixing" temporarily by disabling the setRealized operation on WFLists.

In the future, we may need to consider one of the following:

  • separating scope/wfConfig attachment from WFBase creation
    • this would allow us to make all of a list's elements into WFBase objects and setting their realized state without committing to a scope binding
  • deactivating setRealize entirely because it's a small optimization that introduces a lot of dangers