Few improvements to suggest.#402
Conversation
…n case of OnEvaluateRule action. RuleCompiler; Thee is an issue when a globalParam is declared, it tries to be added to the input of each rule and subrules failed because it is already there. RuleEngine: The PostActions are executed at the end of the exetuon of every rule, not at the end of the workflow.
|
@ianido please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.
Contributor License AgreementContribution License AgreementThis Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
|
|
Hi @ianido , Thanks for raising this PR, both the suggestions are valid but I would like to discuss them, since it will impact existing functionality. For ExecuteRule, we already have an ability to filter the inputs/scopedparams passed to the chained rule, RulesEngine/src/RulesEngine/Actions/EvaluateRuleAction.cs Lines 46 to 49 in 7949a8b Also ExecuteRule is intended for cross-workflow rule execution, so it can be subjective whether they want to reuse a global variable from old workflow or new one. In this case, I would suggest creating a new Custom action which meets the specific requirements of the consumer. Adding an implicit filtering on same named scoped param can lead to predictably issues in some cases. |
|
How can I tell which rules has failed. How to get the fail result back? Thank you. |
… errors (#743) PR #402 surfaced two cases where the engine threw cryptic "An item with the same key has already been added. Key: …" deep inside RuleResultTree construction: 1. Two GlobalParams in the same workflow sharing a name. 2. Two LocalParams on the same rule sharing a name. 3. A caller-supplied RuleParameter whose Name matches a workflow's GlobalParam name. All three now surface clear, actionable errors: - WorkflowsValidator catches case 1 at AddWorkflow time and throws RuleValidationException with "Duplicate GlobalParam name '<name>'". - RuleValidator catches case 2 similarly with "Duplicate LocalParam name '<name>'". - RulesEngine.AppendGlobals catches case 3 at execution time and throws RuleException with "GlobalParam name '<name>' collides with an input RuleParameter of the same name". The exception flows through the existing per-rule error-surfacing path in ExecuteAllRuleByWorkflow, so callers see the explanatory message on each rule's ExceptionMessage — the same pattern other scoped-params errors already use. Constants in Constants.cs make the messages reusable and tested. Regression test: DuplicateParamNameValidationTest covers all three failure modes plus a sanity case where distinct names continue to work. All 174 unit tests pass on net6 / net8 / net9 / net10. Co-authored-by: Yogesh Prajapati <yogeshcprajapati@outlook.com>
Hi, I have been working in a practical application and I found few things you may consider.
EvaluateRuleActions : Allows to track the results of a bifusrcation in case of OnEvaluateRule action.
RuleCompiler; Thee is an issue when a globalParam is declared, it tries to be added to the input of each rule and subrules failed because it is already there.
RuleEngine: The PostActions are executed at the end of the exetuon of every rule, not at the end of the workflow.