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.
fix: carry domain_code on every PipeValidationError that names a pipe_code (#1057)
Louis Choquelbf80606e1a7a
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 19c216415..ff398b916 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -1,5 +1,11 @@# Changelog+## [Unreleased]++### Fixed++- **Validation errors stay domain-qualified: every raise site that names a `pipe_code` now also carries `domain_code`.** The presentation chain (VS Code extension + mthds-ui) identifies pipes by full pipe ref (`domain_code.pipe_code`); a handful of `PipeValidationError` raise sites (PipeLLM static input checks, PipeStructure input-mismatch, the pipe sorter's circular-dependency error) omitted `domain_code`, degrading node decorations and click-to-navigate for those errors in multi-domain bundles. The sorter gains a `domain_code` parameter threaded from the bundle spec's domain.+## [v0.39.2] - 2026-07-17### Addeddiff --git a/pipelex/builder/bundle_spec.py b/pipelex/builder/bundle_spec.pyindex ad601ee6e..5ac7da340 100644--- a/pipelex/builder/bundle_spec.py+++ b/pipelex/builder/bundle_spec.py@@ -143,7 +143,7 @@ class PipelexBundleSpec(StructuredContent):raise PipelexBundleSpecBlueprintError(msg) from exc# Then, sort blueprints by dependencies- sorted_pipe_items = sort_pipes_by_dependencies(pipe_blueprints)+ sorted_pipe_items = sort_pipes_by_dependencies(pipe_blueprints, domain_code=self.domain)# Finally, create the ordered dictpipe = dict[str, PipeBlueprintUnion](sorted_pipe_items)diff --git a/pipelex/core/bundles/pipe_sorter.py b/pipelex/core/bundles/pipe_sorter.pyindex faf8532eb..f010e1775 100644--- a/pipelex/core/bundles/pipe_sorter.py+++ b/pipelex/core/bundles/pipe_sorter.py@@ -6,6 +6,8 @@ from pipelex.core.pipes.exceptions import PipeValidationError, PipeValidationErrdef sort_pipes_by_dependencies(pipes: dict[str, PipeBlueprintUnion],+ *,+ domain_code: str | None = None,) -> list[tuple[str, PipeBlueprintUnion]]:"""Sort pipes by their dependencies using depth-first pre-order traversal.@@ -15,6 +17,8 @@ def sort_pipes_by_dependencies(Args:pipes: Dictionary mapping pipe_code to PipeBlueprintUnion+ domain_code: Declaring domain of the bundle, carried onto the+ circular-dependency error so the wire item stays domain-qualifiedReturns:List of (pipe_code, pipe_blueprint) tuples sorted with controllers before dependencies.@@ -50,7 +54,12 @@ def sort_pipes_by_dependencies(returnif pipe_code in visiting:msg = f"Circular dependency detected involving pipe: {pipe_code}"- raise PipeValidationError(message=msg, pipe_code=pipe_code, error_type=PipeValidationErrorType.CIRCULAR_DEPENDENCY_ERROR)+ raise PipeValidationError(+ message=msg,+ domain_code=domain_code,+ pipe_code=pipe_code,+ error_type=PipeValidationErrorType.CIRCULAR_DEPENDENCY_ERROR,+ )if pipe_code not in pipes:# Dependency not in this bundle, skip itreturndiff --git a/pipelex/pipe_operators/llm/pipe_llm.py b/pipelex/pipe_operators/llm/pipe_llm.pyindex e65604d20..c0b1ca834 100644--- a/pipelex/pipe_operators/llm/pipe_llm.py+++ b/pipelex/pipe_operators/llm/pipe_llm.py@@ -76,6 +76,7 @@ class PipeLLM(PipeOperator[PipeLLMOutput]):raise PipeValidationError(message=msg,error_type=PipeValidationErrorType.EXTRANEOUS_INPUT_VARIABLE,+ domain_code=self.domain_code,pipe_code=self.code,variable_names=[input_name],explanation=f"Input '{input_name}' is declared in inputs but not referenced in prompt/system_prompt.",@@ -88,6 +89,7 @@ class PipeLLM(PipeOperator[PipeLLMOutput]):raise PipeValidationError(message=msg,error_type=PipeValidationErrorType.MISSING_INPUT_VARIABLE,+ domain_code=self.domain_code,pipe_code=self.code,variable_names=[variable_path],explanation=f"Variable '{variable_path}' is used in prompt/system_prompt but not declared in inputs.",@@ -138,6 +140,7 @@ class PipeLLM(PipeOperator[PipeLLMOutput]):raise PipeValidationError(message=msg,error_type=PipeValidationErrorType.LLM_OUTPUT_CANNOT_BE_IMAGE,+ domain_code=self.domain_code,pipe_code=self.code,provided_concept_code=self.output.concept.concept_ref,)diff --git a/pipelex/pipe_operators/structure/pipe_structure.py b/pipelex/pipe_operators/structure/pipe_structure.pyindex 5a9ce8f3c..08a41021f 100644--- a/pipelex/pipe_operators/structure/pipe_structure.py+++ b/pipelex/pipe_operators/structure/pipe_structure.py@@ -75,6 +75,7 @@ class PipeStructure(PipeOperator[PipeStructureOutput]):raise PipeValidationError(message=msg,error_type=PipeValidationErrorType.INPUT_STUFF_SPEC_MISMATCH,+ domain_code=self.domain_code,pipe_code=self.code,provided_concept_code=the_single_input.concept.concept_ref,)diff --git a/tests/integration/pipelex/pipeline/test_validate_bundle_structured_errors.py b/tests/integration/pipelex/pipeline/test_validate_bundle_structured_errors.pyindex 640f11a45..7ae31b531 100644--- a/tests/integration/pipelex/pipeline/test_validate_bundle_structured_errors.py+++ b/tests/integration/pipelex/pipeline/test_validate_bundle_structured_errors.py@@ -108,6 +108,18 @@ output = "Text"prompt = "Write a greeting for $name who lives in $city.""""+_EXTRANEOUS_INPUT_MTHDS = """+domain = "structured_extraneous_input"+main_pipe = "greet_person"++[pipe.greet_person]+type = "PipeLLM"+description = "Greeting that declares an input the prompt never uses."+inputs = { name = "Text", unused_thing = "Text" }+output = "Text"+prompt = "Write a greeting for $name."+"""+_CONCEPT_OWNED_UNRESOLVED_MTHDS = """domain = "structured_concept_owned"main_pipe = "use_wrapper"@@ -246,3 +258,27 @@ class TestValidateBundleStructuredErrors:assert item.category == ValidationErrorCategory.BLUEPRINT_VALIDATIONassert item.pipe_code == "greet_person"assert item.variable_names == ["city"]++ async def test_pipe_channel_items_stay_domain_qualified(+ self,+ load_empty_library: Callable[[], str],+ ) -> None:+ """Every item that carries a `pipe_code` must carry `domain_code` too — the+ presentation chain identifies pipes by full ref (`domain_code.pipe_code`), so a+ bare-code item degrades node decorations and click-to-navigate downstream. Pins+ the report-wide invariant on an extraneous-input bundle (surfaced here by the+ blueprint categorizer; the operator-raised `PipeValidationError` sites that used+ to omit `domain_code` are fixed at their raise sites and pinned by the pipe-sorter+ unit test).+ """+ load_empty_library()+ items = await _validation_errors_for(_EXTRANEOUS_INPUT_MTHDS)+ extraneous_items = [item for item in items if item.error_type == PipeValidationErrorType.EXTRANEOUS_INPUT_VARIABLE]+ assert extraneous_items, f"Expected an extraneous_input_variable item, got {[(i.category, i.error_type) for i in items]}"+ item = extraneous_items[0]+ assert item.pipe_code == "greet_person"+ assert item.domain_code == "structured_extraneous_input"+ # The invariant holds across the whole report, not just the pinned channel.+ for reported in items:+ if reported.pipe_code is not None:+ assert reported.domain_code is not None, f"item {reported.error_type} carries pipe_code without domain_code"diff --git a/tests/unit/pipelex/core/bundles/test_pipe_sorter.py b/tests/unit/pipelex/core/bundles/test_pipe_sorter.pyindex 9f8718aaf..b2b32123e 100644--- a/tests/unit/pipelex/core/bundles/test_pipe_sorter.py+++ b/tests/unit/pipelex/core/bundles/test_pipe_sorter.py@@ -4,6 +4,7 @@ import pytestfrom pipelex.core.bundles.pipe_sorter import sort_pipes_by_dependenciesfrom pipelex.core.bundles.pipelex_bundle_blueprint import PipeBlueprintUnion+from pipelex.core.pipes.exceptions import PipeValidationErrorfrom tests.unit.pipelex.core.bundles.test_data_pipe_sorter import PipeSorterTestCases@@ -63,3 +64,12 @@ class TestSortPipesByDependencies:# For test cases with a specific expected order, verify exact matchif expected_order is not None:assert sorted_codes == expected_order, f"Test '{test_name}': Expected {expected_order}, got {sorted_codes}"++ def test_circular_dependency_error_carries_domain_code(self):+ """The cycle error must stay domain-qualified: `domain_code` rides alongside+ `pipe_code` so the wire item can identify the pipe by full ref.+ """+ with pytest.raises(PipeValidationError) as exc_info:+ sort_pipes_by_dependencies(PipeSorterTestCases.CIRCULAR_PIPES, domain_code="cycling_domain")+ assert exc_info.value.pipe_code is not None+ assert exc_info.value.domain_code == "cycling_domain"