retired

package
v0.2026324.1630 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2026 License: MIT Imports: 16 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package retired publishes the contract's canonical inventory of WITHDRAWN identifiers — the names the contract has retired — and the instruments that assert they stay withdrawn.

WHY one shared list and not scattered literals: a withdrawn name that lives only inside the assertion that guards it is a name no other control can read. The next claim class — the same name re-added somewhere else in the org — is then missed the same way, by the same mechanism, because the only copy of the name is inside the guard that already passed. The list is the one place the names live, so every control reads the same names: this package's own guard, and the org's other controls.

The list is DATA, published as JSON beside this file. It is a control's key set, not an authored configuration and not a wire shape: nothing loads it as a project, nothing carries it over the wire, and no schema-shaped struct is transcribed from it. It is also machine-readable by every reader — the Go guard below, and the org's non-Go controls — so one file serves them all with no projection and no regeneration step.

A name is withdrawn ON A SURFACE, and the surfaces are withdrawn independently: a Go field can be renamed while its yaml key stays, and a yaml key can be withdrawn while the Go field keeps its name. So the list records both, and each entry carries the rule that catches it.

Index

Constants

This section is empty.

Variables

View Source
var Identifiers = mustLoad()

Identifiers is the contract's canonical inventory of withdrawn names.

Functions

func DeclaredTypes

func DeclaredTypes(root string) (map[string]TypeFields, error)

DeclaredTypes returns what every struct type in the tree declares, keyed by type name. It answers the "does this type exist, and what does it carry" question that the registry's own well-formedness rule asks.

The generated files are part of the answer: the generated types are the contract's published wire types, and "did the replacement land" is a question about them.

func ValidateRecords added in v0.2026305.1919

func ValidateRecords(records []Record, ids []Identifier) error

ValidateRecords checks a table against the registry.

A record may not INVENT a name: the withdrawn names are the contract's, and a record about a name the contract does not publish is a record about nothing. A record must also say WHY — a record without a reason is an excuse with no argument, and it is what a table rots into.

Types

type Classification added in v0.2026305.1919

type Classification struct {
	// Carriers are the hits no record covers: a live use of a withdrawn
	// name, and the thing the org's arm exists to catch.
	Carriers []Finding
	// Matches are the hits a record covers.
	Matches []Match
	// Stale are the records that cover no hit. A record that covers
	// nothing is ITSELF a finding: a table that rots into a hole hides a
	// live use behind a record that no longer says anything.
	Stale []Record
}

Classification is the verdict over a set of hits.

func Classify added in v0.2026305.1919

func Classify(root string, findings []Finding, records []Record, repo string) (Classification, error)

Classify judges the hits against the records.

A record covers a hit when it names the swept repository, the hit's file, and the hit's identifier, and when the hit's line carries the record's text. Every record that applies to the swept repository and covers no hit is stale; the records of OTHER repositories are not judged here, because they are about other trees.

type Coverage added in v0.2026305.1919

type Coverage struct {
	// Files is the number of files the sweep read.
	Files int
	// GoFiles is the number of those that are Go sources.
	GoFiles int
	// TextFiles is the number of those that are text surfaces.
	TextFiles int
	// SkippedTests counts the test files, which hold the assertions OF
	// ABSENCE — the name is there on purpose, and its presence is the proof.
	SkippedTests int
	// SkippedHistory counts the files under a CHANGELOG — the record of
	// what happened, not a surface a consumer reads.
	SkippedHistory int
	// SkippedBinary counts the files that are not text.
	SkippedBinary int
	// SkippedNested counts the nested repositories — a submodule is a repo
	// of its own, with its own rulebook and its own gates.
	SkippedNested int
	// SkippedSymlinks counts the SYMLINKS — a link is another path's
	// content, not this tree's.
	SkippedSymlinks int
	// SkippedDirs counts the dependency directories (vendor, node_modules,
	// testdata, .git) the sweep does not descend into.
	SkippedDirs int
	// Excluded counts the paths the caller excluded by name.
	Excluded int
}

Coverage is what one sweep read, and what it did not.

