Documentation
¶
Overview ¶
Package analyze is Verdict's static analysis over a prepared model: it finds decision-table gaps (input combinations no rule covers) and overlaps (input combinations several rules cover), plus the structural problems that make a table suspect regardless of its data.
Gap and overlap detection is what turns a decision table from a program into a specification you can reason about, and it is the feature users of mature DMN engines reach for first. Verdict runs it at load time so a table with a hole is caught before it reaches production, not by the one request that falls through it.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Combination ¶
type Combination struct {
// Values are the sampled values, parallel to the table's input clauses,
// rendered as their FEEL source text.
Values []string
}
Combination is one point in a table's input space.
func (Combination) String ¶
func (c Combination) String() string
type Options ¶
type Options struct {
// Strict raises gap findings from warnings to errors, so the engine's
// strict mode refuses to load a table with a hole.
Strict bool
// MaxCombinations bounds the cross-product the gap search explores. A table
// whose input domains multiply out beyond this is reported as unanalysed
// rather than hanging the loader.
MaxCombinations int
}
Options configure an analysis run.
type Overlap ¶
type Overlap struct {
Combination Combination
// Rules are the IDs of the rules that match, in rule order.
Rules []string
// Agree reports whether the overlapping rules produce the same output. An
// overlap where every rule agrees is harmless under ANY and merely
// redundant elsewhere.
Agree bool
}
Overlap is an input combination matched by more than one rule.
type Report ¶
type Report struct {
// ModelID is the analysed model.
ModelID string
// Tables holds one entry per decision table, in document order.
Tables []TableReport
// Diagnostics are the findings, ready to merge into the model's diagnostic
// surface.
Diagnostics []diag.Diagnostic
}
Report is the outcome of analysing a model.
func (*Report) Sorted ¶
func (r *Report) Sorted() []diag.Diagnostic
Sorted returns the report's diagnostics in a stable order.
type TableReport ¶
type TableReport struct {
DecisionID string
DecisionName string
HitPolicy string
RuleCount int
// Gaps are input combinations no rule matches. Only populated when every
// input clause has a finite, enumerable domain.
Gaps []Combination
// Overlaps are input combinations more than one rule matches.
Overlaps []Overlap
// UnreachableRules are rules that can never fire because an earlier rule
// subsumes them under a first-match policy.
UnreachableRules []string
// Analysable reports whether the input domains were enumerable. When false,
// Gaps and Overlaps are empty and Reason explains why.
Analysable bool
Reason string
}
TableReport is the analysis of one decision table.