Documentation
¶
Index ¶
- Constants
- Variables
- func AttemptTimeout(p Plan) time.Duration
- func CheckCIPatch(p Plan, baseline map[string][]byte, patches []sandbox.Patch, ...) error
- func CheckOwnerPatch(p Plan, baseline map[string][]byte, patches []sandbox.Patch) error
- func CheckPatch(p Plan, baseline map[string][]byte, patches []sandbox.Patch) error
- func ConflictFinding(f discovery.Finding) bool
- func Files(snapshot sandbox.Snapshot) (map[string][]byte, error)
- func Goal(f discovery.Finding) string
- func Instructions(text string) string
- func PatchLines(baseline map[string][]byte, patches []sandbox.Patch) int
- func Protected(p Plan, files map[string][]byte) bool
- func Reproduced(results []CheckResult) bool
- func SourceDiff(original map[string][]byte, patches []sandbox.Patch) string
- func Verified(p Plan, baseline, candidate []CheckResult) bool
- type CILog
- type CheckResult
- type Checkpoint
- type DependencyUpdate
- type Engine
- func (e Engine) Run(ctx context.Context, p Plan, baseline, target sandbox.Snapshot) (Report, error)
- func (e Engine) ValidateCustom(ctx context.Context, p Plan, baseline, target sandbox.Snapshot, ...) (Report, error)
- func (e Engine) ValidateNative(ctx context.Context, p Plan, sha string, target sandbox.Snapshot, ...) (Publication, error)
- type ExecutionContext
- type Input
- type LogEntry
- type LogRecord
- type Plan
- type Preview
- type Publication
- type Regeneration
- type Report
- type ReviewFinding
- type Run
- type Service
- func (s *Service) AppendLogs(ctx context.Context, credential string, entries []LogEntry) error
- func (s *Service) Baseline(ctx context.Context, session auth.Session, org, repo string) (*Run, error)
- func (s *Service) CISuperset(ctx context.Context, org, task string) (string, error)
- func (s *Service) CheckCompletion(ctx context.Context, tx pgx.Tx, l workflow.Lease, t workflow.Task, ...) error
- func (s *Service) CheckModelTx(ctx context.Context, tx pgx.Tx, t workflow.Task, ...) error
- func (s *Service) CheckPublish(ctx context.Context, tx pgx.Tx, t workflow.Task, p policy.Resolved) error
- func (s *Service) CheckStage(ctx context.Context, tx pgx.Tx, t workflow.Task, p policy.Resolved) error
- func (s *Service) CloseFix(ctx context.Context, session auth.Session, org string, f discovery.Finding, ...) error
- func (s *Service) CloseObsolete(ctx context.Context, session auth.Session, org string) error
- func (s *Service) CloseReplaced(ctx context.Context, session auth.Session, org string) error
- func (s *Service) Context(ctx context.Context, credential string) (ExecutionContext, error)
- func (s *Service) Enqueue(ctx context.Context, session auth.Session, org string, in Input, ...) (Run, error)
- func (s *Service) EnqueueCampaign(ctx context.Context, session auth.Session, org string, in Input, ...) (Run, error)
- func (s *Service) Get(ctx context.Context, session auth.Session, org, id string) (Run, error)
- func (s *Service) JobRun(ctx context.Context, credential string) (Run, error)
- func (s *Service) Logs(ctx context.Context, session auth.Session, org, id string, after int64) ([]LogRecord, error)
- func (s *Service) ObserveChange(ctx context.Context, session auth.Session, org, id string) (forge.Change, error)
- func (s *Service) Preview(ctx context.Context, session auth.Session, org string, in Input) (Preview, error)
- func (s *Service) Publish(ctx context.Context, credential string, in Publication) (Run, error)
- func (s *Service) Recipes() map[string]string
- func (s *Service) Reconcile(ctx context.Context, session auth.Session, org, id string, expected int64, ...) (Run, error)
- func (s *Service) RecordNative(ctx context.Context, credential string, in Publication) (Run, error)
- func (s *Service) RefreshBotChange(ctx context.Context, org, connection string, change forge.Change) error
- func (s *Service) RefreshFix(ctx context.Context, session auth.Session, org, taskID string) (bool, error)
- func (s *Service) SaveCheckpoint(ctx context.Context, credential string, in Checkpoint) error
- func (s *Service) SaveReport(ctx context.Context, credential string, in Report) (Run, error)
- func (s *Service) Snapshot(ctx context.Context, credential, sha string) (sandbox.Snapshot, error)
- func (s *Service) Stage(ctx context.Context, credential string) (Run, error)
Constants ¶
View Source
const MaxFollowUps = 5
Variables ¶
View Source
var ErrBranchConflict = errors.New("repair branch conflicts with current target")
View Source
var ErrDuplicateFix = errors.New("Duplicate of an older open Reforge fix")
View Source
var ErrFollowUpsExhausted = errors.New("Reforge fix still failing CI after 5 follow-ups")
View Source
var ErrHandoff = errors.New("repair requires human review")
View Source
var ErrPatch = errors.New("patch changes protected validation, sensitive paths or exceeds recipe limits")
View Source
var ErrPaused = errors.New("paused until budget or provider limits allow")
View Source
var ErrRunLimit = errors.New("run reached its model turn or time limit")
View Source
var ErrRunNotFound = errors.New("repair context not found for this task")
View Source
var ErrSandbox = errors.New("sandbox could not complete a file operation")
View Source
var ErrSourceMoved = errors.New("native source or target moved; refresh discovery before publication")
View Source
var ErrValidation = errors.New("frozen validation plan or evidence is incomplete")
Functions ¶
func AttemptTimeout ¶
func CheckCIPatch ¶
func CheckOwnerPatch ¶
func CheckPatch ¶
func ConflictFinding ¶
func Instructions ¶ added in v0.2.7
func Reproduced ¶
func Reproduced(results []CheckResult) bool
func Verified ¶
func Verified(p Plan, baseline, candidate []CheckResult) bool
Types ¶
type CheckResult ¶
type CheckResult struct {
CommandID string `json:"command_id"`
ExitCode int `json:"exit_code"`
OutputSHA256 string `json:"output_sha256"`
Complete bool `json:"complete"`
Cases map[string]string `json:"cases"`
Reason string `json:"reason"`
Excerpt string `json:"excerpt,omitempty"`
}
func Interpret ¶
func Interpret(command recipes.Command, result sandbox.CommandResult) CheckResult
type Checkpoint ¶
type Checkpoint struct {
PlanDigest string `json:"plan_digest"`
Patches []sandbox.Patch `json:"patches"`
Dependencies []DependencyUpdate `json:"dependencies"`
Recent string `json:"recent"`
Turns int `json:"turns"`
}
func (Checkpoint) ValidFor ¶
func (c Checkpoint) ValidFor(p Plan) bool
type DependencyUpdate ¶
type DependencyUpdate struct {
Ecosystem string `json:"ecosystem"`
Directory string `json:"directory"`
Package string `json:"package"`
Version string `json:"version"`
Strategy string `json:"strategy,omitempty"`
}
func (DependencyUpdate) Paths ¶
func (u DependencyUpdate) Paths() []string
func (DependencyUpdate) Valid ¶
func (u DependencyUpdate) Valid() bool
type Engine ¶
type Engine struct {
Restore *Checkpoint
SaveCheckpoint func(context.Context, Checkpoint) error
Runtime sandbox.SandboxRuntime
PrepareWorkspace func(context.Context, sandbox.WorkspaceRequest, []sandbox.Patch, sandbox.Command) (sandbox.Workspace, error)
Turn func(context.Context, model.Turn) (model.TurnResult, error)
Artifact func(context.Context, string, []byte) (string, string, error)
Progress func(context.Context, string) error
Log func(context.Context, string, string)
Model string
JobID string
AttemptID string
Trust string
Dependencies string
CILogs []CILog
Goal string
OpenFixes []string
RecentMerges []string
OpenFixFiles []map[string]string
AllowObsolete bool
ReviewFinding bool
UpdateDependency func(context.Context, map[string][]byte, DependencyUpdate) (map[string][]byte, error)
Regenerate func(context.Context, map[string][]byte, Regeneration) (map[string][]byte, error)
MaxOutputTokens int
TurnTimeout time.Duration
// contains filtered or unexported fields
}
func (Engine) ValidateCustom ¶
type ExecutionContext ¶
type ExecutionContext struct {
MaxAttempts int `json:"max_attempts"`
NativeHeadSHA string `json:"native_head_sha,omitempty"`
Request Input `json:"request"`
Plan Plan `json:"plan"`
BaselineRepository forge.RepoRef `json:"baseline_repository"`
Repository forge.RepoRef `json:"repository"`
ConnectionID string `json:"connection_id"`
ConnectionVersion int64 `json:"connection_version"`
Model string `json:"model"`
MaxOutputTokens int `json:"max_output_tokens"`
TurnTimeoutMS int64 `json:"turn_timeout_ms"`
CustomProfile *customcmd.ProfileSpec `json:"custom_profile,omitempty"`
Finding discovery.Finding `json:"finding"`
PolicyHash string `json:"policy_hash"`
CILogs []CILog `json:"ci_logs,omitempty"`
OpenFixes []string `json:"open_fixes,omitempty"`
RecentMerges []string `json:"recent_merges,omitempty"`
FollowUpBranch string `json:"follow_up_branch,omitempty"`
ReplacesBranch string `json:"replaces_branch,omitempty"`
OpenFixFiles []map[string]string `json:"open_fix_files,omitempty"`
}
type Input ¶
type Input struct {
FindingID string `json:"finding_id"`
FindingVersion int64 `json:"finding_version"`
Recipe string `json:"recipe"`
ModelConnectionID string `json:"model_connection_id"`
ModelRoute string `json:"model_route"`
RunnerPoolID string `json:"runner_pool_id"`
CustomProfileID string `json:"custom_profile_id,omitempty"`
CustomProfileVersion int64 `json:"custom_profile_version,omitempty"`
PlanDigest string `json:"plan_digest,omitempty"`
IdempotencyKey string `json:"idempotency_key,omitempty"`
Owner bool `json:"owner,omitempty"`
Instructions string `json:"instructions,omitempty"`
}
type Plan ¶
type Plan struct {
AuthorityHash string `json:"authority_hash,omitempty"`
MaxChangedLines int `json:"max_changed_lines"`
Version int `json:"version"`
BaselineSHA string `json:"baseline_sha"`
TargetSHA string `json:"target_sha"`
Image string `json:"image"`
Recipe recipes.Recipe `json:"recipe"`
ProtectedHashes map[string]string `json:"protected_hashes"`
ForbiddenPaths []string `json:"forbidden_paths"`
Owner bool `json:"owner,omitempty"`
Digest string `json:"digest"`
}
type Preview ¶
type Preview struct {
Context ExecutionContext `json:"context"`
Blockers []string `json:"blockers"`
ExpiresAt time.Time `json:"expires_at"`
}
type Publication ¶
type Publication struct {
HeadSHA string `json:"head_sha"`
PlanDigest string `json:"plan_digest"`
Checks []CheckResult `json:"checks"`
ArtifactIDs []string `json:"artifact_ids"`
}
type Regeneration ¶ added in v0.2.21
type Regeneration struct {
Script string `json:"script"`
Args []string `json:"args,omitempty"`
Outputs []string `json:"outputs"`
}
func (Regeneration) Covers ¶ added in v0.2.21
func (r Regeneration) Covers(name string) bool
func (Regeneration) Valid ¶ added in v0.2.21
func (r Regeneration) Valid() bool
type Report ¶
type Report struct {
Diff string `json:"diff,omitempty"`
PlanDigest string `json:"plan_digest"`
State string `json:"state"`
Reason string `json:"reason"`
Baseline []CheckResult `json:"baseline"`
Candidate []CheckResult `json:"candidate"`
Target []CheckResult `json:"target"`
Patches []sandbox.Patch `json:"patches"`
Artifacts []string `json:"artifacts"`
Turns int `json:"turns"`
Mode string `json:"mode,omitempty"`
ChangedLines int `json:"changed_lines,omitempty"`
Dependencies []DependencyUpdate `json:"dependencies,omitempty"`
Disposition string `json:"disposition,omitempty"`
Findings []ReviewFinding `json:"findings,omitempty"`
}
type ReviewFinding ¶
type ReviewFinding struct {
Category string `json:"category"`
Severity string `json:"severity"`
Title string `json:"title"`
Path string `json:"path,omitempty"`
Line int `json:"line,omitempty"`
Confidence string `json:"confidence"`
Objective string `json:"objective"`
Detail string `json:"detail"`
}
func (ReviewFinding) Valid ¶
func (f ReviewFinding) Valid() bool
type Run ¶
type Run struct {
CandidateArtifacts []string `json:"candidate_artifacts"`
Branch string `json:"branch"`
CandidateSHA string `json:"candidate_sha"`
CandidateChecks []CheckResult `json:"candidate_checks"`
Change *forge.Change `json:"change,omitempty"`
Task workflow.Task `json:"task"`
Context ExecutionContext `json:"context"`
Report *Report `json:"report,omitempty"`
Checkpoint *Checkpoint `json:"checkpoint,omitempty"`
State string `json:"state"`
Version int64 `json:"version"`
UpdatedAt time.Time `json:"updated_at"`
}
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func New ¶
func New(db *store.Store, identity *auth.Service, findings *discovery.Service, jobs *workflow.Service, runners *runner.Service, policies *policy.Service, budgets *budget.Service, connections *connections.Service, profiles *customcmd.Service, reader discovery.Reader, images map[string]string) *Service
func (*Service) AppendLogs ¶
func (*Service) CISuperset ¶
func (*Service) CheckCompletion ¶
func (*Service) CheckModelTx ¶
func (*Service) CheckPublish ¶
func (*Service) CheckStage ¶
func (*Service) CloseObsolete ¶ added in v0.2.15
func (*Service) CloseReplaced ¶
func (*Service) EnqueueCampaign ¶
func (*Service) ObserveChange ¶
func (*Service) RecordNative ¶
func (*Service) RefreshBotChange ¶ added in v0.2.15
func (*Service) RefreshFix ¶
func (*Service) SaveCheckpoint ¶
func (*Service) SaveReport ¶
Click to show internal directories.
Click to hide internal directories.