Page MenuHomePhabricator

Make Herald rules more resilient
ClosedPublic

Authored by joshuaspence on May 20 2015, 9:37 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Apr 30, 5:21 PM
Unknown Object (File)
Thu, Apr 25, 3:33 AM
Unknown Object (File)
Tue, Apr 16, 5:45 AM
Unknown Object (File)
Fri, Apr 12, 9:18 PM
Unknown Object (File)
Apr 4 2024, 8:34 AM
Unknown Object (File)
Mar 31 2024, 5:44 AM
Unknown Object (File)
Mar 28 2024, 9:06 PM
Unknown Object (File)
Feb 24 2024, 4:40 PM
Subscribers

Details

Reviewers
epriestley
Group Reviewers
Blessed Reviewers
Summary

Make Herald conditions and actions more resilient (see discussion in D12896). This protects against invalid rules, which may have been valid in the past but are no longer valid. Specifically:

  • If a rule has an invalid field, the conditions fail and the actions do not execute.
  • The transcript shows that the rule failed because of an invalid field, and points at the issue.
  • If a rule has an invalid action, that action fails but other actions execute.
  • The transcript shows that the action failed.
  • Everything else (particularly, other rules) continues normally in both cases.
  • The edit interface is somewhat working when editing an invalid rule, but it could use some further improvements.
Test Plan
  1. Created a Herald rule with an invalid condition.
    1. Ran this rule on a differential revision and saw the rule fail in the transcript.
    2. Was able to submit a differential without receiving an ERR-CONDUIT-CORE.
    3. Edited the Herald rule using the UI and was able to save the rule succesfully.
  2. Created a Herald rule with one valid action and one invalid action.
    1. Ran this rule on a differential revision and saw one success and one failure in the transcript.
    2. Was able to submit a differential without receiving an ERR-CONDUIT-CORE.
    3. Edited the Herald rule using the UI. Clicking save caused a HeraldInvalidActionException to be thrown, but maybe this is okay.

Diff Detail

Repository
rP Phabricator
Branch
master
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 6237
Build 6259: [Placeholder Plan] Wait for 30 Seconds

Event Timeline

joshuaspence retitled this revision from to Make Herald rules more resilient.
joshuaspence updated this object.
joshuaspence edited the test plan for this revision. (Show Details)
joshuaspence added a reviewer: epriestley.
joshuaspence edited edge metadata.

Further progress

joshuaspence edited the test plan for this revision. (Show Details)
joshuaspence edited the test plan for this revision. (Show Details)

Ah actually, saving the rule wiped out the value for the condition.

Ah actually, saving the rule wiped out the value for the condition.

I think this is because of the typeahead... when I nuked the "flag" action for testing purposes, the value persisted.

epriestley edited edge metadata.

I think it's fine to require rules to be valid in order to be saved. Couple of minor inlines to smooth the UX out a little.

In HeraldTranscriptController.php near line 383, we do this:

$rule = idx($action_names, $apply_xscript->getAction(), pht('Unknown'));

Let's make the default for that look more like <Unknown Action "flag"> too? That cleans up the transcripts a bit.

src/applications/herald/controller/HeraldRuleController.php
323

Let's make this $ex->getMessage();? That makes the error a bit more user-friendly.

455

Maybe translate this as <Unknown Action "%s"> to make debugging easier?

And same for <Unknown Field> above?

This revision is now accepted and ready to land.May 24 2015, 1:33 PM
joshuaspence marked 2 inline comments as done.
joshuaspence edited edge metadata.

Rebase, clean up UI

Argh. Sorry, I stuffed up this during some last minute testing... This should be rPf5c9b9c014a789d3b532da2179443a116f104dea.

src/applications/herald/engine/HeraldEngine.php
277

For posterity, this bypassed the cache and made rules more expensive to run. No one noticed for about a year, but it should be resolved by D15451.