From 0bfe9ca88f412acd9c40a2456dc450c4821c8ddf Mon Sep 17 00:00:00 2001 From: Andre Klapper Date: Mon, 22 Jul 2024 13:38:32 +0200 Subject: [PATCH] Log Herald rules with invalid actions via phlog() Summary: When Herald rules fail unexpectedly due to relying on a (now) invalid action, allow Phorge administrators to get aware by creating an entry in the error log via `phlog()` instead of crossing fingers that someone may from time to time get the idea to open and read Herald transcripts. Refs T15887 Test Plan: See steps in T15887; check error log. Reviewers: O1 Blessed Committers, avivey Reviewed By: O1 Blessed Committers, avivey Subscribers: avivey, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno Maniphest Tasks: T15887 Differential Revision: https://we.phorge.it/D25737 --- src/applications/herald/engine/HeraldEngine.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/applications/herald/engine/HeraldEngine.php b/src/applications/herald/engine/HeraldEngine.php index 5569c3ddfd..852fbab090 100644 --- a/src/applications/herald/engine/HeraldEngine.php +++ b/src/applications/herald/engine/HeraldEngine.php @@ -688,6 +688,14 @@ final class HeraldEngine extends Phobject { ->setTarget($action->getTarget()) ->setRule($rule); + if ($object->getActionImplementation($action->getAction()) === null) { + phlog(pht('An exception occurred executing Herald rule %s: Unknown '. + 'action: "%s". Review the Herald transcripts and correct or '. + 'disable the problematic rule.', + $rule->getMonogram(), + $action->getAction())); + } + $name = $rule->getName(); $id = $rule->getID(); $effect->setReason(