validation

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package validation provides static validation for CPN net definitions, including reachability, completeness, boundedness, and type safety checks.

Package validation provides static CPN analysis at config load time.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BoundednessValidator

type BoundednessValidator struct{}

BoundednessValidator checks that resource places have finite capacity and that resource arcs form balanced consume/return pairs across transitions.

func (*BoundednessValidator) Validate

func (bv *BoundednessValidator) Validate(n *state.Net) []Violation

Validate checks resource boundedness constraints.

type CompletenessValidator

type CompletenessValidator struct{}

CompletenessValidator checks that every arc on every transition references an existing place in the net.

func (*CompletenessValidator) Validate

func (cv *CompletenessValidator) Validate(n *state.Net) []Violation

Validate checks that all arc place references resolve to places in the net.

type CompositeValidator

type CompositeValidator struct {
	// contains filtered or unexported fields
}

CompositeValidator runs all registered validators and collects their violations.

func NewCompositeValidator

func NewCompositeValidator(validators ...Validator) *CompositeValidator

NewCompositeValidator creates a CompositeValidator from the given validators.

func (*CompositeValidator) Validate

func (cv *CompositeValidator) Validate(n *state.Net) []Violation

Validate runs all registered validators and returns the combined violations.

type ReachabilityValidator

type ReachabilityValidator struct{}

ReachabilityValidator checks that every INITIAL place can reach at least one TERMINAL place via graph traversal through transitions.

func (*ReachabilityValidator) Validate

func (rv *ReachabilityValidator) Validate(n *state.Net) []Violation

Validate checks reachability from all INITIAL places to at least one TERMINAL place.

type TypeAlignmentValidator

type TypeAlignmentValidator struct{}

TypeAlignmentValidator checks that normalized transition arc sets preserve same-type work-token counts from consumed inputs to routed outputs.

func (*TypeAlignmentValidator) Validate

func (tv *TypeAlignmentValidator) Validate(n *state.Net) []Violation

Validate rejects transitions whose output/rejection/failure arc sets route a work type to a different number of same-type arcs than the number of consumed inputs for that type. Cross-type fanout remains allowed.

type TypeSafetyValidator

type TypeSafetyValidator struct{}

TypeSafetyValidator checks that guard expressions reference valid token color fields and that arc binding names are unique per transition.

func (*TypeSafetyValidator) Validate

func (tv *TypeSafetyValidator) Validate(n *state.Net) []Violation

Validate checks type safety constraints on guards and arc bindings.

type Validator

type Validator interface {
	Validate(n *state.Net) []Violation
}

Validator performs static checks on a net definition.

type Violation

type Violation struct {
	Level    ViolationLevel `json:"level"`
	Code     string         `json:"code"`
	Message  string         `json:"message"`
	Location string         `json:"location"` // human-readable location (e.g., "transition:review.input_arc:work")
}

Violation describes a single validation issue found in a net definition.

type ViolationLevel

type ViolationLevel string

ViolationLevel indicates the severity of a validation violation.

const (
	// ViolationError is a fatal misconfiguration — the net cannot be executed.
	ViolationError ViolationLevel = "ERROR"
	// ViolationWarning is a potential issue that may cause runtime problems.
	ViolationWarning ViolationLevel = "WARNING"
)

Jump to

Keyboard shortcuts

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