validate

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

ENGMODEL-OWNER-UNIT: FU-VALIDATION-ENGINE

ENGMODEL-OWNER-UNIT: FU-VALIDATION-ENGINE

ENGMODEL-OWNER-UNIT: FU-VALIDATION-ENGINE

ENGMODEL-OWNER-UNIT: FU-VALIDATION-ENGINE

ENGMODEL-OWNER-UNIT: FU-VALIDATION-ENGINE

ENGMODEL-OWNER-UNIT: FU-VALIDATION-ENGINE

ENGMODEL-OWNER-UNIT: FU-VALIDATION-ENGINE

ENGMODEL-OWNER-UNIT: FU-VALIDATION-ENGINE

ENGMODEL-OWNER-UNIT: FU-VALIDATION-ENGINE

ENGMODEL-OWNER-UNIT: FU-VALIDATION-ENGINE

Index

Constants

View Source
const ExcludeAcceptedForms = "" /* 173-byte string literal not displayed */

ExcludeAcceptedForms names the inferenceHints.exclude forms the code scan applies; every diagnostic about a pattern quotes it.

Variables

This section is empty.

Functions

func AcceptanceMissing added in v0.7.0

func AcceptanceMissing(rec *model.AcceptanceRecord) []string

AcceptanceMissing returns the parts an acceptance record lacks: actor, date, and statement or decisionRef. It is empty for a complete record. TRLC-LINKS: REQ-EMG-085 ENGMODEL-LINKS: FU-VALIDATION-ENGINE, FU-GEMARA-EXPORTER

func CapabilityLinkParents added in v0.8.0

func CapabilityLinkParents(b model.Bundle) map[string]bool

CapabilityLinkParents returns the local requirements that are the parent of a reqLinks entry whose child is a dependency capability (alias::CAP-*): upward trace (b) of D22. A link to an assumption of use is evidence, not an upward trace. TRLC-LINKS: REQ-EMG-090, REQ-EMG-105 ENGMODEL-LINKS: FU-VALIDATION-ENGINE

func ControlNeedsReview added in v0.7.0

func ControlNeedsReview(statuses []string) bool