WHY THE REACH IS REPORTED. A sweep that names no coverage is a claim nobody can re-derive, and the org's own rule is that a control states what it covered — so a reader never has to guess how far a verdict reached, and a file that was skipped for a reason is visible instead of silently absent.

type Finding

type Finding struct {
	// Identifier is the withdrawn name that was found.
	Identifier Identifier
	// File is the path of the file, relative to the scanned root.
	File string
	// Line is the 1-indexed line the occurrence is on.
	Line int
	// Detail says what was matched — a declaration, a tag, a literal.
	Detail string
}

Finding is one occurrence of a withdrawn identifier in a scanned file.

func ScanTree

func ScanTree(root string, ids []Identifier) ([]Finding, error)

ScanTree reports every withdrawn identifier the tree under root carries.

The tree is scanned BY SURFACE: Go sources contribute their struct declarations and their string literals; CUE and protobuf sources contribute their text. Two kinds of file are skipped, each for a reason that is part of the rule rather than an exception to it:

  • a TEST file holds the assertions OF ABSENCE — the name is there on purpose, and its presence there is the proof, not the defect;
  • a testdata directory holds fixtures, which are inputs to a test and not surfaces of the contract.

A GENERATED file is NOT skipped. It is a committed surface — it is what every consumer compiles against — so a withdrawn name in it is a real finding. It is derived from an authored source, so the withdrawal is normally visible in both; the guard reports both, because they are two files a fix must touch: the authored source AND the artifact it generates.

The Go scan is STRUCTURAL: it reads declarations and literals, never comments. A Go comment naming a withdrawn identifier is a record of the withdrawal — the contract documents what it removed, and that documentation is correct — while a declaration or a literal is a surface a consumer can still reach. The CUE scan is textual, comments included: the schema's prose is part of the schema's published surface, so a withdrawn key named there is stale documentation of a key that is gone.

func (Finding) String

func (f Finding) String() string

String renders the finding for a report.

type Identifier

type Identifier struct {
	Kind       Kind   `json:"kind"`
	Name       string `json:"name"`
	Type       string `json:"type,omitempty"`
	ReplacedBy string `json:"replacedBy,omitempty"`
	Why        string `json:"why"`
}

Identifier is one withdrawn name.

Type scopes the name to one Go type. A name withdrawn from ONE type — a selector that only ever lived on the runtime's engine config — is not withdrawn everywhere, and an unscoped rule for it would condemn the same word where it is still legal (`build` is a legal key on the box schema). An empty Type means the name is withdrawn from every type.

The scope also decides the RULE: an unscoped name is matched as a token wherever it can appear, and a scoped name is matched only inside its scope. A scoped name is never matched as a bare token, because a short word such as `run` would then match inside `runtime`.

func (Identifier) Scoped

func (i Identifier) Scoped() bool

Scoped reports whether the identifier is confined to one Go type.

func (Identifier) String

func (i Identifier) String() string

String renders the identifier the way it is spoken about: the type it lived on, then the name.

type Kind

type Kind string

Kind is the surface an identifier was withdrawn from.

const (
	// KindField is a Go struct field.
	KindField Kind = "field"
	// KindConfigKey is an authored configuration key — a yaml/json tag, a CUE label.
	KindConfigKey Kind = "config-key"
	// KindEnv is an environment variable.
	KindEnv Kind = "env"
	// KindFlag is a command-line flag.
	KindFlag Kind = "flag"
)

type Match added in v0.2026305.1919

type Match struct {
	// Record is the record that covers the hit.
	Record Record
	// Finding is the hit it covers.
	Finding Finding
}

Match is one hit a record covers.

type Record added in v0.2026305.1919

type Record struct {
	// Repo is the repository the record is about. A record applies to the
	// tree whose repository it names, and to no other: a table that covers
	// the org must not make one repo's record another repo's excuse.
	Repo string `json:"repo"`
	// File is the repository-relative path of the hit the record covers.
	File string `json:"file"`
	// Identifier is the withdrawn NAME the record covers. A record covers
	// only the identifier it names, so a record written about one name can
	// never excuse another.
	Identifier string `json:"identifier"`
	// Contains is the text the covered hit's LINE must carry. Empty means
	// the record covers every hit of that identifier in that file.
	Contains string `json:"contains,omitempty"`
	// Why says why the mention is a record rather than a use.
	Why string `json:"why"`
}

