Documentation
¶
Overview ¶
Package types holds the domain model shared across the review-replay engine.
Index ¶
- type Classification
- type ClassificationSource
- type ClassificationStatus
- type CommentEvidence
- type CommentOrigin
- type Commit
- type ConfidenceLevel
- type IssueComment
- type IssueLevelComment
- type IssueLevelEvidence
- type IssueLevelKind
- type Outcome
- type PrRef
- type PrSnapshot
- type Report
- type ReviewComment
- type ReviewState
- type ReviewSummary
- type ReviewThread
- type UsageTotals
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Classification ¶
type Classification struct {
CommentID int64
Origin CommentOrigin
Status ClassificationStatus
EvidenceCommitSha *string
DraftReply *string
Confidence ConfidenceLevel
Rationale string
}
Classification is the output for a single comment.
type ClassificationSource ¶
type ClassificationSource string
ClassificationSource is the upstream that produced the classification.
const ( SourceRule ClassificationSource = "rule" SourceLLM ClassificationSource = "llm" )
type ClassificationStatus ¶
type ClassificationStatus string
ClassificationStatus is the verdict per comment.
const ( StatusAddressed ClassificationStatus = "addressed" StatusPartial ClassificationStatus = "partial" StatusPending ClassificationStatus = "pending" StatusNeedsDiscussion ClassificationStatus = "needs-discussion" )
type CommentEvidence ¶
type CommentEvidence struct {
Comment ReviewComment
Outdated bool
RegionChanged bool
ChangedInCommits []Commit
ThreadReplies []ReviewComment
CurrentHunk *string
Resolved bool
ResolvedByThreadOpener bool
ResolvedByLogin *string
}
CommentEvidence is the per-inline-comment packet the classifier consumes.
type CommentOrigin ¶
type CommentOrigin string
CommentOrigin distinguishes where a classification came from.
const ( OriginInline CommentOrigin = "inline" OriginReviewSummary CommentOrigin = "review-summary" OriginIssueComment CommentOrigin = "issue-comment" )
type ConfidenceLevel ¶
type ConfidenceLevel string
ConfidenceLevel is a discrete confidence bucket. LLMs cluster their numerical outputs in ~5 values anyway, so we ask them for one of three explicit buckets that map to concrete evidence quality.
const ( ConfidenceHigh ConfidenceLevel = "high" ConfidenceMedium ConfidenceLevel = "medium" ConfidenceLow ConfidenceLevel = "low" )
type IssueComment ¶
IssueComment is a general PR comment (not anchored to code).
type IssueLevelComment ¶
type IssueLevelComment struct {
Kind IssueLevelKind
ID int64
Author string
Body string
CreatedAt string
HTMLURL string
ReviewState *ReviewState
}
IssueLevelComment is a normalised view of a review summary or issue comment.
type IssueLevelEvidence ¶
type IssueLevelEvidence struct {
Comment IssueLevelComment
LaterCommits []Commit
LaterReplies []IssueLevelComment
}
IssueLevelEvidence is the packet for review summaries / issue comments.
type IssueLevelKind ¶
type IssueLevelKind string
IssueLevelKind discriminates between review summaries and issue comments.
const ( KindReviewSummary IssueLevelKind = "review-summary" KindIssueComment IssueLevelKind = "issue-comment" )
type Outcome ¶
type Outcome struct {
Classification Classification
Source ClassificationSource
RuleName string
// Token usage for this outcome. Zero when the outcome came from a rule.
InputTokens int
OutputTokens int
CacheReadTokens int
CacheWriteTokens int
}
Outcome wraps a classification with its provenance.
type PrSnapshot ¶
type PrSnapshot struct {
PR PrRef
PRAuthor string
HeadSHA string
ReviewComments []ReviewComment
ReviewThreads []ReviewThread
ReviewSummaries []ReviewSummary
IssueComments []IssueComment
Commits []Commit
// HistoryRewritten is true when the PR branch has been force-pushed at
// least once. When true, commit SHAs referenced by reviews may no longer
// be reachable from HEAD, so draft replies must not cite them.
HistoryRewritten bool
}
PrSnapshot is the immutable view of a PR at fetch time.
type Report ¶
type Report struct {
PR PrRef
GeneratedAt string
Classifications []Classification
Summary map[ClassificationStatus]int
Usage UsageTotals
}
Report aggregates classifications for a PR.
type ReviewComment ¶
type ReviewComment struct {
ID int64
Author string
Body string
Path string
Line *int
StartLine *int
OriginalCommitSha string
CreatedAt string
DiffHunk string
HTMLURL string
InReplyToID *int64
}
ReviewComment is an inline review comment anchored to a line of code.
type ReviewState ¶
type ReviewState string
ReviewState enumerates the GitHub PR review states we care about.
const ( ReviewApproved ReviewState = "APPROVED" ReviewChangesRequested ReviewState = "CHANGES_REQUESTED" ReviewCommented ReviewState = "COMMENTED" ReviewDismissed ReviewState = "DISMISSED" ReviewPending ReviewState = "PENDING" )
type ReviewSummary ¶
type ReviewSummary struct {
ID int64
Author string
Body string
State ReviewState
SubmittedAt string
HTMLURL string
}
ReviewSummary is the body of an Approve / Request changes review.
type ReviewThread ¶
type ReviewThread struct {
RootCommentID int64
IsResolved bool
ResolvedByLogin *string
OpenerLogin string
CommentIDs []int64
}
ReviewThread is a group of inline comments on the same code location.
type UsageTotals ¶
type UsageTotals struct {
InputTokens int
OutputTokens int
CacheReadTokens int
CacheWriteTokens int
LLMCalls int
RuleCalls int
EstimatedUSD float64 // 0 if no price known for the model
PriceModel string // model id used to compute EstimatedUSD; "" if unknown
}
UsageTotals aggregates token counts across outcomes.