lint

package
v0.0.0-...-c9e24ca Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package lint holds the standalone go/analysis analyzer that gates the feedback envelope's Source-to-slot Required matrix. Its single member is the feedbackmatrix Analyzer; the standalone driver under cmd/feedbackmatrixlint/ runs it via singlechecker so the pre-push gate in scripts/pre-push-gates.sh exits non-zero on a diagnostic.

Two structural invariants are enforced at build time, ahead of the run-time Envelope.Validate path and ahead of the `go test` matrix completeness coverage in internal/role/feedback/envelope_completeness_test.go:

  • (a) every declared Source constant has at least one entry in the Required map. A new refer-back originator added without its row fails the gate at the unbacked Source's declaration site rather than silently shipping an envelope with no contract.
  • (b) every slot reference inside a Required matrix entry resolves to a declared slotName constant in the same package. A typo, a string-cast (`slotName("Bogus")`), or a variable-typed slot fails the gate at the offending expression.

The complementary "(c) every matrix entry has a corresponding From* builder" check is NOT statically enforced here. Linking a Source key to its From* function requires a naming-convention bridge that Go's AST does not encode directly; the convention is enforced instead by TestEnvelopeCompleteness_MatrixBuildersAllValidate in internal/role/feedback/envelope_completeness_test.go, which calls each builder by name in the matrix-keyed table — a missing builder fails compilation and a missing matrix entry fails Validate. The split is deliberate: the analyzer fires loudly in CI on the source- addition path; the completeness test catches the same class on the table-rebuild path, and the two together cover the introduction routes a new source can land through.

Scope detection: the analyzer applies to any package that declares ALL THREE of a `Source` named type, a `slotName` named type, and a `Required` package-level variable. Packages without that shape are silently skipped, so the same Analyzer is safe to run over the whole module from the cmd driver — the standalone main scopes to `./internal/role/feedback/...` because that is the only package that owns the matrix, but the structural guard keeps the analyzer noise-free if a sibling package happens to be passed.

Index

Constants

This section is empty.

Variables

View Source
var Analyzer = &analysis.Analyzer{
	Name: analyzerName,
	Doc: "feedbackmatrix: every Source constant declared in a package that also declares the " +
		"slotName type and the Required matrix must appear as a key in Required (invariant a), " +
		"and every slot expression inside a Required matrix entry must resolve to a declared " +
		"slotName constant (invariant b). Packages without the full Source/slotName/Required " +
		"shape are silently skipped. The complementary builder-existence check (every matrix " +
		"row has a From* function) lives in TestEnvelopeCompleteness_MatrixBuildersAllValidate.",
	Run: run,
}

Analyzer is the standalone go/analysis analyzer for the feedback envelope's Source-to-slot Required matrix. It enforces invariants (a) + (b) above; the (c) check lives in the matrix completeness test (see package doc).

Functions

This section is empty.

Types

This section is empty.

Directories

Path Synopsis
cmd
feedbackmatrixlint command
Command feedbackmatrixlint is the standalone driver for the feedbackmatrix static analyzer.
Command feedbackmatrixlint is the standalone driver for the feedbackmatrix static analyzer.

Jump to

Keyboard shortcuts

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