Documentation
¶
Overview ¶
Package bellows monitors open PRs for status changes, CI results, and reviews.
Bellows periodically polls all open PRs in the state DB and updates their status. It triggers downstream actions: CI fix workers, review comment forwarding, and PR lifecycle state tracking.
Index ¶
- Constants
- type Handler
- type Monitor
- func (m *Monitor) OnEvent(h Handler)
- func (m *Monitor) Refresh()
- func (m *Monitor) ResetPRState(anvil string, prNumber int)
- func (m *Monitor) Run(ctx context.Context) error
- func (m *Monitor) SetAutoMergeHandler(h func(ctx context.Context, anvil string, pr state.PR))
- func (m *Monitor) UpdateAnvilPaths(paths map[string]string)
- type PREvent
Constants ¶
const ( EventCIPassed = "ci_passed" EventCIFailed = "ci_failed" EventReviewApproved = "review_approved" EventReviewChanges = "review_changes_requested" EventPRMerged = "pr_merged" EventPRClosed = "pr_closed" EventPRConflicting = "pr_conflicting" EventPRReadyToMerge = "pr_ready_to_merge" )
Event types emitted by the Bellows monitor.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Monitor ¶
type Monitor struct {
// contains filtered or unexported fields
}
Monitor watches open PRs and dispatches events on status changes.
func New ¶
func New(db *state.DB, vcsProvider vcs.Provider, interval time.Duration, anvilPaths map[string]string, autoLearnRules func() bool, maxCIFixAttempts func() int) *Monitor
New creates a Bellows monitor. The autoLearnRules function is called on each PR merge to check whether warden rule learning is enabled, so hot-reloaded config changes take effect without restarting the daemon. The maxCIFixAttempts function returns the current max CI fix attempts from config (may be nil, in which case the state.DefaultMaxCIFixAttempts is used).
func (*Monitor) ResetPRState ¶
ResetPRState clears the internal status cache for a PR. This should be called when a PR is manually reset so that status changes (e.g. from failing back to passing) are re-detected on the next poll cycle even if the state is the same as it was before the reset.
func (*Monitor) SetAutoMergeHandler ¶ added in v0.8.0
SetAutoMergeHandler registers a callback invoked when a PR transitions to the ready-to-merge state. The daemon uses this to trigger automatic merging for anvils that have auto_merge enabled.
func (*Monitor) UpdateAnvilPaths ¶
UpdateAnvilPaths replaces the set of monitored anvil paths. This is safe to call while Run is active and takes effect on the next poll cycle.
type PREvent ¶
type PREvent struct {
PRNumber int
BeadID string
Anvil string
Branch string
EventType string
Details string
Timestamp time.Time
// PRURL is the GitHub URL of the PR, populated for events that need it
// (e.g. pr_ready_to_merge).
PRURL string
}
PREvent is emitted when a PR status changes.