Call buildChildWorkflow with arguments no longer work

Hi,

I have a use case for a custom workflow which is a wrapper around the land workflow, which is used to run some tests and call hooks before actually landing a diff. In this custom workflow I build a child land workflow and pass it some arguments via the buildChildWorkflow() method.

This method builds the child workflow and makes it validate the arguments against its specification. However it seems that this part of the code is using legacy methods that don’t exist anymore. The method getCompleteArgumentSpecification() calls getArguments() (see here) which has turned into getWorkflowArguments() since commit 68f28a17188.

Is this actually a bug or is there a replacement API for buildChildWorkflow() that I’m missing ?

Thanks !

This does look like a bug. Are you able to share your custom workflow or can you provide a minimal test case? That will make it easier for someone to investigate and identify a fix.

Here is a minimal example to reproduce the issue:

<?php

/**
 * Minimal example to reproduce this issue:
 * https://discourse.phabricator-community.org/t/call-buildchildworkflow-with-arguments-no-longer-work/4889
 */
final class ArcanistLandHoldWorkflow extends ArcanistWorkflow {
  public function getWorkflowName() {
    return 'land-hold';
  }

  public function run() {
    $landWorkflow = $this->buildChildWorkflow('land', array('hold'));
    $landWorkflow->run();

    return 0;
  }
}

I get the following output:

$ arc land-hold
Usage Exception: Unrecognized argument 'hold'. Try 'arc help'.

Thank you! I will take a look at this.

I dug around a bit but I’m not really familiar with how custom workflows and child-workflows are expected to be implemented and work.

From what I was looking at I think the arc land workflow specifically is in an in-between state from the old-style implementation of ArcanistWorkflow and the new modern design. I tried fiddling with some changes in buildChildWorkflow() along with the example you provided and was able identify some potential updates that may be needed but ultimately I got the impression that there are significantly larger changes that would need to be made in order to support a child land workflow.

https://secure.phabricator.com/T13546

Thanks for digging into the issue. For my own use I suspect that changing the calls from getArguments() to getWorkflowArguments() in ArcanistWorkflow.php should be enough (not tested), but I don’t know if that will break other custom workflows that rely on the previous interface and just move the problem from one place to another.

In my testing there were a number of other issues that cropped up but I don’t recall exact details off the top of my head. I think the buildChildWorkflow() was also not copying over some other fields like the configuration engine, and I believe the format of the arguments needed adjusted (I had to add an mpull() somewhere for the argument mapping). Even after getting that set up it still seemed to fail to register the argument for the child command.