Page MenuHomePhabricator

Allow Herald rules for Maniphest to act on task status changes
Closed, ResolvedPublic

Event Timeline

swisspol raised the priority of this task from to Needs Triage.
swisspol updated the task description. (Show Details)
swisspol added a subscriber: swisspol.

Be able to have a rule execute when the status changes.

chad triaged this task as Normal priority.May 10 2014, 5:31 AM
chad added projects: Herald, Maniphest.
chad added a subscriber: btrahan.

Is matching the new value ("Task status is closed") sufficient, or do you specifically want to trigger on the change ("Task status changes from X to Y")?

(Assuming the former, this is mostly a typeahead/UI issue.)

I think matching the new value is sufficient for already improved task routing e.g. status changes to "Verify" and project contains "iOS", assign to iOS QA.

I'm not sure I understand why this is a "typeahead" issue: it's that just a pop-up menu to choose the task status to act upon?

The rule will cover things like [Task status] [is any of] [X, Y, Z], similar to how other rules work. The X, Y, Z control will be a typeahead, to support multiple selections.

(We reasonably could use, like, a list of checkboxes, but for consistency it's cleaner to complete T4420 and drive this through that.)

BTW, this is something that we'd like to request as well -- our primary use case is that our developer relations people want to get alerts whenever we fix bugs in our API so we can notify the affected developers. Do we have any sort of an ETA on this?

See T4666 for a more general overview of Herald.

Currently, users can write Herald rules which check task edits in Maniphest and match against fields like Title, Body, etc. However, there's no way to match "Status" right now. The main reason for that is that "Status" is custom and configurable, so we need to do a little bit of work to produce a nice control.

To start with, build a typeahead datasource that returns available statuses.

  • Subclass PhabricatorTypeaheadDatasource and put it in Maniphest as ManiphestTaskStatusDatasource or similar.
  • PhabricatorTypeaheadMonogramDatasource is a reasonably good example.
  • To build the actual results, load statuses with ManiphestTaskStatus::getTaskStatusMap(). ManiphestTaskStatus has other helpful methods.
  • You can test your datasource at http://your.install.com/typeahead/class/. Searching for a string like "open" or "closed" in the "Query" field should return the relevant statuses.

Next, add a "Task Status" field to Herald:

  • This will happen in HeraldManiphestTaskAdapter, with some changes in the parent class HeraldAdapter.
  • You'll add a new FIELD_STATUS.
  • You'll add a new VALUE_TASK_STATUSES.
  • There's a small piece of ugly magic in HeraldRuleController->buildTokenizerTemplates() where you'll explicitly need to map your new VALUE to the appropriate typeahead datasource. Some day this will get less ugly as Herald becomes more modular.

When implemented, Maniphest rules in Herald should now expose a status field which lets you select several statuses via typeahead, like the example above:

[Task status] [is any of] [X, Y, Z]

Hi,

Question: When subtask was fixed, the parent task want to have a action, for example, add a tag or change status if all subtasks were fixed.
So how to get this work in the extention of herald action? Thanks in advance!~

oh, nice work, it will trigger parent task as well when subtask changed, seems I need to add the "condition" like subtask status instead of a "action" for this... any samples? Thanks!