Page MenuHomePhabricator

Draft revisions and the Herald "Is newly created" condition interact badly
Closed, InvalidPublic

Assigned To
None
Authored By
leoluk
Apr 18 2019, 12:49 PM
Tags
None
Referenced Files
F6383720: image.png
Apr 18 2019, 12:49 PM
F6383707: image.png
Apr 18 2019, 12:49 PM

Description

Herald rules that match "Is newly created" do not work as expected when Drafts are enabled.

Repro:

  • Enable prototypes.
  • Write a herald rule that watches revisions and specifies a "Is newly created" condition, with a "send email" action.
  • Create a new revision.

No email is sent when the revision promotes out of Draft state.

Example rule: H170 Watch Revisions

First pass (creation):

image.png (183×874 px, 30 KB)

Third pass (promotion):

image.png (175×376 px, 19 KB)

All passes: https://secure.phabricator.com/herald/transcript/query/wJg_lnKutUrv/#R

See T13027, D18819.

Event Timeline

epriestley added a subscriber: epriestley.

This is expected: the revision is not newly created.

You likely want this rule instead:

When:
[ Repository ][ is any of ][ X ]
Take actions [ only the first time this rule matches ]:
[ Send me an email ]

Note the use of "only the first time this rule matches".

This is expected: the revision is not newly created.

Or, specifically, there are two possible triggers:

  • When the revision is created, it is "newly created", but it can not send email, so the rule does not evaluate and has no effect.
  • When the revision promotes from draft and can send email, it is no longer "newly created", so the rule has no effect.