Page MenuHomePhabricator

When Herald acts, include the transaction group as part of the "state" it acts upon
Closed, ResolvedPublic


See PHI1202, which requests a way to distinguish between edits in Phriction which affect only drafts vs those which affect the published document.

Today, with a few exceptions, Herald mostly acts only on state, not on changes. For example, you can write a rule like "When task assignee is X", but not "When task assignee changes". This is mostly to make testing rules with the test console easier, and some conditions (like "Actor" and "Is Newly Created") already aren't really state rules.

We can make this behavior more predictable/testable like this:

  • When Herald executes in the context of a TransactionEditor, pass the applied transactions to Herald.
  • Build change-triggered rules like "published document changed" out of these transactions.
  • Save the transaction PHIDs in the transcript and show them in the transcript UI.

This will at least make it more clear which changes we're talking about, in a relatively stable/visible way.

When running the test console on an object, we can pick the most recent transaction group and apply a similar treatment.

(We can't let the user select an older transaction group because we can't rewind transactions in the general case.)

Event Timeline

epriestley triaged this task as Normal priority.May 3 2019, 5:11 AM
epriestley created this task.

pass the applied transactions to Herald

We've technically done this since D14575, which added this as a compatibility layer for older code which might rely on ancient events. However, they currently aren't very formal (not saved in the transcript or shown on the transcript page) and the Test Console doesn't build a synthetic transaction set, so actions which depend on transactions can not be tested.

Currently, I think the primary transactions and transactions triggered by Herald are getting different group IDs. They should be the same group ID, e.g. all these transactions should be in the same "group" for the purposes of collecting transactions into effect groups:

alice edited the title: ...
Herald did whatever: ...
Herald added other things: ...

This is likely easy to fix.

epriestley claimed this task.

I think this is about as good as we're going to get, and we've only taken a very small step toward the precipice of a self-aware Herald that hates humankind.