types

package
v1.55.0 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ActionNoOp    = "no-op"
	ActionAutoFix = "auto-fix"
	ActionAskUser = "ask-user"
)

Finding action constants.

View Source
const (
	FindingSourceAgent = "agent"
	FindingSourceUser  = "user"
)

Finding source constants. An empty Source is treated as agent-produced.

View Source
const (
	FindingReviewScopeSource                = "source"
	FindingReviewScopePipelineOwnedDelivery = "pipeline-owned-delivery"
	FindingReviewScopeExternalDelivery      = "external-delivery"
)
View Source
const (
	FindingsRiskScopeSourceOrExternal      = "source-or-external"
	FindingsRiskScopePipelineOwnedDelivery = "pipeline-owned-delivery"
)
View Source
const (
	FindingCategoryDocumentation = "documentation"
	FindingCategoryLint          = "lint"
)

Finding category constants for the combined document+lint housekeeping pass. An empty Category on a housekeeping finding is treated as documentation (the stricter gate).

View Source
const (
	RunCancelReasonAbortedByUser = "cancelled: aborted by user"
	RunCancelReasonSuperseded    = "cancelled: superseded by new push"
)

Variables

This section is empty.

Functions

func ACPRawCommand

func ACPRawCommand(target string, overrides map[string]string) string

ACPRawCommand resolves the raw command acpx runs for an ACP target: a registry override is trimmed and wins when non-blank, otherwise the alias default command is used. Empty means acpx dispatches the target through its own registry.

func ACPTargetFor

func ACPTargetFor(name AgentName) (string, bool)

ACPTargetFor resolves the ACP target an agent name drives: the alias target for a first-class alias, or the parsed target of an explicit acp:<target> name. Returns false for non-ACP agent names.

func CountActionableFindings

func CountActionableFindings(findings Findings) int

CountActionableFindings returns how many findings warrant a fix or an explicit adjudication - every finding whose effective action is not "no-op".

func CountFindingFingerprints

func CountFindingFingerprints(items []Finding) map[FindingIdentity]int

func CountFindingOccurrences

func CountFindingOccurrences(items []Finding) map[string]int

func FindingIDCorroborates

func FindingIDCorroborates(item, candidate Finding) bool

func FindingMatches

func FindingMatches(item Finding, stableIDs map[string][]Finding, itemOccurrenceCounts, candidateOccurrenceCounts map[string]int, itemIdentityCounts, candidateIdentityCounts, itemFingerprintCounts, candidateFingerprintCounts map[FindingIdentity]int) bool

func FindingOccurrenceCorroborates

func FindingOccurrenceCorroborates(item, candidate Finding) bool

func HasActionableFindings

func HasActionableFindings(findings Findings) bool

HasActionableFindings reports whether any finding warrants a fix - that is, any finding whose effective action is not "no-op". Findings that are purely informational ("no-op") are not actionable and need no fix, so a step whose findings are all no-op (or that has no findings) returns false. This is what yolo / auto-resolve uses to decide whether to fix a gate's findings or just accept the step as-is.

func HasAskUserFindings

func HasAskUserFindings(findings Findings) bool

HasAskUserFindings returns true if any finding has an effective action of "ask-user". It uses ActionOrDefault so an empty/missing action (which now defaults to ask-user) parks for a human, keeping this in agreement with AutoFixableFindings: an unclassified finding is never auto-fixed and is always caught here as ask-user.

func MarshalFindingsJSON

func MarshalFindingsJSON(findings Findings) (string, error)

MarshalFindingsJSON encodes findings using the current wire shape.

func StableFindingIDs

func StableFindingIDs(items []Finding) map[string][]Finding

Types

type ACPAlias

type ACPAlias struct {
	Name           AgentName
	Target         string
	DefaultCommand string
}

ACPAlias describes a first-class agent name that resolves to an ACP target.

func ACPAliasFor

func ACPAliasFor(name AgentName) (ACPAlias, bool)

ACPAliasFor returns the ACP alias metadata for a first-class agent name.

func ACPAliasForTarget

