Documentation
¶
Overview ¶
ENGMODEL-OWNER-UNIT: FU-ALLOCATION-TRACE
ENGMODEL-OWNER-UNIT: FU-ALLOCATION-TRACE
ENGMODEL-OWNER-UNIT: FU-ALLOCATION-TRACE
Index ¶
- func DependencyRequirementStatus(composed composition.CompositionResult) func(alias, requirement string) *DelegatedStatus
- func EffectiveCodeRoots(bundle model.Bundle, codeRootOption string) []string
- func KnownModelIDs(bundle model.Bundle, requirements model.RequirementsDocument) map[string]bool
- func ScopeCodeToModel(items []codescan.CodeItem, roots []string, modelDir string) []codescan.CodeItem
- func ValidateIntegrity(bundle model.Bundle, requirements model.RequirementsDocument, ...) []validate.Diagnostic
- type CodeRef
- type DanglingLink
- type DelegatedStatus
- type Delegation
- type LinkRef
- type Matrix
- type Options
- type Provenance
- type Row
- type Summary
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DependencyRequirementStatus ¶ added in v0.8.0
func DependencyRequirementStatus(composed composition.CompositionResult) func(alias, requirement string) *DelegatedStatus
DependencyRequirementStatus returns a lookup of the trace status of a requirement of a resolved dependency in its own repository (by dependency alias and local requirement ID), each dependency's trace computed at most once; nil when the alias is not a resolved dependency. TRLC-LINKS: REQ-EMG-105, REQ-EMG-107 ENGMODEL-LINKS: FU-ALLOCATION-TRACE, FU-SYSTEM-COMPOSITION
func EffectiveCodeRoots ¶
EffectiveCodeRoots mirrors codescan.InferCodeItems' root derivation: the explicit code-root option, or the module root when it is not set. Scoping must use the same roots the scan used, otherwise items scanned via inferenceHints (with no --code-root) escape it. TRLC-LINKS: REQ-EMG-030 ENGMODEL-LINKS: FU-CODEMAP-INFERENCE, FU-MODEL-LOADER
func KnownModelIDs ¶
KnownModelIDs is every id the model defines (catalog, authored architecture, and requirements) — the oracle against which an ENGMODEL-LINKS target is resolved. TRLC-LINKS: REQ-EMG-028 ENGMODEL-LINKS: FU-VALIDATION-ENGINE, FU-MODEL-LOADER
func ScopeCodeToModel ¶
func ScopeCodeToModel(items []codescan.CodeItem, roots []string, modelDir string) []codescan.CodeItem
ScopeCodeToModel keeps only code that belongs to the model rooted at modelDir: a file belongs to the model whose engmod.yml is its nearest enclosing directory. This stops a parent model (scanned with a broad code root) from claiming a nested model's code. TRLC-LINKS: REQ-EMG-030 ENGMODEL-LINKS: FU-CODEMAP-INFERENCE, FU-SYSTEM-COMPOSITION
func ValidateIntegrity ¶
func ValidateIntegrity(bundle model.Bundle, requirements model.RequirementsDocument, scopedCode []codescan.CodeItem, verification []codescan.VerificationCheck, delegationsByReq map[string][]composition.MaterializedAllocation) []validate.Diagnostic
ValidateIntegrity rejects dangling code trace links (a TRLC-LINKS or ENGMODEL-LINKS that resolves to nothing in the model) and reports orphan requirements (traced by no code, verification, or delegation). The code is assumed already scoped to this model. It also reports assurance records whose status lags the tests they name (verification.status_stale). TRLC-LINKS: REQ-EMG-028, REQ-EMG-029, REQ-EMG-073, REQ-EMG-098 ENGMODEL-LINKS: FU-VALIDATION-ENGINE, FU-ALLOCATION-TRACE, CTRL-TRACEABILITY-COVERAGE
Types ¶
type CodeRef ¶
type CodeRef struct {
Symbol string `json:"symbol"`
Path string `json:"path"`
Line int `json:"line,omitempty"`
}
CodeRef is a code symbol that implements a requirement. ENGMODEL-LINKS: FU-CODEMAP-INFERENCE
type DanglingLink ¶
type DanglingLink struct {
Kind string `json:"kind"` // requirement | model
Target string `json:"target"`
From string `json:"from"` // file:line
}
DanglingLink is a code trace link that resolves to nothing in the model. ENGMODEL-LINKS: FU-VALIDATION-ENGINE, CTRL-TRACEABILITY-COVERAGE
type DelegatedStatus ¶
type DelegatedStatus struct {
Requirement string `json:"requirement"`
Status string `json:"status"`
Implemented bool `json:"implemented"`
TestLinked bool `json:"testLinked"`
Result string `json:"result,omitempty"`
}
DelegatedStatus is the trace status of a delegation's target requirement computed in the dependency itself. Status is "implemented", "test-linked", "delegated" or "orphan" as in that repository's own matrix, "not-available" when the dependency has no code sources, and "unknown-requirement" when the target requirement does not exist there. ENGMODEL-LINKS: FU-ALLOCATION-TRACE, FU-SYSTEM-COMPOSITION
type Delegation ¶
type Delegation struct {
Subsystem string `json:"subsystem"`
Target string `json:"target"`
TargetRequirement string `json:"targetRequirement,omitempty"`
}
Delegation is the downward allocation of a requirement onto a subsystem. ENGMODEL-LINKS: FU-ALLOCATION-TRACE
type LinkRef ¶ added in v0.8.0
type LinkRef struct {
ID string `json:"id"`
Child string `json:"child"`
State string `json:"state"`
Status string `json:"status"`
}
LinkRef is one requirement link of a trace row: its id, child item, the evaluated state (unchanged, suspect, broken, version_mismatch, child_unpublished, unresolved) and the review status (claimed, accepted). TRLC-LINKS: REQ-EMG-105 ENGMODEL-LINKS: FU-ALLOCATION-TRACE
type Matrix ¶
type Matrix struct {
Model string `json:"model"`
Requirements []Row `json:"requirements"`
DanglingLinks []DanglingLink `json:"danglingLinks"`
Orphans []string `json:"orphanRequirements"`
Summary Summary `json:"summary"`
}
Matrix is the consolidated, machine-readable traceability matrix for one model. ENGMODEL-LINKS: FU-ALLOCATION-TRACE, CTRL-TRACEABILITY-COVERAGE
func BuildFromFiles ¶
func BuildFromFiles(modelPath, requirementsPath, codeRoot string) (Matrix, []validate.Diagnostic, error)
BuildFromFiles loads a model, scans its code root, scopes the code to the model, validates trace integrity, and returns the matrix together with diagnostics. TRLC-LINKS: REQ-EMG-028, REQ-EMG-030, REQ-EMG-050, REQ-EMG-051 ENGMODEL-LINKS: FU-ALLOCATION-TRACE, FU-MODEL-LOADER, FU-CODEMAP-INFERENCE
func BuildFromFilesWith ¶
func BuildFromFilesWith(modelPath, requirementsPath, codeRoot string, options Options) (Matrix, []validate.Diagnostic, error)
BuildFromFilesWith is BuildFromFiles with explicit resolution options. With composition it composes once, resolves code ENGMODEL-LINKS alias::ID against the dependencies' published entities (requirements stay local), returns the composition diagnostics, and reports each delegated requirement's own status in its target repository. TRLC-LINKS: REQ-EMG-028, REQ-EMG-030, REQ-EMG-050, REQ-EMG-051, REQ-EMG-065, REQ-EMG-066, REQ-EMG-067, REQ-EMG-073, REQ-EMG-098, REQ-EMG-105 ENGMODEL-LINKS: FU-ALLOCATION-TRACE, FU-MODEL-LOADER, FU-CODEMAP-INFERENCE, FU-SYSTEM-COMPOSITION
type Options ¶
type Options struct {
// Resolution overrides ENGMOD_WORK / ENGMOD_LOCK for the composition run.
Resolution composition.ResolutionOptions
// Composition, when set, is a composition already resolved for this
// manifest; the trace then does not compose again.
Composition *composition.CompositionResult
}
Options configures BuildFromFilesWith. TRLC-LINKS: REQ-EMG-063, REQ-EMG-064, REQ-EMG-066
type Provenance ¶
type Provenance struct {
Alias string `json:"alias"`
ModulePath string `json:"modulePath"`
Version string `json:"version"`
SourceModel string `json:"sourceModel"`
Publication string `json:"publication"`
SourceID string `json:"sourceId"`
}
Provenance identifies the selected dependency publication that supplied an imported requirement. TRLC-LINKS: REQ-EMG-050, REQ-EMG-051
type Row ¶
type Row struct {
ID string `json:"id"`
Text string `json:"text,omitempty"`
Units []string `json:"units,omitempty"`
Code []CodeRef `json:"code,omitempty"`
Verifications []string `json:"verifications,omitempty"`
// Result is the recorded outcome of the linked tests: "passed" when parsed
// test-result artifacts report only passes, "failed" when any reports a
// failure (or a blocked, partial or flaky run), "not-run" otherwise. It is
// empty when no verification is linked.
Result string `json:"result,omitempty"`
DelegatedTo *Delegation `json:"delegatedTo,omitempty"`
// DelegatedStatus is the delegated (or imported) requirement's own trace
// status in its target repository at the resolved version.
DelegatedStatus *DelegatedStatus `json:"delegatedStatus,omitempty"`
Provenance *Provenance `json:"provenance,omitempty"`
Status string `json:"status"`
// Gated is true when every linked test of the requirement is
// environment gated: it skips unless a variable is set or under
// testing.Short. Gates names the variables (or testing.Short).
Gated bool `json:"gated,omitempty"`
Gates []string `json:"gates,omitempty"`
// Parents are the upward trace of the requirement: the contract items
// it realizes (alias::ID on a published requirement row); none for a
// requirement traced by its links or derivation (D22). Children are the downward trace of a
// requirement of a composing system: each linked child contract item
// (alias::CAP-*) followed by its realizing requirements (alias::REQ-*).
Parents []string `json:"parents,omitempty"`
Children []string `json:"children,omitempty"`
// Links are the requirement links whose parent the requirement is,
// with their evaluated state.
Links []LinkRef `json:"links,omitempty"`
// SatisfiedBy is "links" when the requirement has no code or test of
// its own and every link is accepted, evaluates unchanged and resolves
// to a child item whose realizing requirements are all implemented
// (LinksImplemented) or all test linked (LinksTestLinked) in their own
// repository; "links-unreviewed" when a link would roll it up but is
// claimed, suspect, version-mismatched or otherwise not unchanged, so
// it does not count.
SatisfiedBy string `json:"satisfiedBy,omitempty"`
LinksImplemented bool `json:"linksImplemented,omitempty"`
LinksTestLinked bool `json:"linksTestLinked,omitempty"`
}
Row is one requirement and everything that traces to it. ENGMODEL-LINKS: FU-ALLOCATION-TRACE, CTRL-TRACEABILITY-COVERAGE
type Summary ¶
type Summary struct {
Requirements int `json:"requirements"`
Implemented int `json:"implemented"`
// Verified is deprecated: it counts test-linked requirements and always
// equals TestLinked and Tested. A linked test is not a verification; use
// TestLinked for links and Passed for requirements with recorded passes.
Verified int `json:"verified"`
// Tested counts requirements with at least one linked test function (or
// verification artifact).
Tested int `json:"tested"`
// TestLinked equals Tested under the name that says what it counts: a
// requirement linked from a test entry point, run or not.
TestLinked int `json:"testLinked"`
// Passed counts requirements whose linked verification has a recorded pass
// and no recorded failure in parsed test-result artifacts.
Passed int `json:"passed"`
Delegated int `json:"delegated"`
// DelegatedImplemented and DelegatedTestLinked count local delegated rows
// whose target requirement is implemented, respectively test linked, in
// the target repository.
DelegatedImplemented int `json:"delegatedImplemented"`
DelegatedTestLinked int `json:"delegatedTestLinked"`
Orphan int `json:"orphan"`
DanglingLinks int `json:"danglingLinks"`
// GatedOnly counts the test-linked requirements whose every linked test
// is environment gated (Row.Gated); GatedOnlyRequirements lists them.
// They are still counted in TestLinked.
GatedOnly int `json:"gatedOnly"`
GatedOnlyRequirements []string `json:"gatedOnlyRequirements,omitempty"`
// LinksSuspect, LinksBroken and LinksClaimed count the requirement
// links whose child item changed since review (also at a stale pin),
// no longer exists, or that are claimed, not reviewed. Unparented counts
// the local requirements that trace upward to nothing
// (requirement.no_parent where the requirement link rules apply).
LinksSuspect int `json:"linksSuspect"`
LinksBroken int `json:"linksBroken"`
LinksClaimed int `json:"linksClaimed"`
Unparented int `json:"unparented"`
}
Summary is the headline coverage roll-up. ENGMODEL-LINKS: FU-ALLOCATION-TRACE