engws

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: 47 Imported by: 0

Documentation

Overview

ENGMODEL-OWNER-UNIT: FU-CLI-ORCHESTRATION

ENGMODEL-OWNER-UNIT: FU-CLI-ORCHESTRATION

ENGMODEL-OWNER-UNIT: FU-CLI-ORCHESTRATION

ENGMODEL-OWNER-UNIT: FU-CLI-ORCHESTRATION

ENGMODEL-OWNER-UNIT: FU-CLI-ORCHESTRATION

ENGMODEL-OWNER-UNIT: FU-CLI-ORCHESTRATION

ENGMODEL-OWNER-UNIT: FU-CLI-ORCHESTRATION

ENGMODEL-OWNER-UNIT: FU-CLI-ORCHESTRATION

ENGMODEL-OWNER-UNIT: FU-CLI-ORCHESTRATION

ENGMODEL-OWNER-UNIT: FU-CLI-ORCHESTRATION

Package engws is the multi-repository workspace helper behind cmd/engws. It scans the model checkouts under a workspace root, decides which ones must resolve locally, and writes the root-level engmod.work.yml and go.work.

ENGMODEL-OWNER-UNIT: FU-CLI-ORCHESTRATION

ENGMODEL-OWNER-UNIT: FU-CLI-ORCHESTRATION

ENGMODEL-OWNER-UNIT: FU-CLI-ORCHESTRATION

Index

Constants

View Source
const (
	// BumpLinkMoved: same meaning at both versions; pinned.version moved.
	BumpLinkMoved = "moved"
	// BumpLinkCurrent: the link is already pinned to the new version.
	BumpLinkCurrent = "current"
	// BumpLinkReview: the meaning changed or the pinned version cannot be
	// resolved; the pin is kept for review.
	BumpLinkReview = "review"
	// BumpLinkBroken: the item does not exist at the new version.
	BumpLinkBroken = "broken"
)

Bump link outcomes.

View Source
const (
	StateNoGit       = "nogit"
	StateDirty       = "dirty"
	StateUntagged    = "untagged"
	StateUnpublished = "unpublished"
	StatePinned      = "pinned"
	StatePublished   = "published"
	StateUnknown     = "unknown"
)

Checkout states, in the order changed detection applies them.

View Source
const (
	// StateFileName holds the workspace pins; it lives at the root only.
	StateFileName = ".engws.yml"
	// GoWorkFileName is the Go workspace written next to engmod.work.yml.
	GoWorkFileName = "go.work"
)
View Source
const (
	// StagingDir is the staging area under the root, owned by engws stage.
	StagingDir = ".engmod/staging"
	// VersionFromManifest stages module.version from engmod.yml (default).
	VersionFromManifest = "manifest"
	// VersionFromTag additionally requires HEAD at tag v<module.version>.
	VersionFromTag = "tag"
)
View Source
const DefaultReqLinksPath = "model/req-links.yml"

DefaultReqLinksPath is the requirement link file migrate-links creates.

View Source
const RedChecksLog = ".engflow/red-checks.jsonl"

RedChecksLog is the red-check evidence log of engineering-flow's red-check.mjs, relative to the git top level of the project.

View Source
const Usage = `` /* 13053-byte string literal not displayed */

Usage is the engws command help.

Variables

View Source
var ErrHandWritten = errors.New("not generated by engws")

ErrHandWritten is returned when a work file exists without the engws header.

Functions

func AcceptLink(repo, id, by, rationale string) (reqlinks.LinkStatus, error)

AcceptLink records the review of link id in the model in repo: pinned.version set to the dependency pin (the published dependency, composed with the workspace off, decision D9), reviewedBy, reviewedOn (today), the rationale and status accepted, a deprecated fingerprint removed. Only the touched lines of the requirement link file change. It refuses an actor the model does not define, an unknown link, a broken link, one whose item cannot be resolved and a model that does not compose with the workspace off. It then evaluates the link again and fails when it still does not pass (the file stays written; the error says why). TRLC-LINKS: REQ-EMG-101 ENGMODEL-LINKS: FU-CLI-ORCHESTRATION, FU-ALLOCATION-TRACE

func AddLink(repo string, opts LinkAddOptions) (model.ReqLink, error)