func ACPAliasForTarget(target string) (ACPAlias, bool)

ACPAliasForTarget returns the ACP alias metadata for a raw ACP target.

func ACPAliases

func ACPAliases() []ACPAlias

ACPAliases returns all first-class ACP aliases.

func (ACPAlias) DefaultCommandBinary

func (a ACPAlias) DefaultCommandBinary() string

DefaultCommandBinary returns the executable named by the alias default command.

type AgentName

type AgentName string

AgentName identifies a supported agent backend. Explicit ACP targets use dynamic acp:<target> values; first-class ACP aliases have constants below.

const (
	AgentAuto     AgentName = "auto"
	AgentClaude   AgentName = "claude"
	AgentCodex    AgentName = "codex"
	AgentRovoDev  AgentName = "rovodev"
	AgentOpenCode AgentName = "opencode"
	AgentPi       AgentName = "pi"
	AgentCopilot  AgentName = "copilot"
	AgentCursor   AgentName = "cursor"
)

type ApprovalAction

type ApprovalAction string

ApprovalAction represents user responses at approval points.

const (
	ActionApprove ApprovalAction = "approve"
	ActionFix     ApprovalAction = "fix"
	ActionSkip    ApprovalAction = "skip"
	ActionAbort   ApprovalAction = "abort"
)

type Finding

type Finding struct {
	ID                   string           `json:"id,omitempty"`
	IDGenerated          bool             `json:"id_generated,omitempty"`
	ContinuityToken      string           `json:"continuity_token,omitempty"`
	OccurrenceToken      string           `json:"occurrence_token,omitempty"`
	PriorID              string           `json:"prior_id,omitempty"`
	PriorContinuityToken string           `json:"prior_continuity_token,omitempty"`
	Severity             string           `json:"severity"`
	File                 string           `json:"file,omitempty"`
	Line                 int              `json:"line,omitempty"`
	Description          string           `json:"description"`
	Action               string           `json:"action"`
	Source               string           `json:"source,omitempty"`
	UserInstructions     string           `json:"user_instructions,omitempty"`
	ReviewScope          string           `json:"review_scope,omitempty"`
	Evidence             *FindingEvidence `json:"evidence,omitempty"`
	// Category separates the combined document+lint housekeeping pass's
	// findings into their owning gates. Empty everywhere else.
	Category string `json:"category,omitempty"`
}

Finding represents a single review, test, lint, or PR comment finding.

func (Finding) ActionOrDefault

func (f Finding) ActionOrDefault() string

ActionOrDefault resolves a finding's effective action, defaulting an empty/missing action to ask-user (park), not auto-fix. This closes a fail-open hole: an unclassified finding on a non-schema path (a legacy requires_human_review omission, an IPC- or user-supplied finding) must route to a human rather than be silently auto-applied. It also matches the review prompt's own "When in doubt, default to ask-user" instruction. (MergeUserOverrides still stamps user-*added* findings auto-fix explicitly - a user who hand-adds a finding is asking for a fix.)

func (Finding) Fingerprint

func (f Finding) Fingerprint() FindingIdentity

func (Finding) HasLineage

func (f Finding) HasLineage() bool

func (Finding) HasOccurrence

func (f Finding) HasOccurrence() bool

func (Finding) Identity

func (f Finding) Identity() FindingIdentity

func (*Finding) UnmarshalJSON

func (f *Finding) UnmarshalJSON(data []byte) error

type FindingEvidence

type FindingEvidence struct {
	Tested         []string       `json:"tested,omitempty"`
	TestingSummary string         `json:"testing_summary,omitempty"`
	Artifacts      []TestArtifact `json:"artifacts,omitempty"`
}

type FindingIdentity

type FindingIdentity struct {
	File        string
	Line        int
	Description string
}

type Findings

