validation

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package validation implements complete DraftView validation from Spec 007.

Index

Constants

View Source
const (
	SeverityInfo     = "info"
	SeverityWarning  = "warning"
	SeverityError    = "error"
	SeverityBlocking = "blocking"

	ReadinessReady   = "ready"
	ReadinessBlocked = "blocked"
	StatusFresh      = "fresh"
	StatusStale      = "stale"
)

Variables

View Source
var ErrNotFound = errors.New("validation result not found")

Functions

func ExitCodeFor

func ExitCodeFor(diagnostics []Diagnostic) int

ExitCodeFor returns the CLI process exit code defined by Spec 007.

func ReadinessFor

func ReadinessFor(diagnostics []Diagnostic) string

ReadinessFor returns the complete-validation readiness for diagnostics.

func SortDiagnostics

func SortDiagnostics(diagnostics []Diagnostic)

SortDiagnostics applies the frozen diagnostic ordering.

Types

type Diagnostic

type Diagnostic struct {
	Code             string `json:"code"`
	Path             string `json:"path"`
	Severity         string `json:"severity"`
	Message          string `json:"message"`
	EntityRef        string `json:"entity_ref,omitempty"`
	FixSuggestion    string `json:"fix_suggestion"`
	DocumentationURL string `json:"documentation_url,omitempty"`
}

Diagnostic is the stable, display-independent diagnosis contract.

func Validate

func Validate(input Input) []Diagnostic

Validate validates the currently supported mobile advertising Pack. Other Pack versions have no domain rules until their Pack-specific validator exists.

type Input

type Input struct {
	PackRef           string
	EnvironmentID     string
	EnvironmentKind   string
	Effective         map[string]any
	RestrictedDeletes []RestrictedDelete
}

Input is the captured DraftView data needed for a complete validation run. RestrictedDeletes is supplied by callers that validate a pending restricted deletion; ordinary full validation leaves it empty.

type RestrictedDelete

type RestrictedDelete struct {
	EntityType string
	EntityID   string
}

type Result

type Result struct {
	EnvironmentID          string       `json:"environment_id"`
	ValidatedDraftRevision uint64       `json:"validated_draft_revision"`
	ValidatedAt            time.Time    `json:"validated_at"`
	Status                 string       `json:"status"`
	Readiness              string       `json:"readiness"`
	Diagnostics            []Diagnostic `json:"diagnostics"`
}

Result is persisted after a complete validation run.

type Store

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

Store persists complete-validation results next to draft state. This is a temporary Spec 005 boundary: source configuration persistence is not owned by this file and validation records remain local under .conflow.

func NewMemory

func NewMemory() *Store

func Open

func Open(path string) (*Store, error)

func (*Store) Get

func (s *Store) Get(environmentID string, currentDraftRevision uint64) (Result, error)

func (*Store) Save

func (s *Store) Save(result Result) error

Jump to

Keyboard shortcuts

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