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 : no longer silent ignore corrupted config override
Louis Choquel7776cac04630
diff --git a/pipelex/pipelex.toml b/pipelex/pipelex.tomlindex 3f8a28669..9d81049bd 100644--- a/pipelex/pipelex.toml+++ b/pipelex/pipelex.toml@@ -204,11 +204,11 @@ text_gen_truncate_length = 256nb_list_items = 3nb_ocr_pages = 4allowed_to_fail_pipes = [- "infinite_loop_1", # Loop but only for testing purposes- "fix_failing_pipes_once", # Loop but its normal+ "infinite_loop_1", # Loop but only for testing purposes+ "fix_failing_pipes_once", # Loop but its normal"validate_pipelex_bundle_spec", # Loop but its normal- "handle_validation_result", # Complex case of a sub pipe needed a ListContent because its batching on, but the dry_run cannot know.- "pipe_builder", # because of the 'fix_failing_pipes_once', 'validate_pipelex_bundle_spec', 'handle_validation_result'+ "handle_validation_result", # Complex case of a sub pipe needed a ListContent because its batching on, but the dry_run cannot know.+ "pipe_builder", # because of the 'fix_failing_pipes_once', 'validate_pipelex_bundle_spec', 'handle_validation_result']image_urls = ["https://storage.googleapis.com/public_test_files_7fa6_4277_9ab/fashion/fashion_photo_1.jpg",diff --git a/pipelex/tools/config/manager.py b/pipelex/tools/config/manager.pyindex 15376ec22..97aefde57 100644--- a/pipelex/tools/config/manager.py+++ b/pipelex/tools/config/manager.py@@ -10,7 +10,7 @@ from pipelex.tools.config.config_root import (CONFIG_BASE_OVERRIDES_BEFORE_ENV,)from pipelex.tools.misc.json_utils import deep_update-from pipelex.tools.misc.toml_utils import failable_load_toml_from_path, load_toml_from_path+from pipelex.tools.misc.toml_utils import load_toml_from_path, load_toml_from_path_if_existsfrom pipelex.tools.runtime_manager import runtime_managerCONFIG_DIR_NAME = ".pipelex"@@ -74,8 +74,9 @@ class ConfigManager:Dict[str, Any]: The configuration dictionary from the local pipelex.toml"""- config_path = os.path.join(self.local_root_dir, CONFIG_NAME)- return failable_load_toml_from_path(config_path) or {}+ config_path = os.path.join(self.pipelex_config_dir, CONFIG_NAME)+ print(f"Getting local config from {config_path}")+ return load_toml_from_path_if_exists(config_path) or {}def load_inheritance_config(self, the_pipelex_config: dict[str, Any]):"""Load the config by inheritance in a pyproject.toml file.@@ -105,7 +106,7 @@ class ConfigManager:if package_path:config_path = os.path.join(package_path, "pipelex.toml")if os.path.exists(config_path):- config = failable_load_toml_from_path(config_path)+ config = load_toml_from_path_if_exists(config_path)if config:deep_update(the_pipelex_config, config)@@ -150,12 +151,12 @@ class ConfigManager:override_path = os.path.join(self.local_root_dir, "tests", f"pipelex_{override}.toml")else:override_path = os.path.join(self.local_root_dir, "pipelex" if self.is_in_pipelex_config else "", f"pipelex_{override}.toml")- if override_dict := failable_load_toml_from_path(override_path):+ if override_dict := load_toml_from_path_if_exists(override_path):deep_update(pipelex_config, override_dict)#################### 5. Load specific config ####################if specific_config_path:- config = failable_load_toml_from_path(specific_config_path)+ config = load_toml_from_path_if_exists(specific_config_path)if config:deep_update(pipelex_config, config)else:diff --git a/pipelex/tools/misc/toml_utils.py b/pipelex/tools/misc/toml_utils.pyindex 23b06db9e..0fc407277 100644--- a/pipelex/tools/misc/toml_utils.py+++ b/pipelex/tools/misc/toml_utils.py@@ -115,12 +115,8 @@ def load_toml_from_path(path: str) -> dict[str, Any]:raise toml.TomlDecodeError(msg, exc.doc, exc.pos) from exc-def failable_load_toml_from_path(path: str) -> dict[str, Any] | None:- """Load TOML from path with failure handling."""+def load_toml_from_path_if_exists(path: str) -> dict[str, Any] | None:+ """Load TOML from path if it exists."""if not path_exists(path):return None- try:- return load_toml_from_path(path)- except (toml.TomlDecodeError, TOMLValidationError) as exc:- print(f"Failed to parse TOML file '{path}': {exc}")- return None+ return load_toml_from_path(path)diff --git a/tests/unit/pipelex/tools/misc/test_toml_utils.py b/tests/unit/pipelex/tools/misc/test_toml_utils.pyindex a19a20c18..9980dea8e 100644--- a/tests/unit/pipelex/tools/misc/test_toml_utils.py+++ b/tests/unit/pipelex/tools/misc/test_toml_utils.py@@ -4,7 +4,7 @@ import pytestfrom pipelex.tools.misc.toml_utils import (TOMLValidationError,- failable_load_toml_from_path,+ load_toml_from_path_if_exists,load_toml_from_path,validate_toml_file,)@@ -104,12 +104,12 @@ definition = "Test with trailing space"assert isinstance(result, dict)assert result["domain"] == "test"- def test_failable_load_toml_from_path_nonexistent_file(self) -> None:+ def test_load_toml_from_path_if_exists_nonexistent_file(self) -> None:"""Test failable loading with non-existent file."""- result = failable_load_toml_from_path("/nonexistent/path.toml")+ result = load_toml_from_path_if_exists("/nonexistent/path.toml")assert result is None- def test_failable_load_toml_from_path_valid_file(self, tmp_path: Path) -> None:+ def test_load_toml_from_path_if_exists_valid_file(self, tmp_path: Path) -> None:"""Test failable loading with valid file."""toml_content = """domain = "test"definition = "Test definition"@@ -117,12 +117,12 @@ definition = "Test definition"toml_file = tmp_path / "valid.toml"toml_file.write_text(toml_content)- result = failable_load_toml_from_path(str(toml_file))+ result = load_toml_from_path_if_exists(str(toml_file))assert result is not Noneassert result["domain"] == "test"- def test_failable_load_toml_from_path_with_whitespace_works(self, tmp_path: Path) -> None:+ def test_load_toml_from_path_if_exists_with_whitespace_works(self, tmp_path: Path) -> None:"""Test failable loading works normally with whitespace."""toml_content = """domain = "test""""@@ -130,7 +130,7 @@ definition = "Test definition"toml_file.write_text(toml_content)# Should work fine - loading doesn't validate by default- result = failable_load_toml_from_path(str(toml_file))+ result = load_toml_from_path_if_exists(str(toml_file))assert result is not Noneassert result["domain"] == "test"