Documentation
¶
Overview ¶
Package layoutcheck holds the UNIVERSAL visual invariants a layout must satisfy no matter its shape — node boxes must not overlap, a routed edge must not cut through or graze a box it is not connected to, edges must not cross/cover, stub badges and chips must keep clear of boxes, and unrelated boxes must not sit at band rhythm so they read as paired. The fitness corpora assert precise per-shape geometry; these checks catch the combinations no fixture anticipates.
It is a DEBUG VIEW (what is visually wrong with THIS diagram) that doubles as a regression harness when run wide against a baseline — one code path, one vocabulary. cmd-dev/layout-debug exposes both:
layout-debug --in c.ipmt --check # one diagram, findings layout-debug --check --baseline <f> <paths…> # the ratchet
Everything here is a pure function over layout.Graph or a baseline blob — the CLI owns file IO and the engine run.
Index ¶
- func Categorize(findings []string) [4]int
- func Findings(g *layout.Graph, opts Options) []string
- func FormatBaseline(counts map[string][4]int) []byte
- func FormatTotals(files int, counts map[string][4]int) string
- func ParseBaseline(data []byte) (map[string][4]int, []string)
- func Regressed(was, n [4]int) bool
- type Options
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Categorize ¶
Categorize buckets findings into the four severity classes the ratchet tracks: {node overlaps, edge-through-node family, edge-edge crossings, badge overlaps}. The through-node bucket is everything not one of the three named prefixes — grazes, false pairings, covers, stubs.
func Findings ¶
Findings runs every universal invariant over g and returns one string per violation, in a deterministic order. An empty slice means the diagram is clean. The strings are the grep/diff vocabulary — their prefixes drive Categorize, so a new finding phrasing must stay consistent with it.
func FormatBaseline ¶
FormatBaseline renders the per-file finding counts as the ratchet baseline file: only dirty files, sorted, four counts then the path.
func FormatTotals ¶
FormatTotals sums the per-file finding counts into one summary line. files is the count of files considered; dirty counts files with any finding.
func ParseBaseline ¶
ParseBaseline reads a baseline blob into per-file counts. A record is N leading integer counts (3 legacy, 4 current) followed by a file path; the leading integers are parsed greedily and the rest rejoined as the path, so a path containing spaces survives. Unparsable lines are skipped and returned as warnings (line-numbered) rather than failing.
func Regressed ¶
Regressed reports whether current counts n are worse than baseline was, using the lexicographic severity order overlaps[0] > through-node[1] > edge-edge[2] > badge[3]: a file regresses when a worse-severity kind grows, or it ties on all worse kinds and a lesser kind grows. This is the ratchet core; any change to the ordering changes which regressions the CI gate catches.