AddLink writes a claimed requirement link into the model in repo, pinned to the dependency version of the child's alias (decision D23). It checks before writing: the parent is a requirement of the model (a capability link needs one, an assumption link needs parent or evidence), each evidence ID validates like a link's, the child is alias::ID of a declared dependency and a published capability or assumption of use at the pinned version (resolved with the workspace off, the published content), and no link already joins the same parent or evidence to the child. The link is appended with every other line kept; a model without a link file gets model/req-links.yml and documents.reqLinks. The link id is LNK-<REQ>-<ALIAS>, made unique. TRLC-LINKS: REQ-EMG-119 ENGMODEL-LINKS: FU-CLI-ORCHESTRATION, FU-ALLOCATION-TRACE

func CheckAllDrift

func CheckAllDrift(plan Plan) string

CheckAllDrift is WorkFileDrift for check --all, whose plan marks every checkout local on purpose: it warns only when a changed or pinned checkout is missing from engmod.work.yml, never about the unchanged ones --all adds or about extra replacements. TRLC-LINKS: REQ-EMG-068 ENGMODEL-LINKS: FU-CLI-ORCHESTRATION

func FindRoot

func FindRoot(start string) (string, error)

FindRoot returns the nearest directory at or above start that contains engmod.work.yml or .engws.yml, or start itself when none does. The search stops below $HOME: $HOME and its ancestors are never returned, so a stray marker there cannot make sync write $HOME/go.work. A world-writable root is refused; give it explicitly with --root. TRLC-LINKS: REQ-EMG-068 ENGMODEL-LINKS: FU-CLI-ORCHESTRATION, FU-SYSTEM-COMPOSITION

func GoVersion

func GoVersion() (string, error)

GoVersion returns the local toolchain as the go.work go directive value (go1.27.3 -> 1.27.3; pre-release suffixes dropped). TRLC-LINKS: REQ-EMG-068

func LoadBundleAtRef added in v0.8.0

func LoadBundleAtRef(repo, ref string) (model.Bundle, error)

LoadBundleAtRef loads the model in repo as committed at a git ref: it reads engmod.yml and every document the manifest names with git show into a temporary directory (0700, files 0600, removed afterwards) and loads it with the model loader. A ref starting with "-" is refused, so it is never read as a git option. TRLC-LINKS: REQ-EMG-102, REQ-EMG-103 ENGMODEL-LINKS: FU-CLI-ORCHESTRATION, FU-MODEL-LOADER

func LoadPins

func LoadPins(root string) (map[string]bool, error)

LoadPins reads the pinned checkout names from root/.engws.yml. TRLC-LINKS: REQ-EMG-068 ENGMODEL-LINKS: FU-CLI-ORCHESTRATION

func Main

func Main(ctx context.Context, args []string, stdout, stderr io.Writer, registry Registry) int

Main runs engws with args (without the program name) and returns the exit code. TRLC-LINKS: REQ-EMG-068 ENGMODEL-LINKS: FU-CLI-ORCHESTRATION, FU-SYSTEM-COMPOSITION

func SavePins

func SavePins(root string, pins map[string]bool) error

SavePins writes root/.engws.yml with the pins sorted. TRLC-LINKS: REQ-EMG-068 ENGMODEL-LINKS: FU-CLI-ORCHESTRATION

func ServeStaging added in v0.6.0

func ServeStaging(ctx context.Context, result StageResult, addr string, ready func(host string)) error

ServeStaging loads every staged OCI layout into an in-memory read-only registry and serves it on addr (loopback only) until ctx is done. ready is called with the listening host:port before serving. TRLC-LINKS: REQ-EMG-080 ENGMODEL-LINKS: FU-CLI-ORCHESTRATION, REF-CUE-OCI-MODULE-REGISTRY

func StageEnv added in v0.6.0

func StageEnv(result StageResult, host string, current map[string]string) []string

StageEnv returns the environment to run the gate against the staging area: CUE_REGISTRY routes every staged module to host (merged with the current CUE_REGISTRY, replacing routes for the same prefix; omitted when host is empty), GOPROXY is the file proxy with no fallback, GONOPROXY=none makes private patterns use it, GONOSUMDB names the staged Go modules plus the current GONOSUMDB or GOPRIVATE, and ENGMOD_WORK=off with GOWORK=off make every dependency resolve from staging instead of the checkouts. TRLC-LINKS: REQ-EMG-080 ENGMODEL-LINKS: FU-CLI-ORCHESTRATION, REF-CUE-OCI-MODULE-REGISTRY

