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 ¶
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.
Types ¶
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.
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 TypeFields ¶
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.