Enrichment
Layers extra information on top of a freshly loaded Vista — demangled display names, per-function metrics from clang-tidy, doxygen-style descriptions, and node-kind icons.
Why view overlays, not entity mutation
The underlying com.stigway.metamodels.highway.MetamodelEntity instances are immutable — their name / description / asil are vals set at construction. Enrichment writes only to the overlay slots on the views (CodeConstructView.name, CodeConstructView.description, CodeConstructView.iconKey, CodeConstructView.metrics); it never reaches the wrapped entity. Renderers read view.name ?: view.construct.name, so the override transparently takes priority when present.
Mangled vs demangled
The analyzer emits mangled LLVM symbol names (e.g. _ZN3foo3barEv) — the loader stamps them onto CodeInstruction.mangledName / CodeFunction.mangledName. The metrics + descriptions JSON files key on the unmangled C++ function-name token reported by clang-tidy diagnostics. So:
applyDemangling populates
view.nameby demangling each construct's mangled symbol.addCodeMetrics / addDescriptions then key on a simple-name token extracted from
view.name.
Steps are exposed as separate named functions because each joins on a different key and each input is optional. enrich is the canonical-order convenience wrapper.
Functions
Parses the metrics JSON produced by analyzeFunctionMetrics and folds each function's metrics into the matching CodeConstructViews.
Parses the descriptions JSON produced by analyzeFunctionDescriptions and folds each function's description text into the matching CodeConstructViews by writing view.description.
Assigns each view's diagram-node iconKey (a sprite ID stig-icons-<slug>): code-construct views from their CodeConstructKind, element views from the element's ElementType. SVG export emits <use href="#stig-icons-...">; cytoscape resolves the same sprite via background-image data URLs.
Synthesises a class-level compound layer above the existing instruction → function nesting. For every function view whose demangled name contains a :: qualifier (e.g. harness::Entry::Execute()), this step:
Populates view.name on non-instruction CodeConstructViews whose underlying construct carries a mangled symbol the demangler can resolve. Instruction views keep their IR labels; their mangledName is the enclosing function symbol, not the instruction's own display identity.
Outermost compound layer (issue 17 batch D / issue 24 multi-level boxing). Adds an ElementView for the analysed highway element and reparents every top-level code box (no existing parent) under it, so the cytoscape compound chain becomes Element → … → Instruction. SVG / sigma exporters ignore the parent link.
Populates view.sourceUrl from view.construct.source + view.construct.line. For each source file, picks the CodeBrowserUrl.Context whose gitRoot is the deepest ancestor of the file — handling the multi-repo case where a kotlin module's softwareUnderAnalysis { include(repos["sourceRepo"]/...) } pulls in C++ sources from a repo different from the module's own. Files outside every configured repo (e.g. bazel-out generated headers) keep sourceUrl = null.
Canonical-order convenience wrapper: demangle → class-nesting → source URLs → icons → metrics → descriptions.