validate

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 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

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 AIAgentNames added in v0.10.0

func AIAgentNames() []string

AIAgentNames returns the registered engineering-flow agent names that aviation.ai_actor_as_credit rejects as DO-178C credit holders, sorted. TRLC-LINKS: REQ-EMG-133 ENGMODEL-LINKS: FU-VALIDATION-ENGINE, FU-AIRBORNE-ASSURANCE-EXPORTER

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 AcceptedRiskDependencies added in v0.10.0

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

AcceptedRiskDependencies returns the dependencies aliases of the local risks recorded as accepted with a complete, resolving acceptedBy: the dependencies an owner accepted below the system's life-cycle tier. TRLC-LINKS: REQ-EMG-126 ENGMODEL-LINKS: FU-VALIDATION-ENGINE, FU-SYSTEM-COMPOSITION

func AcceptedRiskScopes added in v0.10.0

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

AcceptedRiskScopes returns the appliesTo IDs of the local risks recorded as accepted (status accepted or response accept) with a complete, resolving acceptedBy: the scopes an owner accepted the risk for. TRLC-LINKS: REQ-EMG-126 ENGMODEL-LINKS: FU-VALIDATION-ENGINE, FU-SYSTEM-COMPOSITION

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 CoreCodes added in v0.10.0

func CoreCodes() []string

CoreCodes returns the rank-0 code patterns (a trailing * matches a code prefix): integrity rules that are errors at every tier, are never keyed by the tier policy and that no POA&M item can defer. TRLC-LINKS: REQ-EMG-125 ENGMODEL-LINKS: FU-VALIDATION-ENGINE

func EffectiveRequirementLinkMode added in v0.10.0

func EffectiveRequirementLinkMode(b model.Bundle) string

EffectiveRequirementLinkMode returns the requirement link strictness that applies: the declared requirementLinks, raised to strict from tier mvp (the effective maximum of ADR-EMG-031). TRLC-LINKS: REQ-EMG-127 ENGMODEL-LINKS: FU-VALIDATION-ENGINE

func EffectiveTier added in v0.10.0

func EffectiveTier(b model.Bundle) (string, int, bool)

EffectiveTier returns the project tier of a model (lowercased) and its rank 1..5; ok is false without lifecycle or with an unknown tier, and then no tier rule applies. TRLC-LINKS: REQ-EMG-124, REQ-EMG-125 ENGMODEL-LINKS: FU-VALIDATION-ENGINE

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 IsCoreCode added in v0.10.0

func IsCoreCode(code string) bool

IsCoreCode reports whether a code is a rank-0 core code. TRLC-LINKS: REQ-EMG-125, REQ-EMG-129 ENGMODEL-LINKS: FU-VALIDATION-ENGINE

func RendersDespite added in v0.10.0

func RendersDespite(b model.Bundle, code string) bool

RendersDespite reports whether an error diagnostic lets the AsciiDoc document render in a model with lifecycle (D15 extended, ADR-EMG-032): a code whose severity the tier policy sets (a tier-keyed code or one lifecycle.raise names) fails the check but not the render; every other error, the rank-0 core codes included, stops it as before. TRLC-LINKS: REQ-EMG-130 ENGMODEL-LINKS: FU-VALIDATION-ENGINE, FU-ASCIIDOC-GENERATOR

func TierKeyed added in v0.10.0

func TierKeyed(code string) bool

TierKeyed reports whether the tier policy sets a code's severity. TRLC-LINKS: REQ-EMG-125, REQ-EMG-130 ENGMODEL-LINKS: FU-VALIDATION-ENGINE

func TierPolicyMarkdown added in v0.10.0

func TierPolicyMarkdown() string

TierPolicyMarkdown renders TierPolicy as a Markdown table: one row per code, D (deferred), W (warning) or E (error) per tier, with the safety row where it differs. TRLC-LINKS: REQ-EMG-125 ENGMODEL-LINKS: FU-VALIDATION-ENGINE, DO-MODEL-AUTHORING-CONTRACT

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 AviationFloorGap added in v0.10.0

type AviationFloorGap struct {
	Path  string `json:"path"`
	ID    string `json:"id"`
	State string `json:"state"`
	Floor string `json:"floor"`
}

AviationFloorGap is one aviation record below the evidence floor of a tier, or (ID coverage:<metric>) a missing coverage metric. ENGMODEL-LINKS: FU-VALIDATION-ENGINE

