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:20

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:95

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:100

RunWithInput executes the review gate using an explicit review agenda.

Types

type Clock

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

Clock supplies review timestamps.

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

type Input

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

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:48

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"`
	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"`
  • 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:64

GateFailure exposes review blockers to the CLI JSON envelope.

type Pass

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

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:35

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:29

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:23

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:40

WorkspaceStatus is the mutation-guard workspace state port.

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