Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CELEvaluator ¶
type CELEvaluator struct {
// contains filtered or unexported fields
}
CELEvaluator implements Evaluator using a compiled CEL program.
func NewCELEvaluator ¶
func NewCELEvaluator(env *cel.Env, def EvalDefinition) (*CELEvaluator, error)
NewCELEvaluator compiles a CEL expression and returns an evaluator.
func (*CELEvaluator) CacheTTL ¶
func (e *CELEvaluator) CacheTTL() time.Duration
func (*CELEvaluator) Name ¶
func (e *CELEvaluator) Name() string
Name returns the writes field — the canonical identifier used as the result key, CEL variable name for downstream evaluators, and execution order node.
func (*CELEvaluator) Reads ¶
func (e *CELEvaluator) Reads() []FieldRef
func (*CELEvaluator) ResolutionWorkflow ¶
func (e *CELEvaluator) ResolutionWorkflow() string
func (*CELEvaluator) Writes ¶
func (e *CELEvaluator) Writes() FieldRef
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine loads evaluation definitions, compiles CEL expressions, builds the dependency graph, and runs all evaluators against a proto input.
func NewEngine ¶
NewEngine creates an evaluation engine from a config and a proto message that serves as the input type. The proto is registered in the CEL environment as the variable "input" — YAML expressions reference fields as "input.<field>". Extra opts are forwarded to NewCELEnvironment for additional declarations.
func NewEngineFromBytes ¶
NewEngineFromBytes loads evaluation definitions from raw YAML bytes.
func NewEngineFromFile ¶
NewEngineFromFile loads evaluation definitions from a YAML file.
func (*Engine) DeriveStatus ¶
DeriveStatus derives the overall status from evaluation results.
func (*Engine) Evaluators ¶
Evaluators returns all registered evaluators.
type EvalConfig ¶
type EvalConfig struct {
Evaluations []EvalDefinition `yaml:"evaluations"`
}
EvalConfig is the top-level YAML structure.
func LoadDefinitions ¶
func LoadDefinitions(r io.Reader) (*EvalConfig, error)
LoadDefinitions parses evaluation definitions from a reader.
func LoadDefinitionsFromFile ¶
func LoadDefinitionsFromFile(path string) (*EvalConfig, error)
LoadDefinitionsFromFile loads evaluation definitions from a YAML file.
type EvalDefinition ¶
type EvalDefinition struct {
Name string `yaml:"name"`
Description string `yaml:"description"`
Expression string `yaml:"expression"`
Reads []FieldRef `yaml:"reads"`
Writes FieldRef `yaml:"writes"`
ResolutionWorkflow string `yaml:"resolution_workflow"`
Resolution string `yaml:"resolution"`
Severity string `yaml:"severity"`
Category string `yaml:"category"`
CacheTTL string `yaml:"cache_ttl"`
ParsedCacheTTL time.Duration
}
EvalDefinition is a single evaluator loaded from YAML.
type EvalGraph ¶
type EvalGraph struct {
// contains filtered or unexported fields
}
EvalGraph holds the auto-calculated dependency graph derived from evaluator reads/writes declarations.
func BuildGraph ¶
BuildGraph derives the dependency graph from evaluator declarations. Reads prefixed with "input." are treated as raw proto field references — no producer dependency is created for them.
func (*EvalGraph) BlockedBy ¶
BlockedBy returns the names of upstream evaluators that have not passed.
func (*EvalGraph) DependenciesMet ¶
DependenciesMet returns true if all upstream dependencies of the given evaluator have passed.
func (*EvalGraph) ExecutionOrder ¶
ExecutionOrder returns the topologically sorted evaluator names.
type Evaluator ¶
type Evaluator interface {
Name() string
Reads() []FieldRef
Writes() FieldRef
CacheTTL() time.Duration
ResolutionWorkflow() string
Evaluate(activation map[string]any) Result
}
Evaluator is the interface for all evaluators.
type FieldRef ¶
type FieldRef string
FieldRef is a dependency reference — either an evaluator output (bare name like "score_sufficient") or an input field path (like "input.email_verified"). Reads prefixed with "input." refer to the proto passed to Engine.Run.
type Issue ¶
type Issue struct {
Type string // "circular_dependency", "missing_producer", "duplicate_producer", "orphan_output"
Severity string // "error", "warning", "info"
Message string
}
Issue represents a validation issue found in the dependency graph.
type Result ¶
type Result struct {
Name string
Passed bool
Error string
Resolution string
ResolutionWorkflow string
Severity string
Category string
}
Result represents the outcome of a single evaluator run.
type Status ¶
type Status int
Status represents the logical outcome of evaluating all results.
func DeriveStatus ¶
DeriveStatus determines the overall status from evaluation results. Status is derived, never stored directly — it reflects the current state of all evaluations.