workflow

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2026 License: AGPL-3.0, AGPL-3.0-or-later Imports: 25 Imported by: 0

Documentation

Overview

Package workflow implements the CEM producer/verifier operations — begin, prepare, cite, mark, status, verify, and report — over the CEM seams, with the frozen CEM-CB envelope table, validation precedence, and resume rules.

Index

Constants

View Source
const ActionReportPreview = "report-preview"

ActionReportPreview renders the report without publishing it: the read-only MCP projection of `cem report` (MCPV0-025).

Variables

View Source
var OpenHunkJudge func(ctx context.Context, root, target string) (HunkJudge, error)

OpenHunkJudge serves `cem discriminate` (internal/cemdiscriminate). The binary installs it, so the CEM seams' dependency closure stays the standard library and internal/cem; an uninstalled runner is an unavailable runner, so every selected hunk carries a not-run witness.

Functions

This section is empty.

Types

type BeginOptions

type BeginOptions struct {
	PatchPath string // out-of-band patch input; absolute or root-relative
	Base      string // revision; empty means HEAD
	Output    string // required root-relative map output
}

BeginOptions configure the low-level exact-patch producer entry.

type CiteOptions

type CiteOptions struct {
	MapPath      string
	Hunk         string
	EvidencePath string
	Bytes        string // START:END zero-based byte span
	Lines        string // START:END one-based inclusive line span
	Relation     string
	Output       string // optional root-relative output; empty rewrites in place
}

CiteOptions attach one evidence span to one hunk.

type CoverOptions added in v0.7.0

type CoverOptions struct {
	MapPath      string
	Coverprofile string
	TestRun      string
	Output       string
}

CoverOptions attach one local coverprofile to every hunk of a map.

type DiscriminateOptions added in v0.7.0

type DiscriminateOptions struct {
	MapPath    string
	Target     string
	MaxHunks   string
	MaxMutants string
	WallTime   string
	Output     string
}

DiscriminateOptions run bounded hunk mutation against the tests a map's hunks cite. MaxHunks, MaxMutants, and WallTime are the operator's text; empty means the default.

type HunkJudge added in v0.7.0

type HunkJudge interface {
	Judge(ctx context.Context, hunk wire.Hunk, tests []string, maxMutants int, wallTime time.Duration) wire.DiscriminationWitness
	Close()
}

HunkJudge judges one hunk's mutants against its cited test files on one exported copy of the target tree. Its not-run details are bounded here.

type MarkOptions

type MarkOptions struct {
	MapPath     string
	Hunk        string
	Disposition string
	Reason      string
	Output      string
}

MarkOptions set one hunk's explicit unknown or mechanical disposition.

type PolicyLimits

type PolicyLimits struct {
	MaxUnknown    *int
	MaxMechanical *int
}

PolicyLimits are optional disposition-count ceilings.

type PrepareOptions

type PrepareOptions struct {
	Base    string // required independent producer baseline
	Target  string // required code revision
	MapPath string // must be empty or the frozen default
	Cache   string // optional root-relative convenience-cache selection
	Replace bool
}

PrepareOptions configure candidate generation.

type ReadOptions

type ReadOptions struct {
	MapPath      string
	PatchPath    string // 0.1 only: explicit out-of-band patch
	PatchGiven   bool   // whether --patch appeared at all
	ExpectedBase string
	Target       string
	Limits       PolicyLimits
	Output       string // report only
}

ReadOptions configure status, verify, and report.

type Session

type Session struct {
	// contains filtered or unexported fields
}

Session is one opened worktree root; the repository boundary is validated separately by openRepository at its frozen precedence position.

func Open

func Open(root string) (*Session, error)

Open validates the worktree root as a publication root only. Repository validation (precedence stages 5–6) is deferred to openRepository so each command judges argument and map validation (stages 1–4) first.

func (*Session) Begin

func (s *Session) Begin(ctx context.Context, options BeginOptions) (map[string]any, error)

Begin builds a cem/0.1 candidate from exact out-of-band patch bytes.

func (*Session) Cite

func (s *Session) Cite(ctx context.Context, options CiteOptions) (map[string]any, error)

Cite compiles the requested span into the normative byte span and records the typed evidence reference, preserving the input profile.

func (*Session) Cover added in v0.7.0

func (s *Session) Cover(ctx context.Context, options CoverOptions) (map[string]any, error)

Cover records a coverage witness on every hunk (TCQ-V0-051..054). The coverprofile is one explicit operator-named local file: Corvint neither discovers profiles nor runs tests here. Covered ranges are the hunk's added lines that a block with a positive count reaches (diff-cover semantics); a hunk none reach carries an explicit uncovered witness rather than none. Witnesses are a cem/0.3 field, so a canonical map is upgraded like a structural reason in Mark (CEM-SM-006).

func (*Session) Discriminate added in v0.7.0

func (s *Session) Discriminate(ctx context.Context, options DiscriminateOptions) (map[string]any, error)

Discriminate records a mutation discrimination witness on every hunk (TCQ-V0-055..058). It reuses the prove --mutate runner through the installed OpenHunkJudge (internal/cemdiscriminate) on the map's changed hunks only, pins the run to the resolved --target tree revision and to the digest of the selected test files, and never fails the build: a survived mutant is a visible downgrade in the report, and a hunk the bounds or the host leave unjudged carries an explicit not-run witness with its reason.

func (*Session) Mark

func (s *Session) Mark(ctx context.Context, options MarkOptions) (map[string]any, error)

Mark records an explicit unknown or mechanical disposition and prunes evidence left uncited, preserving the input profile. The one profile change is additive (CEM-SM-006): a structural reason on a canonical map declares cem/0.3, the vocabulary the map now uses; a cem/0.1 map cannot carry one.

func (*Session) Prepare

func (s *Session) Prepare(ctx context.Context, options PrepareOptions) (map[string]any, error)

Prepare derives the canonical patch and writes or resumes the candidate map. It ignores target-side sidecar state entirely: candidate generation precedes the commit that creates the final revision.

func (*Session) Read

func (s *Session) Read(ctx context.Context, action string, options ReadOptions) (map[string]any, error)

Read runs one of the verification-consuming commands. The action is "status", "verify", "report", or ActionReportPreview; rendering is not a second trust path.

Jump to

Keyboard shortcuts

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