Documentation
¶
Overview ¶
Package reviewplan builds the pure PR review action plan.
Index ¶
- func ReviewEventForFindings(findings []review.Finding, opts EventOptions) review.ReviewEvent
- type Action
- type ActionIDGenerator
- type ActionKind
- type ActionStatus
- type AnchoredFinding
- type Diff
- type DiffFile
- type DiffHunk
- type EventOptions
- type InlineCommentPayload
- type MarkerPlacement
- type Outcome
- type Plan
- type PostMode
- type ProviderCaps
- type Request
- type ResolveThreadPayload
- type RollupCommentPayload
- type SubmitReviewPayload
- type ThreadReplyPayload
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ReviewEventForFindings ¶
func ReviewEventForFindings(findings []review.Finding, opts EventOptions) review.ReviewEvent
ReviewEventForFindings implements the default event mapping from severity.
Types ¶
type Action ¶
type Action struct {
ActionID string
Kind ActionKind
FindingID review.FindingID
ThreadID string
PlannedAt time.Time
Status ActionStatus
Required bool
Marker MarkerPlacement
InlineComment *InlineCommentPayload
ThreadReply *ThreadReplyPayload
ResolveThread *ResolveThreadPayload
RollupComment *RollupCommentPayload
SubmitReview *SubmitReviewPayload
}
Action is one planner-local planned action.
func SortActions ¶
SortActions returns actions in durable outbox order.
type ActionIDGenerator ¶
type ActionIDGenerator func(ActionKind) (string, error)
ActionIDGenerator allocates a deterministic action id for an action kind.
type ActionKind ¶
type ActionKind string
ActionKind is the planner-local outbox action kind.
const ( ActionKindInlineComment ActionKind = "inline_comment" ActionKindThreadReply ActionKind = "thread_reply" ActionKindResolveThread ActionKind = "resolve_thread" ActionKindRollupComment ActionKind = "rollup_comment" ActionKindSubmitReview ActionKind = "submit_review" )
Action kind values.
type ActionStatus ¶
type ActionStatus string
ActionStatus is the planner-local planned action status.
const ( ActionStatusPending ActionStatus = "pending" ActionStatusPlannedOnly ActionStatus = "planned_only" )
Action status values.
type AnchoredFinding ¶
type AnchoredFinding struct {
FindingID review.FindingID
Severity review.Severity
FilePath string
Anchoring review.Anchoring
Side *review.DiffSide
Line *int
DiffPosition *int
Body string
}
AnchoredFinding records durable finding anchoring after normalization.
type Diff ¶
type Diff struct {
Files []DiffFile
}
Diff is the planner-owned diff metadata needed for anchoring.
type DiffHunk ¶
type DiffHunk struct {
OldStart int
OldEnd int
NewStart int
NewEnd int
FallbackSide review.DiffSide
FallbackLine int
DiffPosition int
}
DiffHunk describes line ranges and fallback target metadata for one hunk.
type EventOptions ¶
type EventOptions struct {
MajorEventRequestsChanges bool
PostingIdentityIsPRAuthor bool
AllowSelfApprove bool
}
EventOptions controls default review-event mapping.
type InlineCommentPayload ¶
type InlineCommentPayload struct {
Body string
Path string
Side review.DiffSide
Line int
SubjectType review.AnchorKind
DiffPosition int
}
InlineCommentPayload mirrors the provider-neutral inline comment payload.
type MarkerPlacement ¶
type MarkerPlacement struct {
BodyBearing bool
Skip bool
ThreadSummary bool
ActionKind ActionKind
Outcome Outcome
}
MarkerPlacement records where the post phase should place markers.
type Outcome ¶
type Outcome string
Outcome is the planner-local review outcome.
const ( OutcomeApproved Outcome = "approved" OutcomeComment Outcome = "comment" OutcomeRequestChanges Outcome = "request_changes" OutcomeNothingToReview Outcome = "nothing_to_review" )
Outcome values.
func OutcomeFromReviewEvent ¶
func OutcomeFromReviewEvent(event review.ReviewEvent) (Outcome, error)
OutcomeFromReviewEvent maps a review-domain event into a planner outcome.
type Plan ¶
type Plan struct {
Outcome Outcome
RollupMarkdown string
Actions []Action
AnchoredFindings []AnchoredFinding
}
Plan is the complete pure action plan.
type PostMode ¶
type PostMode string
PostMode controls whether planned actions are postable or inspect-only.
type ProviderCaps ¶
ProviderCaps contains host capabilities that affect planning choices.
type Request ¶
type Request struct {
PostMode PostMode
ProviderCaps ProviderCaps
Diff Diff
Findings []review.Finding
Rollup review.Rollup
ThreadActions []review.ThreadAction
EventOptions EventOptions
NoDiff bool
Profile string
PostingIdentity string
HeadSHA string
AgentDefinitionsChanged bool
IncludeNits bool
MaxInlineComments int
Now func() time.Time
NewActionID ActionIDGenerator
}
Request is the pure input to Build.
type ResolveThreadPayload ¶
type ResolveThreadPayload struct{}
ResolveThreadPayload mirrors the resolve-thread payload.
type RollupCommentPayload ¶
type RollupCommentPayload struct {
Body string
}
RollupCommentPayload mirrors the rollup comment payload.
type SubmitReviewPayload ¶
type SubmitReviewPayload struct {
Body string
Event review.ReviewEvent
}
SubmitReviewPayload mirrors the submit-review payload.
type ThreadReplyPayload ¶
ThreadReplyPayload mirrors the thread reply payload.