Skip to content

Support rules with a script node interior type.#30

Merged
scunningham merged 2 commits intomainfrom
script
Feb 25, 2026
Merged

Support rules with a script node interior type.#30
scunningham merged 2 commits intomainfrom
script

Conversation

@scunningham
Copy link
Contributor

No description provided.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds support for script nodes as an interior node type in the rule parsing and AST building system. Script nodes are internal nodes that process events through embedded code (currently supporting Lua), with one input node that can be a sequence, set, promql, or another script node.

Changes:

  • Added NodeTypeScript to the schema and parser types
  • Implemented script node parsing with validation for language, code, and input requirements
  • Created AST building logic for script nodes with proper tree traversal
  • Added test cases for successful script usage and failure scenarios

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
pkg/schema/schema.go Added NodeTypeScript constant to supported node types
pkg/parser/parse.go Added ParseScriptT struct and integrated script support into ParseTermT; refactored _parse and Unmarshal functions
pkg/parser/tree.go Implemented nodeFromScript function with validation logic; added IsScriptNode predicate; refactored buildChildren for cleaner code structure
pkg/testdata/rules.go Added test cases for script nodes (root-level failure, missing input failure, and two success cases with nested inputs)
pkg/parser/parse_test.go Added test cases for script validation and a new TestStableHashStability test
pkg/ast/ast_script.go New file implementing AST building for script nodes with buildScriptChildren and buildScriptNode functions
pkg/ast/ast.go Refactored node building logic to support script nodes through buildChildrenNodes and buildLeafChild; added script case in buildStateMachine
pkg/ast/ast_test.go Fixed gatherNodeAddresses to properly traverse all children; added script test cases

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@scunningham scunningham merged commit eaa2e69 into main Feb 25, 2026
1 check passed
@scunningham scunningham deleted the script branch February 25, 2026 16:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants