Graph data was exported as bespoke LSP JSON, CLI ASCII trees, and unused edge arrays. Multiple presentation paths diverged from the same domain graphs.
Design model
Platform spec article
Design model
Spec standingStandard
-
All user-visible compiler graphs are emitted as Mermaid flowcharts via mermaid-builder.
Context
Decision
beskid_graphrenders all tooling graphs to Mermaid flowcharts usingmermaid-builderonly.- No DOT, GraphViz, or hand-rolled ASCII graph renderers in compiler presentation code.
- CLI uses
graphs-tuito display Mermaid in the terminal; VS Code uses bundled Mermaid.js.
Consequences
- Domain graphs in
beskid_analysis(daggy, module tree) stay for compile correctness. - All consumers share one Mermaid string from Salsa memoization.
Status
Accepted — reference implementation in
compiler/crates/beskid_graph/. -
beskid_queries graph_mermaid tracked queries memoize Mermaid output with revision fingerprints.
Context
LSP
getProjectGraphrebuilt domain graphs from disk on every call. CLI printed a flattened ASCII tree fromCompilePlan, losing multi-hop structure.Decision
graph_fingerprintandgraph_mermaidare#[salsa::tracked]queries inbeskid_queries::graph.- LSP and CLI must read graphs through
compilation_db, not ad-hoc rebuilds. - Invalidation follows
ManifestGenerationId,FileText, and assembly/composition revision inputs per graph kind.
Consequences
- Extension and CLI share the same cached Mermaid revision.
- Manifest or lock edits invalidate project/workspace graphs without full process restart.
Status
Accepted — extends ADR D-COMP-BUILD-0021.
0 revisions (git unavailable at build; counts may be empty)
No commits recorded for this path.
| Section id | Required | Found |
|---|---|---|
what-this-feature-specifies | yes | yes |
implementation-anchors | yes | yes |
Full tree: run pnpm verify:platform-spec-layout (writes src/generated/platform-spec-layout-report.json).
GraphSpec IR
Section titled “GraphSpec IR”Domain graphs (ProjectGraph, ModuleGraph, RegistrationDag) remain in beskid_analysis for correctness. Presentation flows through a domain-agnostic intermediate representation:
| Field | Meaning |
|---|---|
kind | GraphKind discriminator |
nodes | Stable id, label, shape, style class, optional URI metadata |
edges | Directed links with optional labels |
subgraphs | Workspace members, module paths, DI scopes |
warnings | Cycles, unresolved deps, empty host |
GraphDocument
Section titled “GraphDocument”| Field | Meaning |
|---|---|
spec | Populated GraphSpec |
mermaid | Rendered flowchart string from mermaid-builder |
revision | Fingerprint for client cache invalidation |
Salsa memoization
Section titled “Salsa memoization”beskid_queries::graph_mermaid is the single cache host. Invalidation keys:
| Kind | Inputs |
|---|---|
projectDeps / workspace | ProjectSession, ManifestGenerationId |
moduleTree / importClosure | FileText, unit_imports, assembly fingerprint |
hostComposition | Entry text, syntax generation, composition snapshot |
Presentation policy
Section titled “Presentation policy”- Mermaid flowchart is the only supported output format.
- CLI renders via
graphs-tui; VS Code renders via bundledmermaid.min.js. - Internal
daggygraphs are never serialized directly to tooling.