Implement rule chaining support for @RuleName references and success events#680
Closed
Copilot wants to merge 4 commits into
Closed
Implement rule chaining support for @RuleName references and success events#680Copilot wants to merge 4 commits into
Copilot wants to merge 4 commits into
Conversation
Co-authored-by: pbhal <47822122+pbhal@users.noreply.github.com>
Co-authored-by: pbhal <47822122+pbhal@users.noreply.github.com>
Co-authored-by: pbhal <47822122+pbhal@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Unable to bind values in rule chaining.
Implement rule chaining support for @RuleName references and success events
Jun 26, 2025
YogeshPraj
added a commit
that referenced
this pull request
May 30, 2026
…692 (#737) for STJ, properties on an ExpandoObject built from JSON came through as JsonElement values. Rule expressions like `input1.country == "india"` then failed with "binary operator Equal is not defined for the types 'JsonElement' and 'System.String'." Utils.CreateAbstractClassType now infers the native CLR type from a JsonElement's ValueKind (string / int / long / double / bool / null), and Utils.CreateObject unwraps JsonElement scalars to their native values before assigning them. Objects and arrays inside the JsonElement keep JsonElement shape — that path is for typed Newtonsoft-style models that weren't using ExpandoObject anyway. in JSON examples across README.md, docs/Getting-Started.md, and docs/index.md. Removed. after 5.0.4." That's actually standard C# Nullable<T> semantics — both `null < x` and `null > x` are false. The pre-5.0.4 behavior was a Newtonsoft / Dynamic.Core quirk, not the documented contract. Added an explicit test documenting the current behavior plus the canonical `!Dt.HasValue || Dt < someDate` workaround for users who want null-aware ordering. Not changed here: #679 (rule-chaining via @RuleName) is already covered by in-flight PR #680 — no point duplicating that work. #710 and #709 are unrelated AGV-themed spam; closing comments are in issue-close-comments-batch-5.md. All 164 unit tests pass on net6 / net8 / net9 / net10. Co-authored-by: Yogesh Prajapati <yogeshcprajapati@outlook.com>
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.
This PR implements rule chaining functionality that allows rules to reference the results of previously executed rules using
@RuleNamesyntax and success event names.Problem
Users were unable to chain rules together where subsequent rules depend on the results of previous rules. The specific issue was that expressions like
@EvaluationExpression && metrics.cost_limit >= -1would fail with "Unknown identifier '@EvaluationExpression'" errors.Solution
Modified the rule execution flow to:
@RuleNameand success event names)@RuleNamewithRuleNamebefore compilationExample Usage
[ { "WorkflowName": "Tuning", "Rules": [ { "RuleName": "EvaluationExpression", "SuccessEvent": "EvaluationExpressionPassed", "Expression": "metrics.current_value > 1000", "RuleExpressionType": "LambdaExpression" }, { "RuleName": "VerificationExpression", "SuccessEvent": "VerificationExpressionPassed", "Expression": "@EvaluationExpression && metrics.cost_limit >= -1", "RuleExpressionType": "LambdaExpression" }, { "RuleName": "ActionExpression", "Expression": "VerificationExpressionPassed", "RuleExpressionType": "LambdaExpression" } ] } ]Key Features
@RuleNamereferences: Evaluate to the boolean result of the referenced ruleEvaluationExpressionPassed)EnableScopedParams = trueTesting
Added comprehensive test coverage including:
All existing tests continue to pass, ensuring no regressions.
Fixes #679.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.