func ToolGoWork

func ToolGoWork(repoDir string) string

ToolGoWork is the GOWORK value for running a repository's own .github/engmod-check: its go.work when the repository deliberately builds the check against a local engine, else "off". The workspace root go.work lists the checkouts, not the tool module, and is never inherited. TRLC-LINKS: REQ-EMG-068 ENGMODEL-LINKS: FU-CLI-ORCHESTRATION

func WorkFileDrift

func WorkFileDrift(plan Plan) string

WorkFileDrift reports how root/engmod.work.yml differs from the plan's local set, so check can warn that sync was not run. TRLC-LINKS: REQ-EMG-068 ENGMODEL-LINKS: FU-CLI-ORCHESTRATION, FU-SYSTEM-COMPOSITION

Types

type BumpLink struct {
	ID, Child, From, To string
	Outcome             string
	Changes             []string
	Note                string
	Before, After       *reqlinks.Item
}

BumpLink is the outcome of one requirement link on the bumped alias: the item at its pinned version (Before) and at the new version (After), the difference in meaning (Changes) and, for a link left for review, Note. TRLC-LINKS: REQ-EMG-100

type BumpOptions added in v0.8.0

type BumpOptions struct {
	AllowReview bool
}

BumpOptions modify Bump. AllowReview makes a bump that leaves links for review succeed (exit 0); the pins are written either way. TRLC-LINKS: REQ-EMG-100

type BumpResult

type BumpResult struct {
	Module      string // dependency model module path
	From, To    string
	GoModule    string // Go module required, empty when not changed
	LockWritten bool
	Diagnostics []validate.Diagnostic
	// Links is the outcome of every requirement link of the consumer on the
	// bumped alias, in link order.
	Links []BumpLink
	// Repinned lists the links whose pinned.version moved to the new
	// version because the item means the same at both versions (D23).
	Repinned []string
	// NeedReview reports that a link was left at its pin for review: its
	// item changed in meaning, is gone, or its pinned version cannot be
	// resolved.
	NeedReview bool
}

BumpResult describes what bump changed.

func Bump

func Bump(root, repo, alias, version string, opts BumpOptions) (BumpResult, error)

Bump sets the version of dependency alias in root/<repo>/engmod.yml by editing only that YAML line, updates the go.mod require and go.sum of the Go module of the same repository family (go get with GOWORK=off) when the dependency's checkout has go.mod, and regenerates engmod.lock.yml with the workspace off and the module cache refreshed. It then compares each requirement link of the consumer on the alias between its pinned version and the new one, both published versions resolved with the workspace off (decision D23): a link whose item means the same at both (reqlinks.SameMeaning) moves pinned.version to the new version; one whose meaning changed, whose item is gone or whose pinned version cannot be resolved keeps its pin, so the model check reports link.version_mismatch (or link.broken) until engws review-links accepts it. Any failure restores engmod.yml, go.mod, go.sum, the lock and the requirement link file. TRLC-LINKS: REQ-EMG-068, REQ-EMG-100 ENGMODEL-LINKS: FU-CLI-ORCHESTRATION, FU-SYSTEM-COMPOSITION

type Change added in v0.8.0

type Change string

Change is how a contract item changed between two versions.

const (
	ChangeAdded     Change = "added"
	ChangeRemoved   Change = "removed"
	ChangeChanged   Change = "changed"
	ChangeUnchanged Change = "unchanged"
)

type CheckOptions

type CheckOptions struct {
	// InProcess forces the library check even when a repo pins its own.
	InProcess bool
	// Jobs bounds the concurrent exec checks; 0 means GOMAXPROCS.
	Jobs int
	// Refresh re-fetches every registry dependency instead of reusing the
	// module cache (ENGMOD_MODULE_CACHE=refresh), so a moved tag is seen.
	Refresh bool
}

CheckOptions configures RunChecks.

type CheckResult

type CheckResult struct {
	Target   CheckTarget
	Method   string // exec: the repo's pinned .github/engmod-check; library: in-process
	Errors   int
	Warnings int
	Lines    []string // error lines and other failure output
	Failed   bool
}

