Skip to main content

Module architecture

Module architecture 

Source
Expand description

#851: the architecture-model query — a whole-project map of contexts and adapters, their consumes edges, and the capabilities/providers/services/ agents each one binds, for the “Show Architecture Map” VS Code webview. The macro counterpart to #846’s per-handler sequence diagram: where that query is file-scoped and cursor-anchored, this one is project-scoped — every span here is paired with the project-relative file it belongs to (a unit’s declarations may span several files, per unit_sources), so a wire layer can open the right file on click-to-code rather than assuming the request’s own document.

Citation correction (found during implementation of #851; recorded in design/pending/architecture-map-851.md): the issue proposed this as “a pure, read-only query over the binding index and call graph” (bynk-check/src/index.rs). That index has no Context/Adapter symbol kind and its call graph does not carry consumes edges — its own comment notes cross-context dispatch is “the one uncovered relation”. The actual source, used here exactly as sequence::Builder::classify_cross_context already does, is ContextSequenceInfo::cross_context for resolved consumed-context names (aliasing applied) plus a re-parse of each unit’s own snapshot text for its local declarations and raw consumes clauses — there is no retained AST after a round, the same constraint sequence_request/documentation_request re-parse against.

Capability binding (Decision C: show binding, defer residency): a braced consumes U { Cap, … } selection flattens Cap into the consumer’s own namespace, so each selected capability is recorded directly on the consuming node (not only as an edge label) — this is what makes the built-in consumes bynk { Clock } binding visible on a single-context project even though the synthetic bynk unit has no project file and so never becomes a node itself (an edge to it would dangle); see architecture_model’s node-name filter. A whole-unit consumes (no braces) grants qualified access to every exported capability but flattens none of them, so it contributes an edge only, unlabelled — matching the issue’s “labelled with selected capabilities where braced”.

Structs§

ArchAgent
ArchCapability
ArchEdge
A directed consumes edge between two nodes.
ArchModel
ArchNode
One context/adapter node — the “services in, agents below” grouping the design notes describe, rendered as a single box with click-to-expand members.
ArchProvider
ArchService
Located
A declaration site: which project-relative file it lives in, and its span within that file’s text. Project-scoped models (unlike the file-scoped sequence/documentation ones) always need both — a node’s members can come from different files of the same multi-file unit.

Enums§

CapabilityOrigin
NodeKind

Functions§

architecture_model
Build the whole-project architecture model.