Documentation
¶
Overview ¶
Package census is the element-coverage guard (WS6-011). For each source format it holds a reviewed MANIFEST classifying every construct the format's files carry as consumed by the reader or a known drop. A test walks the committed fixtures and fails on a construct the manifest does not classify, and `agni census` runs the same audit over a local corpus, report-only.
The census asserts CLASSIFICATION coverage, not behavioral consumption; behavioral correctness is the conformance harness's job (WS6-004). The two tiers and the workflow are in census/README.md.
Index ¶
Constants ¶
const NumberToken = "<number>"
NumberToken is the sentinel for a numeric s-expr head (KiCad layer-table rows keyed by number, version triples). Collapsing them to one token keeps a manifest from listing every integer.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Entry ¶
Entry is one construct's classification. Why is a one-line rationale; Ticket is the roadmap id that tracks closing the gap ("" when none applies, e.g. a Consumed or DroppedByDesign entry).
type Kind ¶
type Kind int
Kind selects the extractor for a format family. The two s-expr kinds differ only in the shared parser's string dialect (KiCad escapes vs EDIF CR/LF drop), which the census needs correct so a quoted string terminates where the reader would find it.
const ( // KindKiCad enumerates s-expression head atoms with the KiCad string dialect (.kicad_pcb/.kicad_sch). KindKiCad Kind = iota // KindEDIF enumerates s-expression head atoms with the EDIF string dialect (.edn/.eds). KindEDIF // KindXML enumerates XML element local names (IPC-2581). KindXML // KindLine enumerates line-oriented object type chars + "@key" attribute keys (xschem, gEDA). KindLine )
type Manifest ¶
type Manifest struct {
Format string // display name, e.g. "kicad-pcb"
Kind Kind // which extractor enumerates this format's files
Entries map[string]Entry
}
Manifest classifies a format's constructs. Keys are the tokens Enumerate emits (s-expr head atoms, XML element names, line-type chars, or "@key" for a line-format attribute key), and the numeric-head sentinel is NumberToken.
func Lookup ¶
Lookup resolves a design file to the manifest that classifies its constructs, by extension (and, for the ambiguous `.sch`/`.sym`, a light header sniff of data to tell xschem from gEDA from legacy KiCad). ok is false for a file no manifest covers. `agni census` uses it to walk a mixed corpus directory.
func Manifests ¶
func Manifests() []Manifest
Manifests returns every format census, keyed by format name. The CI test and `agni census` both drive it.
func (Manifest) Audit ¶
func (m Manifest) Audit(filesByPath map[string][]byte) []Unclassified
Audit enumerates the constructs in each file (via the manifest's extractor Kind) and returns the tokens absent from the manifest, sorted by token then file. An empty result means full classification coverage. filesByPath maps a display path to its raw bytes.
type Status ¶
type Status string
Status is how a manifest classifies one source construct.
const ( // Consumed means the reader transforms this construct into the IR. Consumed Status = "consumed" // DroppedCosmetic is not read, and the only loss is render fidelity. DroppedCosmetic Status = "dropped-cosmetic" // DroppedAnalysis is not read, and its absence blocks a check or diff (a rule can't be written). DroppedAnalysis Status = "dropped-analysis" // DroppedLatent is not read, and its absence produces WRONG data when the construct is present // (a correctness hole), even if no current corpus/fixture exercises it. DroppedLatent Status = "dropped-latent" // DroppedByDesign is not read and never will be (editor/tool metadata, 3D models). DroppedByDesign Status = "dropped-by-design" )
type Unclassified ¶
Unclassified is one construct found in a file that the manifest does not list.