func AviationFloorGaps added in v0.10.0

func AviationFloorGaps(a model.AviationProfile, rank int) []AviationFloorGap

AviationFloorGaps returns the aviation records below the evidence floor of a tier rank: path, record ID, state and floor; plus, from product, a gap for a software level A, B or C without structural coverage of its metric. not-applicable satisfies a floor only with a rationale. TRLC-LINKS: REQ-EMG-132, REQ-EMG-134 ENGMODEL-LINKS: FU-VALIDATION-ENGINE

type Diagnostic

type Diagnostic struct {
	Code     string   `json:"code"`
	Severity Severity `json:"severity"`
	Message  string   `json:"message"`
	Path     string   `json:"path,omitempty"`
	// Deferred marks a warning the life-cycle tier policy defers: evidence
	// debt of a tier below the one it is required from, or covered by an
	// open POA&M item (PoamRef). It never fails a check.
	Deferred bool `json:"deferred,omitempty"`
	// RequiredFrom is the tier from which the policy makes the code an
	// error (empty when it never does or the model has no lifecycle).
	RequiredFrom string `json:"requiredFrom,omitempty"`
	// PoamRef is the POA&M item that defers the diagnostic.
	PoamRef string `json:"poamRef,omitempty"`
}

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

func ApplyTierPolicy added in v0.10.0

func ApplyTierPolicy(b model.Bundle, diags []Diagnostic) []Diagnostic

ApplyTierPolicy returns the diagnostics with the severities of the project tier: each tier-keyed code gets RequiredFrom and the severity of its row (deferred is a warning with Deferred set); an open POA&M item with milestone tier:<project tier> that names a diagnostic's code (and path) defers it with PoamRef (a tier-keyed code or a warning; an untiered error is never deferred); lifecycle.raise makes a code an error. A requirement link rule stays an error with requirementLinks: strict declared; rank-0 core codes and codes the table does not key are never changed. Without lifecycle it returns the diagnostics unchanged. It is idempotent and does not modify its input; it runs at each public entry on the merged list (ValidateBundle, GenerateAsciiDoc, the trace builders, engws check, MCP). TRLC-LINKS: REQ-EMG-125, REQ-EMG-126, REQ-EMG-127, REQ-EMG-129 ENGMODEL-LINKS: FU-VALIDATION-ENGINE

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, REQ-EMG-124, REQ-EMG-126, REQ-EMG-128, REQ-EMG-132, REQ-EMG-133

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"`
	// TierPolicy is the severity of each tier-keyed code per life-cycle
	// tier (engmod.yml lifecycle.tier); engineering-flow renders it as the
	// "Severity by tier" table of MODEL-RULES.md.
	TierPolicy []TierRule `json:"tierPolicy"`
}

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, REQ-EMG-131 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. From life-cycle tier mvp the effective mode is strict (ADR-EMG-031): the rules apply in every model, at the declared mode's severity, and ApplyTierPolicy sets the tier's severity. TRLC-LINKS: REQ-EMG-090, REQ-EMG-098, REQ-EMG-127 ENGMODEL-LINKS: FU-VALIDATION-ENGINE

type TierRule added in v0.10.0

type TierRule struct {
	Code               string    `json:"code"`
	Severities         [5]string `json:"severities"`
	SafetySeverities   [5]string `json:"safetySeverities"`
	RequiredFrom       string    `json:"requiredFrom,omitempty"`
	RequiredFromSafety string    `json:"requiredFromSafety,omitempty"`
	Bundle             string    `json:"bundle,omitempty"`
	Note               string    `json:"note,omitempty"`
}

TierRule is one tier-keyed code of the policy table: its severity at each tier poc..operational (deferred, warning or error), the row that applies with the safety bundle, the tier from which it is an error (empty when it never is) without and with safety, and the bundle that emits it (empty for every model with lifecycle). ENGMODEL-LINKS: FU-VALIDATION-ENGINE, DO-MODEL-AUTHORING-CONTRACT

func TierPolicy added in v0.10.0

func TierPolicy() []TierRule

TierPolicy returns the tier-keyed codes with their severity per tier, sorted by code. It is the table ApplyTierPolicy applies; engineering-flow renders it as "Severity by tier" in MODEL-RULES.md. TRLC-LINKS: REQ-EMG-125 ENGMODEL-LINKS: FU-VALIDATION-ENGINE, DO-MODEL-AUTHORING-CONTRACT

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