Record is the ORG's classification of one hit: the hit is a RECORD — a mention that is correct — and not a CARRIER, a live use of a withdrawn name.

WHY A HIT IS CLASSIFIED AND NOT ASSUMED. The org's own sweeps classify every hit BY HAND: history stays; a counter-instance that DENIES the withdrawn name stays; an explanatory comment that names it stays; a live claim is a carrier. The distinction is semantic — a sentence that denies a withdrawn name and a sentence that sets its value carry the same name and mean opposite things — so a control that reported both as defects would cry wolf on the org's own correct documentation, and a control that GUESSED the distinction would miss the carriers it exists to catch. So the classification is COMMITTED, and every record says WHY.

WHY THE RECORDS LIVE OUTSIDE THE CONTRACT. A record names a file in a repository the contract does not own, and the contract's own tree has no records at all — its guard reads its surfaces directly. The table is the ORG's, and it is DATA the contract's rule reads; the rule for what makes a hit a carrier lives here, once.

func LoadRecords added in v0.2026305.1919

func LoadRecords(path string) ([]Record, error)

LoadRecords reads a records table from disk.

type RecordsFile added in v0.2026305.1919

type RecordsFile struct {
	Records []Record `json:"records"`
}

RecordsFile is the shape of a records table.

type SweepOptions added in v0.2026305.1919

type SweepOptions struct {
	// Exclude names repo-relative paths the sweep does not read. The file
	// that PUBLISHES the names is one of them, and so is a records table:
	// both are places where the names are SUPPOSED to appear.
	Exclude []string
}

SweepOptions are the choices one sweep makes about the tree it reads.

type SweepResult added in v0.2026305.1919

type SweepResult struct {
	// Findings are the hits: every occurrence of a withdrawn name the
	// sweep read.
	Findings []Finding
	// Coverage is what the sweep read and what it skipped.
	Coverage Coverage
}

SweepResult is what a sweep found, and how far it reached.

func SweepTree added in v0.2026305.1919

func SweepTree(root string, ids []Identifier, opts SweepOptions) (SweepResult, error)

SweepTree reports every withdrawn identifier the tree under root carries, over EVERY surface the tree has.

WHY A SWEEP AND NOT THE CONTRACT'S OWN SCAN. The contract's guard (ScanTree) reads the contract's OWN surfaces — Go sources, CUE schemas, protobuf schemas — because that is where the contract's names live. The org's trees have more surfaces than that: an authored yaml, a skill's prose, a script, a check bed. A withdrawn name in those is just as live, and a scan that reads only three extensions cannot see it. So the sweep reads EVERY text file, under the same rules the contract's own scan applies to the surfaces it already reads:

  • a Go source is read STRUCTURALLY — declarations and literals, never comments, because a comment naming a withdrawn identifier is the RECORD of the withdrawal, and a declaration is a surface a consumer can still reach;
  • every other text surface is read TEXTUALLY, comments included, because the prose IS the published surface;
  • a SCOPED name is never swept on a text surface: a scope is a Go type, and a text file has no such notion;
  • a TEST file holds the assertions OF ABSENCE and is skipped;
  • a CHANGELOG is history, not a surface;
  • a nested repository is a repo of its own;
  • a SYMLINK is another path's content, not this tree's;
  • a file that is not text is not a surface.

The contract's own guard keeps reading the contract's surfaces with ScanTree; this sweep is the ORG-WIDE reach, and the two share one set of rules and one token matcher.

type TypeFields

type TypeFields struct {
	Fields []string
	Keys   []string
}

TypeFields is what a struct type declares: its field names, and the yaml/json keys those fields carry. The registry's replacement rule reads both: a withdrawn FIELD is replaced by a field, and a withdrawn configuration key by a key.

Directories

Path Synopsis
cmd
retired-sweep command
retired-sweep — assert that a tree carries no withdrawn identifier the contract has not classified as a RECORD.
retired-sweep — assert that a tree carries no withdrawn identifier the contract has not classified as a RECORD.

Jump to

Keyboard shortcuts

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