Documentation
¶
Overview ¶
Package kernel holds the shared domain value objects — PR, Message, Event, Sender, ReviewState — and the cross-domain enums used by the notification, review, and routing domains.
It is the pure center of the hexagon: it imports nothing from other internal/... packages (a depguard rule enforces this) and carries no persistence, transport, or SDK concerns. Types arrive here as their owning domains migrate onto the DDD/fx architecture; notification (Phase 5) is the first to populate it.
Index ¶
Constants ¶
const ( SenderTypeUser = "User" SenderTypeBot = "Bot" )
Sender type values. Kept as plain string constants because the AI-suppression policy compares the raw sender type string.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Action ¶
type Action string
Action is the webhook payload's action field.
const ( ActionOpened Action = "opened" ActionClosed Action = "closed" ActionReadyForReview Action = "ready_for_review" ActionConvertedToDraft Action = "converted_to_draft" ActionSubmitted Action = "submitted" ActionCreated Action = "created" ActionEdited Action = "edited" )
Recognised webhook action values.
type Event ¶
type Event struct {
GitHubEvent GitHubEventType
Action Action
Repository string
PR PR
// Review is non-nil only for pull_request_review events.
Review *Review
// PRComment is true for issue_comment events fired on a pull request (the
// payload carried an issue.pull_request reference). False for comments on
// plain issues.
PRComment bool
Sender Sender
}
Event is the immutable record of an incoming pull-request-related webhook, detached from any HTTP payload type. Handlers inspect it to decide whether to run.
type GitHubEventType ¶
type GitHubEventType string
GitHubEventType is the value of the X-GitHub-Event header, naming the webhook event family.
const ( EventPullRequest GitHubEventType = "pull_request" EventPullRequestReview GitHubEventType = "pull_request_review" EventPullRequestReviewComment GitHubEventType = "pull_request_review_comment" EventIssueComment GitHubEventType = "issue_comment" )
Recognised X-GitHub-Event header values.
type PR ¶
type PR struct {
Number int
Title string
URL string
Author string
Merged bool
Draft bool
// Body is the PR description, consulted to tell a Dependabot/Renovate
// security advisory from a routine bump.
Body string
// CreatedAt is the PR's open time, rendered as a localized date token in the
// Slack context line. Zero when the payload omits it.
CreatedAt time.Time
}
PR holds the pull-request fields the notification handlers and message composer read. It is detached from any webhook payload or persistence type.
type Review ¶
type Review struct {
State ReviewState
}
Review carries the review state of a pull_request_review event.
type ReviewState ¶
type ReviewState string
ReviewState is the state of a submitted review.
const ( ReviewApproved ReviewState = "approved" ReviewCommented ReviewState = "commented" ReviewChangesRequested ReviewState = "changes_requested" )
Recognised review state values.