Help us shape the future of Go! Take the 2026 Go Developer Survey

trace

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

ENGMODEL-OWNER-UNIT: FU-ALLOCATION-TRACE

ENGMODEL-OWNER-UNIT: FU-ALLOCATION-TRACE

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EffectiveCodeRoots

func EffectiveCodeRoots(bundle model.Bundle, codeRootOption string) []string

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

func KnownModelIDs(bundle model.Bundle, requirements model.RequirementsDocument) map[string]bool

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 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 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 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 ENGMODEL-LINKS: FU-ALLOCATION-TRACE, FU-MODEL-LOADER, FU-CODEMAP-INFERENCE, FU-SYSTEM-COMPOSITION

func (Matrix) CSV

func (m Matrix) CSV() []byte

CSV renders the matrix as one row per requirement for spreadsheet/diff consumption. TRLC-LINKS: REQ-EMG-030 ENGMODEL-LINKS: FU-ALLOCATION-TRACE

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"`
}

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"`
}

Summary is the headline coverage roll-up. ENGMODEL-LINKS: FU-ALLOCATION-TRACE

Jump to

Keyboard shortcuts

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