rigor

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2026 License: Apache-2.0 Imports: 11 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.

The fuzz requirement is not only a list. A declared list is a thing someone has to remember to add a package to, and the parsers that most needed fuzzing were exactly the ones nobody remembered. So the gate also infers it: a package that reaches a network or host boundary and decodes what comes back is parsing input it does not control, and must carry a fuzz target whether or not it was ever listed. A new parser wired to a socket or a subprocess now cannot land without one.

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. The boundary-fuzz exemption list works the same way.

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
	// BoundaryFuzzExempt lists module-relative packages the boundary-decoder
	// inference flags but which carry no fuzz target yet. It exists so the
	// inference can land green over a tree that predates it. Burn it down; never
	// add to it. The gate fails on an entry that has gained a fuzz target, and on
	// one that no longer decodes at a boundary, so the list can only shrink.
	BoundaryFuzzExempt 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