Documentation
¶
Overview ¶
Package sourcectrl is the source-controller's engine: it turns normalized findings from source plugins into GitHub issues, accumulating alerts of the same finding type (repository + source + primary advisory) into one issue for the accumulation window, and flipping aged issues to accumulation-complete so the remediation pipeline may pick them up.
The webhook path is the fast lane; the reconcile pass re-derives everything from GitHub (issue labels and created_at timestamps), so missed deliveries, restarts, and races converge. No state lives outside GitHub.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Clients ¶
type Clients interface {
For(ctx context.Context, repo ghclient.Repo) (Stores, error)
All(ctx context.Context) ([]Searcher, error)
}
Clients resolves GitHub access: per-repository stores for the webhook path, and one searcher per installation for the reconcile sweep.
type Config ¶
type Config struct {
// Window is the accumulation window; issues older than this stop
// accumulating and are released downstream. Default one hour.
Window time.Duration
}
Config tunes the controller.
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
Controller is the source-controller engine. It implements webhook.Handler.
func (*Controller) Handle ¶
Handle implements webhook.Handler: it routes the delivery to every source plugin registered for the event type and processes the findings.
func (*Controller) Reconcile ¶
func (c *Controller) Reconcile(ctx context.Context) error
Reconcile is the periodic pass: it sweeps every installation for open accumulating issues, flips the aged ones, and merges duplicates (two open accumulating issues for one key — possible only through races or manual label edits) into the oldest. Best-effort: failures are joined, never short-circuit the sweep.
type Searcher ¶
type Searcher interface {
SearchIssues(ctx context.Context, query string) ([]*ghclient.Issue, error)
}
Searcher runs cross-repository issue searches within one installation.
type Stores ¶
type Stores interface {
ghclient.IssueStore
}
Stores is the per-repository GitHub surface the controller mutates.