ControlNeedsReview reports whether the Gemara evaluation log gives a control with these verification statuses the result Needs Review: it has no verification, or at least one needs review and none failed or is unknown (Failed and Unknown outrank Needs Review in the log's aggregate). TRLC-LINKS: REQ-EMG-083 ENGMODEL-LINKS: FU-VALIDATION-ENGINE, FU-GEMARA-EXPORTER

func ExcludePatternProblem added in v0.9.0

func ExcludePatternProblem(pattern string) string

ExcludePatternProblem returns why an inferenceHints.exclude pattern cannot be applied, or "" when it can: it is empty, absolute, leaves the module root (..), uses ** other than as a trailing /**, or is a malformed glob. TRLC-LINKS: REQ-EMG-114 ENGMODEL-LINKS: FU-VALIDATION-ENGINE, FU-CODEMAP-INFERENCE

func HasErrors

func HasErrors(diags []Diagnostic) bool

ENGMODEL-LINKS: FU-VALIDATION-ENGINE, CTRL-TRACEABILITY-COVERAGE, STATE-MODEL-VALID, STATE-MODEL-INVALID, EVT-VALIDATION-FAILED TRLC-LINKS: REQ-EMG-001, REQ-EMG-009, REQ-EMG-011

func TracesUpward added in v0.8.0

func TracesUpward(r model.Requirement, realized []string, linkParents map[string]bool) bool

TracesUpward reports whether a requirement satisfies the upward-trace rule (D22), given the contract items it realizes (realizes and a deprecated ref, valid or not: an invalid target is reported as requirement.realizes_unknown instead) and the capability link parents: (a) it realizes a local capability or assumption of use, (b) it is the parent of a link to a dependency capability, or (c) it is derived with a derivedRationale. Stakeholder sourceRefs do not count. TRLC-LINKS: REQ-EMG-090, REQ-EMG-105 ENGMODEL-LINKS: FU-VALIDATION-ENGINE

Types

type AcceptanceProblem added in v0.7.0

type AcceptanceProblem struct {
	Field   string // actor, date or decisionRef
	Message string
}

AcceptanceProblem is one acceptedBy field that does not resolve. ENGMODEL-LINKS: FU-VALIDATION-ENGINE

type AcceptanceRefs added in v0.7.0

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

AcceptanceRefs resolves the references of acceptance records against one model: its actors and its decisions with their status. Validation and the Gemara policy share it, so a record the policy lists as accepted is one validation accepts. ENGMODEL-LINKS: FU-VALIDATION-ENGINE, FU-GEMARA-EXPORTER

func NewAcceptanceRefs added in v0.7.0

func NewAcceptanceRefs(b model.Bundle) AcceptanceRefs

NewAcceptanceRefs collects the actors and decisions of a bundle. TRLC-LINKS: REQ-EMG-085 ENGMODEL-LINKS: FU-VALIDATION-ENGINE, FU-GEMARA-EXPORTER

func (AcceptanceRefs) Problems added in v0.7.0

Problems returns the fields of a record that are set but do not resolve: an actor that is no actor, a date that is no calendar date in YYYY-MM-DD, and a decisionRef that is no decision or a decision whose status is not accepted. TRLC-LINKS: REQ-EMG-085 ENGMODEL-LINKS: FU-VALIDATION-ENGINE, FU-GEMARA-EXPORTER

func (AcceptanceRefs) Resolves added in v0.7.0

func (r AcceptanceRefs) Resolves(rec *model.AcceptanceRecord) bool

Resolves reports whether a record is complete and every field resolves: the condition for listing a risk as accepted. TRLC-LINKS: REQ-EMG-085 ENGMODEL-LINKS: FU-VALIDATION-ENGINE, FU-GEMARA-EXPORTER

type Diagnostic

type Diagnostic struct {
	Code     string   `json:"code"`
	Severity Severity `json:"severity"`
	Message  string   `json:"message"`
	Path     string   `json:"path,omitempty"`
}

ENGMODEL-LINKS: FU-VALIDATION-ENGINE, CTRL-TRACEABILITY-COVERAGE, STATE-MODEL-VALID, STATE-MODEL-INVALID, EVT-VALIDATION-FAILED

func Bundle

func Bundle(b model.Bundle) []Diagnostic

ENGMODEL-LINKS: FU-VALIDATION-ENGINE, CTRL-TRACEABILITY-COVERAGE, STATE-MODEL-VALID, STATE-MODEL-INVALID, EVT-VALIDATION-FAILED, FU-VIEW-PROJECTION TRLC-LINKS: REQ-EMG-001, REQ-EMG-009, REQ-EMG-011, REQ-EMG-035, REQ-EMG-036, REQ-EMG-037, REQ-EMG-041, REQ-EMG-043, REQ-EMG-049, REQ-EMG-065, REQ-EMG-070, REQ-EMG-082, REQ-EMG-083, REQ-EMG-085, REQ-EMG-090, REQ-EMG-094

func DedupeDiagnostics

func DedupeDiagnostics(lists ...[]Diagnostic) []Diagnostic

DedupeDiagnostics merges diagnostic lists produced by separate checks of one run (for example document generation and the trace check, which both run the trace-integrity check) so each finding is reported once. Diagnostics are identified by code, path and message; the first occurrence keeps its position, and an error severity on any duplicate wins over a warning. ENGMODEL-LINKS: FU-VALIDATION-ENGINE, CTRL-TRACEABILITY-COVERAGE, EVT-VALIDATION-FAILED TRLC-LINKS: REQ-EMG-001, REQ-EMG-009, REQ-EMG-011

func SortDiagnostics

func SortDiagnostics(in []Diagnostic) []Diagnostic

ENGMODEL-LINKS: FU-VALIDATION-ENGINE, CTRL-TRACEABILITY-COVERAGE, STATE-MODEL-VALID, STATE-MODEL-INVALID, EVT-VALIDATION-FAILED TRLC-LINKS: REQ-EMG-001, REQ-EMG-009, REQ-EMG-011, REQ-EMG-012

type FieldType added in v0.9.0

type FieldType struct {
	Name string `json:"name"`
	Type string `json:"type"`
	Of   string `json:"of,omitempty"`
}

FieldType is the YAML type of one field of an entity kind. ENGMODEL-LINKS: FU-VALIDATION-ENGINE, DO-MODEL-AUTHORING-CONTRACT

type RelationshipPair

type RelationshipPair struct {
	Type string `json:"type"`
	From string `json:"from"`
	To   string `json:"to"`
}

RelationshipPair is one allowed authoredArchitecture.mappings type with the entity kinds of its from and to ends. ENGMODEL-LINKS: FU-VALIDATION-ENGINE, DO-MODEL-AUTHORING-CONTRACT

type Rules

type Rules struct {
	Enums             map[string][]string `json:"enums"`
	RelationshipPairs []RelationshipPair  `json:"relationshipPairs"`
	FieldRules        []string            `json:"fieldRules"`
	// FieldSets lists, per entity kind, the YAML fields strict decoding
	// accepts, in declaration order; any other field is rejected.
	FieldSets map[string][]string `json:"fieldSets"`
	// FieldTypes gives, per entity kind and in the order of FieldSets, each
	// field's YAML type: string, bool, int, list<string>, list<object>,
	// object or map<string,string>; Of names the fieldSets kind of an object
	// or list<object> field when it has one.
	FieldTypes map[string][]FieldType `json:"fieldTypes"`
	// PublicationSections are the manifest publication sections that may
	// export stable IDs. Decisions cannot be published.
	PublicationSections []string `json:"publicationSections"`
}

Rules is the machine-readable subset of the validation rules that agents need before authoring YAML: controlled vocabularies, allowed relationship kind pairs and cross-reference field rules. It is derived from the same tables Bundle uses, so it cannot drift from validation. ENGMODEL-LINKS: FU-VALIDATION-ENGINE, DO-MODEL-AUTHORING-CONTRACT

func AuthoringRules

func AuthoringRules() Rules

AuthoringRules returns the validation vocabularies and relationship pairs as sorted, deterministic data for the model authoring contract. TRLC-LINKS: REQ-EMG-045, REQ-EMG-009, REQ-EMG-082, REQ-EMG-083, REQ-EMG-085, REQ-EMG-087, REQ-EMG-099 ENGMODEL-LINKS: FU-VALIDATION-ENGINE, DO-MODEL-AUTHORING-CONTRACT

type Severity

type Severity string

ENGMODEL-LINKS: FU-VALIDATION-ENGINE, CTRL-TRACEABILITY-COVERAGE, STATE-MODEL-VALID, STATE-MODEL-INVALID, EVT-VALIDATION-FAILED

const (
	SeverityError   Severity = "error"
	SeverityWarning Severity = "warning"
)

func RequirementLinkRules added in v0.8.0

func RequirementLinkRules(b model.Bundle) (Severity, bool)

RequirementLinkRules returns the severity of the strictness-dependent requirement link rules (requirement.no_parent, link.aou_unverified, requirement.unsatisfied) and whether they apply to the model: in strict mode they are errors in every model; in guided mode (the default) they are warnings, and only in a model that publishes a contract item or has requirement links. TRLC-LINKS: REQ-EMG-090, REQ-EMG-098 ENGMODEL-LINKS: FU-VALIDATION-ENGINE

type VerificationOutcome added in v0.7.0

type VerificationOutcome int

VerificationOutcome is the evaluation result a control verification status stands for. The Gemara evaluation log maps it to its Result values. ENGMODEL-LINKS: FU-VALIDATION-ENGINE, FU-GEMARA-EXPORTER

const (
	OutcomeNotRun VerificationOutcome = iota
	OutcomePassed
	OutcomeFailed
	OutcomeNeedsReview
	OutcomeNotApplicable
	OutcomeUnknown
)

Verification outcomes.

func ClassifyVerificationStatus added in v0.7.0

func ClassifyVerificationStatus(status string) VerificationOutcome

ClassifyVerificationStatus maps a control verification status (trimmed, any case) to its outcome; an unrecognized status is OutcomeUnknown. TRLC-LINKS: REQ-EMG-083, REQ-EMG-015 ENGMODEL-LINKS: FU-VALIDATION-ENGINE, FU-GEMARA-EXPORTER

Jump to

Keyboard shortcuts

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