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

linkreview

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package linkreview evaluates the requirement links of one model and prepares their review: the links with their state, the child item before (at the link's pinned version, resolved with the workspace off) and after (at the dependency pin), and the line-preserving edit that records an accepted review in the requirement link file. engws review-links writes the edit; the MCP server only shows it.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DiffLines

func DiffLines(before, after []string, haveBefore bool) []string

DiffLines marks lines only in before with "- ", only in after with "+ " and common lines with " ", in document order (a longest common subsequence walk). With no before, every after line is shown unmarked. TRLC-LINKS: REQ-EMG-101, REQ-EMG-106

func ItemsAtVersion

func ItemsAtVersion(system model.Bundle, alias, version string, options composition.ResolutionOptions) (map[string]reqlinks.Item, string)

ItemsAtVersion resolves dependency alias of system at version with the workspace off (options otherwise; use lock check so no lock is written) and returns its published contract items, or a note naming the first composition error when the version cannot be resolved. TRLC-LINKS: REQ-EMG-101, REQ-EMG-106

func NeedsReview

func NeedsReview(s reqlinks.LinkStatus) bool

NeedsReview reports whether a link is listed for review: suspect, broken, version_mismatch or fingerprint_outdated. TRLC-LINKS: REQ-EMG-101, REQ-EMG-106, REQ-EMG-109

func OneLine

func OneLine(s string) string

OneLine collapses whitespace like the canonical serialization. TRLC-LINKS: REQ-EMG-101, REQ-EMG-106

Types

type Acceptance

type Acceptance struct {
	Status reqlinks.LinkStatus
	Path   string
	Before []byte
	After  []byte
}

Acceptance is the edit that records the review of one link: the link status it accepts and the requirement link file content before and after. TRLC-LINKS: REQ-EMG-101, REQ-EMG-106

func Accept

func Accept(ctx Context, data []byte, id, by, rationale, date string) (Acceptance, error)

Accept prepares the review of link id in ctx: the current fingerprint, the dependency pin, reviewedBy, reviewedOn (date, YYYY-MM-DD), the rationale and status accepted, editing only the touched lines of data (the requirement link file). It refuses an actor the model does not define, an unknown link, a broken link and one whose item cannot be evaluated. Nothing is written. TRLC-LINKS: REQ-EMG-101, REQ-EMG-106 ENGMODEL-LINKS: FU-ALLOCATION-TRACE

func (Acceptance) Patch

func (a Acceptance) Patch(name string) string

Patch renders the acceptance as a unified-style line diff of the link file under name: "--- a/name", "+++ b/name", then the changed lines marked "-" and "+" with the unchanged lines around them omitted. TRLC-LINKS: REQ-EMG-106

type Context

type Context struct {
	Manifest string
	Bundle   model.Bundle
	Statuses []reqlinks.LinkStatus
}

Context is a model with its links evaluated at the current pins. TRLC-LINKS: REQ-EMG-101, REQ-EMG-106

func Evaluate

func Evaluate(manifest string, options composition.ResolutionOptions) (Context, error)

Evaluate loads the model of manifest, composes it with options and evaluates its links. A model without documents.reqLinks has no statuses and is not composed. TRLC-LINKS: REQ-EMG-101, REQ-EMG-106 ENGMODEL-LINKS: FU-ALLOCATION-TRACE, FU-SYSTEM-COMPOSITION

func EvaluateForAccept

func EvaluateForAccept(manifest string, options composition.ResolutionOptions) (Context, error)

EvaluateForAccept is Evaluate with the workspace off: an acceptance records the fingerprint of the published dependency at its pin, the content every user of the pin computes, never that of a workspace checkout (decision D9). A dependency that does not resolve that way (the version is not published or the registry is unreachable) leaves its links unresolved, so Accept refuses them; their Detail names the cause. TRLC-LINKS: REQ-EMG-101, REQ-EMG-106 ENGMODEL-LINKS: FU-ALLOCATION-TRACE, FU-SYSTEM-COMPOSITION

type ItemView

type ItemView struct {
	ID                   string         `json:"id"`
	Kind                 string         `json:"kind"`
	Text                 string         `json:"text"`
	VerificationCriteria string         `json:"verificationCriteria,omitempty"`
	Fingerprint          string         `json:"fingerprint"`
	Realizers            []RealizerView `json:"realizers"`
}

ItemView is a contract item as a review shows it: the canonical fields of the item and its realizing requirements, sorted by ID. TRLC-LINKS: REQ-EMG-101, REQ-EMG-106

func NewItemView

func NewItemView(item *reqlinks.Item) *ItemView

NewItemView converts an item; nil stays nil. TRLC-LINKS: REQ-EMG-101, REQ-EMG-106

func (*ItemView) Lines

func (v *ItemView) Lines() []string

Lines renders an item view as one line for the item and one per realizer. TRLC-LINKS: REQ-EMG-101

type RealizerView

type RealizerView struct {
	ID                   string `json:"id"`
	Text                 string `json:"text"`
	VerificationCriteria string `json:"verificationCriteria,omitempty"`
	Status               string `json:"status,omitempty"`
}

RealizerView is one realizing requirement of an ItemView. TRLC-LINKS: REQ-EMG-101, REQ-EMG-106

type Review

type Review struct {
	ID         string    `json:"id"`
	Child      string    `json:"child"`
	State      string    `json:"state"`
	Content    string    `json:"content,omitempty"`
	Parent     string    `json:"parent,omitempty"`
	ParentText string    `json:"parentText,omitempty"`
	Pinned     string    `json:"pinnedVersion"`
	Version    string    `json:"dependencyVersion"`
	Recorded   string    `json:"recordedFingerprint"`
	Current    string    `json:"currentFingerprint,omitempty"`
	Before     *ItemView `json:"before,omitempty"`
	BeforeNote string    `json:"beforeNote,omitempty"`
	After      *ItemView `json:"after,omitempty"`
	Detail     string    `json:"detail,omitempty"`
}

Review is one link that needs review: its state, the parent requirement and the child item at the reviewed version (Before, nil with BeforeNote when it cannot be resolved) and at the dependency pin (After, nil when the item is gone). TRLC-LINKS: REQ-EMG-101, REQ-EMG-106

func Reviews

func Reviews(ctx Context, options composition.ResolutionOptions) []Review

Reviews returns every link of ctx that needs review, with the item at the reviewed version resolved through options with the workspace off (module cache, else the registry; never a workspace checkout, whose content is not that version's). TRLC-LINKS: REQ-EMG-101, REQ-EMG-106 ENGMODEL-LINKS: FU-ALLOCATION-TRACE

Jump to

Keyboard shortcuts

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