Skip to content

Commit bc83a11

Browse files
committed
docs: say what compile() does, not what add() did
The note left by the expansion commit read "compile() runs inference against everything the members import", which puts the emphasis in the wrong place and invites the reading that compile resolves imports. It does not: it unions exactly the shape collections of the listed members and resolves nothing. Verified -- the number of shape collections equals the number of members, for import_depth=-1 and =0 alike. A dependency is compiled against only when it is itself a member, which add() arranges by expanding imports; add(..., import_depth=0) leaves them genuinely absent. Comment, explanation page, wording only.
1 parent a687089 commit bc83a11

2 files changed

Lines changed: 12 additions & 7 deletions

File tree

buildingmotif/dataclasses/model.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -330,10 +330,11 @@ def compile(
330330
manifest = self.manifest
331331
shape_collections = manifest.shape_collections()
332332
backend = get_shacl_backend(shacl_engine or self._bm.shacl_engine)
333-
# Compiling against the members is compiling against everything they
334-
# import, because a manifest expands imports when a library is added
335-
# rather than resolving them here. There is deliberately no separate
336-
# resolution step: the explicit membership is the whole story.
333+
# Exactly the shape collections listed: no import resolution happens
334+
# here, and none is wanted. A dependency is compiled against only if
335+
# it is itself a member, which add() arranges by expanding imports at
336+
# the time a library is added (add(..., import_depth=0) opts out, and
337+
# then its imports are genuinely absent here).
337338
compiled_graph = backend.compile_model_graph(self.graph, shape_collections)
338339
return CompiledModel(
339340
self,

docs/explanations/manifests.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,13 @@ since it was added, or one added with `import_depth=0`. It raises
123123

124124
`model.manifest.shape_collections()` is the list `validate()` and `compile()` use: the
125125
shape collection of each member library, in name order. The manifest's own graph is *not*
126-
in that list — it holds imports, not shapes. Since the membership is complete, `compile()`
127-
runs inference against everything the members import as well; there is deliberately no
128-
separate resolution step for it to skip.
126+
in that list — it holds imports, not shapes.
127+
128+
Both work on **exactly** those members. Neither resolves imports: a dependency is validated
129+
and compiled against only if it is itself a member, which `add` arranges. Add a library
130+
with `import_depth=0` and its imports are genuinely absent from both — that is the
131+
difference between "the manifest lists it" and "something will find it later", and the
132+
manifest only ever means the first.
129133

130134
Passing shape collections explicitly still bypasses the manifest entirely:
131135
`model.validate([sc1, sc2])` checks against exactly those. To validate against the

0 commit comments

Comments
 (0)