|
32 | 32 | ) |
33 | 33 | from jacobian.domains._examples import example |
34 | 34 | from jacobian.operations import ComputedSuccess, MaterializedOperation |
35 | | -from jacobian.storage.repository import ArtifactRepository |
36 | 35 |
|
37 | 36 |
|
38 | 37 | def _presentation_graph(request: FinitePosetRequest) -> nx.DiGraph[str]: |
@@ -172,24 +171,20 @@ def _width(request: PosetRequest) -> ComputedSuccess[PosetWidthResult]: |
172 | 171 | ) |
173 | 172 |
|
174 | 173 |
|
175 | | -def _resolve_poset_request( |
| 174 | +def _convert_materialized_poset( |
176 | 175 | request: PosetRequest, |
177 | | - store: ArtifactRepository, |
178 | | - accepted_artifact_types: tuple[str, ...], |
179 | | - semantics_uri: str, |
| 176 | + payload: FinitePosetMaterializationResult, |
180 | 177 | ) -> tuple[PosetRequest, tuple[str, ...]]: |
181 | | - if request.poset is not None: |
182 | | - return request, () |
183 | | - if request.poset_artifact_uri is None: |
184 | | - raise ValueError("poset artifact URI is required") |
185 | | - artifact = store.get(request.poset_artifact_uri) |
186 | | - if ( |
187 | | - artifact.manifest.schema_uri not in accepted_artifact_types |
188 | | - or artifact.manifest.semantics_uri != semantics_uri |
189 | | - ): |
190 | | - raise ValueError("artifact is not a compatible finite poset") |
191 | | - materialized = FinitePosetMaterializationResult.model_validate(artifact.payload) |
192 | | - return PosetRequest(poset=materialized.poset), (request.poset_artifact_uri,) |
| 178 | + """Convert a materialized poset artifact into a domain request. |
| 179 | +
|
| 180 | + This is a pure typed conversion with no storage dependency; the installer |
| 181 | + handles artifact retrieval, schema/semantics validation, and payload |
| 182 | + deserialization before calling this converter. |
| 183 | + """ |
| 184 | + |
| 185 | + return PosetRequest(poset=payload.poset), ( |
| 186 | + request.poset_artifact_uri, |
| 187 | + ) if request.poset_artifact_uri else () |
193 | 188 |
|
194 | 189 |
|
195 | 190 | def _linear_extensions( |
@@ -378,7 +373,9 @@ def _mobius( |
378 | 373 | implementation=_width, |
379 | 374 | relation_id="poset.width.dilworth.relation", |
380 | 375 | accepted_result_capability_ids=("poset.finite.materialize",), |
381 | | - input_resolver=_resolve_poset_request, |
| 376 | + artifact_converter=_convert_materialized_poset, |
| 377 | + artifact_payload_model=FinitePosetMaterializationResult, |
| 378 | + artifact_uri_field="poset_artifact_uri", |
382 | 379 | tags=( |
383 | 380 | "poset", |
384 | 381 | "width", |
|
0 commit comments