Skip to content

Execution frame integration with updated IntepretableV2#1344

Open
TristonianJones wants to merge 4 commits into
cel-expr:masterfrom
TristonianJones:eval-frame-1.1
Open

Execution frame integration with updated IntepretableV2#1344
TristonianJones wants to merge 4 commits into
cel-expr:masterfrom
TristonianJones:eval-frame-1.1

Conversation

@TristonianJones

Copy link
Copy Markdown
Collaborator

Plugs the ExecutionFrame into the CEL interpreter and program APIs and introduces
a new InterpretableV2 for calling program steps with the ExecutionFrame rather than
the Activation.

@TristonianJones TristonianJones requested a review from l46kok June 15, 2026 19:50
@@ -44,15 +44,15 @@ type EvalObserver func(vars Activation, id int64, programStep any, value ref.Val
// StatefulObserver observes evaluation while tracking or utilizing stateful behavior.
type StatefulObserver interface {
// InitState configures stateful metadata on the activation.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

nit: s/activation/ExecutionFrame

tracker, found := asCostTracker(vars)
if !found {
frame := AsFrame(vars)
tracker := ct.GetState(frame).(*CostTracker)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Consider checking for nil from ct.getState call first before the cast

//
// This method is concurrency safe and the expectation is that the observer function will use
// a switch statement to determine the type of the state which has been reported back from the call.
func (oi *ObservableInterpretable) ObserveEval(vars Activation, observer func(any)) ref.Val {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Would the rename here be a breaking change?

@@ -44,15 +44,15 @@ type EvalObserver func(vars Activation, id int64, programStep any, value ref.Val
// StatefulObserver observes evaluation while tracking or utilizing stateful behavior.
type StatefulObserver interface {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This is technically a breaking change.. but not sure if it matters at all. Can external authors author a custom cost tracker against this interface and inject it into the evaluator?

Comment thread ext/bindings.go
sa.Activation = activation
sa.Activation = frame
defer b.clearSlots(sa)
return b.expr.Eval(sa)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Should we push the slot into a child frame? sa no longer takes in an Activation, so this would force allocate a new frame on the heap per bind right?

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.

2 participants