internal/app/review
import "github.com/nilstate/scafld/v2/internal/app/review"
Package review runs adversarial provider review and records review evidence.
Variables
ErrReviewStartBlocked is returned when the current review gate state forbids starting a new provider attempt.
Source: internal/app/review/review.go:30
var ErrReviewStartBlocked = errors.New("review attempt cannot start")ErrSpecNotReviewable is returned when review is attempted before build reaches the review gate.
Source: internal/app/review/review.go:26
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:114
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:119
RunWithInput executes the review gate using an explicit review agenda.
Types
type Clock
Source: internal/app/review/review.go:57
Clock supplies review timestamps.
type Clock interface{ Now() time.Time }Methods
Now func() time.Time
type Input
Source: internal/app/review/review.go:81
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
RequiredContextMaxBytes int
Contract agentcontract.Contract
MaxFindings int
MinAttackAngles int
ReviewDepth string
RerunPolicy string
ForceReview bool
ProviderName string
ProviderModel string
PrintContext bool
HumanReviewed bool
Reason string
}Fields
TaskID stringMode review.ModeForceMode boolPasses []PassInvariants map[string]stringReviewScope []stringContextSections []reviewcontext.SectionContextMaxBytes intRequiredContextMaxBytes intContract agentcontract.ContractMaxFindings intMinAttackAngles intReviewDepth stringRerunPolicy stringForceReview boolProviderName stringProviderModel stringPrintContext boolHumanReviewed boolReason string
type Output
Source: internal/app/review/review.go:60
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:78
GateFailure exposes review blockers to the CLI JSON envelope.
type Pass
Source: internal/app/review/review.go:105
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 stringCategory stringOrder intTitle stringDescription string
type Provider
Source: internal/app/review/review.go:46
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:39
SessionStore is the session evidence port used by review.
type SessionStore interface {
Append(context.Context, string, session.Entry, string) (session.Session, error)
AppendTransaction(context.Context, string, string, func(session.Session) ([]session.Entry, error)) (session.Session, error)
Load(context.Context, string) (session.Session, error)
}Methods
Append func(context.Context, string, session.Entry, string) (session.Session, error)AppendTransaction func(context.Context, string, string, func(session.Session) ([]session.Entry, error)) (session.Session, error)Load func(context.Context, string) (session.Session, error)
type SpecStore
Source: internal/app/review/review.go:33
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:51
WorkspaceStatus is the mutation-guard workspace state port.
type WorkspaceStatus interface {
ChangedFiles(context.Context) ([]string, error)
ResolveHead(context.Context) (string, bool, error)
}Methods
ChangedFiles func(context.Context) ([]string, error)ResolveHead func(context.Context) (string, bool, error)