CheckResult is the outcome of the model check in one checkout.

func RunChecks

func RunChecks(ctx context.Context, root string, targets []CheckTarget, opts CheckOptions) []CheckResult

RunChecks runs the model check in every target. A repository that ships .github/engmod-check with --workspace-root support is checked with its own pinned engine (go run with GOWORK from ToolGoWork, so the root go.work never captures the check module); otherwise the library in this binary checks it in-process. Exec checks run concurrently; in-process checks run one at a time because they share process state (environment, caches). TRLC-LINKS: REQ-EMG-068 ENGMODEL-LINKS: FU-CLI-ORCHESTRATION, FU-SYSTEM-COMPOSITION

func (CheckResult) Line

func (r CheckResult) Line() string

Line is the one-line summary: ok|FAIL repo (n errors, m warnings). TRLC-LINKS: REQ-EMG-068

type CheckTarget

type CheckTarget struct {
	Entry  Entry
	Reason string // local, depends on <checkout>, top system
}

CheckTarget is a checkout selected for the model check and why.

func SelectCheckTargets

func SelectCheckTargets(plan Plan) []CheckTarget

SelectCheckTargets returns the checkouts affected by the local set: the local checkouts, every checkout that depends on one of them directly or transitively inside the workspace, and the top systems (checkouts no other checkout depends on). The result is sorted by checkout name. TRLC-LINKS: REQ-EMG-068 ENGMODEL-LINKS: FU-CLI-ORCHESTRATION, FU-SYSTEM-COMPOSITION

type Checkout

type Checkout struct {
	Name     string // directory name under the root
	Dir      string // absolute directory
	Manifest model.ManifestDocument
	GoModule string // module path from go.mod, empty without go.mod
	// GoRequires maps each module path required in go.mod to its version.
	GoRequires map[string]string
}

Checkout is one direct child directory of the root holding an engmod.yml.

func Scan

func Scan(root string) ([]Checkout, error)

Scan lists the direct children of root that hold an engmod.yml, sorted by name. Dot directories are skipped. A manifest that cannot be read is an error naming the checkout, since every later decision depends on it. TRLC-LINKS: REQ-EMG-068 ENGMODEL-LINKS: FU-CLI-ORCHESTRATION, FU-SYSTEM-COMPOSITION

func ScanWithWarnings

func ScanWithWarnings(root string) ([]Checkout, []string, error)

ScanWithWarnings is Scan that also returns one warning per skipped checkout: a directory name outside [A-Za-z0-9._-] or a module.path that is not a valid CUE module path (host/path@vN). Neither is written into the work files. Go module paths are checked where they are written (Sync). TRLC-LINKS: REQ-EMG-068 ENGMODEL-LINKS: FU-CLI-ORCHESTRATION

type ContractDiffResult added in v0.8.0

type ContractDiffResult struct {
	From   string       `json:"from,omitempty"`
	To     string       `json:"to,omitempty"`
	Items  []ItemChange `json:"items"`
	Impact Impact       `json:"impact"`
}

ContractDiffResult is the contract diff of a model between two versions with the overall semantic version impact (patch when nothing changed). TRLC-LINKS: REQ-EMG-102

func ContractDiff added in v0.8.0

func ContractDiff(repo, fromRef, toRef string) (ContractDiffResult, error)

ContractDiff diffs the contract of the model in repo between two refs. TRLC-LINKS: REQ-EMG-102 ENGMODEL-LINKS: FU-CLI-ORCHESTRATION, FU-ALLOCATION-TRACE

func DiffContracts added in v0.8.0

func DiffContracts(from, to model.Bundle) ContractDiffResult

DiffContracts compares the published contract items of two versions of a model. Major: a capability removed or its text changed, an assumption of use added or its text or verificationCriteria changed, an item's kind changed. Minor: an assumption removed, a capability added, only the realizing requirements changed. Anything else is patch. TRLC-LINKS: REQ-EMG-102 ENGMODEL-LINKS: FU-CLI-ORCHESTRATION, FU-ALLOCATION-TRACE

type ControlVerificationSuggestion added in v0.9.0

type ControlVerificationSuggestion struct {
	ID        string   `json:"id"`
	Current   string   `json:"current"`
	Suggested string   `json:"suggested"`
	Missing   []string `json:"missing,omitempty"`
}