type Findings struct {
	Items          []Finding        `json:"findings"`
	Summary        string           `json:"summary"`
	Tested         []string         `json:"tested,omitempty"`
	TestingSummary string           `json:"testing_summary,omitempty"`
	Artifacts      []TestArtifact   `json:"artifacts,omitempty"`
	SharedEvidence *FindingEvidence `json:"shared_evidence,omitempty"`
	RiskLevel      string           `json:"risk_level"`
	RiskRationale  string           `json:"risk_rationale"`
	RiskScope      string           `json:"risk_scope,omitempty"`
}

Findings is the structured findings payload exchanged across pipeline, IPC, and TUI.

func AutoFixableFindings

func AutoFixableFindings(findings Findings) Findings

AutoFixableFindings returns a new Findings containing only items where Action is "auto-fix". These are safe for automatic fixing without user involvement.

func EnsureFindingOccurrenceTokens

func EnsureFindingOccurrenceTokens(findings Findings) (Findings, error)

func ExcludeFindings

func ExcludeFindings(findings Findings, ids []string) Findings

ExcludeFindings keeps only findings whose IDs are NOT in the excluded set.

func FilterFindings

func FilterFindings(findings Findings, ids []string) Findings

FilterFindings keeps only findings whose IDs are included in ids.

func MergeUserOverrides

func MergeUserOverrides(findings Findings, instructions map[string]string, added []Finding) Findings

MergeUserOverrides applies per-finding user instructions to existing agent findings and appends user-added findings at the end. Added findings have Source stamped to FindingSourceUser and receive deterministic "user-N" IDs if they do not carry an ID. The original Findings is not mutated.

func NormalizeFindings

func NormalizeFindings(findings Findings, prefix string, existing []Finding) (Findings, error)

NormalizeFindings replaces reviewer-local IDs with pipeline-owned lineage IDs.

func NormalizeUserFindings

func NormalizeUserFindings(findings Findings, existing []Finding) (Findings, error)

func ParseFindingsJSON

func ParseFindingsJSON(raw string) (Findings, error)

ParseFindingsJSON decodes findings JSON, accepting current and legacy item keys plus legacy requires_human_review fields.

type RunStatus

type RunStatus string

RunStatus represents the lifecycle state of a pipeline run.

const (
	RunPending   RunStatus = "pending"
	RunRunning   RunStatus = "running"
	RunCompleted RunStatus = "completed"
	RunFailed    RunStatus = "failed"
	RunCancelled RunStatus = "cancelled"
)

type StepName

type StepName string

StepName identifies a pipeline step.

const (
	StepIntent   StepName = "intent"
	StepRebase   StepName = "rebase"
	StepReview   StepName = "review"
	StepTest     StepName = "test"
	StepDocument StepName = "document"
	StepLint     StepName = "lint"
	StepPush     StepName = "push"
	StepPR       StepName = "pr"
	StepCI       StepName = "ci"
)

func AllSteps

func AllSteps() []StepName

AllSteps returns all pipeline steps in execution order.

func (StepName) Order

func (s StepName) Order() int

StepOrder returns the fixed execution order for a step (1-indexed).

func (*StepName) Scan

func (s *StepName) Scan(src any) error

func (*StepName) UnmarshalJSON

func (s *StepName) UnmarshalJSON(data []byte) error

func (StepName) Value

func (s StepName) Value() (driver.Value, error)

type StepStatus

type StepStatus string

StepStatus represents the lifecycle state of a pipeline step.

const (
	StepStatusPending          StepStatus = "pending"
	StepStatusRunning          StepStatus = "running"
	StepStatusAwaitingApproval StepStatus = "awaiting_approval"
	StepStatusFixing           StepStatus = "fixing"
	StepStatusFixReview        StepStatus = "fix_review"
	StepStatusCompleted        StepStatus = "completed"
	StepStatusSkipped          StepStatus = "skipped"
	StepStatusFailed           StepStatus = "failed"
)

type TestArtifact

type TestArtifact struct {
	Kind    string `json:"kind,omitempty"`
	Label   string `json:"label"`
	Path    string `json:"path,omitempty"`
	URL     string `json:"url,omitempty"`
	Content string `json:"content,omitempty"`
}

TestArtifact describes evidence produced by the test step for human review.

Jump to

Keyboard shortcuts

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