Skip to content

Commit 824f248

Browse files
committed
fix: correct type conversion and timeout logic
Update CEL evaluation to use ConvertToNative for type safety. Fix context timeout logic to only override when instance timeout is less than default.
1 parent db687f6 commit 824f248

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

pkg/checks/cel.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ func (c *CEL) EvaluateAny(expr string, celCtx map[string]any) (any, error) {
291291
return nil, err
292292
}
293293

294-
return result.Value(), nil
294+
return result.ConvertToNative(reflect.TypeFor[any]())
295295
}
296296

297297
// EvaluateEach evaluates a CEL expression for each item in a collection.

pkg/commands/context/context.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ func runProviderContext(cmd *cobra.Command, providerType string) error {
133133
func displayContext(cmd *cobra.Command, checkProvider provider.InstanceWithChecks) error {
134134
v := phctx.Viper(cmd.Context())
135135
timeout := v.GetDuration("timeout")
136-
if instTimeout := checkProvider.GetTimeout(); instTimeout > 0 {
136+
if instTimeout := checkProvider.GetTimeout(); instTimeout > 0 && instTimeout < timeout {
137137
timeout = instTimeout
138138
}
139139
ctx, cancel := gocontext.WithTimeout(cmd.Context(), timeout)

0 commit comments

Comments
 (0)