Page MenuHomePhabricator

When revisions autopromote out of "Draft", Herald rules blocked by "Draft" do not trigger until the next edit
Closed, ResolvedPublic



Repro instructions are something like:

  • As Alice, write a revision rule like "Always send me an email".
  • Enable prototypes.
  • As Bailey, create a revision without involving Alice.

The revision is initially a draft, so Alice's rule gets blocked (as "forbidden"). When the revision auto-promotes out of draft (either inline during creation, or later after a build success) the Herald rules run first, then the promotion occurs.

This means that Alice's rule doesn't get a chance to run until the next edit, when the revision is no longer a draft.

One fix to this is to change the promotion behavior in didApplyTransactions(). Instead of promoting immediately, set a flag on the Editor, then apply a second edit after everything finishes. This will trigger Herald again. This feels kind of hacky, but may be the least-bad approach available, and I can't come up with anything it explicitly breaks.