ControlVerificationSuggestion is the status a control verification earns: pass when every requirement its verificationRefs name earns verified, else its current status. TRLC-LINKS: REQ-EMG-122

type Entry

type Entry struct {
	Checkout
	Pinned  bool
	Reasons []string // why the checkout is changed, in detection order
	State   string
	Local   bool // listed as a replacement
	Note    string
}

Entry is one checkout with its changed-detection result.

type Impact added in v0.8.0

type Impact string

Impact is a semantic version impact.

const (
	ImpactPatch Impact = "patch"
	ImpactMinor Impact = "minor"
	ImpactMajor Impact = "major"
)

type ItemChange added in v0.8.0

type ItemChange struct {
	ID      string   `json:"id"`
	Kind    string   `json:"kind"`
	Change  Change   `json:"change"`
	Aspects []string `json:"aspects,omitempty"`
	Impact  Impact   `json:"impact,omitempty"`
	Text    string   `json:"text"`
	Notes   []string `json:"notes,omitempty"`
}

ItemChange is one contract item in a contract diff. Aspects names what changed (kind, text, verificationCriteria, realizers); Impact is empty for an unchanged item. TRLC-LINKS: REQ-EMG-102

type KeptAllocation added in v0.8.0

type KeptAllocation struct {
	Requirement, Target string
	Reason              string
}

KeptAllocation is an allocation migrate-links leaves in place because its target is not a link target (D13), with the reason printed for it. TRLC-LINKS: REQ-EMG-104

type LinkAddOptions added in v0.9.0

type LinkAddOptions struct {
	Parent    string
	Evidence  []string
	Child     string
	Rationale string
}

LinkAddOptions name the link engws link add writes: the parent requirement or the evidence IDs, the child alias::ID and a rationale. TRLC-LINKS: REQ-EMG-119

type LinkReview added in v0.8.0

type LinkReview = linkreview.Review

LinkReview is one link that needs review (linkreview.Review). TRLC-LINKS: REQ-EMG-101

func ReviewLinks(repo string) ([]LinkReview, error)

