rigor

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package rigor enforces the project's engineering-rigor floor as a test rather than a hope: every production package must carry a property test (rapid or the testkit harness), a declared set must carry a fuzz target, and a declared set must carry a benchmark (so a hot path, once measured, can never silently lose its measurement). Because the gate is an ordinary Go test (see rigor_test.go), it runs inside dev/test, dev/check, and the CI test matrix with no extra wiring, so a package added without its required tests turns `go test ./...` red locally and in CI.

New packages are held to the floor immediately. A grandfather allowlist covers the gaps that predate the gate so it lands green; the list only ever shrinks (the gate fails if a grandfathered package starts complying, forcing its removal), and nothing new is added to it.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Policy

type Policy struct {
	// Grandfathered lists module-relative package paths that predate the gate and
	// have no property test yet. Burn it down; never add to it.
	Grandfathered map[string]bool
	// FuzzRequired lists module-relative packages that parse untrusted input and so
	// must carry a fuzz target.
	FuzzRequired map[string]bool
	// BenchRequired lists module-relative packages on the hot path (the write
	// path, the canonical codec, the durable store) that must carry a benchmark,
	// so dev/bench and the CI bench smoke always have something to measure and a
	// regression gate cannot be deleted along with its benchmark. Grow it as
	// hotspots gain benchmarks; never shrink it.
	BenchRequired map[string]bool
}

Policy parameterizes the gate. Keeping it injectable lets the checker's own logic be unit-tested against synthetic trees, while the live gate uses DefaultPolicy.

func DefaultPolicy

func DefaultPolicy() Policy

DefaultPolicy is the policy the live gate enforces. The empty string is the root (module) package.

type Violation

type Violation struct {
	Pkg    string // full import path
	Reason string
}

Violation is one package failing the rigor floor.

func Check

func Check(root, modulePath string, pol Policy) ([]Violation, error)

Check walks the module rooted at root (with module path modulePath) and returns every rigor violation under pol. It reads source only; it does not build or run packages.

Jump to

Keyboard shortcuts

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