contextctrl

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2026 License: MIT Imports: 12 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 contextctrl is the context-controller's engine: it reacts to newly opened security-finding issues, runs the enhancer chain (CMDB ownership, infrastructure context — pkg/enhance plugins), posts each contribution as an attributed comment carrying a machine-readable enrichment block, and advances the issue to context-enhanced.

Enhancement is best-effort by design: a failing enhancer is logged and skipped, and the transition happens regardless — enrichment must never block the pipeline.

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 and across installations.

type Config

type Config struct {
	// Grace is how old an opened issue must be before the reconcile pass
	// enhances it — breathing room for the webhook fast path so the two
	// don't race on fresh issues. Default two minutes.
	Grace time.Duration
}

Config tunes the controller.

type Controller

type Controller struct {
	// contains filtered or unexported fields
}

Controller is the context-controller engine; it implements webhook.Handler.

func New

func New(log *slog.Logger, clients Clients, cfg Config, chain ...enhance.Enhancer) *Controller

New builds a Controller running the given enhancer chain, in order.

func (*Controller) Handle

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

Handle implements webhook.Handler for issues events.

func (*Controller) Reconcile

func (c *Controller) Reconcile(ctx context.Context) error

Reconcile sweeps for opened issues the webhook path missed, enhancing any older than the grace period.

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