Import closure not directory sweep
Platform spec ADR
Import closure not directory sweep
Spec standingStandard
- Program assembly - Contracts and edge cases Materialized-first roots, discovery caps, and parity across CLI and LSP.
- Program assembly - Design model EffectiveCompilationRoots, ProgramAssembly, ModuleIndex, and hybrid discovery modes.
- Program assembly - Flow and algorithm Ordered assembly after workspace materialize and before multi-unit parse and HIR resolution.
- Program assembly - Verification and traceability Test and source anchors for ProgramAssembly and effective roots.
0 revisions (git unavailable at build; counts may be empty)
No commits recorded for this path.
Full tree: run pnpm verify:platform-spec-layout (writes src/generated/platform-spec-layout-report.json).
Context
Section titled “Context”ImportClosure and WorkspaceScan modes were conflated in places: directory sweeps pulled unrelated .bd files into compile graphs, breaking determinism and parity with explicit use graphs.
Decision
Section titled “Decision”For AssemblyDiscovery::ImportClosure (build, run, lower, test, LSP document snapshots):
| Rule | Detail |
|---|---|
| Seeds | Entry file, prelude union seeds (D-COMP-BUILD-0022), and each pub mod A.B resolve exactly one module file before traversal |
| Expansion | Additional units enter the queue only when a queued file contains a use import that resolves under effective roots |
| No sweep | ImportClosure must not enumerate all *.bd under roots (that mode is WorkspaceScan only, for LSP workspace indexing) |
WorkspaceScan remains capped by max_units with deterministic sort; it must not be used for beskid build / beskid run / beskid test.
Consequences
Section titled “Consequences”Assembly unit count tracks the transitive use graph plus explicit prelude seeds. Tests assert closure size for fixture projects.
Verification anchors
Section titled “Verification anchors”compiler/crates/beskid_analysis/src/projects/assembly/loader.rscompiler/crates/beskid_analysis/src/projects/model.rs(AssemblyDiscovery)compiler/crates/beskid_tests/src/projects/composition.rs