Help us shape the future of Go! Take the 2026 Go Developer Survey

filter

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2026 License: BSD-2-Clause Imports: 3 Imported by: 0

Documentation

Overview

Package filter implements the scope filter chain — the mandatory defense-in-depth predicate that refuses to act on any repo outside the configured REPO_ALLOWLIST, even if the upstream GitHub search returns more.

This watcher's keep/skip decision for whether a PR carries an approved-not-completed dark-factory spec is NOT a pure filter — it needs network reads and lives in the pkg/darkfactory package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseRepoAllowlist

func ParseRepoAllowlist(_ context.Context, raw string) ([]string, error)

ParseRepoAllowlist parses a comma-separated allowlist string into a slice of host-qualified repo keys. Whitespace is trimmed; empty entries are skipped. Returns (nil, nil) for empty input (allow-all). Entry well-formedness is NOT validated here — repoallowlist.IsAllowed handles malformed entries gracefully at match time (logs and skips).

Types

type PR

type PR struct {
	// RepoKey is the host-qualified repo key, e.g. "github.com/bborbe/maintainer".
	RepoKey string
}

PR is the filter-evaluation input derived from a GitHub pull request. Only the RepoKey is needed for the scope decision.

type TaskCreationFilter

type TaskCreationFilter interface {
	// Skip returns true if the PR should be excluded from task creation.
	Skip(pr PR) bool
}

TaskCreationFilter decides whether a single PR should be skipped (no vault task created). Implementations return true to skip.

func NewRepoAllowlistFilter

func NewRepoAllowlistFilter(allowlist []string) TaskCreationFilter

NewRepoAllowlistFilter returns a TaskCreationFilter that skips PRs whose RepoKey is not in the allowlist. An empty allowlist never skips (allow-all).

type TaskCreationFilterFunc

type TaskCreationFilterFunc func(pr PR) bool

TaskCreationFilterFunc adapts a function to the TaskCreationFilter interface (function-as-implementation, useful for inline filters).

func (TaskCreationFilterFunc) Skip

func (f TaskCreationFilterFunc) Skip(pr PR) bool

Skip implements TaskCreationFilter for the function adapter.

type TaskCreationFilters

type TaskCreationFilters []TaskCreationFilter

TaskCreationFilters is a slice composite: skip if ANY member votes skip. An empty slice never skips (no filters configured = process every PR).

func (TaskCreationFilters) Skip

func (fs TaskCreationFilters) Skip(pr PR) bool

Skip returns true if any contained filter votes skip. Iteration is short-circuit on first hit.

Jump to

Keyboard shortcuts

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