Skip to main content

Module graph

Module graph 

Source
Expand description

Resource graph: flatten module bodies into their callers, expand count / for_each, and emit a Workspace.

Phase 5 lands module expansion (closes M2). Dependency-edge collection and the secondary Parquet tables (dependencies.parquet, components.parquet, modules.parquet) are Phase 8 / M5 work — they consume the same Workspace, so the contract pinned here does not need to change when they arrive.

Per 15-resource-graph.md.

§Public surface

  • GraphBuilder / DefaultGraphBuilder: the trait + default impl that flattens module bodies into their callers.
  • ModuleRegistry: canonical-path-keyed index of local module bodies; the orchestrator (Phase 5 pipeline wiring) builds this by evaluating every DirKind::Module directory the discoverer emitted.
  • GraphContext: per-build context (workspace root, recursion / expansion caps).
  • GraphError: errors emitted by the graph phase. Spec § 7 UnresolvableModuleSource / DepthExceeded are recorded as crate::Diagnostics in practice (the builder method signature reserves Err for fatal IR-construction failures).

Structs§

DefaultGraphBuilder
Default builder.
ExternalModuleRef
An external module reference captured for the dependency graph but not walked source-only (Registry, Git, or generic External source).
GraphContext
Per-build context: workspace root, recursion / expansion caps.
ModuleRegistry
Map of local module dirs (canonical paths) to their evaluator output.

Enums§

GraphError
Errors the graph builder can surface.

Traits§

GraphBuilder
Trait the orchestrator calls to build a Workspace. Phase 5 ships exactly one implementation, DefaultGraphBuilder; downstream tests may swap an in-memory variant.

Functions§

collect_edges_in_place
Walk ws and append every inferred edge to ws.edges. Existing edges (e.g. populated by a future phase) are preserved; duplicates are removed in the final sort.