ReviewLinks returns every link of the model in repo that needs review (pinned to another version than the dependency, broken or claimed), with the item at the pinned version and at the dependency pin, both resolved with the workspace off from the module cache or the registry (never from a workspace checkout, whose content is not that version's). TRLC-LINKS: REQ-EMG-101 ENGMODEL-LINKS: FU-CLI-ORCHESTRATION, FU-ALLOCATION-TRACE

type MigrateResult added in v0.8.0

type MigrateResult struct {
	Links []MigratedLink
	// DroppedFingerprints counts the deprecated pinned.fingerprint entries
	// removed from the existing link file (D23).
	DroppedFingerprints int
	Kept                []KeptAllocation
	Refs                []MigratedRef
	AddedDocument       bool
	Files               []string // files written (or to write)
	NoParent            []string
	NoParentSeverity    validate.Severity
}

MigrateResult is what migrate-links changed (or, in a dry run, would change) and the requirements that report requirement.no_parent after it, sorted by ID, with the severity the model's strictness gives them. TRLC-LINKS: REQ-EMG-104

func MigrateLinks(repo string, dryRun bool) (MigrateResult, error)

MigrateLinks converts the deprecated requirement trace of the model in repo: each composition.allocations entry becomes a claimed reqLinks entry pinned to the dependency version (a parent link to a capability, an evidence link to an assumption of use), documents.reqLinks is added when missing, the allocations are removed, each capability contract.provides[].ref becomes realizes on the referenced requirement, and every deprecated pinned.fingerprint of the link file is removed (D23). Every edit keeps the other lines of the files. dryRun writes nothing. A second run changes nothing. TRLC-LINKS: REQ-EMG-104, REQ-EMG-118 ENGMODEL-LINKS: FU-CLI-ORCHESTRATION, FU-ALLOCATION-TRACE

func (MigrateResult) Changed added in v0.8.0

func (r MigrateResult) Changed() bool

Changed reports whether the migration changes anything. TRLC-LINKS: REQ-EMG-104

type MigratedLink struct {
	Link model.ReqLink
	Note string // why the target's kind could not be checked, when it could not
}

MigratedLink is one allocation converted to a requirement link. TRLC-LINKS: REQ-EMG-104

type MigratedRef added in v0.8.0

type MigratedRef struct {
	Capability, Requirement string
	Note                    string
}

MigratedRef is one contract ref converted to realizes (or kept, with Note). TRLC-LINKS: REQ-EMG-104

type Plan

type Plan struct {
	Root    string
	Entries []Entry
	Notes   []string
	// Warnings name the checkouts Scan skipped as unsafe.
	Warnings []string
}

Plan is the workspace decision for every checkout under Root.

func BuildPlan

func BuildPlan(ctx context.Context, root string, registry Registry, all bool) (Plan, error)

BuildPlan classifies every checkout under root. A checkout is local when it is pinned, changed, or all is set; registry problems are notes, never changes, so an offline developer is not forced into local mode. TRLC-LINKS: REQ-EMG-068 ENGMODEL-LINKS: FU-CLI-ORCHESTRATION, FU-SYSTEM-COMPOSITION

func (Plan) Local

func (p Plan) Local() []Entry

Local returns the local entries. TRLC-LINKS: REQ-EMG-068

func (Plan) Skews

func (p Plan) Skews() []Skew

Skews lists every dependency pin of a checkout whose module is local at a different version (the replacement overrides every pin of its module), and every go.mod require of a workspace checkout's Go module at another version than that checkout's version tag (go.work uses every Go checkout). TRLC-LINKS: REQ-EMG-068 ENGMODEL-LINKS: FU-CLI-ORCHESTRATION, FU-SYSTEM-COMPOSITION

type Publication

type Publication int

Publication is the registry answer for one module version.

const (
	// PublicationUnknown means the registry could not be asked (offline,
	// unconfigured or failing); it never marks a checkout changed.
	PublicationUnknown Publication = iota
	PublicationPublished
	PublicationMissing
)

type Registry

type Registry interface {
	// Published reports the publication of modulePath (with @vN) at version
	// and, for PublicationUnknown, why.
	Published(ctx context.Context, modulePath, version string) (Publication, string)
}

Registry answers whether a module version is published.

func NewCUERegistry

func NewCUERegistry() Registry

NewCUERegistry returns the registry configured by CUE_REGISTRY. An unset CUE_REGISTRY is reported as unknown instead of falling back to CUE's public default registry, so engws never contacts a registry the project did not configure. TRLC-LINKS: REQ-EMG-068 ENGMODEL-LINKS: FU-CLI-ORCHESTRATION, FU-SYSTEM-COMPOSITION

type ReleaseCheckResult added in v0.8.0

type ReleaseCheckResult struct {
	Findings []validate.Diagnostic
	Notes    []string
	Diff     *ContractDiffResult
}

ReleaseCheckResult is the outcome of release-check: findings (dependency.unreleased_pin, contract.semver_too_small), notes and the contract diff the semver gate used (nil when it was skipped). TRLC-LINKS: REQ-EMG-103

func ReleaseCheck added in v0.8.0

func ReleaseCheck(repo, tag string) (ReleaseCheckResult, error)

ReleaseCheck checks that the model in repo may be released under tag: no dependency pin is a pre-release or pseudo-version, and the tag's bump over the previous release tag (the highest release tag below it among the tags merged into the released commit, git tag --merged) covers the contract diff between them (to the tag if it exists, else HEAD). An empty tag means the highest release tag at HEAD; without one, or without a previous release tag, the semver gate is skipped with a note. TRLC-LINKS: REQ-EMG-103 ENGMODEL-LINKS: FU-CLI-ORCHESTRATION, FU-ALLOCATION-TRACE

type RequirementSuggestion added in v0.9.0

type RequirementSuggestion struct {
	ID        string   `json:"id"`
	Current   string   `json:"current"`
	Suggested string   `json:"suggested"`
	Reasons   []string `json:"reasons"`
}

RequirementSuggestion is the status a requirement earns from the tree's evidence: verified, implemented, or "" (nothing), with why. TRLC-LINKS: REQ-EMG-122

type Skew

type Skew struct {
	Consumer, Alias, Module, Pinned, LocalCheckout, LocalVersion string
}

Skew is a consumer pin that a local replacement overrides with another version.

func (Skew) String

func (s Skew) String() string

String is the SKEW line: consumer, alias, pinned, local, then context. A Go require skew has alias go:<module path>. TRLC-LINKS: REQ-EMG-068

type StageResult added in v0.6.0

type StageResult struct {
	Root        string
	RegistryDir string
	GoProxyDir  string
	Modules     []StagedModule // in dependency order
	Warnings    []string
	// Failures name the checkouts that cannot be staged; when any exist
	// nothing is written.
	Failures []string
}

StageResult is the outcome of Stage.

func Stage added in v0.6.0

func Stage(ctx context.Context, root, versionFrom string) (StageResult, error)

Stage publishes every checkout under root, in dependency order, into root/.engmod/staging: the CUE module as cue mod publish would (an OCI image layout per module under registry/<module path>, source kind git zips committed files only, kind self the directory) and, for a checkout with go.mod at its top, the Go module in GOPROXY file layout under goproxy/<module>/@v/<version>.{info,mod,zip} with list. It refuses a checkout cue mod publish would refuse (dirty tree, no source, module path mismatch) and, with versionFrom tag, one whose HEAD lacks tag v<module.version>; then nothing is written. It never writes inside a checkout. TRLC-LINKS: REQ-EMG-080 ENGMODEL-LINKS: FU-CLI-ORCHESTRATION, FU-SYSTEM-COMPOSITION, REF-CUE-OCI-MODULE-REGISTRY

type StagedModule added in v0.6.0

type StagedModule struct {
	Name       string // checkout directory name
	ModulePath string // CUE module path with major version
	Version    string
	CUEFiles   int
	LayoutDir  string // OCI image layout of the CUE module
	GoModule   string // staged Go module path, empty without go.mod
	Notes      []string
}

StagedModule is one checkout published into the staging area.

type StatusSuggestion added in v0.9.0

type StatusSuggestion struct {
	Tree                 string                          `json:"tree"`
	Log                  string                          `json:"log"`
	Requirements         []RequirementSuggestion         `json:"requirements"`
	ControlVerifications []ControlVerificationSuggestion `json:"controlVerifications"`
}

StatusSuggestion is the output of engws status-suggest. TRLC-LINKS: REQ-EMG-122

func SuggestStatus added in v0.9.0

func SuggestStatus(repo, tree string) (StatusSuggestion, error)

SuggestStatus computes the status each requirement and control verification of the model in repo earns from this tree's evidence, writing nothing. A requirement earns implemented when code links it, and verified when also a test links it that is not environment gated and not only a benchmark, and a RED line of .engflow/red-checks.jsonl (at the git top level) for tree names it in reqs. tree is the working-tree hash as engineering-flow's tree-hash.mjs computes it (git add -A into a temporary index, git write-tree) when empty. A requirement satisfied through reviewed requirement links (trace satisfiedBy links) earns what the trace rolls up. A control verification earns pass when every requirement in its verificationRefs earns verified; CODE-* references are not judged and keep it at its status. TRLC-LINKS: REQ-EMG-122 ENGMODEL-LINKS: FU-CLI-ORCHESTRATION, FU-ALLOCATION-TRACE

type SyncResult

type SyncResult struct {
	WorkFile      string
	GoWork        string // written go.work, empty when none
	GoWorkRemoved bool
	// Warnings name the go.mod module paths and requires left out of go.work
	// because they are not valid Go module paths or versions.
	Warnings []string
}

SyncResult names the files sync wrote or removed.

func Sync

func Sync(plan Plan, goVersion string, force bool) (SyncResult, error)

Sync writes root/engmod.work.yml with every local checkout and root/go.work with every checkout that has go.mod, removing go.work when none do. A non-local checkout is at its published tag, so its code equals the version a consumer pins at that tag; another pinned version is reported by Skews. Listing every Go checkout lets go test and go run work in each of them. It writes nothing inside a checkout. A work file that engws did not generate is kept unless force is set. It replaces each required version of a workspace Go module with its checkout, so unpublished modules build. A go.mod module path or require that fails golang.org/x/mod/module checks is left out of go.work and named in SyncResult.Warnings, so a crafted go.mod cannot add a directive. TRLC-LINKS: REQ-EMG-068, REQ-EMG-086 ENGMODEL-LINKS: FU-CLI-ORCHESTRATION, FU-SYSTEM-COMPOSITION, CTRL-GO-WORK-INPUT-VALIDATION

Jump to

Keyboard shortcuts

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