Internal

internal/app/review

Package review runs adversarial provider review and records review evidence.

import "github.com/nilstate/scafld/v2/internal/app/review"

Package review runs adversarial provider review and records review evidence.

Variables

ErrSpecNotReviewable is returned when review is attempted before build reaches the review gate.

Source: internal/app/review/review.go:21

var ErrSpecNotReviewable = errors.New("review requires task status review")

Functions

func Run(ctx context.Context, specs SpecStore, sessions SessionStore, workspace WorkspaceStatus, provider Provider, clock Clock, taskID string) (Output, error)

Source: internal/app/review/review.go:98

Run executes the review gate for taskID.

func RunWithInput(ctx context.Context, specs SpecStore, sessions SessionStore, workspace WorkspaceStatus, provider Provider, clock Clock, input Input) (Output, error)

Source: internal/app/review/review.go:103

RunWithInput executes the review gate using an explicit review agenda.

Types

type Clock

Source: internal/app/review/review.go:46

Clock supplies review timestamps.

type Clock interface{ Now() time.Time }
Methods
  • Now func() time.Time

type Input

Source: internal/app/review/review.go:70

Input describes the task and review agenda to run.

type Input struct {
	TaskID          string
	Mode            review.Mode
	ForceMode       bool
	Passes          []Pass
	Invariants      map[string]string
	ReviewScope     []string
	ContextSections []reviewcontext.Section
	ContextMaxBytes int
	MaxFindings     int
	MinAttackAngles int
	ReviewDepth     string
	RerunPolicy     string
	PrintContext    bool
	HumanReviewed   bool
	Reason          string
}
Fields
  • TaskID string
  • Mode review.Mode
  • ForceMode bool
  • Passes []Pass
  • Invariants map[string]string
  • ReviewScope []string
  • ContextSections []reviewcontext.Section
  • ContextMaxBytes int
  • MaxFindings int
  • MinAttackAngles int
  • ReviewDepth string
  • RerunPolicy string
  • PrintContext bool
  • HumanReviewed bool
  • Reason string

type Output

Source: internal/app/review/review.go:49

Output describes a completed review run.

type Output struct {
	TaskID         string                  `json:"task_id"`
	Verdict        string                  `json:"verdict"`
	Mode           review.Mode             `json:"mode,omitempty"`
	Summary        string                  `json:"summary,omitempty"`
	Provider       string                  `json:"provider,omitempty"`
	Model          string                  `json:"model,omitempty"`
	OutputFormat   string                  `json:"output_format,omitempty"`
	Normalizations []string                `json:"normalizations,omitempty"`
	Findings       []review.Finding        `json:"findings"`
	AttackLog      []review.AttackLogEntry `json:"attack_log,omitempty"`
	Budget         review.Budget           `json:"budget,omitempty"`
	Next           string                  `json:"next"`
	Context        string                  `json:"context,omitempty"`
	Repair         *gate.Failure           `json:"repair,omitempty"`
}
Fields
  • TaskID string `json:"task_id"`
  • Verdict string `json:"verdict"`
  • Mode review.Mode `json:"mode,omitempty"`
  • Summary string `json:"summary,omitempty"`
  • Provider string `json:"provider,omitempty"`
  • Model string `json:"model,omitempty"`
  • OutputFormat string `json:"output_format,omitempty"`
  • Normalizations []string `json:"normalizations,omitempty"`
  • Findings []review.Finding `json:"findings"`
  • AttackLog []review.AttackLogEntry `json:"attack_log,omitempty"`
  • Budget review.Budget `json:"budget,omitempty"`
  • Next string `json:"next"`
  • Context string `json:"context,omitempty"`
  • Repair *gate.Failure `json:"repair,omitempty"`

func GateFailure() *gate.Failure

Source: internal/app/review/review.go:67

GateFailure exposes review blockers to the CLI JSON envelope.

type Pass

Source: internal/app/review/review.go:89

Pass describes one configured review pass included in the provider prompt.

type Pass struct {
	ID          string
	Category    string
	Order       int
	Title       string
	Description string
}
Fields
  • ID string
  • Category string
  • Order int
  • Title string
  • Description string

type Provider

Source: internal/app/review/review.go:36

Provider is the review provider port.

type Provider interface {
	Invoke(context.Context, review.Request) (review.Dossier, error)
}
Methods
  • Invoke func(context.Context, review.Request) (review.Dossier, error)

type SessionStore

Source: internal/app/review/review.go:30

SessionStore is the session evidence port used by review.

type SessionStore interface {
	Append(context.Context, string, session.Entry, string) (session.Session, error)
	Load(context.Context, string) (session.Session, error)
}
Methods
  • Append func(context.Context, string, session.Entry, string) (session.Session, error)
  • Load func(context.Context, string) (session.Session, error)

type SpecStore

Source: internal/app/review/review.go:24

SpecStore is the spec persistence port used by review.

type SpecStore interface {
	Load(context.Context, string) (spec.Model, string, error)
	Save(context.Context, string, spec.Model) error
}
Methods
  • Load func(context.Context, string) (spec.Model, string, error)
  • Save func(context.Context, string, spec.Model) error

type WorkspaceStatus

Source: internal/app/review/review.go:41

WorkspaceStatus is the mutation-guard workspace state port.

type WorkspaceStatus interface {
	ChangedFiles(context.Context) ([]string, error)
}
Methods
  • ChangedFiles func(context.Context) ([]string, error)