analyze

package
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 28, 2026 License: MIT Imports: 7 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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 Analyze

func Analyze(p *eval.Program, opts Options) *Report

Analyze runs the static analysis over a prepared program.

func (*Report) Sorted

func (r *Report) Sorted() []diag.Diagnostic

Sorted returns the report's diagnostics in a stable order.

func (*Report) Table

func (r *Report) Table(decisionID string) (TableReport, bool)

Table returns the report for a decision, if it has a decision table.

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL