Page MenuHomePhabricator

Make Herald rules more resilient
ClosedPublic

Authored by joshuaspence on May 20 2015, 9:37 PM.
Tags
None
Referenced Files
F14078303: D12957.diff
Fri, Nov 22, 3:08 AM
Unknown Object (File)
Sun, Nov 17, 4:45 PM
Unknown Object (File)
Wed, Nov 13, 11:44 PM
Unknown Object (File)
Sun, Nov 10, 6:23 AM
Unknown Object (File)
Wed, Nov 6, 3:11 PM
Unknown Object (File)
Sat, Nov 2, 5:26 AM
Unknown Object (File)
Fri, Nov 1, 1:01 PM
Unknown Object (File)
Oct 21 2024, 4:19 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 6175
Build 6196: [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.

453

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
274

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.