testselection

package
v0.42.0 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2026 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Overview

Package testselection owns the conservative affected-Go-package selection policy used by the separate local feedback command.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Package

type Package struct {
	Path          string   `json:"path"`
	Reasons       []string `json:"reasons"`
	RequiredTests []string `json:"required_tests,omitempty"`
}

Package is one selected Go package and its stable, accumulated reasons.

type Policy

type Policy struct {
	Version             int           `json:"version"`
	MetaSuites          []SuitePolicy `json:"meta_suites"`
	SharedPathPatterns  []string      `json:"shared_path_patterns"`
	GeneratedGoPatterns []string      `json:"generated_go_patterns"`
}

Policy is the versioned repository selection policy.

func Load

func Load(path string) (Policy, error)

Load reads and validates a versioned selection policy.

type Result

type Result struct {
	Version  int       `json:"version"`
	Outcome  string    `json:"outcome"`
	Packages []Package `json:"packages"`
	Suites   []Suite   `json:"suites"`
	Reasons  []string  `json:"reasons,omitempty"`
}

Result is machine-consumable selection evidence. Outcome is selected, empty, widened, or refused; refused is returned alongside an error to retain the diagnostic when package discovery is unavailable.

func Select

func Select(ctx context.Context, root string, policy Policy, changedPaths []string) (Result, error)

Select discovers repository packages then selects changed package ownership, their reverse dependents, and declared meta suites. Production dependency effects close transitively; test-only imports select their importing package without falsely making that package's production consumers affected. Any shared or uncertain path widens visibly; unavailable package discovery refuses rather than guessing at a partial dependency graph.

type Suite

type Suite struct {
	ID      string   `json:"id"`
	Package string   `json:"package"`
	Tests   []string `json:"tests"`
	Reasons []string `json:"reasons"`
}

Suite is one selected declared suite and its stable, accumulated reasons.

type SuitePolicy

type SuitePolicy struct {
	ID      string   `json:"id"`
	Package string   `json:"package"`
	Tests   []string `json:"tests"`
}

SuitePolicy declares one closed set of representative top-level proving units. Suite IDs, packages, and proving-unit names are repository policy, not operator-supplied regular expressions.

Jump to

Keyboard shortcuts

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