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 ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Event ¶
Event is the immutable, provider-neutral record of an incoming pull-request-related webhook, detached from any HTTP payload type. The inbound adapter builds it — mapping provider vocabulary to a Kind and resolving Sender.IsBot — and handlers inspect only the neutral fields to decide whether to run.
type EventKind ¶ added in v0.22.0
type EventKind int
EventKind is the provider-neutral classification of an inbound pull-request webhook. Each inbound adapter maps its provider's own vocabulary (event names, action strings, review states, draft gating) onto one of these kinds; handlers match on the kind alone and never see provider verbs.
The zero value KindUnknown marks a payload no handler acts on — the adapter returns it for draft opens, synchronize/label churn, plain-issue comments, and anything unmapped, so the dispatcher debug-logs no_handler exactly as before.
const ( KindUnknown EventKind = iota KindOpened KindReadyForReview KindClosed KindMerged KindConvertedToDraft KindApproved KindChangesRequested KindCommented KindReviewCommented )
Recognised event kinds. KindReviewCommented is distinct from KindCommented: a submitted review carrying only comments finishes the PR's review session, whereas a line/conversation comment (or an edited review) does not.
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 Provider ¶ added in v0.22.0
type Provider string
Provider is the git host a deployment serves and an event originates from. It is a named type rather than a bare string so a provider value can never be crossed with an arbitrary string: every call site names one of the constants below, and config, routing, and the inbound adapter share this one enum. The inbound adapter stamps it on every event so handlers, the store, and logs stay provider-agnostic.
Recognised git providers. A deployment serves exactly one, selected by the required git_provider config key.
type Sender ¶
Sender identifies the actor that fired a webhook — the reviewer for review events, the PR author for opened events, etc. IsBot is resolved by the inbound adapter from the provider's own signal (GitHub's sender.type == "Bot"); the per-repo ignore-AI-reviews policy consults it without knowing any provider vocabulary.