Skip to content

Build AI methods with your coding agent, then run them anywhere: as an MCP for chatbots, as a webapp for people, or via API for your software.

chore: align review-comment fix with project conventions

Louis Choquel3f6c354b0c8b
diff --git a/pipelex/core/concepts/structure_generation/generator.py b/pipelex/core/concepts/structure_generation/generator.py
index 4792c682c..124b71911 100644
--- a/pipelex/core/concepts/structure_generation/generator.py
+++ b/pipelex/core/concepts/structure_generation/generator.py
@@ -279,11 +279,7 @@ class StructureGenerator:
base_module_path = class_info.module_path
break
if base_module_path is None:
- # Cross-package refines: the base class lives in another package's
- # already-generated structures module and is not in concept_ref_to_class_info
- # (which only covers the bundles passed to `pipelex build structures`).
- # Recover the import path from the class registry. Guard on
- # __name__ == base_class so we only emit a valid `from X import <base_class>`.
+ # Cross-package refines: base class lives in another already-installed package — recover its module via the class registry.
registered_cls = _get_class_registry().get_class(name=base_class)
if registered_cls is not None and registered_cls.__name__ == base_class and registered_cls.__module__ not in {"__main__", "builtins"}:
base_module_path = registered_cls.__module__
diff --git a/tests/unit/pipelex/cli/commands/build/test_structures_cmd_cross_package_refines.py b/tests/unit/pipelex/cli/commands/build/test_structures_cmd_cross_package_refines.py
index 15573a351..c347de78d 100644
--- a/tests/unit/pipelex/cli/commands/build/test_structures_cmd_cross_package_refines.py
+++ b/tests/unit/pipelex/cli/commands/build/test_structures_cmd_cross_package_refines.py
@@ -25,14 +25,11 @@ _FAKE_BASE_MODULE_PATH = "tests_pr898_other_pkg_stub.structures.other_domain__ot
class TestStructuresCmdCrossPackageRefines:
- def _register_cross_package_stub(self) -> type:
- """Register a stub that mimics what another package's `pipelex build structures`
- would have produced for `other_domain.OtherConcept`:
-
- - The class name equals the registry key (`other_domain__OtherConcept`),
- matching what `ConceptFactory` registers.
- - The class lives at a stable, importable-looking module path on `sys.modules`
- so the generator can recover an import statement from `__module__`.
+ @classmethod
+ def _register_cross_package_stub(cls) -> type:
+ """Register a stub mimicking what another package's `pipelex build structures` would have
+ produced: a class whose `__name__` equals the registry key and that lives at a stable
+ importable module path, so the generator can recover the import path via `__module__`.
"""
stub_module = ModuleType(_FAKE_BASE_MODULE_PATH)
stub_class: type = type("other_domain__OtherConcept", (StructuredContent,), {"__module__": _FAKE_BASE_MODULE_PATH})