sourcectrl

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 14, 2026 License: MIT Imports: 13 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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 New

func New(log *slog.Logger, clients Clients, cfg Config, handlers ...source.Handler) *Controller

New builds a Controller over the given source plugins.

func (*Controller) Handle

func (c *Controller) Handle(ctx context.Context, e webhook.Event) error

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL