Page MenuHomePhorge

Herald rule referring to a disabled rule silently fails
Open, Needs TriagePublic

Description

Assume this rule:

H15
when:
    <something happens> 
    AND rule H10 doesn't match,
then:
    send me an email

If rule H10 is disabled, then rule H15 will fail to evaluate, never actually do anything, and there's no way to find that except by visiting a Transcript after you know something is wrong.

In my use-case (H7 -> H22), I expected it to interpret "disable rule" as "doesn't match", but I suspect there are other possible interpretations, depending on context.

In any case, having the referring rule silently fail is bad.

Event Timeline

Uhmm, transcripts at http://phorge.localhost/herald/transcript/33065/ never ever render a Herald rule condition (disabled or not) within another rule, it seems

Ahh but Transcripts do render an exception when it fails at least. I get a HeraldInvalidConditionException printing Invalid Condition: Condition references a rule which does not exist!, triggered in HeraldAdapter::doesConditionMatch() (only if you reach that condition in the evaluation of course, because https://we.phorge.it/source/phorge/browse/master/src/applications/herald/engine/HeraldEngine.php$437-445 ).
That's called in HeraldEngine in the line $is_match = $adapter->doesConditionMatch (note that class also has a method with the very same name).

So I would take the same approach in T15885 / D25735 and phlog() the exception - that'll allow admins to find a hint when checking the error log.

Another option could be checking whether a Herald rule is referenced in a condition or an action whenever disabling that very Herald rule but I think I lack skills to write such code.