Documentation
¶
Overview ¶
Package application holds the notification use cases — the PR-lifecycle handlers (open/close/draft and the review-reaction handlers) and the event dispatcher — behind the domain's Handler and use-case interfaces.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DetectBot ¶
DetectBot matches login against the two known dependency-bot logins, case-insensitively. The surface is exactly two values, so the match is exact — prefix matching ("dependabot") is intentionally not a hit. Callers pass the PR author so the classification follows who opened the PR, not who fired the webhook.
func IsSecurityAdvisory ¶
IsSecurityAdvisory reports whether prBody carries the advisory section that marks a security update. A miss returns false (routine) — the safe default.
Types ¶
type ApproveHandler ¶
type ApproveHandler struct {
// contains filtered or unexported fields
}
ApproveHandler adds a reaction when a review is submitted with state "approved".
func NewApproveHandler ¶
func NewApproveHandler(store domain.MessageStore, behavior domain.RepoBehavior, messenger domain.Messenger, logger *slog.Logger, reviews domain.ReviewSessions) *ApproveHandler
NewApproveHandler builds an ApproveHandler.
func (*ApproveHandler) Applicable ¶
type CloseHandler ¶
type CloseHandler struct {
// contains filtered or unexported fields
}
CloseHandler reacts to a PR being closed (merged or not). It updates every stored message with a [Merged]/[Closed] decoration and, if enabled, adds the corresponding reaction to each.
func NewCloseHandler ¶
func NewCloseHandler(store domain.MessageStore, behavior domain.RepoBehavior, messenger domain.Messenger, logger *slog.Logger, reviews domain.ReviewSessions) *CloseHandler
NewCloseHandler builds a CloseHandler.
func (*CloseHandler) Applicable ¶
func (h *CloseHandler) Applicable(event kernel.Event) bool
Applicable returns true when the action is "closed".
type CommentedHandler ¶
type CommentedHandler struct {
// contains filtered or unexported fields
}
CommentedHandler adds a reaction when a review is submitted or edited with state "commented".
func NewCommentedHandler ¶
func NewCommentedHandler(store domain.MessageStore, behavior domain.RepoBehavior, messenger domain.Messenger, logger *slog.Logger, reviews domain.ReviewSessions) *CommentedHandler
NewCommentedHandler builds a CommentedHandler.
func (*CommentedHandler) Applicable ¶
type Dispatcher ¶
type Dispatcher struct {
// contains filtered or unexported fields
}
Dispatcher routes an event to the first registered handler whose Applicable returns true. Handlers are checked in registration order. If none matches, Dispatch logs a Debug line and returns nil (no error) so the HTTP layer still responds 200 OK.
func NewDispatcher ¶
func NewDispatcher(logger *slog.Logger, handlers []domain.Handler) *Dispatcher
NewDispatcher builds a Dispatcher with the given handlers. Registration order is preserved. The logger receives one Debug record per event with no applicable handler.
type DraftHandler ¶
type DraftHandler struct {
// contains filtered or unexported fields
}
DraftHandler reacts to a PR being converted back to draft. It removes every stored message and deletes the PR row — the PR will be re-announced when it is marked ready_for_review again.
func NewDraftHandler ¶
func NewDraftHandler(store domain.MessageStore, messenger domain.Messenger, logger *slog.Logger) *DraftHandler
NewDraftHandler builds a DraftHandler.
func (*DraftHandler) Applicable ¶
func (h *DraftHandler) Applicable(event kernel.Event) bool
Applicable returns true when the action is "converted_to_draft".
type OpenHandler ¶
type OpenHandler struct {
// contains filtered or unexported fields
}
OpenHandler reacts to a PR being opened (non-draft) or marked ready_for_review. It fans out one notification per resolved target channel and records each for later updates.
func NewOpenHandler ¶
func NewOpenHandler(store domain.MessageStore, resolver domain.TargetResolver, messenger domain.Messenger, logger *slog.Logger) *OpenHandler
NewOpenHandler builds an OpenHandler.
func (*OpenHandler) Applicable ¶
func (h *OpenHandler) Applicable(event kernel.Event) bool
Applicable returns true for "ready_for_review", or "opened" on a non-draft PR.
type RequestChangeHandler ¶
type RequestChangeHandler struct {
// contains filtered or unexported fields
}
RequestChangeHandler adds a reaction when a review is submitted with state "changes_requested".
func NewRequestChangeHandler ¶
func NewRequestChangeHandler(store domain.MessageStore, behavior domain.RepoBehavior, messenger domain.Messenger, logger *slog.Logger, reviews domain.ReviewSessions) *RequestChangeHandler
NewRequestChangeHandler builds a RequestChangeHandler.