CancellationToken (#609), AutoExecuteActions (#596), additionalInputs example (#573)#736
Merged
Merged
Conversation
cd14cc6 to
0e90e05
Compare
…tions (microsoft#596), additionalInputs example (microsoft#573) All three are additive; default behavior is unchanged. microsoft#609 — IRulesEngine.ExecuteAllRulesAsync gains an overload taking a CancellationToken. The token is observed cooperatively between rules (ExecuteAllRuleByWorkflow) and before each action (ExecuteActionAsync). A single rule's compiled expression isn't interrupted mid-evaluation; cancellation happens at rule/action boundaries where async work lives. The new 3-arg overload (string, RuleParameter[], CancellationToken) is strictly more specific than the existing `params object[]` overload, so call-site overload resolution continues to bind to the params forms when no token is supplied — no behavioral change at existing call sites. microsoft#596 — New ReSettings.AutoExecuteActions (default true). When false, ExecuteAllRulesAsync evaluates rules but skips automatic OnSuccess/OnFailure action execution, letting callers run actions selectively via ExecuteActionWorkflowAsync. Wired into the copy constructor. microsoft#573 — EvaluateRuleAction already supports additionalInputs; the reporter just lacked a working example. Added a test showing a computed additionalInput ("doubled" = input1.Value * 2) referenced by name in the target rule. Deferred (documented in the PR, not implemented): microsoft#623 (Dynamic.Core method- resolution limitation), microsoft#598 (non-standard implicit list projection), microsoft#565 (already achievable via NestedRuleExecutionMode.Performance), microsoft#569 (workflow schema change needing maintainer buy-in), microsoft#564 and microsoft#550 (niche). All 166 unit tests pass on net6 / net8 / net9 / net10.
sagarambilpure
approved these changes
May 30, 2026
This was referenced May 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Three Tier-4 feature requests that met the bar of being generic, well-justified, and implementable without breaking changes. Each is additive; default behavior is unchanged.
#609 —
CancellationTokensupport onExecuteAllRulesAsyncNew overload
ExecuteAllRulesAsync(string workflowName, RuleParameter[] ruleParams, CancellationToken cancellationToken). The token is observed cooperatively — checked between rules (ExecuteAllRuleByWorkflow) and before each action (ExecuteActionAsync). A single rule's compiled expression isn't interrupted mid-evaluation (they're fast synchronous delegates); cancellation happens at rule/action boundaries, which is where async action work lives.Added to
IRulesEngineas well, per the repo'sClass_PublicMethods_ArePartOfInterfaceinvariant. Source-compatible for all callers — the existingparams object[]andparams RuleParameter[]overloads are untouched; only someone who implementsIRulesEnginethemselves would need to add the member (the same is true of every prior API addition in this library).#596 —
ReSettings.AutoExecuteActions(defaulttrue)When
false,ExecuteAllRulesAsyncevaluates rules but skips the automatic OnSuccess/OnFailure action execution, letting callers run actions selectively (the issue's use case: send only the first matched rule's decision to an external API) viaExecuteActionWorkflowAsync. Defaulttruepreserves current behavior exactly. Wired into theReSettingscopy constructor so it round-trips.#573 —
additionalInputsforEvaluateRuleaction (already supported; documented + tested)EvaluateRuleActionalready evaluatesadditionalInputsand adds them as rule parameters — the reporter just lacked a working example and hit "Unknown identifier". Added a test showing a computed input ("doubled"=input1.Value * 2) referenced by itsNamein the target rule's expression. No code change; this lets the issue close with a concrete example.Deferred (with reasons)
System.Linq.Dynamic.Coremethod-resolution limitation; not fixable in RulesEngine without forking the parserUsers.Name)Users.Any(u => u.Name==…)already worksAndAlso/OrElse+NestedRuleExecutionMode.Performanceshort-circuits identicallyOnSuccess→ list); needs maintainer buy-in on API shapeTest plan
Issue609Test,Issue596Test,Issue573Test) — 6 new tests covering happy path, cancellation (uncancelled + pre-cancelled), non-breaking signature checks, action-skip + selective-run, and the additionalInputs example.Class_PublicMethods_ArePartOfInterfacepasses (interface kept in sync).[Unreleased]section updated.