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.
feature/Keyless-boot-models · L-261005-155130 (#1352)
Louis Choquel6b354dd19149
diff --git a/.drift/acks/cli-docs.toml b/.drift/acks/cli-docs.tomlindex d1fc591de..27ac4e7cb 100644--- a/.drift/acks/cli-docs.toml+++ b/.drift/acks/cli-docs.toml@@ -1,8 +1,8 @@contract = "cli-docs"-digest = "sha256:731ea2ebe457df66277ad5a8175682faa7153284fa7f88e5ea22a68efc744b54"+digest = "sha256:99306940c616bb57196113a07e173e04a4bb173fe716eec33de645d99ad3c2b8"reviewed_by = "Claude (Opus 5.5)"-reviewed_at = "2026-10-05T16:08:22Z"-rationale = "clean-pass: pipelex init now escapes the target directory and the credentials path before printing them as Rich markup, so a bracketed PIPELEX_HOME prints verbatim; no flag, help text or documented output changed, and docs/tools/cli/init.md already names the home configuration directory."+reviewed_at = "2026-10-06T00:00:23Z"+rationale = "clean-pass: the show backends change only escapes the endpoint and variable names before Rich renders them, so a bracketed name prints as written, which is what docs/tools/cli/show.md already says the command shows; the run core change rewrites a comment only. Re-read run.md's dry-run claims (no credentials needed) and show.md's no-resolution paragraph against the code: both hold. pipelex/cli/agent_cli/CLAUDE.md names no surface either change touched."[trigger_files]"pipelex/cli/__init__.py" = "blob:8b137891791fe96927ad78e64b0aad7bded08bdc"@@ -10,7 +10,7 @@ rationale = "clean-pass: pipelex init now escapes the target directory and the c"pipelex/cli/agent_cli/__init__.py" = "blob:e69de29bb2d1d6434b8b29ae775ad8c2e48c5391""pipelex/cli/agent_cli/_agent_cli.py" = "blob:9241b520ba209867c37330551101bdd5d262ac88""pipelex/cli/agent_cli/commands/__init__.py" = "blob:e69de29bb2d1d6434b8b29ae775ad8c2e48c5391"-"pipelex/cli/agent_cli/commands/agent_cli_factory.py" = "blob:3a70f3a7fe2670510c0ca7748a4fdba6f33db318"+"pipelex/cli/agent_cli/commands/agent_cli_factory.py" = "blob:57b6a4d76b918626218633873273adbddfaac97d""pipelex/cli/agent_cli/commands/agent_output.py" = "blob:506eabec37ab3b06644b6ae4c321a91780241161""pipelex/cli/agent_cli/commands/bundle_path_resolver.py" = "blob:a1904517c731afb72af7d49adf6d217dc50b2660""pipelex/cli/agent_cli/commands/check_model_cmd.py" = "blob:42a6b8c02a1d103394e12243181af8ea1c16f31d"@@ -50,7 +50,7 @@ rationale = "clean-pass: pipelex init now escapes the target directory and the c"pipelex/cli/agent_cli/commands/validate/method_cmd.py" = "blob:0f4cf76d99b39422610c5daf6b5a0500de234818""pipelex/cli/agent_cli/commands/validate/pipe_cmd.py" = "blob:9a315ab32c89430c8ea111a0a50e629ed1acd6bf""pipelex/cli/bundle_target_resolution.py" = "blob:460aa997ea0886c6faee0f3a42bd55231c480240"-"pipelex/cli/cli_factory.py" = "blob:27167bc7ee2b8543a87323d2caf4196efd3e7573"+"pipelex/cli/cli_factory.py" = "blob:315842c19e173ccb7f57d0c5fee955154624c0dd""pipelex/cli/commands/__init__.py" = "blob:e69de29bb2d1d6434b8b29ae775ad8c2e48c5391""pipelex/cli/commands/build/__init__.py" = "blob:e69de29bb2d1d6434b8b29ae775ad8c2e48c5391""pipelex/cli/commands/build/app.py" = "blob:d3205e1dc0268a9d32a517e4f9a9a3b4647e8889"@@ -74,7 +74,7 @@ rationale = "clean-pass: pipelex init now escapes the target directory and the c"pipelex/cli/commands/codegen/inputs_cmd.py" = "blob:28b22cfbca717d3f5ee75162b68e132439655deb""pipelex/cli/commands/codegen/types_cmd.py" = "blob:27d7a06d571ad832b449d21b6f9eb66c017fb197""pipelex/cli/commands/crate_loading.py" = "blob:3d7d651931ecf1a15a3e2d72411b3212b55d74ef"-"pipelex/cli/commands/doctor_cmd.py" = "blob:aba718233ff3a55bf152b24984a8f79be381f17e"+"pipelex/cli/commands/doctor_cmd.py" = "blob:33937d62ee5168690dae5146611ade0d6c44c126""pipelex/cli/commands/fix/__init__.py" = "blob:e69de29bb2d1d6434b8b29ae775ad8c2e48c5391""pipelex/cli/commands/fix/_diff_sandbox.py" = "blob:d39c0df92b95567f74881deb01f8c1b3119fc8ef""pipelex/cli/commands/fix/_fix_core.py" = "blob:aa698305e6b60dfb7caf133698dc1d5c1f5f68f1"@@ -101,13 +101,13 @@ rationale = "clean-pass: pipelex init now escapes the target directory and the c"pipelex/cli/commands/run/_inputs_file_loader.py" = "blob:957e6eb00531d168b3b1e179a517717d069cb7fc""pipelex/cli/commands/run/_inputs_path_resolver.py" = "blob:c8ec89d98718e18af7aaaded44c9f545be60adab""pipelex/cli/commands/run/_main_stuff_file.py" = "blob:ca806e55085aa2e5748492751521296ce1f42960"-"pipelex/cli/commands/run/_run_core.py" = "blob:bf092cc1bfeb5e6c091aedf0e2f1c34efee83b02"+"pipelex/cli/commands/run/_run_core.py" = "blob:3d09a8142b4f5a22db7239b8eab6d199ea999eff""pipelex/cli/commands/run/app.py" = "blob:a7090b0ff6bf2f1d47827fa27d2a138096a2e148""pipelex/cli/commands/run/bundle_cmd.py" = "blob:13d68d533986c3938b1b2ee808819d8daf6f91db""pipelex/cli/commands/run/exceptions.py" = "blob:e9552226e597922b6ac0757f7b52eb880a2e1472""pipelex/cli/commands/run/method_cmd.py" = "blob:9f5c7b6ad8f7fc7d086a9e6253049c6e2ec3e7d8""pipelex/cli/commands/run/pipe_cmd.py" = "blob:f92fcb94e3ad55cf5aeec366a59fa7a74bcc9667"-"pipelex/cli/commands/show_cmd.py" = "blob:ffddb6bd91ab503d691ff41a5ae7d1f745786f36"+"pipelex/cli/commands/show_cmd.py" = "blob:4c87c70058ea3b15827d03a370f3345569a2b705""pipelex/cli/commands/update_cmd.py" = "blob:b2db6170ddd9c67f17d88096ba1f1796a897557d""pipelex/cli/commands/validate/__init__.py" = "blob:e69de29bb2d1d6434b8b29ae775ad8c2e48c5391""pipelex/cli/commands/validate/_validate_core.py" = "blob:27c343323180c73280f4ad5f29336811d06cf635"diff --git a/.drift/acks/pipelex-kernel-docs.toml b/.drift/acks/pipelex-kernel-docs.tomlindex e7cd0d39e..1917cdba0 100644--- a/.drift/acks/pipelex-kernel-docs.toml+++ b/.drift/acks/pipelex-kernel-docs.toml@@ -1,8 +1,8 @@contract = "pipelex-kernel-docs"-digest = "sha256:9def7a7729aac507aaf746de8fe79a8ea65c22d5c3d54a99347122a3d92c0357"+digest = "sha256:db78d8e45be9c93a67d013d0d1b9b09dbe9bb8f429deb6804db5ed678868afff"reviewed_by = "Claude (Opus 5.5)"-reviewed_at = "2026-10-04T16:18:57Z"-rationale = "clean-pass: the boot-contract test's docstring now says an offline boot skips the remote config fetch rather than the removed first-run gate; its calls are unchanged, and docs/under-the-hood/pipelex-kernel.md names no first-run check, onboarding flag or inference setup state, so nothing on the page moved."+reviewed_at = "2026-10-05T23:28:51Z"+rationale = "real-catch: docs/under-the-hood/pipelex-kernel.md said a keyless boot uses no credentials, which the code contradicted (it substituted every backend's credentials and dropped the backends missing one); it now says the boot loads every enabled backend and model and resolves no credential. The trigger, judgment_ops.resolve_judgment_setting, changed only its docstring example; re-read its body: on a dry run a model no backend serves still keeps the deck's handle, which the page's judgment paragraph states as is."[trigger_files]"pipelex/kernel/__init__.py" = "blob:c4f1b0fe2ccc17db9110733f71b612f4ac1ba4ce"@@ -16,7 +16,7 @@ rationale = "clean-pass: the boot-contract test's docstring now says an offline"pipelex/kernel/img_gen_ops.py" = "blob:b85360f6c118e93be53bf8d1a04504ccb7552469""pipelex/kernel/img_gen_prompt.py" = "blob:e4f72040561929aa0d96ad5f00b1c4af652d3f77""pipelex/kernel/img_gen_results.py" = "blob:46b4ca11c70d906ae6d58ce66461f9b3414f1bfa"-"pipelex/kernel/judgment_ops.py" = "blob:b205e52e30b55c50e215d5fa2fd4db94ededf347"+"pipelex/kernel/judgment_ops.py" = "blob:efeae1fe68ad417ad98e0fe307d090a1b452f9e4""pipelex/kernel/judgment_results.py" = "blob:40ba1258cc81d34df3e427d5511ccd40c6edf789""pipelex/kernel/llm_ops.py" = "blob:64a6d3d77a165f4f70614ced69876f56d873a8c7""pipelex/kernel/llm_prompt_content.py" = "blob:3fade4a660226e63ad4f916952ee37d34e7d2bbd"diff --git a/.test_durations b/.test_durationsindex 0a579f11a..9bcc07bfd 100644--- a/.test_durations+++ b/.test_durations@@ -1439,8 +1439,15 @@"tests/integration/pipelex/system/test_keyless_boot_forced_dry.py::TestKeylessBootForcedDry::test_keyless_boot_does_not_legalise_mock_usage_on_a_live_request": 0.8879,"tests/integration/pipelex/system/test_keyless_boot_forced_dry.py::TestKeylessBootForcedDry::test_keyless_boot_forces_dry_on_the_kernel_factory_too": 1.0051,"tests/integration/pipelex/system/test_keyless_boot_forced_dry.py::TestKeylessBootForcedDry::test_keyless_boot_needs_no_key_for_an_enabled_judgment_backend": 0.1068,- "tests/integration/pipelex/system/test_keyless_boot_forced_dry.py::TestKeylessBootForcedDry::test_keyless_boot_validates_a_judge_whose_model_backend_it_skipped": 0.1104,"tests/integration/pipelex/system/test_keyless_boot_forced_dry.py::TestKeylessBootForcedDry::test_keyless_direct_boot_inline_generator_and_forced_dry": 0.9896,+ "tests/integration/pipelex/system/test_keyless_boot_forced_dry.py::TestKeylessBootForcedDry::test_keyless_boot_validates_a_judge_whose_model_backend_has_no_key": 0.1104,+ "tests/integration/pipelex/system/test_keyless_boot_model_metadata.py::TestKeylessBootModelMetadata::test_a_keyless_boot_without_keys_knows_what_a_keyed_boot_with_every_key_knows": 0.01,+ "tests/integration/pipelex/system/test_keyless_boot_model_metadata.py::TestKeylessBootModelMetadata::test_a_keyless_boot_without_keys_validates_a_bundle_naming_keyed_models[search_presets]": 0.01,+ "tests/integration/pipelex/system/test_keyless_boot_model_metadata.py::TestKeylessBootModelMetadata::test_a_keyless_boot_without_keys_validates_a_bundle_naming_keyed_models[bare_handle]": 0.01,+ "tests/integration/pipelex/system/test_keyless_boot_model_metadata.py::TestKeylessBootModelMetadata::test_a_keyless_boot_refuses_to_hand_out_a_backend_it_did_not_credential": 0.01,+ "tests/integration/pipelex/system/test_keyless_boot_model_metadata.py::TestKeylessBootModelMetadata::test_a_boot_that_needs_inference_still_refuses_to_start_without_a_key": 0.01,+ "tests/integration/pipelex/system/test_keyless_boot_model_metadata.py::TestKeylessBootModelMetadata::test_a_routing_profile_naming_a_disabled_backend_is_refused_on_both_boots[True]": 0.01,+ "tests/integration/pipelex/system/test_keyless_boot_model_metadata.py::TestKeylessBootModelMetadata::test_a_routing_profile_naming_a_disabled_backend_is_refused_on_both_boots[False]": 0.01,"tests/integration/pipelex/system/test_load_config.py::TestLoadConfig::test_kit_config_matches_defaults": 0.0956,"tests/integration/pipelex/system/test_load_config.py::TestLoadConfig::test_load_config": 0.985,"tests/integration/pipelex/test_extras/test_mthds_corpus_entries.py::TestMthdsCorpusEntries::test_invalid_entry_fails_with_exactly_its_declared_error[NOTSET]": 0.0002,@@ -2480,7 +2487,6 @@"tests/unit/pipelex/cli/test_doctor_backend_checks.py::TestDoctorBackendChecks::test_backend_files_library_error_about_another_backend": 3.4029,"tests/unit/pipelex/cli/test_doctor_backend_checks.py::TestDoctorBackendChecks::test_backend_files_library_error_naming_backend": 0.0027,"tests/unit/pipelex/cli/test_doctor_backend_checks.py::TestDoctorBackendChecks::test_backend_files_library_error_not_naming_backend": 0.0042,- "tests/unit/pipelex/cli/test_doctor_backend_checks.py::TestDoctorBackendChecks::test_backend_files_malformed_file_still_caught_under_leniency": 1.2559,"tests/unit/pipelex/cli/test_doctor_backend_checks.py::TestDoctorBackendChecks::test_backend_files_no_backends_dir": 0.0017,"tests/unit/pipelex/cli/test_doctor_backend_checks.py::TestDoctorBackendChecks::test_backend_files_no_backends_toml": 0.005,"tests/unit/pipelex/cli/test_doctor_backend_checks.py::TestDoctorBackendChecks::test_backend_files_read_the_override_over_the_base": 4.1443,@@ -2499,6 +2505,7 @@"tests/unit/pipelex/cli/test_doctor_backend_checks.py::TestDoctorBackendChecks::test_replace_backend_file_dry_run_does_not_write": 0.002,"tests/unit/pipelex/cli/test_doctor_backend_checks.py::TestDoctorBackendChecks::test_replace_backend_file_missing_template": 0.0746,"tests/unit/pipelex/cli/test_doctor_backend_checks.py::TestDoctorBackendChecks::test_replace_backend_file_writes_template": 0.0031,+ "tests/unit/pipelex/cli/test_doctor_backend_checks.py::TestDoctorBackendChecks::test_backend_files_malformed_file_still_caught_without_resolving_credentials": 1.2559,"tests/unit/pipelex/cli/test_doctor_check_models.py::TestCheckModels::test_a_backends_document_that_does_not_parse_is_a_reported_finding": 0.0584,"tests/unit/pipelex/cli/test_doctor_check_models.py::TestCheckModels::test_a_credentials_error_quoting_the_providers_text_is_redacted_in_the_row": 0.0992,"tests/unit/pipelex/cli/test_doctor_check_models.py::TestCheckModels::test_a_provider_failing_on_a_lookup_is_a_row_finding_quoted_redacted": 0.1676,@@ -2916,6 +2923,8 @@"tests/unit/pipelex/cli/test_show_cmd.py::TestShowCmd::test_do_show_config_pretty_prints_loaded_config": 0.7697,"tests/unit/pipelex/cli/test_show_cmd.py::TestShowCmd::test_do_show_config_wraps_toml_error": 0.0009,"tests/unit/pipelex/cli/test_show_cmd.py::TestShowCmd::test_do_show_pipe_pretty_prints_pipe": 0.0017,+ "tests/unit/pipelex/cli/test_show_cmd.py::TestShowCmd::test_do_show_backends_lists_a_backend_whose_credentials_this_boot_did_not_resolve": 0.0031,+ "tests/unit/pipelex/cli/test_show_cmd.py::TestShowCmd::test_do_show_backends_prints_a_bracketed_variable_name_as_written": 0.0031,"tests/unit/pipelex/cli/test_stdin_resolver.py::TestStdinResolver::test_alias_skip": 0.0004,"tests/unit/pipelex/cli/test_stdin_resolver.py::TestStdinResolver::test_ambiguous_auto_dir_raises_when_no_stdin": 0.0952,"tests/unit/pipelex/cli/test_stdin_resolver.py::TestStdinResolver::test_auto_detected_path_used_when_no_stdin": 0.0017,@@ -4287,23 +4296,23 @@"tests/unit/pipelex/cogt/llm/test_structured_output.py::TestStructureMethod::test_every_structure_method_is_accepted_on_the_openai_sdk[instructor/vertexai_tools]": 0.0083,"tests/unit/pipelex/cogt/llm/test_structured_output.py::TestStructureMethod::test_every_structure_method_is_accepted_on_the_openai_sdk[instructor/writer_tools]": 0.0121,"tests/unit/pipelex/cogt/llm/test_structured_output.py::TestStructureMethod::test_legacy_modes_cover_every_member": 0.0638,- "tests/unit/pipelex/cogt/model_backends/test_backend_boot_tolerance.py::TestAStaleBackendDirectory::test_a_file_the_ledger_only_half_explains_raises_the_users_own_error[False]": 0.1716,- "tests/unit/pipelex/cogt/model_backends/test_backend_boot_tolerance.py::TestAStaleBackendDirectory::test_a_file_the_ledger_only_half_explains_raises_the_users_own_error[True]": 0.1165,- "tests/unit/pipelex/cogt/model_backends/test_backend_boot_tolerance.py::TestAStaleBackendDirectory::test_a_healthy_directory_loads_and_says_nothing[False]": 0.0183,- "tests/unit/pipelex/cogt/model_backends/test_backend_boot_tolerance.py::TestAStaleBackendDirectory::test_a_healthy_directory_loads_and_says_nothing[True]": 1.0454,"tests/unit/pipelex/cogt/model_backends/test_backend_boot_tolerance.py::TestAStaleBackendDirectory::test_a_healthy_directory_never_reaches_the_migration_engine": 0.0098,- "tests/unit/pipelex/cogt/model_backends/test_backend_boot_tolerance.py::TestAStaleBackendDirectory::test_a_key_the_user_chose_to_have_is_still_fatal[False]": 0.1314,- "tests/unit/pipelex/cogt/model_backends/test_backend_boot_tolerance.py::TestAStaleBackendDirectory::test_a_key_the_user_chose_to_have_is_still_fatal[True]": 0.1436,- "tests/unit/pipelex/cogt/model_backends/test_backend_boot_tolerance.py::TestAStaleBackendDirectory::test_a_stale_directory_loads_the_same_models_the_current_files_would[False]": 0.5998,- "tests/unit/pipelex/cogt/model_backends/test_backend_boot_tolerance.py::TestAStaleBackendDirectory::test_a_stale_directory_loads_the_same_models_the_current_files_would[True]": 0.2879,- "tests/unit/pipelex/cogt/model_backends/test_backend_boot_tolerance.py::TestAStaleBackendDirectory::test_it_parks_one_warning_naming_every_stale_file_and_the_remedy[False]": 0.5379,- "tests/unit/pipelex/cogt/model_backends/test_backend_boot_tolerance.py::TestAStaleBackendDirectory::test_it_parks_one_warning_naming_every_stale_file_and_the_remedy[True]": 0.2515,"tests/unit/pipelex/cogt/model_backends/test_backend_boot_tolerance.py::TestAStaleBackendDirectory::test_nothing_is_written_to_disk": 0.6424,"tests/unit/pipelex/cogt/model_backends/test_backend_boot_tolerance.py::TestAStaleBackendDirectory::test_the_warning_carries_no_value_read_from_the_users_file": 0.2048,- "tests/unit/pipelex/cogt/model_backends/test_backend_boot_tolerance.py::TestThePreviousReleaseKit::test_as_left_its_enabled_gateway_serving_no_model_is_refused[False]": 0.0095,- "tests/unit/pipelex/cogt/model_backends/test_backend_boot_tolerance.py::TestThePreviousReleaseKit::test_as_left_its_enabled_gateway_serving_no_model_is_refused[True]": 0.0698,- "tests/unit/pipelex/cogt/model_backends/test_backend_boot_tolerance.py::TestThePreviousReleaseKit::test_its_backends_and_active_routing_profile_load_once_remedied[False]": 0.0242,- "tests/unit/pipelex/cogt/model_backends/test_backend_boot_tolerance.py::TestThePreviousReleaseKit::test_its_backends_and_active_routing_profile_load_once_remedied[True]": 0.0304,+ "tests/unit/pipelex/cogt/model_backends/test_backend_boot_tolerance.py::TestAStaleBackendDirectory::test_a_healthy_directory_loads_and_says_nothing[skip]": 0.1375,+ "tests/unit/pipelex/cogt/model_backends/test_backend_boot_tolerance.py::TestAStaleBackendDirectory::test_a_healthy_directory_loads_and_says_nothing[require]": 0.1375,+ "tests/unit/pipelex/cogt/model_backends/test_backend_boot_tolerance.py::TestAStaleBackendDirectory::test_a_stale_directory_loads_the_same_models_the_current_files_would[skip]": 0.1375,+ "tests/unit/pipelex/cogt/model_backends/test_backend_boot_tolerance.py::TestAStaleBackendDirectory::test_a_stale_directory_loads_the_same_models_the_current_files_would[require]": 0.1375,+ "tests/unit/pipelex/cogt/model_backends/test_backend_boot_tolerance.py::TestAStaleBackendDirectory::test_it_parks_one_warning_naming_every_stale_file_and_the_remedy[skip]": 0.1375,+ "tests/unit/pipelex/cogt/model_backends/test_backend_boot_tolerance.py::TestAStaleBackendDirectory::test_it_parks_one_warning_naming_every_stale_file_and_the_remedy[require]": 0.1375,+ "tests/unit/pipelex/cogt/model_backends/test_backend_boot_tolerance.py::TestAStaleBackendDirectory::test_a_key_the_user_chose_to_have_is_still_fatal[skip]": 0.1375,+ "tests/unit/pipelex/cogt/model_backends/test_backend_boot_tolerance.py::TestAStaleBackendDirectory::test_a_key_the_user_chose_to_have_is_still_fatal[require]": 0.1375,+ "tests/unit/pipelex/cogt/model_backends/test_backend_boot_tolerance.py::TestAStaleBackendDirectory::test_a_file_the_ledger_only_half_explains_raises_the_users_own_error[skip]": 0.1375,+ "tests/unit/pipelex/cogt/model_backends/test_backend_boot_tolerance.py::TestAStaleBackendDirectory::test_a_file_the_ledger_only_half_explains_raises_the_users_own_error[require]": 0.1375,+ "tests/unit/pipelex/cogt/model_backends/test_backend_boot_tolerance.py::TestThePreviousReleaseKit::test_as_left_its_enabled_gateway_serving_no_model_is_refused[skip]": 0.1375,+ "tests/unit/pipelex/cogt/model_backends/test_backend_boot_tolerance.py::TestThePreviousReleaseKit::test_as_left_its_enabled_gateway_serving_no_model_is_refused[require]": 0.1375,+ "tests/unit/pipelex/cogt/model_backends/test_backend_boot_tolerance.py::TestThePreviousReleaseKit::test_its_backends_and_active_routing_profile_load_once_remedied[skip]": 0.1375,+ "tests/unit/pipelex/cogt/model_backends/test_backend_boot_tolerance.py::TestThePreviousReleaseKit::test_its_backends_and_active_routing_profile_load_once_remedied[require]": 0.1375,"tests/unit/pipelex/cogt/model_backends/test_backend_credentials.py::TestBackendCredentials::test_backend_credentials_report_round_trip": 0.8064,"tests/unit/pipelex/cogt/model_backends/test_backend_credentials.py::TestBackendCredentials::test_comprehensive_env_both_kinds_one_backend": 0.0012,"tests/unit/pipelex/cogt/model_backends/test_backend_credentials.py::TestBackendCredentials::test_comprehensive_env_missing_vars_only": 0.0007,@@ -4314,40 +4323,64 @@"tests/unit/pipelex/cogt/model_backends/test_backend_credentials.py::TestBackendCredentials::test_credentials_validation_report_round_trip": 0.0004,"tests/unit/pipelex/cogt/model_backends/test_backend_credentials.py::TestBackendCredentials::test_one_variable_missing_env_provider": 0.0012,"tests/unit/pipelex/cogt/model_backends/test_backend_credentials.py::TestBackendCredentials::test_one_variable_missing_generic_provider": 0.002,- "tests/unit/pipelex/cogt/model_backends/test_backend_library_leniency.py::TestBackendLibraryLeniency::test_a_header_shaped_key_the_wire_cannot_carry_is_fatal_in_both_modes[False]": 0.0025,- "tests/unit/pipelex/cogt/model_backends/test_backend_library_leniency.py::TestBackendLibraryLeniency::test_a_header_shaped_key_the_wire_cannot_carry_is_fatal_in_both_modes[True]": 0.0026,- "tests/unit/pipelex/cogt/model_backends/test_backend_library_leniency.py::TestBackendLibraryLeniency::test_a_header_shaped_key_with_a_non_string_value_is_fatal_in_both_modes[False]": 0.0034,- "tests/unit/pipelex/cogt/model_backends/test_backend_library_leniency.py::TestBackendLibraryLeniency::test_a_header_shaped_key_with_a_non_string_value_is_fatal_in_both_modes[True]": 0.003,- "tests/unit/pipelex/cogt/model_backends/test_backend_library_leniency.py::TestBackendLibraryLeniency::test_a_header_shaped_per_model_key_still_becomes_a_request_header": 0.0014,- "tests/unit/pipelex/cogt/model_backends/test_backend_library_leniency.py::TestBackendLibraryLeniency::test_a_header_value_the_wire_cannot_carry_is_fatal_in_both_modes[False]": 0.0028,- "tests/unit/pipelex/cogt/model_backends/test_backend_library_leniency.py::TestBackendLibraryLeniency::test_a_header_value_the_wire_cannot_carry_is_fatal_in_both_modes[True]": 0.0023,- "tests/unit/pipelex/cogt/model_backends/test_backend_library_leniency.py::TestBackendLibraryLeniency::test_a_hyphenated_spelling_of_a_known_field_is_fatal_and_names_the_field": 0.003,- "tests/unit/pipelex/cogt/model_backends/test_backend_library_leniency.py::TestBackendLibraryLeniency::test_a_missing_backend_credential_is_skipped_leniently": 0.0753,- "tests/unit/pipelex/cogt/model_backends/test_backend_library_leniency.py::TestBackendLibraryLeniency::test_a_missing_credential_raises_a_credentials_error_when_strict[\\n[acme]\\nenabled = true\\napi_key = \"${PIPELEX_TEST_ABSENT_VAR_FOR_LENIENCY}\"\\n-\\n[defaults]\\nmodel_type = \"llm\"\\nsdk = \"openai_responses\"\\n\\n[\"acme-one\"]\\nmodel_id = \"acme-one\"\\n]": 0.0016,- "tests/unit/pipelex/cogt/model_backends/test_backend_library_leniency.py::TestBackendLibraryLeniency::test_a_missing_credential_raises_a_credentials_error_when_strict[\\n[acme]\\nenabled = true\\napi_key = \"sk-not-a-real-key\"\\n-\\n[defaults]\\nmodel_type = \"llm\"\\nsdk = \"openai_responses\"\\n\\n[\"acme-one\"]\\nmodel_id = \"${PIPELEX_TEST_ABSENT_VAR_FOR_LENIENCY}\"\\n]": 0.1307,- "tests/unit/pipelex/cogt/model_backends/test_backend_library_leniency.py::TestBackendLibraryLeniency::test_a_missing_model_spec_credential_is_skipped_leniently": 0.0715,- "tests/unit/pipelex/cogt/model_backends/test_backend_library_leniency.py::TestBackendLibraryLeniency::test_a_missing_per_backend_toml_is_fatal_in_both_modes[False]": 0.0014,- "tests/unit/pipelex/cogt/model_backends/test_backend_library_leniency.py::TestBackendLibraryLeniency::test_a_missing_per_backend_toml_is_fatal_in_both_modes[True]": 0.001,- "tests/unit/pipelex/cogt/model_backends/test_backend_library_leniency.py::TestBackendLibraryLeniency::test_a_well_formed_backend_loads": 0.7747,- "tests/unit/pipelex/cogt/model_backends/test_backend_library_leniency.py::TestBackendLibraryLeniency::test_an_unknown_key_in_a_local_backend_is_fatal_in_both_modes[False]": 0.0033,- "tests/unit/pipelex/cogt/model_backends/test_backend_library_leniency.py::TestBackendLibraryLeniency::test_an_unknown_key_in_a_local_backend_is_fatal_in_both_modes[True]": 0.0048,- "tests/unit/pipelex/cogt/model_backends/test_backend_library_leniency.py::TestBackendLibraryLeniency::test_an_unknown_per_model_key_in_a_local_backend_is_fatal_in_both_modes[False]": 0.0036,- "tests/unit/pipelex/cogt/model_backends/test_backend_library_leniency.py::TestBackendLibraryLeniency::test_an_unknown_per_model_key_in_a_local_backend_is_fatal_in_both_modes[True]": 0.0036,- "tests/unit/pipelex/cogt/model_backends/test_backend_library_leniency.py::TestBackendLibraryLeniency::test_an_unresolvable_model_spec_fallback_pattern_is_skipped_leniently": 0.0693,- "tests/unit/pipelex/cogt/model_backends/test_backend_library_leniency.py::TestBackendLibraryLeniency::test_an_unresolvable_model_spec_fallback_pattern_raises_a_credentials_error_when_strict": 0.0026,+ "tests/unit/pipelex/cogt/model_backends/test_backend_library_malformed_configuration.py::TestMalformedConfigurationIsFatalInBothModes::test_a_well_formed_backend_loads": 0.0017,+ "tests/unit/pipelex/cogt/model_backends/test_backend_library_malformed_configuration.py::TestMalformedConfigurationIsFatalInBothModes::test_an_unknown_key_in_a_local_backend_is_fatal_in_both_modes[require]": 0.0017,+ "tests/unit/pipelex/cogt/model_backends/test_backend_library_malformed_configuration.py::TestMalformedConfigurationIsFatalInBothModes::test_an_unknown_key_in_a_local_backend_is_fatal_in_both_modes[skip]": 0.0017,+ "tests/unit/pipelex/cogt/model_backends/test_backend_library_malformed_configuration.py::TestMalformedConfigurationIsFatalInBothModes::test_an_unknown_per_model_key_in_a_local_backend_is_fatal_in_both_modes[require]": 0.0017,+ "tests/unit/pipelex/cogt/model_backends/test_backend_library_malformed_configuration.py::TestMalformedConfigurationIsFatalInBothModes::test_an_unknown_per_model_key_in_a_local_backend_is_fatal_in_both_modes[skip]": 0.0017,+ "tests/unit/pipelex/cogt/model_backends/test_backend_library_malformed_configuration.py::TestMalformedConfigurationIsFatalInBothModes::test_a_hyphenated_spelling_of_a_known_field_is_fatal_and_names_the_field": 0.0017,+ "tests/unit/pipelex/cogt/model_backends/test_backend_library_malformed_configuration.py::TestMalformedConfigurationIsFatalInBothModes::test_a_header_shaped_key_with_a_non_string_value_is_fatal_in_both_modes[require]": 0.0017,+ "tests/unit/pipelex/cogt/model_backends/test_backend_library_malformed_configuration.py::TestMalformedConfigurationIsFatalInBothModes::test_a_header_shaped_key_with_a_non_string_value_is_fatal_in_both_modes[skip]": 0.0017,+ "tests/unit/pipelex/cogt/model_backends/test_backend_library_malformed_configuration.py::TestMalformedConfigurationIsFatalInBothModes::test_a_header_shaped_key_the_wire_cannot_carry_is_fatal_in_both_modes[require]": 0.0017,+ "tests/unit/pipelex/cogt/model_backends/test_backend_library_malformed_configuration.py::TestMalformedConfigurationIsFatalInBothModes::test_a_header_shaped_key_the_wire_cannot_carry_is_fatal_in_both_modes[skip]": 0.0017,+ "tests/unit/pipelex/cogt/model_backends/test_backend_library_malformed_configuration.py::TestMalformedConfigurationIsFatalInBothModes::test_a_header_value_the_wire_cannot_carry_is_fatal_in_both_modes[require]": 0.0017,+ "tests/unit/pipelex/cogt/model_backends/test_backend_library_malformed_configuration.py::TestMalformedConfigurationIsFatalInBothModes::test_a_header_value_the_wire_cannot_carry_is_fatal_in_both_modes[skip]": 0.0017,+ "tests/unit/pipelex/cogt/model_backends/test_backend_library_malformed_configuration.py::TestMalformedConfigurationIsFatalInBothModes::test_a_header_shaped_per_model_key_still_becomes_a_request_header": 0.0017,+ "tests/unit/pipelex/cogt/model_backends/test_backend_library_malformed_configuration.py::TestMalformedConfigurationIsFatalInBothModes::test_a_missing_per_backend_toml_is_fatal_in_both_modes[require]": 0.0017,+ "tests/unit/pipelex/cogt/model_backends/test_backend_library_malformed_configuration.py::TestMalformedConfigurationIsFatalInBothModes::test_a_missing_per_backend_toml_is_fatal_in_both_modes[skip]": 0.0017,+ "tests/unit/pipelex/cogt/model_backends/test_backend_library_malformed_configuration.py::TestMalformedConfigurationIsFatalInBothModes::test_a_placeholder_in_a_field_describing_the_model_is_fatal_in_both_modes[model_type_in_defaults-require]": 0.0017,+ "tests/unit/pipelex/cogt/model_backends/test_backend_library_malformed_configuration.py::TestMalformedConfigurationIsFatalInBothModes::test_a_placeholder_in_a_field_describing_the_model_is_fatal_in_both_modes[model_type_in_defaults-skip]": 0.0017,+ "tests/unit/pipelex/cogt/model_backends/test_backend_library_malformed_configuration.py::TestMalformedConfigurationIsFatalInBothModes::test_a_placeholder_in_a_field_describing_the_model_is_fatal_in_both_modes[thinking_mode_on_a_model-require]": 0.0017,+ "tests/unit/pipelex/cogt/model_backends/test_backend_library_malformed_configuration.py::TestMalformedConfigurationIsFatalInBothModes::test_a_placeholder_in_a_field_describing_the_model_is_fatal_in_both_modes[thinking_mode_on_a_model-skip]": 0.0017,+ "tests/unit/pipelex/cogt/model_backends/test_backend_library_malformed_configuration.py::TestMalformedConfigurationIsFatalInBothModes::test_a_placeholder_in_a_field_describing_the_model_is_fatal_in_both_modes[listed_constraints_on_a_backend-require]": 0.0017,+ "tests/unit/pipelex/cogt/model_backends/test_backend_library_malformed_configuration.py::TestMalformedConfigurationIsFatalInBothModes::test_a_placeholder_in_a_field_describing_the_model_is_fatal_in_both_modes[listed_constraints_on_a_backend-skip]": 0.0017,+ "tests/unit/pipelex/cogt/model_backends/test_backend_library_malformed_configuration.py::TestMalformedConfigurationIsFatalInBothModes::test_an_unknown_placeholder_prefix_is_fatal_in_both_modes[backend_table-require]": 0.0017,+ "tests/unit/pipelex/cogt/model_backends/test_backend_library_malformed_configuration.py::TestMalformedConfigurationIsFatalInBothModes::test_an_unknown_placeholder_prefix_is_fatal_in_both_modes[backend_table-skip]": 0.0017,+ "tests/unit/pipelex/cogt/model_backends/test_backend_library_malformed_configuration.py::TestMalformedConfigurationIsFatalInBothModes::test_an_unknown_placeholder_prefix_is_fatal_in_both_modes[model_spec-require]": 0.0017,+ "tests/unit/pipelex/cogt/model_backends/test_backend_library_malformed_configuration.py::TestMalformedConfigurationIsFatalInBothModes::test_an_unknown_placeholder_prefix_is_fatal_in_both_modes[model_spec-skip]": 0.0017,+ "tests/unit/pipelex/cogt/model_backends/test_backend_library_malformed_configuration.py::TestMalformedConfigurationIsFatalInBothModes::test_a_templated_field_of_the_wrong_type_is_fatal_in_both_modes[api_key_in_a_list-require]": 0.0017,+ "tests/unit/pipelex/cogt/model_backends/test_backend_library_malformed_configuration.py::TestMalformedConfigurationIsFatalInBothModes::test_a_templated_field_of_the_wrong_type_is_fatal_in_both_modes[api_key_in_a_list-skip]": 0.0017,+ "tests/unit/pipelex/cogt/model_backends/test_backend_library_malformed_configuration.py::TestMalformedConfigurationIsFatalInBothModes::test_a_templated_field_of_the_wrong_type_is_fatal_in_both_modes[extra_config_as_a_string-require]": 0.0017,+ "tests/unit/pipelex/cogt/model_backends/test_backend_library_malformed_configuration.py::TestMalformedConfigurationIsFatalInBothModes::test_a_templated_field_of_the_wrong_type_is_fatal_in_both_modes[extra_config_as_a_string-skip]": 0.0017,+ "tests/unit/pipelex/cogt/model_backends/test_backend_library_malformed_configuration.py::TestMalformedConfigurationIsFatalInBothModes::test_an_unknown_placeholder_prefix_is_fatal_in_both_modes[model_spec_literal_field-require]": 0.0017,+ "tests/unit/pipelex/cogt/model_backends/test_backend_library_malformed_configuration.py::TestMalformedConfigurationIsFatalInBothModes::test_an_unknown_placeholder_prefix_is_fatal_in_both_modes[model_spec_literal_field-skip]": 0.0017,"tests/unit/pipelex/cogt/model_backends/test_backend_library_overrides.py::TestBackendLibraryOverrides::test_a_merged_override_is_logged_and_an_absent_one_is_not": 0.0031,"tests/unit/pipelex/cogt/model_backends/test_backend_library_overrides.py::TestBackendLibraryOverrides::test_a_missing_base_is_not_found_even_when_an_override_exists": 0.0032,"tests/unit/pipelex/cogt/model_backends/test_backend_library_overrides.py::TestBackendLibraryOverrides::test_a_refusal_names_the_base_and_the_override_that_was_read": 0.032,- "tests/unit/pipelex/cogt/model_backends/test_backend_library_overrides.py::TestBackendLibraryOverrides::test_a_scalar_where_a_table_was_meant_is_refused_in_both_modes[False]": 0.0447,- "tests/unit/pipelex/cogt/model_backends/test_backend_library_overrides.py::TestBackendLibraryOverrides::test_a_scalar_where_a_table_was_meant_is_refused_in_both_modes[True]": 0.095,"tests/unit/pipelex/cogt/model_backends/test_backend_library_overrides.py::TestBackendLibraryOverrides::test_an_override_disables_a_backend": 0.0301,"tests/unit/pipelex/cogt/model_backends/test_backend_library_overrides.py::TestBackendLibraryOverrides::test_an_override_enables_a_backend_and_keeps_the_rest_of_its_table": 0.0278,"tests/unit/pipelex/cogt/model_backends/test_backend_library_overrides.py::TestBackendLibraryOverrides::test_an_override_that_does_not_parse_is_the_librarys_refusal_and_names_the_file": 0.002,"tests/unit/pipelex/cogt/model_backends/test_backend_library_overrides.py::TestBackendLibraryOverrides::test_the_base_alone_is_what_it_was": 0.5421,"tests/unit/pipelex/cogt/model_backends/test_backend_library_overrides.py::TestBackendLibraryOverrides::test_the_last_override_wins": 0.035,+ "tests/unit/pipelex/cogt/model_backends/test_backend_library_overrides.py::TestBackendLibraryOverrides::test_a_scalar_where_a_table_was_meant_is_refused_in_both_modes[require]": 0.0698,+ "tests/unit/pipelex/cogt/model_backends/test_backend_library_overrides.py::TestBackendLibraryOverrides::test_a_scalar_where_a_table_was_meant_is_refused_in_both_modes[skip]": 0.0698,+ "tests/unit/pipelex/cogt/model_backends/test_backend_library_require_credentials.py::TestRequireResolvesEveryCredential::test_a_missing_credential_raises_a_credentials_error[\\n[acme]\\nenabled = true\\napi_key = \"${PIPELEX_TEST_ABSENT_VAR_FOR_CREDENTIALS}\"\\n-\\n[defaults]\\nmodel_type = \"llm\"\\nsdk = \"openai_responses\"\\n\\n[\"acme-one\"]\\nmodel_id = \"acme-one\"\\n]": 0.0017,+ "tests/unit/pipelex/cogt/model_backends/test_backend_library_require_credentials.py::TestRequireResolvesEveryCredential::test_a_missing_credential_raises_a_credentials_error[\\n[acme]\\nenabled = true\\napi_key = \"sk-not-a-real-key\"\\n-\\n[defaults]\\nmodel_type = \"llm\"\\nsdk = \"openai_responses\"\\n\\n[\"acme-one\"]\\nmodel_id = \"${PIPELEX_TEST_ABSENT_VAR_FOR_CREDENTIALS}\"\\n]": 0.0017,+ "tests/unit/pipelex/cogt/model_backends/test_backend_library_require_credentials.py::TestRequireResolvesEveryCredential::test_an_unresolvable_model_spec_fallback_pattern_raises_a_credentials_error": 0.0017,+ "tests/unit/pipelex/cogt/model_backends/test_backend_library_require_credentials.py::TestRequireResolvesEveryCredential::test_an_empty_provider_refuses_the_backend": 0.0017,+ "tests/unit/pipelex/cogt/model_backends/test_backend_library_require_credentials.py::TestRequireResolvesEveryCredential::test_a_credentialed_provider_gives_the_substituted_key_and_leaves_nothing_unresolved": 0.0017,+ "tests/unit/pipelex/cogt/model_backends/test_backend_library_skip_credentials.py::TestSkipKeepsEveryBackendAndResolvesNothing::test_it_keeps_the_backend_its_models_and_its_constraints_and_asks_nothing[secrets_provider0]": 0.0017,+ "tests/unit/pipelex/cogt/model_backends/test_backend_library_skip_credentials.py::TestSkipKeepsEveryBackendAndResolvesNothing::test_it_keeps_the_backend_its_models_and_its_constraints_and_asks_nothing[secrets_provider1]": 0.0017,+ "tests/unit/pipelex/cogt/model_backends/test_backend_library_skip_credentials.py::TestSkipKeepsEveryBackendAndResolvesNothing::test_it_leaves_every_templated_field_unset_and_names_its_variables": 0.0017,+ "tests/unit/pipelex/cogt/model_backends/test_backend_library_skip_credentials.py::TestSkipKeepsEveryBackendAndResolvesNothing::test_it_keeps_a_literal_endpoint": 0.0017,+ "tests/unit/pipelex/cogt/model_backends/test_backend_library_skip_credentials.py::TestSkipKeepsEveryBackendAndResolvesNothing::test_a_backend_that_references_no_variable_has_nothing_unresolved": 0.0017,+ "tests/unit/pipelex/cogt/model_backends/test_backend_library_skip_credentials.py::TestSkipKeepsEveryBackendAndResolvesNothing::test_a_templated_model_spec_keeps_its_text_and_names_its_variables[\\n[defaults]\\nmodel_type = \"llm\"\\nsdk = \"openai_responses\"\\n\\n[\"acme-one\"]\\nmodel_id = \"${PIPELEX_TEST_ABSENT_VAR_FOR_CREDENTIALS}\"\\n-expected_vars0]": 0.0017,+ "tests/unit/pipelex/cogt/model_backends/test_backend_library_skip_credentials.py::TestSkipKeepsEveryBackendAndResolvesNothing::test_a_templated_model_spec_keeps_its_text_and_names_its_variables[\\n[defaults]\\nmodel_type = \"llm\"\\nsdk = \"openai_responses\"\\n\\n[\"acme-one\"]\\nmodel_id = \"${env:PIPELEX_TEST_ABSENT_VAR_FOR_CREDENTIALS_A|env:PIPELEX_TEST_ABSENT_VAR_FOR_CREDENTIALS_B}\"\\n-expected_vars1]": 0.0017,+ "tests/unit/pipelex/cogt/model_backends/test_backend_library_skip_credentials.py::TestSkipKeepsEveryBackendAndResolvesNothing::test_a_missing_backend_credential_keeps_the_backend": 0.0017,+ "tests/unit/pipelex/cogt/model_backends/test_backend_library_skip_credentials.py::TestSkipKeepsEveryBackendAndResolvesNothing::test_an_enabled_vertexai_backend_mints_no_token_and_touches_no_file": 0.0017,"tests/unit/pipelex/cogt/model_backends/test_backend_retired_model_specs_section.py::TestBackendRetiredModelSpecsSection::test_a_disabled_backend_naming_it_is_skipped": 0.0012,- "tests/unit/pipelex/cogt/model_backends/test_backend_retired_model_specs_section.py::TestBackendRetiredModelSpecsSection::test_an_enabled_backend_naming_it_is_refused_in_both_modes[False]": 0.0652,- "tests/unit/pipelex/cogt/model_backends/test_backend_retired_model_specs_section.py::TestBackendRetiredModelSpecsSection::test_an_enabled_backend_naming_it_is_refused_in_both_modes[True]": 0.001,+ "tests/unit/pipelex/cogt/model_backends/test_backend_retired_model_specs_section.py::TestBackendRetiredModelSpecsSection::test_an_enabled_backend_naming_it_is_refused_in_both_modes[require]": 0.0331,+ "tests/unit/pipelex/cogt/model_backends/test_backend_retired_model_specs_section.py::TestBackendRetiredModelSpecsSection::test_an_enabled_backend_naming_it_is_refused_in_both_modes[skip]": 0.0331,"tests/unit/pipelex/cogt/model_backends/test_backend_toml_path.py::TestBackendTomlPath::test_an_absolute_backend_name_stays_under_the_backends_directory": 0.1031,"tests/unit/pipelex/cogt/model_backends/test_backend_toml_path.py::TestBackendTomlPath::test_an_ordinary_backend_name_lands_beside_its_siblings": 0.7344,"tests/unit/pipelex/cogt/model_backends/test_model_lister_dispatch.py::TestModelListerDispatch::test_any_listed_progresses_across_sdks": 0.0039,@@ -4457,7 +4490,6 @@"tests/unit/pipelex/cogt/model_routing/test_routing_profile_overrides.py::TestRoutingProfileOverrides::test_an_override_carrying_only_active_switches_the_profile": 0.0788,"tests/unit/pipelex/cogt/model_routing/test_routing_profile_overrides.py::TestRoutingProfileOverrides::test_an_override_replaces_a_list_rather_than_extending_it": 0.041,"tests/unit/pipelex/cogt/model_routing/test_routing_profile_overrides.py::TestRoutingProfileOverrides::test_an_override_that_does_not_parse_is_the_librarys_refusal_and_names_the_file": 0.0029,- "tests/unit/pipelex/cogt/model_routing/test_routing_profile_overrides.py::TestRoutingProfileOverrides::test_lenient_tolerates_a_disabled_backend": 0.071,"tests/unit/pipelex/cogt/model_routing/test_routing_profile_overrides.py::TestRoutingProfileOverrides::test_the_base_alone_is_what_it_was": 0.5345,"tests/unit/pipelex/cogt/model_routing/test_routing_profile_overrides.py::TestRoutingProfileOverrides::test_the_last_override_wins": 0.0263,"tests/unit/pipelex/cogt/models/test_deck_manifest.py::TestDeckManifest::test_compute_file_sha256_is_deterministic": 0.0024,@@ -4631,6 +4663,12 @@"tests/unit/pipelex/cogt/models/test_model_deck_validation_helpers.py::TestModelDeckValidationHelpers::test_detects_waterfall_containing_preset": 0.0007,"tests/unit/pipelex/cogt/models/test_model_deck_validation_helpers.py::TestModelDeckValidationHelpers::test_detects_waterfall_containing_wrong_model_type": 0.0008,"tests/unit/pipelex/cogt/models/test_model_deck_validation_helpers.py::TestModelDeckValidationHelpers::test_no_cycle_when_unprefixed_target_is_not_alias_key": 0.1107,+ "tests/unit/pipelex/cogt/models/test_model_manager_credentials_guard.py::TestModelManagerCredentialsGuard::test_a_backend_left_unresolved_is_refused_with_its_variables": 0.01,+ "tests/unit/pipelex/cogt/models/test_model_manager_credentials_guard.py::TestModelManagerCredentialsGuard::test_its_report_is_a_configuration_error_whose_next_step_is_a_boot_with_inference": 0.01,+ "tests/unit/pipelex/cogt/models/test_model_manager_credentials_guard.py::TestModelManagerCredentialsGuard::test_the_class_keeps_its_own_next_step_elsewhere": 0.01,+ "tests/unit/pipelex/cogt/models/test_model_manager_credentials_guard.py::TestModelManagerCredentialsGuard::test_a_field_minted_at_boot_is_named_when_no_variable_is": 0.01,+ "tests/unit/pipelex/cogt/models/test_model_manager_credentials_guard.py::TestModelManagerCredentialsGuard::test_a_backend_with_nothing_unresolved_is_handed_out": 0.01,+ "tests/unit/pipelex/cogt/models/test_model_manager_credentials_guard.py::TestModelManagerCredentialsGuard::test_an_unknown_backend_is_still_not_found": 0.01,"tests/unit/pipelex/cogt/models/test_model_reference.py::TestConstants::test_namespace_constants": 0.1428,"tests/unit/pipelex/cogt/models/test_model_reference.py::TestConstants::test_sigil_constants": 0.0006,"tests/unit/pipelex/cogt/models/test_model_reference.py::TestModelReferenceHashability::test_model_reference_is_hashable": 0.0006,@@ -10279,6 +10317,10 @@"tests/unit/pipelex/providers/linkup/test_linkup_worker_error_handling.py::TestLinkupWorkerErrorHandling::test_search_user_action_uses_specific_kind[LinkupAuthenticationError-check_credentials]": 0.0015,"tests/unit/pipelex/providers/linkup/test_linkup_worker_error_handling.py::TestLinkupWorkerErrorHandling::test_search_user_action_uses_specific_kind[LinkupInsufficientCreditError-check_billing]": 0.0016,"tests/unit/pipelex/providers/linkup/test_linkup_worker_error_handling.py::TestLinkupWorkerErrorHandling::test_search_user_action_uses_specific_kind[LinkupTooManyRequestsError-wait_and_retry]": 0.002,+ "tests/unit/pipelex/providers/linkup/test_linkup_workers_backend_key.py::TestLinkupWorkersTakeTheBackendKey::test_the_worker_calls_linkup_with_the_backends_own_key[search]": 0.0017,+ "tests/unit/pipelex/providers/linkup/test_linkup_workers_backend_key.py::TestLinkupWorkersTakeTheBackendKey::test_the_worker_calls_linkup_with_the_backends_own_key[extract]": 0.0017,+ "tests/unit/pipelex/providers/linkup/test_linkup_workers_backend_key.py::TestLinkupWorkersTakeTheBackendKey::test_a_backend_with_no_key_is_refused_before_any_client_is_built[search]": 0.0017,+ "tests/unit/pipelex/providers/linkup/test_linkup_workers_backend_key.py::TestLinkupWorkersTakeTheBackendKey::test_a_backend_with_no_key_is_refused_before_any_client_is_built[extract]": 0.0017,"tests/unit/pipelex/providers/log_sinks/test_gcp_credentials_file_path_variable.py::TestGcpCredentialsFilePathVariable::test_a_key_path_variable_that_does_not_resolve_stops_the_boot_naming_it": 0.0145,"tests/unit/pipelex/providers/log_sinks/test_gcp_credentials_file_path_variable.py::TestGcpCredentialsFilePathVariable::test_a_plain_key_path_is_handed_over_as_written_with_no_placeholder": 0.0141,"tests/unit/pipelex/providers/log_sinks/test_gcp_credentials_file_path_variable.py::TestGcpCredentialsFilePathVariable::test_an_unset_key_path_stays_unset_for_application_default_credentials": 0.012,@@ -12352,6 +12394,17 @@"tests/unit/pipelex/tools/network/test_ssrf_guard.py::TestSsrfGuard::test_resolve_returns_all_public_ips_in_order": 0.0067,"tests/unit/pipelex/tools/network/test_ssrf_guard.py::TestSsrfGuard::test_resolve_returns_public_ip": 0.8865,"tests/unit/pipelex/tools/network/test_ssrf_guard.py::TestSsrfGuard::test_transport_aborts_request_to_private_resolution": 0.1716,+ "tests/unit/pipelex/tools/secrets/test_placeholder_var_names.py::TestPlaceholderVarNames::test_it_names_every_variable_once_in_order[no placeholder at all-expected0]": 0.0017,+ "tests/unit/pipelex/tools/secrets/test_placeholder_var_names.py::TestPlaceholderVarNames::test_it_names_every_variable_once_in_order[${API_KEY}-expected1]": 0.0017,+ "tests/unit/pipelex/tools/secrets/test_placeholder_var_names.py::TestPlaceholderVarNames::test_it_names_every_variable_once_in_order[Bearer ${env:TOKEN}-expected2]": 0.0017,+ "tests/unit/pipelex/tools/secrets/test_placeholder_var_names.py::TestPlaceholderVarNames::test_it_names_every_variable_once_in_order[${secret:API_KEY}-expected3]": 0.0017,+ "tests/unit/pipelex/tools/secrets/test_placeholder_var_names.py::TestPlaceholderVarNames::test_it_names_every_variable_once_in_order[${env:PRIMARY|secret:FALLBACK}-expected4]": 0.0017,+ "tests/unit/pipelex/tools/secrets/test_placeholder_var_names.py::TestPlaceholderVarNames::test_it_names_every_variable_once_in_order[${env: SPACED | secret: OTHER }-expected5]": 0.0017,+ "tests/unit/pipelex/tools/secrets/test_placeholder_var_names.py::TestPlaceholderVarNames::test_it_names_every_variable_once_in_order[${A}/${B}/${A}-expected6]": 0.0017,+ "tests/unit/pipelex/tools/secrets/test_placeholder_var_names.py::TestPlaceholderVarNames::test_it_asks_no_provider_and_reads_no_environment": 0.0017,+ "tests/unit/pipelex/tools/secrets/test_placeholder_var_names.py::TestPlaceholderVarNames::test_it_names_every_variable_once_in_order[\"${QUOTED}\"-expected7]": 0.0017,+ "tests/unit/pipelex/tools/secrets/test_placeholder_var_names.py::TestPlaceholderVarNames::test_it_refuses_a_prefix_substitution_would_refuse[${foo:BAR}]": 0.0017,+ "tests/unit/pipelex/tools/secrets/test_placeholder_var_names.py::TestPlaceholderVarNames::test_it_refuses_a_prefix_substitution_would_refuse[${env:A|secrte:B}]": 0.0017,"tests/unit/pipelex/tools/secrets/test_secrets_utils.py::TestSubstituteVars::test_complex_variable_names": 0.0048,"tests/unit/pipelex/tools/secrets/test_secrets_utils.py::TestSubstituteVars::test_env_takes_precedence_in_fallback": 0.0014,"tests/unit/pipelex/tools/secrets/test_secrets_utils.py::TestSubstituteVars::test_explicit_env_substitution": 0.0014,@@ -12373,6 +12426,7 @@"tests/unit/pipelex/tools/secrets/test_secrets_utils.py::TestSubstituteVars::test_simple_secret_substitution": 0.7356,"tests/unit/pipelex/tools/secrets/test_secrets_utils.py::TestSubstituteVars::test_unknown_prefix_raises_error": 0.1042,"tests/unit/pipelex/tools/secrets/test_secrets_utils.py::TestSubstituteVars::test_whitespace_handling": 0.0026,+ "tests/unit/pipelex/tools/secrets/test_secrets_utils.py::TestSubstituteVars::test_an_unknown_prefix_after_a_candidate_that_resolves_is_refused": 0.0017,"tests/unit/pipelex/tools/storage/test_gcp_storage_provider.py::TestGcpStorageProvider::test_credentials_file_not_found_raises_error": 0.0039,"tests/unit/pipelex/tools/storage/test_gcp_storage_provider.py::TestGcpStorageProvider::test_load_head_downloads_a_byte_range": 0.2481,"tests/unit/pipelex/tools/storage/test_gcp_storage_provider.py::TestGcpStorageProvider::test_load_head_of_a_missing_object_raises_not_found": 0.006,@@ -14685,4 +14739,4 @@"tests/unit/repo/test_test_durations_paths.py::TestTestDurationsPaths::test_durations_file_is_committed_and_not_empty": 0.8507,"tests/unit/repo/test_test_durations_paths.py::TestTestDurationsPaths::test_every_node_id_is_rooted_in_a_test_file_path": 0.0153,"tests/unit/repo/test_test_durations_paths.py::TestTestDurationsPaths::test_every_recorded_test_file_still_exists": 0.1253-}+}\ No newline at end of filediff --git a/CHANGELOG.md b/CHANGELOG.mdindex dc86e12b4..c95ef9321 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -5,10 +5,17 @@### Changed- **`GraphAnalysis.stuff_producers` lists every producer (Breaking)**: it maps a digest to a list of node ids, `get_producer` is replaced by `get_producers`, and the new `shared_stuff_controllers` names the controller a stuff with several writers belongs to, a parallel or batch controller combining or aggregating into the stuff counting as one of them. The Mermaid graph draws such a stuff once, inside that controller, with an edge from each producer.+- **`InferenceBackendLibrary.load` takes `credentials` (Breaking)**: its `lenient` flag is replaced by `credentials: CredentialResolution`, `REQUIRE` or `SKIP`. A backend a `SKIP` load built records what it left unresolved in `InferenceBackend.unresolved_credentials`, and `ModelManager.get_required_inference_backend` refuses it with an `InferenceBackendCredentialsError` of type `not_resolved_on_keyless_boot` that names the variables.+- **A routing profile naming a disabled backend is refused on every boot (Breaking)**: a boot without inference, such as `pipelex validate`, now refuses a routing profile whose default or routes name a backend that is not enabled, as a boot with inference already did, and `load_active_routing_profile` loses its `lenient` argument.+- **A variable in a field that describes a model is refused on every boot (Breaking)**: a `${…}` placeholder may stand only in a value a call sends, which means `api_key`, `endpoint` and a backend's extra keys, or a model's `model_id`, `endpoint_path` and request headers. A placeholder in a field such as `model_type`, `sdk`, `thinking_mode` or the constraints is now refused with an error naming the field, where a boot with inference substituted it and a boot without inference could not, so the two gave different verdicts.+- **An unknown variable prefix is refused wherever it stands in a fallback chain (Breaking)**: `${env:KEY|secrte:KEY}` is refused for its `secrte` prefix whether or not `KEY` is set, where a boot read the candidates in turn and accepted the chain whenever an earlier one resolved. A boot without inference, which resolves nothing, refuses it too, so a file gets the same verdict on its syntax on every boot and every machine.+- **`pipelex show backends` lists every backend with its credential variables**: a backend whose key is unset is listed instead of hidden, a new column names the variables each backend reads its credentials from, and an endpoint read from a variable is shown as not resolved.### Fixed- **A dry-run condition's output is one stuff every outcome produces**: in the graph of a dry run, every outcome of a `PipeCondition` now carries the condition's output digest, so the step reading the condition's result is wired to all of them rather than to the outcome whose pipe code sorts last, and when the outcomes write or declare different outputs, the condition's declared output types that stuff on every node outside the outcomes: the condition, the controllers whose output it is, such as a sequence ending on the condition, and the steps reading it, while each outcome keeps the concept it writes. Each outcome but the last now runs on a copy of the memory the condition received, so an outcome reading the condition's slot reads the value from before the condition rather than a sibling's output, and the default outcome runs last, so the steps after the condition read its value.+- **Validation and dry runs no longer depend on which keys the machine holds**: a boot without inference (`Pipelex.make(needs_inference=False)`, used by `pipelex validate`, `pipelex run --dry-run`, `pipelex show` and the agent CLI's validation) now loads every enabled backend with its models and constraints and resolves none of their credentials, where it dropped every backend whose key was missing. A method using a search preset or pinning a bare handle such as `model = "gpt-4o-mini"` now validates on a machine or CI runner with no key, and such a boot no longer reads the backends' keys or requests a Vertex AI token.+- **Linkup uses the key its backend names**: the Linkup search and fetch workers take the key from the `[linkup]` table's `api_key`, like every other provider, where they read `LINKUP_API_KEY` themselves and ignored a configuration naming another variable. A Linkup backend with no `api_key` is refused with `LinkupError` when its worker is built.## [v0.74.1] - 2026-10-05diff --git a/docs/building-methods/pipes/run-modes-and-backends.md b/docs/building-methods/pipes/run-modes-and-backends.mdindex 90f809a16..c1bf026be 100644--- a/docs/building-methods/pipes/run-modes-and-backends.md+++ b/docs/building-methods/pipes/run-modes-and-backends.md@@ -81,6 +81,8 @@ This is not a contradiction of "the run mode never changes the backend" — it'sWhen a process boots without inference configured — `Pipelex.make(needs_inference=False)`, e.g. no AI provider set up — every run that process initiates is forced to dry-run mode. This is a property of the run, not of the backend: under a Temporal-enabled boot the forced-dry run still dispatches activities and mocks inside them, like any other dry run. A warning logs whenever a live-requested run is forced dry.+Such a boot knows every model a boot with inference knows: it loads every enabled backend with its models and their constraints, and resolves none of their credentials. That is why a dry run validates a method the same way whether or not the machine holds the keys. What it cannot do is call a provider: if live work reaches it from another process, as it can on a Temporal worker, the call is refused with an `InferenceBackendCredentialsError` that names the variables this process did not resolve, and the remedy is to boot that process with inference.+## See Also- [Validation & Dry Run](../../features/validation-dry-run.md) — feature overviewdiff --git a/docs/configuration/config-technical/inference-backend-config.md b/docs/configuration/config-technical/inference-backend-config.mdindex 830b1b477..3543b948d 100644--- a/docs/configuration/config-technical/inference-backend-config.md+++ b/docs/configuration/config-technical/inference-backend-config.md@@ -165,6 +165,10 @@ enabled = trueThe `${VARIABLE_NAME}` syntax automatically loads values from your `.env` file. Set `enabled = true` to activate a backend, or `false` to disable it.+Keys are needed only to call a provider. A process that runs methods resolves every enabled backend's variables when it starts, and refuses to start without one, naming it. A process that boots without inference, such as `pipelex validate`, `pipelex show backends` or a dry run, resolves none of them: it loads every enabled backend with all its models anyway, so a validation gives the same verdict whether or not your keys are set. Every backend reads its key from the variable its own `api_key` names, Linkup included.++A variable may stand only in a value that a call sends: `api_key`, `endpoint` and a backend's extra keys (such as `aws_region` or `gcp_project_id`) in `backends.toml`, and a model's `model_id`, `endpoint_path` and request headers in its backend's file. A field that describes the model, such as `model_type`, `sdk`, `thinking_mode`, `structure_method`, `inputs`, `outputs`, `costs` or the constraints, is written literally, because a boot without inference must know it without resolving anything. Pipelex refuses to boot on a variable in such a field and names the field and the variable.+An enabled backend must declare at least one model in its file under `backends/` (see [Model Specifications](#model-specifications)). Pipelex refuses to boot when one declares none, because routing would send models to a backend that cannot serve them: disable the backend, or list the models it serves. The `internal` backend is exempt, since plugins add its models at boot. A backend table also no longer accepts a `model_specs_section` key; an enabled backend that still carries one is refused, and the fix is to list its models in `backends/<name>.toml` and remove the key, or to disable the backend.Judgment models are served by their own backend alone, so the default routing profile sends them to their own backend through an optional route (`"jev-*" = "typesafe"`), which applies only while that backend is enabled. With a `TYPESAFE_API_KEY` set, `@default-judgment` works under the default profile with no routing edit.diff --git a/docs/contribute/inference-family-surface.md b/docs/contribute/inference-family-surface.mdindex c57fa4fcc..3a0be052a 100644--- a/docs/contribute/inference-family-surface.md+++ b/docs/contribute/inference-family-surface.md@@ -48,7 +48,7 @@ Most of the list is enforced by the type checker: the matches over the family en5. **Silent: the routing profiles.** The default `all_enabled_backends` profile tries the backends its `fallback_order` lists first and any other enabled backend after them, so list the vendor there when it should be tried before the end. A profile whose `default` is a single backend sends every handle there, and a handle that backend does not serve is silently dropped from the deck — so a user who has the vendor's key still cannot use its models. Give such a profile an `optional_routes` entry sending the vendor's models to its backend; an optional route applies only while that backend is enabled.-6. **Silent: the CI placeholder list.** CI runners hold no provider keys, and every test module boots live, so each variable an enabled kit backend references must be in `ENV_VAR_KEYS_WHICH_MAY_NEED_PLACEHOLDERS_IN_CI` in `pipelex/test_extras/shared_pytest_plugins.py`. `tests/unit/pipelex/test_extras/test_ci_placeholder_keys.py` fails when one is missing. The agent CLI's end-to-end tests build their own hermetic environment, with a dummy value per variable, in the `offline_subprocess_env` fixture of `tests/e2e/agent_cli/conftest.py`, and nothing checks that list: a variable missing there only makes a dry run skip the backend.+6. **Silent: the CI placeholder list.** CI runners hold no provider keys, and every test module boots live, so each variable an enabled kit backend references must be in `ENV_VAR_KEYS_WHICH_MAY_NEED_PLACEHOLDERS_IN_CI` in `pipelex/test_extras/shared_pytest_plugins.py`. `tests/unit/pipelex/test_extras/test_ci_placeholder_keys.py` fails when one is missing. The agent CLI's end-to-end tests build their own hermetic environment, with a dummy value per variable, in the `offline_subprocess_env` fixture of `tests/e2e/agent_cli/conftest.py`, and nothing checks that list: a dry run resolves no key, so a variable missing there only reaches the tests of commands that check credentials, such as `pipelex doctor`.7. **Plugin surface tests.** The `(family, sdk)` pair in `tests/unit/pipelex/plugins/test_inference_backend_coverage.py`, a missing-extra guard test mirroring Linkup's, the SDK's import name in the blocked list of `tests/unit/pipelex/plugins/test_import_light_boot.py`, and an arm in `tests/integration/pipelex/system/test_keyless_boot_forced_dry.py` showing that a keyless boot does not need the key.diff --git a/docs/features/configuration.md b/docs/features/configuration.mdindex 049b632ea..2e0e4f0a8 100644--- a/docs/features/configuration.md+++ b/docs/features/configuration.md@@ -31,7 +31,7 @@ The two inference documents, `.pipelex/inference/backends.toml` and `.pipelex/in## Environment Variables-Two configuration areas support `${...}` variable substitution in their TOML files: the inference backend configuration (`.pipelex/inference/backends.toml` and the per-backend TOML files under `.pipelex/inference/backends/`) and the telemetry configuration (`.pipelex/telemetry.toml`). In those files, use `${env:VAR}` for environment variables, `${secret:VAR}` for the secrets provider, and fallback chains like `${env:VAR|secret:VAR}`. The `pipelex.toml` layering described above does not perform substitution — a `${env:VAR}` there stays a literal string.+Two configuration areas support `${...}` variable substitution in their TOML files: the inference backend configuration (`.pipelex/inference/backends.toml` and the per-backend TOML files under `.pipelex/inference/backends/`) and the telemetry configuration (`.pipelex/telemetry.toml`). In those files, use `${env:VAR}` for environment variables, `${secret:VAR}` for the secrets provider, and fallback chains like `${env:VAR|secret:VAR}`; a prefix other than `env` or `secret` is refused wherever it stands in a chain, even after a candidate that resolves. In the inference backend files, a variable stands only in a value a call sends, such as a key, an endpoint or a model id, never in a field that describes the model (see [Inference Backend Configuration](../configuration/config-technical/inference-backend-config.md)). The `pipelex.toml` layering described above does not perform substitution — a `${env:VAR}` there stays a literal string.## Key Configuration Areasdiff --git a/docs/features/validation-dry-run.md b/docs/features/validation-dry-run.mdindex 2b1bcb086..eeb9cc635 100644--- a/docs/features/validation-dry-run.md+++ b/docs/features/validation-dry-run.md@@ -32,7 +32,7 @@ Execute pipelines with mocked LLM responses to test pipeline logic, data flow, a- **Mock generation** — Format-compliant mock values for constrained fields, including structured outputs- **Configurable mock behavior** — Control mock list sizes, template handling, and response formats- **Full pipeline execution** — Working memory, controllers, and data flow all work as in production-- **No credentials needed** — A dry run boots without inference credentials, on both `pipelex run --dry-run` and `pipelex-agent run --dry-run`. A backend whose API key is missing is skipped rather than fatal, so a dry run executes on a machine that holds no key at all. The one limit: a model handle that lives on a skipped backend cannot be resolved there, so a pipe pinning a bare handle such as `model = "gpt-4o-mini"` reports it as not found in the model deck; presets and the default model are unaffected+- **No credentials needed** — A dry run boots without inference credentials, on both `pipelex run --dry-run` and `pipelex-agent run --dry-run`, and so does `pipelex validate`. Such a boot loads every enabled backend with all its models but resolves none of their keys, so validation and dry runs give the same verdict on a machine that holds no key at all as on one that holds them all: presets, the default models and a bare handle such as `model = "gpt-4o-mini"` resolve alike## Allowed-to-Fail Pipesdiff --git a/docs/tools/cli/show.md b/docs/tools/cli/show.mdindex 6799e5fa6..6615c849f 100644--- a/docs/tools/cli/show.md+++ b/docs/tools/cli/show.md@@ -102,6 +102,8 @@ pipelex show backends [OPTIONS]Displays all configured inference backends and the active routing profile with its routing rules.+The command does not resolve credentials, so it works on a machine that holds no key: every enabled backend is listed, with the variables it reads its credentials from. An endpoint read from a variable is shown as not resolved, by the name of its variable.+**Options:**- `--all`, `-a` - Show all backends including disabled ones (by default, only enabled backends are shown)@@ -118,7 +120,7 @@ pipelex show backends --all**What it displays:**-- Table of configured backends with status, endpoint, and model count+- Table of configured backends with status, endpoint, credential variables, and model count- Active routing profile name and description- Default backend for the profile- Routing rules mapping model patterns to backendsdiff --git a/docs/under-the-hood/init-cli-flows.md b/docs/under-the-hood/init-cli-flows.mdindex e443cdfb9..85a6962ae 100644--- a/docs/under-the-hood/init-cli-flows.md+++ b/docs/under-the-hood/init-cli-flows.md@@ -405,7 +405,7 @@ flowchart TD`check_pending_migrations()` is the one check that takes no `config_dir` at all, and that is deliberate. Every other row reports on a *file* and is scoped to the directory the doctor was pointed at, `--global` included. That one reports on a *command* — it is `pipelex migrate`'s own dry run — and `pipelex migrate` has no `--global`: it walks the global `~/.pipelex/` and the project `.pipelex/` both. Scoping the row narrower would name a command that then rewrites a file the row never mentioned. Every file it reports is named with its full path, so the wider scope stays legible.-`check_backend_files()` loads the backend library once per enabled backend, and loads it with `lenient=True`. The row reports on file shape — an unknown key, a spec that is not a table, a missing per-backend file — so a backend whose credentials do not resolve is skipped rather than reported: that is the Credentials row's finding. Without leniency an enabled backend whose key is not set yet would be reported as a backend-configuration error, and because the loader stops at the first backend it cannot load, a malformed file listed after that backend in `backends.toml` would go unreported. Leniency covers credentials and nothing else: a malformed file stays fatal, and so do the refusals of an enabled backend that declares no model or still carries `model_specs_section`. Every probe sees that same first failure, so a failure is charged to the backend the error declares (`backend_name`, stamped by the loader on every error about one backend) or, for an error that declares none, to the backend whose file it names — never to a backend whose name merely appears in the message's prose. `check_models()` attributes the same way and for the same reason: its own load is strict and reaches backends the probe skipped leniently, so it can be the first thing to name a broken backend, and it writes into the very reports this row produced.+`check_backend_files()` loads the backend library once per enabled backend, and loads it without resolving credentials (`CredentialResolution.SKIP`, the keyless boot's mode). The row reports on file shape — an unknown key, a spec that is not a table, a missing per-backend file — so a backend's credentials are the Credentials row's finding, not this one's. Resolving them here would report an enabled backend whose key is not set yet as a backend-configuration error, and because the loader stops at the first backend it cannot load, a malformed file listed after that backend in `backends.toml` would go unreported. Skipping credentials skips nothing else: every enabled backend is loaded, a malformed file stays fatal, and so do the refusals of an enabled backend that declares no model or still carries `model_specs_section`. Every probe sees that same first failure, so a failure is charged to the backend the error declares (`backend_name`, stamped by the loader on every error about one backend) or, for an error that declares none, to the backend whose file it names — never to a backend whose name merely appears in the message's prose. `check_models()` attributes the same way and for the same reason: its own load resolves credentials, which the probe's does not, so it can be the first thing to name a broken backend, and it writes into the very reports this row produced.### Fix Targetingdiff --git a/docs/under-the-hood/pipelex-kernel.md b/docs/under-the-hood/pipelex-kernel.mdindex 8fd0ad795..a268b574a 100644--- a/docs/under-the-hood/pipelex-kernel.md+++ b/docs/under-the-hood/pipelex-kernel.md@@ -34,7 +34,7 @@ That boot stands up the model deck, the content generator, the class registry, t**`read_scope` is required too, and `None` is a value you pass, not a default.** It bounds what the run may read: every `pipelex-storage://` key a step reads must lie under it, compared segment by segment, and no step reads a bare path or a `file://` URI from the local disk. `https://` and `data:` URLs are untouched. A value can carry any URL its method or its model chose, so the check runs where values are read, in every content-generation leaf before the dry-run branch, and `shape_inputs` applies it to a table given as a CSV input, which is always a local file. The storage scope must lie under the read scope, since a run reads its own outputs back, and a mismatch is refused at construction. A multi-tenant host passes its tenant's prefix (the hosted platform passes the organization id); `None` is the explicit statement that the run is unscoped, which is the truth for a single-tenant service or a laptop. It has no default for the storage scope's reason: a host that forgot it would run unscoped, and an unscoped run reads every key the process's credentials reach. A refused read raises `UriReadRefusedError`, a caller-facing input error that names where the URL sat and never quotes it.-`needs_inference=False` boots keyless (no credentials, no model-deck validation) and sets the forced-DRY flag: every run the process initiates is coerced to `run_mode=DRY`, so the leaves mock instead of calling a provider. `PipelexKernel.make` applies that rule through the same `runtime_hub.resolve_run_mode_for_boot` the pipe tier uses — a second copy of the rule at a second factory is how the two would drift apart.+`needs_inference=False` boots keyless (every enabled backend and model loaded, no credential resolved, no model-deck validation) and sets the forced-DRY flag: every run the process initiates is coerced to `run_mode=DRY`, so the leaves mock instead of calling a provider. `PipelexKernel.make` applies that rule through the same `runtime_hub.resolve_run_mode_for_boot` the pipe tier uses — a second copy of the rule at a second factory is how the two would drift apart.---diff --git a/pipelex/cli/agent_cli/commands/agent_cli_factory.py b/pipelex/cli/agent_cli/commands/agent_cli_factory.pyindex 3a70f3a7f..57b6a4d76 100644--- a/pipelex/cli/agent_cli/commands/agent_cli_factory.py+++ b/pipelex/cli/agent_cli/commands/agent_cli_factory.py@@ -181,7 +181,8 @@ def make_pipelex_for_agent_cli(*, library_dirs: list[str] | list[Path] | None =Args:library_dirs: Optional library directories to use for the Pipelex instance.- needs_inference: When False, skip inference setup (credentials, telemetry).+ needs_inference: When False, boot without inference: every enabled backend and its models+ load, no credential is resolved, and every run this process starts is forced to DRY.Returns:Initialized Pipelex instance.diff --git a/pipelex/cli/cli_factory.py b/pipelex/cli/cli_factory.pyindex 27167bc7e..315842c19 100644--- a/pipelex/cli/cli_factory.py+++ b/pipelex/cli/cli_factory.py@@ -28,7 +28,8 @@ def make_pipelex_for_cli(Args:context: The CLI context for error messages.library_dirs: The library directories to use for the Pipelex instance.- needs_inference: When False, skip inference setup (credentials, telemetry).+ needs_inference: When False, boot without inference: every enabled backend and its models+ load, no credential is resolved, and every run this process starts is forced to DRY.boot_orchestrator: When provided, boots this process under the orchestrator plugin of this name.Returns:diff --git a/pipelex/cli/commands/doctor_cmd.py b/pipelex/cli/commands/doctor_cmd.pyindex aba718233..33937d62e 100644--- a/pipelex/cli/commands/doctor_cmd.py+++ b/pipelex/cli/commands/doctor_cmd.py@@ -38,6 +38,7 @@ from pipelex.cogt.exceptions import ()from pipelex.cogt.model_backends.backend_credentials import BackendCredentialsErrorMsgFactory, BackendCredentialsReportfrom pipelex.cogt.model_backends.backend_library import InferenceBackendLibrary+from pipelex.cogt.model_backends.credential_resolution import CredentialResolutionfrom pipelex.cogt.models.deck_manifest import (MANAGED_BACKEND_FILENAME,DeckFileStatus,@@ -561,8 +562,8 @@ def check_backend_files("""Check individual backend configuration files for validity.Args:- secrets_provider: The provider the configuration selects, which the backends' credentials resolve- through, as they do at boot.+ secrets_provider: The provider the configuration selects. The probe resolves no credential, so it+ never asks it anything; the load takes it all the same.config_dir: Explicit config directory override (e.g. for --global).If None, uses layered resolution (project .pipelex/ → global ~/.pipelex/).@@ -619,17 +620,17 @@ def check_backend_files(# Create a temporary backend library and try to load this backendtemp_library = InferenceBackendLibrary.make_empty()- # This row reports on file shape, so the load is lenient: a backend whose- # credentials do not resolve is skipped rather than reported — that is the- # Credentials row's finding. A malformed file stays fatal in lenient mode, which- # is what this probe exists to catch, and so do the library's refusals of an- # enabled backend that declares no model or still carries `model_specs_section`.+ # This row reports on file shape, so the load resolves no credential: a backend+ # whose credentials do not resolve is the Credentials row's finding, not this one's.+ # A malformed file stays fatal on such a load, which is what this probe exists to+ # catch, and so do the library's refusals of an enabled backend that declares no+ # model or still carries `model_specs_section`.temp_library.load(secrets_provider=secrets_provider,backends_library_paths=backends_file_paths,backends_dir_path=str(backends_dir_path),include_disabled=False,- lenient=True,+ credentials=CredentialResolution.SKIP,)except Exception as exc: # ruff: ignore[blind-except]@@ -1490,9 +1491,9 @@ def check_models()models_manager.validate_model_deck()except InferenceBackendLibraryError as exc:- # The setup load is strict and reaches backends the file probe skipped leniently, so it can- # be the first thing to name a broken backend. Attribution is the file probe's, for the same- # reason: the loader's own advice text names other backends in passing.+ # The setup load resolves credentials, which the file probe does not, so it can still be the+ # first thing to name a broken backend. Attribution is the file probe's: the loader's own+ # advice text names other backends in passing.error_str = str(exc)for backend_name, backend_file_report in backend_file_reports.items():if _is_error_about_backend(exc=exc, backend_name=backend_name, backend_file_path=backend_file_report.file_path):diff --git a/pipelex/cli/commands/run/_run_core.py b/pipelex/cli/commands/run/_run_core.pyindex bf092cc1b..3d09a8142 100644--- a/pipelex/cli/commands/run/_run_core.py+++ b/pipelex/cli/commands/run/_run_core.py@@ -495,11 +495,10 @@ def execute_run(Shared between the ``method`` and ``pipe`` subcommands."""# A dry run makes no inference call, so it must not demand credentials: `needs_inference=False`- # forces every run to DRY and skips a backend whose key is missing instead of failing the boot.- # Wherever credentials ARE present a dry run resolves model handles exactly as a live run would. On- # a machine with no key at all, a skipped backend contributes no models, so a pipe pinning a- # bare handle served only by that backend reports it as not found (see docs/features/validation-dry-run.md).- # This is the same boot `pipelex-agent run --dry-run` uses, so the two CLIs agree either way.+ # forces every run to DRY and resolves no backend's credentials, yet keeps every enabled backend+ # with its models, so a dry run resolves model handles exactly as a live run would, whichever keys+ # the machine holds (see docs/features/validation-dry-run.md). This is the same boot+ # `pipelex-agent run --dry-run` uses, so the two CLIs agree.make_pipelex_for_cli(context=ErrorContext.VALIDATION_BEFORE_PIPE_RUN,library_dirs=library_dir,diff --git a/pipelex/cli/commands/show_cmd.py b/pipelex/cli/commands/show_cmd.pyindex ffddb6bd9..4c87c7005 100644--- a/pipelex/cli/commands/show_cmd.py+++ b/pipelex/cli/commands/show_cmd.py@@ -18,6 +18,7 @@ from pipelex.cli.cli_factory import make_pipelex_for_clifrom pipelex.cli.error_handlers import ErrorContextfrom pipelex.cli.exceptions import PipelexCLIErrorfrom pipelex.cogt.model_backends.backend_library import InferenceBackendLibrary+from pipelex.cogt.model_backends.credential_resolution import CredentialResolutionfrom pipelex.cogt.model_backends.model_lists import ModelListerfrom pipelex.interpreter_hub import get_library_manager, get_pipe_library, get_required_entry_pipe, resolve_library_dirs, set_current_libraryfrom pipelex.libraries.pipe.exceptions import PipeLibraryError@@ -75,7 +76,7 @@ def do_show_backends(*, show_all: bool = False) -> None:backends_library_paths=config_manager.backends_file_paths(),backends_dir_path=str(config_manager.backends_dir_path),include_disabled=True,- lenient=True,+ credentials=CredentialResolution.SKIP,)else:backend_library = models_manager.inference_backend_library@@ -108,17 +109,29 @@ def do_show_backends(*, show_all: bool = False) -> None:if show_all:backends_table.add_column("Status", style="yellow")backends_table.add_column("Endpoint", style="blue")+ backends_table.add_column("Credential variables", style="magenta")backends_table.add_column("Models", style="cyan", justify="right")for backend in sorted(backends_to_display, key=lambda b: b.name):- endpoint = backend.endpoint or "[dim]N/A[/dim]"+ # This command boots without inference, which keeps every backend and resolves no credential:+ # an endpoint read from a variable is shown by its variable, never by a value it never looked up.+ if backend.endpoint:+ endpoint = escape(backend.endpoint)+ elif endpoint_var_names := backend.unresolved_credentials.get("endpoint"):+ endpoint = f"[dim]not resolved ({escape(', '.join(endpoint_var_names))})[/dim]"+ elif "endpoint" in backend.unresolved_credentials:+ endpoint = "[dim]not resolved[/dim]"+ else:+ endpoint = "[dim]N/A[/dim]"+ # A variable name is the user's text, and the placeholder syntax allows brackets in it.+ credential_variables = escape(", ".join(backend.unresolved_credential_vars)) or "[dim]none[/dim]"model_count = str(len(backend.model_specs))if show_all:status = "[green]Enabled[/green]" if backend.enabled else "[red]Disabled[/red]"- backends_table.add_row(backend.name, status, endpoint, model_count)+ backends_table.add_row(backend.name, status, endpoint, credential_variables, model_count)else:- backends_table.add_row(backend.name, endpoint, model_count)+ backends_table.add_row(backend.name, endpoint, credential_variables, model_count)console.print("\n")console.print(backends_table)@@ -168,6 +181,7 @@ def do_show_backends(*, show_all: bool = False) -> None:console.print(f"[dim]💡 Showing {enabled_count} enabled backend(s). {disabled_count} disabled backend(s) hidden.[/dim]")console.print("[dim] To see all backends: [bold]pipelex show backends --all[/bold][/dim]\n")+ console.print("[dim]💡 This command does not resolve credentials: it lists the variables each backend reads them from.[/dim]")console.print("[dim]💡 To enable more backends, edit: [bold].pipelex/inference/backends.toml[/bold][/dim]")console.print("[dim]💡 To list available models for a backend: [bold]pipelex show models <backend_name>[/bold][/dim]\n")get_telemetry_manager().track_event(EventName.BACKENDS_SHOW, properties={EventProperty.NB_BACKENDS: len(all_backends)})diff --git a/pipelex/cogt/exceptions.py b/pipelex/cogt/exceptions.pyindex 77eee85ae..dca73f461 100644--- a/pipelex/cogt/exceptions.py+++ b/pipelex/cogt/exceptions.py@@ -545,6 +545,9 @@ class InferenceBackendCredentialsErrorType(StrEnum):VAR_NOT_FOUND = "var_not_found"UNKNOWN_VAR_PREFIX = "unknown_var_prefix"VAR_FALLBACK_PATTERN = "var_fallback_pattern"+ # The process booted without inference, which loads every backend but resolves no credential,+ # and was then asked for a backend to call.+ NOT_RESOLVED_ON_KEYLESS_BOOT = "not_resolved_on_keyless_boot"class InferenceBackendCredentialsError(CogtError):@@ -560,10 +563,22 @@ class InferenceBackendCredentialsError(CogtError):backend_name: str,message: str,key_name: str,+ user_action: UserAction | None = None,):+ """A credential a backend needs that this process does not hold.++ Args:+ credentials_error_type: Why the credential is missing.+ backend_name: The backend whose credential it is.+ message: The error's message.+ key_name: The variable the credential is read from, or the field when no variable names it.+ user_action: This error's own next step, when the class's ("set the variable") is not it.+ """self.credentials_error_type = credentials_error_typeself.backend_name = backend_nameself.key_name = key_name+ if user_action is not None:+ self.user_action = user_actionsuper().__init__(message)diff --git a/pipelex/cogt/model_backends/backend.py b/pipelex/cogt/model_backends/backend.pyindex d8c9e9ca7..e5f3ae252 100644--- a/pipelex/cogt/model_backends/backend.py+++ b/pipelex/cogt/model_backends/backend.py@@ -25,6 +25,16 @@ class InferenceBackend(ConfigModel):valued_constraints: dict[ValuedConstraint, Any] = Field(default_factory=empty_dict_factory_of(ValuedConstraint))extra_config: dict[str, Any] = Field(default_factory=dict)model_specs: dict[str, InferenceModelSpec] = Field(default_factory=dict)+ # What a keyless load (`CredentialResolution.SKIP`) left unresolved: each field it left unset, or+ # `model_specs` for the backend's own file, mapped to the names of the variables it references.+ # A field minted at boot rather than read from a variable, as Vertex AI's token is, maps to no+ # name. Empty after a load that resolved every credential, and only then may the backend be called.+ unresolved_credentials: dict[str, list[str]] = Field(default_factory=dict)++ @property+ def unresolved_credential_vars(self) -> list[str]:+ """The names of every variable this backend's credentials reference and its load left unresolved, sorted."""+ return sorted({var_name for var_names in self.unresolved_credentials.values() for var_name in var_names})def list_model_names(self) -> list[str]:"""List the names of all models in the backend."""diff --git a/pipelex/cogt/model_backends/backend_factory.py b/pipelex/cogt/model_backends/backend_factory.pyindex 061ba0c8d..fb8f6f39e 100644--- a/pipelex/cogt/model_backends/backend_factory.py+++ b/pipelex/cogt/model_backends/backend_factory.py@@ -4,6 +4,7 @@ from pydantic import Field, field_validatorfrom pipelex.cogt.model_backends.backend import InferenceBackendfrom pipelex.cogt.model_backends.constraints import ListedConstraint, ValuedConstraint+from pipelex.cogt.model_backends.credential_resolution import CredentialResolutionfrom pipelex.cogt.model_backends.model_spec import InferenceModelSpecfrom pipelex.system.configuration.config_model import ConfigModelfrom pipelex.tools.typing.pydantic_utils import empty_dict_factory_of, empty_list_factory_of@@ -35,6 +36,10 @@ class InferenceBackendBlueprint(ConfigModel):class InferenceBackendFactory:+ # The fields Vertex AI derives at boot from its extra config: the endpoint from the project and+ # location, the API key by minting an OAuth token from the service-account file.+ VERTEXAI_DERIVED_FIELDS = ("endpoint", "api_key")+@classmethoddef make_inference_backend(cls,@@ -43,16 +48,39 @@ class InferenceBackendFactory:blueprint: InferenceBackendBlueprint,extra_config: dict[str, Any],model_specs: dict[str, InferenceModelSpec],+ credentials: CredentialResolution,+ unresolved_credentials: dict[str, list[str]],) -> InferenceBackend:+ """Build a backend from its loaded blueprint.++ Args:+ name: The backend's name, its table name in `backends.toml`.+ blueprint: The backend's standard fields, already resolved or, on a keyless load, stripped+ of every field that references a variable.+ extra_config: The backend's other keys, likewise.+ model_specs: The backend's models.+ credentials: Whether this load resolves credentials. On `SKIP`, Vertex AI mints no token.+ unresolved_credentials: What the load left unresolved, field by field (see+ `InferenceBackend.unresolved_credentials`).+ """endpoint = blueprint.endpointapi_key = blueprint.api_key+ unresolved_credentials = dict(unresolved_credentials)# Deal with special authentication for some backendsmatch name:case "vertexai":- # Deferred import: avoid pulling heavy SDK at module-load time- from pipelex.providers.openai.vertexai_factory import VertexAIFactory # ruff: ignore[import-outside-top-level]+ match credentials:+ case CredentialResolution.REQUIRE:+ # Deferred import: avoid pulling heavy SDK at module-load time+ from pipelex.providers.openai.vertexai_factory import VertexAIFactory # ruff: ignore[import-outside-top-level]- endpoint, api_key = VertexAIFactory.make_endpoint_and_api_key(extra_config=extra_config)+ endpoint, api_key = VertexAIFactory.make_endpoint_and_api_key(extra_config=extra_config)+ case CredentialResolution.SKIP:+ # Minting the token reads the service-account file and calls Google over the+ # network: exactly the credential resolution a keyless load does not do.+ endpoint, api_key = None, None+ for derived_field in cls.VERTEXAI_DERIVED_FIELDS:+ unresolved_credentials.setdefault(derived_field, [])case _:passreturn InferenceBackend(@@ -64,4 +92,5 @@ class InferenceBackendFactory:valued_constraints=blueprint.valued_constraints,extra_config=extra_config,model_specs=model_specs,+ unresolved_credentials=unresolved_credentials,)diff --git a/pipelex/cogt/model_backends/backend_library.py b/pipelex/cogt/model_backends/backend_library.pyindex bf10e593f..4c40e79fa 100644--- a/pipelex/cogt/model_backends/backend_library.py+++ b/pipelex/cogt/model_backends/backend_library.py@@ -1,4 +1,4 @@-from collections.abc import Sequence+from collections.abc import Callable, Iterable, Sequencefrom functools import partialfrom pathlib import Pathfrom typing import TYPE_CHECKING, Any, NamedTuple, Self, cast@@ -21,6 +21,7 @@ from pipelex.cogt.model_backends.backend_factory import (InferenceBackendFactory,)from pipelex.cogt.model_backends.constraints import ListedConstraint, ValuedConstraint+from pipelex.cogt.model_backends.credential_resolution import CredentialResolutionfrom pipelex.cogt.model_backends.model_spec_document import MODEL_SPEC_DEFAULTS_TABLEfrom pipelex.cogt.model_backends.model_spec_factory import (BackendModelSpecs,@@ -49,7 +50,7 @@ from pipelex.tools.misc.toml_utils import ()from pipelex.tools.secrets.exceptions import UnknownVarPrefixError, VarFallbackPatternError, VarNotFoundErrorfrom pipelex.tools.secrets.secrets_provider_abstract import SecretsProviderAbstract-from pipelex.tools.secrets.secrets_utils import substitute_vars+from pipelex.tools.secrets.secrets_utils import placeholder_var_names, substitute_varsfrom pipelex.tools.typing.pydantic_utils import format_pydantic_validation_errorif TYPE_CHECKING:@@ -60,6 +61,22 @@ InferenceBackendLibraryRoot = dict[str, InferenceBackend]# A `backends.toml` key that named the remote-config section holding a backend's model specs.RETIRED_MODEL_SPECS_SECTION_KEY = "model_specs_section"+# Where a keyless load records the variables a backend's own file references, beside the fields of+# its `backends.toml` table (see `InferenceBackend.unresolved_credentials`).+UNRESOLVED_MODEL_SPECS_KEY = "model_specs"++# What the loader runs over every string of a backend's files: substitution on a load that resolves+# credentials, a recorder that keeps the text on one that does not.+StringTransform = Callable[[str], str]++# The declared fields a `${…}` placeholder may stand in: the values a call sends. Every other declared+# field describes the model (its type, its constraints, the SDK that serves it), which a keyless load+# must know without resolving anything, so both loads refuse a placeholder there. A key the blueprint+# does not declare is extra config on a backend and a request header on a model, both sent with a+# call, so both stay templatable.+TEMPLATABLE_BACKEND_FIELDS = frozenset({"endpoint", "api_key", "extra_config"})+TEMPLATABLE_MODEL_SPEC_FIELDS = frozenset({"model_id", "endpoint_path"})+class RecoveredModelSpecs(NamedTuple):"""One backend's model specs rebuilt from a migrated file, and what the ledger did to get there."""@@ -113,7 +130,7 @@ class InferenceBackendLibrary(RootModel[InferenceBackendLibraryRoot]):backends_library_paths: Sequence[Path],backends_dir_path: str,include_disabled: bool = False,- lenient: bool = False,+ credentials: CredentialResolution = CredentialResolution.REQUIRE,):"""Load backend configurations from TOML files.@@ -139,14 +156,20 @@ class InferenceBackendLibrary(RootModel[InferenceBackendLibraryRoot]):backends_library_paths: The base `backends.toml` first, then the override files in merge order.backends_dir_path: Path to directory containing per-backend TOML files.include_disabled: Whether to include disabled backends.- lenient: When True, skip a backend whose *credentials* cannot be resolved instead of- raising — that is the whole of the tolerance. A malformed configuration (an unknown- or invalid key, a model spec that is not a table, a missing per-backend TOML) stays- fatal in both modes: a config typo must never silently delete a backend, because the- commands that boot leniently (validate, show, dry runs) would then report the far- more confusing "model not found" for every handle that backend served. A *stale* key- — one the ledger explains — is not a typo and is not covered by this flag at all: it- is carried forward in both modes, or fatal in both, according to the ledger alone.+ credentials: `REQUIRE` substitutes every `${…}` placeholder and raises+ `InferenceBackendCredentialsError` naming the variable it cannot resolve. `SKIP`, the+ keyless boot's mode (validate, show, dry runs), substitutes nothing and asks the+ secrets provider nothing: every enabled backend is kept with its models and+ constraints, a field of its table that references a variable is left unset, a+ templated model-spec string keeps its text, and the backend records the variables in+ `unresolved_credentials`, which refuses a call to it. Vertex AI mints no token.+ A malformed configuration (an unknown or invalid key, a model spec that is not a+ table, a missing per-backend TOML, a placeholder in a field that describes the model+ rather than a value a call sends) is fatal in both modes: a config typo must never+ silently delete a backend, because the commands that boot keyless would then report+ the far more confusing "model not found" for every handle that backend served. A+ *stale* key — one the ledger explains — is not a typo: it is carried forward in both+ modes, or fatal in both, according to the ledger alone."""stale_plans: list[MigrationPlan] = []library_paths_description = describe_toml_base_and_overrides(paths=backends_library_paths)@@ -174,7 +197,7 @@ class InferenceBackendLibrary(RootModel[InferenceBackendLibraryRoot]):# The likeliest half-written override: `acme = false` where `[acme] enabled = false`# was meant. `deep_update` replaces a table by a scalar whole, so this is the first# place that can name the file rather than crash on `.copy()`. Fatal in both modes:- # leniency is for what this machine cannot load, not for a document that is wrong.+ # a keyless boot skips credentials, not a document that is wrong.msg = (f"Invalid inference backend '{backend_name}' in {library_paths_description}: "f"expected a table, got {type(backend_dict).__name__} ({backend_dict!r})"@@ -198,122 +221,260 @@ class InferenceBackendLibrary(RootModel[InferenceBackendLibraryRoot]):f"or disable the backend.")raise InferenceBackendLibraryValidationError(msg, backend_name=backend_name)- if runtime_manager.is_ci_testing and backend_name == "vertexai":- continuetry:- inference_backend_blueprint_dict = apply_to_strings_recursive(- inference_backend_blueprint_dict_raw, transform_func=substitute_vars_with_provider- )- except VarFallbackPatternError as var_fallback_pattern_exc:- if lenient:- log.verbose(f"Skipping backend '{backend_name}': variable fallback pattern error")- continue- msg = f"Variable substitution failed due to a pattern error in {library_paths_description}:\n{var_fallback_pattern_exc}"- key_name = "unknown"- raise InferenceBackendCredentialsError(- credentials_error_type=InferenceBackendCredentialsErrorType.VAR_FALLBACK_PATTERN,+ self._refuse_placeholders_in_literal_fields(+ table=backend_table,+ declared_fields=backend_blueprint_standard_fields,+ templatable_fields=TEMPLATABLE_BACKEND_FIELDS,+ where=f"inference backend '{backend_name}' in {library_paths_description}",backend_name=backend_name,- message=msg,- key_name=key_name,- ) from var_fallback_pattern_exc- except VarNotFoundError as var_not_found_exc:- if lenient:- log.verbose(f"Skipping backend '{backend_name}': missing credential variable '{var_not_found_exc.var_name}'")- continue- msg = (- f"Variable substitution failed due to a 'variable not found' error in {library_paths_description}:\n"- f"Backend name: '{backend_name}', Variable name: '{var_not_found_exc.var_name}'\n"- f"{var_not_found_exc}\nRun mode: '{runtime_manager.run_mode}'")- raise InferenceBackendCredentialsError(- credentials_error_type=InferenceBackendCredentialsErrorType.VAR_NOT_FOUND,- backend_name=backend_name,- message=msg,- key_name=var_not_found_exc.var_name,- ) from var_not_found_excexcept UnknownVarPrefixError as unknown_var_prefix_exc:- if lenient:- log.verbose(f"Skipping backend '{backend_name}': unknown variable prefix for '{unknown_var_prefix_exc.var_name}'")- continue- raise InferenceBackendCredentialsError(- credentials_error_type=InferenceBackendCredentialsErrorType.UNKNOWN_VAR_PREFIX,- backend_name=backend_name,- message=(- f"Variable substitution failed due to an unknown variable prefix error "- f"in {library_paths_description}:\n{unknown_var_prefix_exc}"- ),- key_name=unknown_var_prefix_exc.var_name,+ raise self._unknown_var_prefix_credentials_error(+ unknown_var_prefix_exc=unknown_var_prefix_exc, backend_name=backend_name, source=library_paths_description) from unknown_var_prefix_exc+ unresolved_credentials: dict[str, list[str]] = {}+ model_spec_var_names: list[str] = []+ match credentials:+ case CredentialResolution.REQUIRE:+ if runtime_manager.is_ci_testing and backend_name == "vertexai":+ # Its token is minted over the network at load, which a CI sandbox cannot do.+ continue+ inference_backend_blueprint_dict = self._substitute_backend_table_vars(+ backend_table=inference_backend_blueprint_dict_raw,+ backend_name=backend_name,+ library_paths_description=library_paths_description,+ substitute_vars_with_provider=substitute_vars_with_provider,+ )+ model_specs_transform: StringTransform = substitute_vars_with_provider+ case CredentialResolution.SKIP:+ # The shape is checked before a templated field is stripped: substitution turns text into+ # text, so the raw table is refused wherever the resolved one would be, a key written as a+ # list included, and stripping cannot hide a field of the wrong type.+ self._validated_backend_blueprint(+ table=inference_backend_blueprint_dict_raw, backend_name=backend_name, library_paths_description=library_paths_description+ )+ try:+ inference_backend_blueprint_dict = self._backend_table_without_templated_fields(+ backend_table=inference_backend_blueprint_dict_raw,+ unresolved_credentials=unresolved_credentials,+ )+ except UnknownVarPrefixError as unknown_var_prefix_exc:+ # The prefix is refused as the load that resolves credentials refuses it.+ raise self._unknown_var_prefix_credentials_error(+ unknown_var_prefix_exc=unknown_var_prefix_exc, backend_name=backend_name, source=library_paths_description+ ) from unknown_var_prefix_exc+ model_specs_transform = partial(self._record_placeholder_var_names, var_names=model_spec_var_names)++ for backend_blueprint_key in list(inference_backend_blueprint_dict):+ if backend_blueprint_key not in backend_blueprint_standard_fields:+ extra_config[backend_blueprint_key] = inference_backend_blueprint_dict.pop(backend_blueprint_key)+ backend_blueprint = self._validated_backend_blueprint(+ table=inference_backend_blueprint_dict, backend_name=backend_name, library_paths_description=library_paths_description+ )++ model_specs_dict, backend_config_source = self._load_local_model_specs(+ backend_name=backend_name,+ backends_dir_path=backends_dir_path,+ substitute_vars_with_provider=model_specs_transform,+ )try:- for backend_blueprint_key in backend_table:- if backend_blueprint_key not in backend_blueprint_standard_fields:- extra_config[backend_blueprint_key] = inference_backend_blueprint_dict.pop(backend_blueprint_key)- try:- backend_blueprint = InferenceBackendBlueprint.model_validate(inference_backend_blueprint_dict)- except ValidationError as validation_error:- # The index file's own refusal, said with the backend and the file in front of the- # analysis: pydantic's error alone names a field, and every table of this file has- # that field.- validation_error_msg = format_pydantic_validation_error(validation_error)- msg = f"Invalid inference backend '{backend_name}' in {library_paths_description}: {validation_error_msg}"- raise InferenceBackendLibraryValidationError(msg, backend_name=backend_name) from validation_error-- model_specs_dict, backend_config_source = self._load_local_model_specs(+ backend_model_specs = self._build_backend_model_specs(+ model_specs_dict=model_specs_dict,+ backend_name=backend_name,+ backend_config_source=backend_config_source,+ backend_listed_constraints=backend_blueprint.listed_constraints,+ backend_valued_constraints=backend_blueprint.valued_constraints,+ )+ except InferenceBackendLibraryError:+ recovered = self._local_model_specs_the_ledger_can_explain(backend_name=backend_name,backends_dir_path=backends_dir_path,- substitute_vars_with_provider=substitute_vars_with_provider,+ backend_blueprint=backend_blueprint,+ substitute_vars_with_provider=model_specs_transform,)-- try:- backend_model_specs = self._build_backend_model_specs(- model_specs_dict=model_specs_dict,- backend_name=backend_name,- backend_config_source=backend_config_source,- backend_listed_constraints=backend_blueprint.listed_constraints,- backend_valued_constraints=backend_blueprint.valued_constraints,- )- except InferenceBackendLibraryError:- recovered = self._local_model_specs_the_ledger_can_explain(- backend_name=backend_name,- backends_dir_path=backends_dir_path,- backend_blueprint=backend_blueprint,- substitute_vars_with_provider=substitute_vars_with_provider,- )- if recovered is None:- raise- backend_model_specs = recovered.model_specs- stale_plans.extend(recovered.plans)- if enabled and not backend_model_specs and backend_name != PipelexBackend.INTERNAL:- # An enabled backend serving nothing is never what a user meant: it is a table an- # earlier release left enabled over a comment-only file, the Pipelex Gateway's above all.- # Booting it would only drop every model routed to it from the deck, which says- # "handle not found" and nothing about why. The internal backend is exempt: plugins- # add its models after this load.- msg = (- f"Inference backend '{backend_name}' is enabled in {library_paths_description} but "- f"{backend_config_source} declares no model. Disable it, or list the models it serves; "- f"if a routing profile sends models to it, point that profile at a backend that serves them."- )- raise InferenceBackendLibraryValidationError(msg, backend_name=backend_name)- backend = InferenceBackendFactory.make_inference_backend(- name=backend_name,- blueprint=backend_blueprint,- extra_config=extra_config,- model_specs=backend_model_specs,+ if recovered is None:+ raise+ backend_model_specs = recovered.model_specs+ stale_plans.extend(recovered.plans)+ if enabled and not backend_model_specs and backend_name != PipelexBackend.INTERNAL:+ # An enabled backend serving nothing is never what a user meant: it is a table an+ # earlier release left enabled over a comment-only file, the Pipelex Gateway's above all.+ # Booting it would only drop every model routed to it from the deck, which says+ # "handle not found" and nothing about why. The internal backend is exempt: plugins+ # add its models after this load.+ msg = (+ f"Inference backend '{backend_name}' is enabled in {library_paths_description} but "+ f"{backend_config_source} declares no model. Disable it, or list the models it serves; "+ f"if a routing profile sends models to it, point that profile at a backend that serves them.")- self.root[backend_name] = backend- except InferenceBackendCredentialsError as credentials_exc:- if lenient:- log.verbose(f"Skipping backend '{backend_name}': {credentials_exc}")- continue- raise+ raise InferenceBackendLibraryValidationError(msg, backend_name=backend_name)+ if model_spec_var_names:+ unresolved_credentials[UNRESOLVED_MODEL_SPECS_KEY] = model_spec_var_names+ backend = InferenceBackendFactory.make_inference_backend(+ name=backend_name,+ blueprint=backend_blueprint,+ extra_config=extra_config,+ model_specs=backend_model_specs,+ credentials=credentials,+ unresolved_credentials=unresolved_credentials,+ )+ self.root[backend_name] = backend# One warning for the whole load rather than one per backend: a schema change lands on every# file of the directory at once, and a user reading a dozen warnings would learn nothing the# first did not already say.self._stale_warning = stale_configuration_warning(plans=stale_plans, walked_dirs=config_manager.existing_config_dirs) if stale_plans else None+ @classmethod+ def _substitute_backend_table_vars(+ cls,+ *,+ backend_table: dict[str, Any],+ backend_name: str,+ library_paths_description: str,+ substitute_vars_with_provider: StringTransform,+ ) -> dict[str, Any]:+ """Resolve every placeholder of a backend's `backends.toml` table, as a *credentials* failure when one cannot be.++ Raises:+ InferenceBackendCredentialsError: If a variable cannot be resolved.+ """+ try:+ return apply_to_strings_recursive(backend_table, transform_func=substitute_vars_with_provider)+ except VarFallbackPatternError as var_fallback_pattern_exc:+ msg = f"Variable substitution failed due to a pattern error in {library_paths_description}:\n{var_fallback_pattern_exc}"+ raise InferenceBackendCredentialsError(+ credentials_error_type=InferenceBackendCredentialsErrorType.VAR_FALLBACK_PATTERN,+ backend_name=backend_name,+ message=msg,+ # The pattern names several candidates, so no single one of them is the missing key.+ key_name="unknown",+ ) from var_fallback_pattern_exc+ except VarNotFoundError as var_not_found_exc:+ msg = (+ f"Variable substitution failed due to a 'variable not found' error in {library_paths_description}:\n"+ f"Backend name: '{backend_name}', Variable name: '{var_not_found_exc.var_name}'\n"+ f"{var_not_found_exc}\nRun mode: '{runtime_manager.run_mode}'"+ )+ raise InferenceBackendCredentialsError(+ credentials_error_type=InferenceBackendCredentialsErrorType.VAR_NOT_FOUND,+ backend_name=backend_name,+ message=msg,+ key_name=var_not_found_exc.var_name,+ ) from var_not_found_exc+ except UnknownVarPrefixError as unknown_var_prefix_exc:+ raise cls._unknown_var_prefix_credentials_error(+ unknown_var_prefix_exc=unknown_var_prefix_exc, backend_name=backend_name, source=library_paths_description+ ) from unknown_var_prefix_exc++ @classmethod+ def _validated_backend_blueprint(+ cls,+ *,+ table: dict[str, Any],+ backend_name: str,+ library_paths_description: str,+ ) -> InferenceBackendBlueprint:+ """The blueprint of a backend's `backends.toml` table, built from its declared fields alone.++ Raises:+ InferenceBackendLibraryValidationError: The index file's own refusal, said with the backend+ and the file in front of the analysis: pydantic's error alone names a field, and every+ table of this file has that field.+ """+ declared_fields = InferenceBackendBlueprint.model_fields.keys()+ try:+ return InferenceBackendBlueprint.model_validate(+ {field_name: value for field_name, value in table.items() if field_name in declared_fields}+ )+ except ValidationError as validation_error:+ validation_error_msg = format_pydantic_validation_error(validation_error)+ msg = f"Invalid inference backend '{backend_name}' in {library_paths_description}: {validation_error_msg}"+ raise InferenceBackendLibraryValidationError(msg, backend_name=backend_name) from validation_error++ @classmethod+ def _unknown_var_prefix_credentials_error(+ cls,+ *,+ unknown_var_prefix_exc: UnknownVarPrefixError,+ backend_name: str,+ source: str,+ ) -> InferenceBackendCredentialsError:+ """A placeholder's unknown prefix, said the same way whether the load resolves credentials or not."""+ return InferenceBackendCredentialsError(+ credentials_error_type=InferenceBackendCredentialsErrorType.UNKNOWN_VAR_PREFIX,+ backend_name=backend_name,+ message=f"Variable substitution failed due to an unknown variable prefix error in {source}:\n{unknown_var_prefix_exc}",+ key_name=unknown_var_prefix_exc.var_name,+ )++ @classmethod+ def _backend_table_without_templated_fields(+ cls,+ *,+ backend_table: dict[str, Any],+ unresolved_credentials: dict[str, list[str]],+ ) -> dict[str, Any]:+ """A backend's `backends.toml` table less every field that references a variable, which it records instead.++ A keyless load leaves such a field unset rather than keep its `${…}` text, so that nothing+ can mistake the text for an endpoint or a key: `endpoint` and `api_key` fall back to `None`,+ an extra-config key is absent. A literal field, such as a fixed endpoint, is kept as written.+ """+ kept_fields: dict[str, Any] = {}+ for field_name, value in backend_table.items():+ field_var_names: list[str] = []+ apply_to_strings_recursive({field_name: value}, transform_func=partial(cls._record_placeholder_var_names, var_names=field_var_names))+ if field_var_names:+ unresolved_credentials[field_name] = field_var_names+ else:+ kept_fields[field_name] = value+ return kept_fields++ @classmethod+ def _refuse_placeholders_in_literal_fields(+ cls,+ *,+ table: dict[str, Any],+ declared_fields: Iterable[str],+ templatable_fields: frozenset[str],+ where: str,+ backend_name: str,+ ) -> None:+ """Refuse a `${…}` placeholder in a declared field that describes the model, on every load.++ Checked on the raw text, before any substitution, so a load that resolves credentials and one+ that does not refuse the same files: a keyless load cannot resolve such a field, and a verdict+ that held only where the variable is set is what the keyless boot exists to rule out.++ Raises:+ InferenceBackendLibraryValidationError: Naming the field and the variables it references.+ """+ literal_fields = set(declared_fields) - templatable_fields+ for field_name, value in table.items():+ if field_name not in literal_fields:+ continue+ var_names: list[str] = []+ apply_to_strings_recursive({field_name: value}, transform_func=partial(cls._record_placeholder_var_names, var_names=var_names))+ if var_names:+ msg = (+ f"Invalid {where}: '{field_name}' references {', '.join(var_names)}, but a placeholder may only "+ f"stand in a value a call sends (an API key, an endpoint, a model id, a request header or an extra "+ f"config key). '{field_name}' describes the model, which a boot without inference must know "+ f"without resolving anything: write it literally."+ )+ raise InferenceBackendLibraryValidationError(msg, backend_name=backend_name)++ @classmethod+ def _record_placeholder_var_names(cls, content: str, *, var_names: list[str]) -> str:+ """Add the variables `content` references to `var_names`, and return `content` as it is."""+ for var_name in placeholder_var_names(content=content):+ if var_name not in var_names:+ var_names.append(var_name)+ return content+@classmethoddef _build_backend_model_specs(cls,@@ -344,9 +505,8 @@ class InferenceBackendLibrary(RootModel[InferenceBackendLibraryRoot]):# like one; anything else is a typo or a dead field, and is refused.key_split = split_model_spec_keys(model_spec_dict=model_spec_dict)if key_split.rejected:- # Fatal in lenient mode too: leniency covers credentials only (see the docstring),- # and this is not a credentials error, so the lenient `except` in `load` lets it- # through. What may still catch it is the ledger, one level up.+ # Fatal on a keyless load too: that load skips credentials, and this is a document+ # that is wrong. What may still catch it is the ledger, one level up.plural = "s" if len(key_split.rejected) > 1 else ""msg = (f"Unknown key{plural} on model '{model_spec_name}' for backend '{backend_name}' "@@ -384,7 +544,7 @@ class InferenceBackendLibrary(RootModel[InferenceBackendLibraryRoot]):backend_name: str,backends_dir_path: str,backend_blueprint: InferenceBackendBlueprint,- substitute_vars_with_provider: Any,+ substitute_vars_with_provider: StringTransform,) -> RecoveredModelSpecs | None:"""This backend's specs rebuilt from its file as the ledger would leave it, or `None`.@@ -425,20 +585,22 @@ class InferenceBackendLibrary(RootModel[InferenceBackendLibraryRoot]):backend_name: str,*,backends_dir_path: str,- substitute_vars_with_provider: Any,+ substitute_vars_with_provider: StringTransform,) -> tuple[BackendModelSpecs, str]:"""Load model specs from local TOML file.Args:backend_name: Name of the backend.backends_dir_path: Path to directory containing TOML files.- substitute_vars_with_provider: Function to substitute variables.+ substitute_vars_with_provider: What runs over every string of the file: substitution, or on a+ keyless load a recorder that keeps the text.Returns:Model specs dictionary from local TOML.Raises:InferenceBackendLibraryError: If the file is missing.+ InferenceBackendLibraryValidationError: If a field describing a model references a variable.InferenceBackendCredentialsError: If variable substitution fails."""path_to_model_specs_toml = backend_toml_path(backends_dir_path=backends_dir_path, backend_name=backend_name)@@ -449,6 +611,20 @@ class InferenceBackendLibrary(RootModel[InferenceBackendLibraryRoot]):raise InferenceBackendLibraryError(msg, backend_name=backend_name) from file_not_found_excbackend_config_source = f"file '{path_to_model_specs_toml}'"+ for model_spec_name, model_spec_table in model_specs_dict_raw.items():+ if isinstance(model_spec_table, dict):+ try:+ self._refuse_placeholders_in_literal_fields(+ table=cast("dict[str, Any]", model_spec_table),+ declared_fields=InferenceModelSpecBlueprint.model_fields.keys(),+ templatable_fields=TEMPLATABLE_MODEL_SPEC_FIELDS,+ where=f"model '{model_spec_name}' for backend '{backend_name}' in {backend_config_source}",+ backend_name=backend_name,+ )+ except UnknownVarPrefixError as unknown_var_prefix_exc:+ raise self._unknown_var_prefix_credentials_error(+ unknown_var_prefix_exc=unknown_var_prefix_exc, backend_name=backend_name, source=backend_config_source+ ) from unknown_var_prefix_excmodel_specs_dict = self._substitute_model_spec_vars(model_specs_dict=model_specs_dict_raw,backend_name=backend_name,@@ -464,13 +640,12 @@ class InferenceBackendLibrary(RootModel[InferenceBackendLibraryRoot]):model_specs_dict: BackendModelSpecs,backend_name: str,source: str,- substitute_vars_with_provider: Any,+ substitute_vars_with_provider: StringTransform,) -> BackendModelSpecs:"""Resolve variable placeholders in model specs, as a *credentials* failure when one cannot be.- The error class carries the leniency decision: `load(lenient=True)` skips a backend whose- credentials are missing, and nothing else. Raising anything broader here would put a- malformed-config failure on the same silent path.+ Only a load that resolves credentials can raise here: a keyless load's transform keeps the+ text and records the variables, and never raises.Raises:InferenceBackendCredentialsError: If a variable cannot be resolved.diff --git a/pipelex/cogt/model_backends/credential_resolution.py b/pipelex/cogt/model_backends/credential_resolution.pynew file mode 100644index 000000000..cb1f4f07a--- /dev/null+++ b/pipelex/cogt/model_backends/credential_resolution.py@@ -0,0 +1,15 @@+from enum import StrEnum+++class CredentialResolution(StrEnum):+ """Whether a load of the inference backend library resolves the credentials its files reference.++ `REQUIRE` is the boot that needs inference: every `${…}` placeholder is substituted, and a+ credential that cannot be resolved is an error naming the variable. `SKIP` is the keyless boot:+ it substitutes nothing and asks the secrets provider nothing, yet keeps every enabled backend with+ its models and constraints, so it knows every model a keyed boot knows. What it cannot do is call+ a provider, and each backend records what it left unresolved so that a call is refused.+ """++ REQUIRE = "require"+ SKIP = "skip"diff --git a/pipelex/cogt/model_routing/routing_profile_loader.py b/pipelex/cogt/model_routing/routing_profile_loader.pyindex 58fa9cc46..4909603aa 100644--- a/pipelex/cogt/model_routing/routing_profile_loader.py+++ b/pipelex/cogt/model_routing/routing_profile_loader.py@@ -16,7 +16,6 @@ def load_active_routing_profile(*,routing_profile_library_paths: Sequence[Path],enabled_backends: list[str],- lenient: bool = False,) -> RoutingProfile:"""Load the active routing profile from the routing profile library.@@ -30,13 +29,12 @@ def load_active_routing_profile(blueprint refuses or an ``active`` naming no profile is ``RoutingProfileLibraryError``, and a profile whose default orroutes name a backend that is not enabled is ``RoutingProfileDisabledBackendError``. That lastone is the half-written override — ``active`` flipped, the backend still off — and the boot- turns it into a setup error that says so.+ turns it into a setup error that says so, whether or not it needs inference: a keyless boot keeps+ every enabled backend, so a profile it cannot route is a configuration error there too.Args:routing_profile_library_paths: The base file first, then the override files in merge order.enabled_backends: List of currently enabled backend names.- lenient: When True, warn instead of raising when the profile references- backends that are not enabled (e.g. because credentials are missing)."""library_description = describe_toml_base_and_overrides(paths=routing_profile_library_paths)try:@@ -75,25 +73,17 @@ def load_active_routing_profile(blueprint=active_profile_blueprint,)if active_profile.default and active_profile.default not in enabled_backends:- if lenient:- log.verbose(f"Default backend '{active_profile.default}' for routing profile '{active_profile_name}' is not enabled (lenient mode)")- else:- msg = (- f"Default backend '{active_profile.default}' set for routing profile '{active_profile_name}' is not enabled. "- f"You must either enable backend '{active_profile.default}' or set a different default backend for profile '{active_profile_name}', "- "or select a different routing profile."- )- raise RoutingProfileDisabledBackendError(msg)+ msg = (+ f"Default backend '{active_profile.default}' set for routing profile '{active_profile_name}' is not enabled. "+ f"You must either enable backend '{active_profile.default}' or set a different default backend for profile '{active_profile_name}', "+ "or select a different routing profile."+ )+ raise RoutingProfileDisabledBackendError(msg)# Check routes that use disabled backends- seen_disabled_backends: set[str] = set()for backend_name in active_profile.routes.values():- if backend_name not in enabled_backends and backend_name not in seen_disabled_backends:- if lenient:- log.verbose(f"Backend '{backend_name}' for profile '{active_profile_name}' is not enabled (lenient mode)")- else:- msg = f"Backend '{backend_name}', required for profile '{active_profile_name}' is not enabled"- raise RoutingProfileDisabledBackendError(msg)- seen_disabled_backends.add(backend_name)+ if backend_name not in enabled_backends:+ msg = f"Backend '{backend_name}', required for profile '{active_profile_name}' is not enabled"+ raise RoutingProfileDisabledBackendError(msg)return active_profilediff --git a/pipelex/cogt/models/model_manager.py b/pipelex/cogt/models/model_manager.pyindex b772b1702..99b25da19 100644--- a/pipelex/cogt/models/model_manager.py+++ b/pipelex/cogt/models/model_manager.py@@ -6,9 +6,16 @@ from typing_extensions import overridefrom pipelex import logfrom pipelex.cogt.doc_gen.doc_gen_format import parse_doc_gen_choice_key-from pipelex.cogt.exceptions import ModelManagerError, PluginModelDeclarationError+from pipelex.cogt.exceptions import (+ InferenceBackendCredentialsError,+ InferenceBackendCredentialsErrorType,+ ModelManagerError,+ PluginModelDeclarationError,+)+from pipelex.cogt.inference.error_classification import UserAction, UserActionKindfrom pipelex.cogt.model_backends.backend import InferenceBackend, PipelexBackendfrom pipelex.cogt.model_backends.backend_library import InferenceBackendLibrary+from pipelex.cogt.model_backends.credential_resolution import CredentialResolutionfrom pipelex.cogt.model_backends.model_spec import InferenceModelSpecfrom pipelex.cogt.model_backends.model_type import ModelTypefrom pipelex.cogt.model_routing.routing_models import BackendMatchingMethod@@ -78,7 +85,9 @@ class ModelManager(ModelManagerAbstract):secrets_provider=secrets_provider,backends_library_paths=backends_library_paths or config_manager.backends_file_paths(),backends_dir_path=resolved_backends_dir_path,- lenient=not needs_inference,+ # A keyless boot knows every enabled backend's models and resolves no credential; the boot+ # that needs inference resolves every one and refuses to start without it.+ credentials=CredentialResolution.REQUIRE if needs_inference else CredentialResolution.SKIP,)# The loader parks its stale-configuration warning rather than logging it, so that the# doctor's per-backend probe — which loads the whole library once per backend — does not@@ -96,7 +105,6 @@ class ModelManager(ModelManagerAbstract):self._routing_profile = load_active_routing_profile(routing_profile_library_paths=routing_profile_library_paths or config_manager.routing_profiles_file_paths(),enabled_backends=enabled_backends,- lenient=not needs_inference,)model_deck_paths = ModelManager.get_model_deck_paths(deck_dir_path=deck_dir_path or str(config_manager.model_decks_dir_path))deck_blueprint = load_model_deck_blueprint(@@ -248,8 +256,41 @@ class ModelManager(ModelManagerAbstract):@overridedef get_required_inference_backend(self, backend_name: str) -> InferenceBackend:+ """The backend a worker calls, refused when this process left its credentials unresolved.++ Every reader of a backend's credentials reaches it here, so this one check keeps a keyless+ boot's unset key and endpoint away from every provider client. A keyless boot forces its own+ runs to DRY, so only a keyless process executing live work for another one, as a Temporal+ worker can, gets this far; it is told why rather than sending a provider no key.++ Raises:+ ModelManagerError: No such backend is loaded.+ InferenceBackendCredentialsError: The backend's credentials were not resolved, because the+ process booted without inference.+ """backend = self.inference_backend_library.get_inference_backend(backend_name)if backend is None:msg = f"Inference backend '{backend_name}' not found"raise ModelManagerError(msg)+ if backend.unresolved_credentials:+ unresolved_description = ", ".join(+ f"{field_name} ({', '.join(var_names)})" if var_names else field_name+ for field_name, var_names in backend.unresolved_credentials.items()+ )+ unresolved_var_names = backend.unresolved_credential_vars+ msg = (+ f"Inference backend '{backend_name}' cannot be called by this process: it booted without inference "+ f"(needs_inference=False), which loads every backend's models but resolves none of their credentials. "+ f"Left unresolved: {unresolved_description}."+ )+ raise InferenceBackendCredentialsError(+ credentials_error_type=InferenceBackendCredentialsErrorType.NOT_RESOLVED_ON_KEYLESS_BOOT,+ backend_name=backend_name,+ message=msg,+ key_name=unresolved_var_names[0] if unresolved_var_names else next(iter(backend.unresolved_credentials)),+ user_action=UserAction(+ kind=UserActionKind.CHECK_CREDENTIALS,+ detail="Boot the process that calls this backend with needs_inference=True, with its credentials set",+ ),+ )return backenddiff --git a/pipelex/cogt/models/model_manager_abstract.py b/pipelex/cogt/models/model_manager_abstract.pyindex 7db74b1b0..56c78bd38 100644--- a/pipelex/cogt/models/model_manager_abstract.py+++ b/pipelex/cogt/models/model_manager_abstract.py@@ -27,6 +27,10 @@ class ModelManagerAbstract(ABC):) -> None:"""Load the inference backends, the routing profile and the model deck, and build the deck.+ With ``needs_inference=False`` an implementation knows every enabled backend's models, as a boot+ that needs inference does, but resolves no credential; ``get_required_inference_backend`` then+ refuses every backend whose credentials it left unresolved.+``plugin_model_declarations`` carries the internal models and the model deck defaults the registered pluginsdeclared (``PluginRegistrar.make_model_declarations``): an implementation merges the models into the internalbackend and the defaults beneath the deck files. Required, so no caller can forget the plugins' engines.@@ -42,4 +46,8 @@ class ModelManagerAbstract(ABC):@abstractmethoddef get_required_inference_backend(self, backend_name: str) -> InferenceBackend:- pass+ """The backend a worker calls, and the one way to a backend's credentials.++ Raises ``InferenceBackendCredentialsError`` for a backend whose credentials this process left+ unresolved, because it booted without inference.+ """diff --git a/pipelex/kernel/judgment_ops.py b/pipelex/kernel/judgment_ops.pyindex b205e52e3..efeae1fe6 100644--- a/pipelex/kernel/judgment_ops.py+++ b/pipelex/kernel/judgment_ops.py@@ -99,7 +99,7 @@ def resolve_judgment_setting(The returned setting is pinned to the *resolved* handle, so it doubles as a distributed run'srouting key. A dry run calls no judging worker, so a model the deck names that no backend serves on- this boot, as on a keyless boot that skipped the backend whose key is unset, keeps the deck's handle.+ this boot, as when its backend is disabled, keeps the deck's handle."""model_deck = get_model_deck()judgment_setting = judgment_setting_of_choice(judgment_choice=judgment_choice, pipe_code=pipe_code)diff --git a/pipelex/pipe_operators/judge/pipe_judge.py b/pipelex/pipe_operators/judge/pipe_judge.pyindex b48652eee..184ee9539 100644--- a/pipelex/pipe_operators/judge/pipe_judge.py+++ b/pipelex/pipe_operators/judge/pipe_judge.py@@ -106,9 +106,10 @@ class PipeJudge(PipeOperator[PipeJudgeOutput]):an `Image` or a `Document` input, or a list of either, is sent to the model as a file. Whether themodel reads one is its own capability, stated in its spec's `inputs`: a model that does not isrefused here, naming the input and what it reads. That needs the model's spec, which a boot that- skipped its backend, a keyless one with the backend's key unset, does not hold, and neither does- one serving none of a waterfall's models: the check is then left to the worker when the step runs,- as it is for a `Dynamic` input, whose declaration names no kind of value.+ does not enable the model's backend does not hold, and neither does one serving none of a+ waterfall's models: the check is then left to the worker when the step runs, as it is for a+ `Dynamic` input, whose declaration names no kind of value. A keyless boot holds the spec: it keeps+ every enabled backend, whether or not its key is set."""with self.locating_model_choice(field_name="model"):judgment_setting = judgment_setting_of_choice(judgment_choice=self.judgment_choice, pipe_code=self.code)diff --git a/pipelex/pipelex.py b/pipelex/pipelex.pyindex aec180ba6..05b571e95 100644--- a/pipelex/pipelex.py+++ b/pipelex/pipelex.py@@ -261,11 +261,13 @@ class Pipelex(RuntimeBoot):integration_mode: Integration mode (CLI, FASTAPI, DOCKER, MCP, N8N, PYTHON, PYTEST)needs_inference: When False, forces every run THIS process initiates to DRY mode(applied at runtime_hub.resolve_run_mode_for_boot, which every run-params factory- calls: operators dispatch normally and the cogt leaf mocks) and loads backends leniently- (skipping those with missing credentials). This skips model deck validation. Useful for- commands like validate/show that don't call inference APIs. Generator selection stays- backend-keyed. Submitter-side contract only: it does not constrain work this process- executes as a Temporal worker.+ calls: operators dispatch normally and the cogt leaf mocks) and loads every enabled+ backend with its models without resolving any credential, so it knows every model a+ boot with inference knows; a backend it did not credential refuses to be called. This+ skips model deck validation. Useful for commands like validate/show that don't call+ inference APIs. Generator selection stays backend-keyed. The forced DRY mode binds+ only the runs this process submits, but the unresolved credentials bind everything+ it executes: a Temporal worker that runs live work boots with inference.boot_orchestrator: When provided, boots this process under the orchestrator pluginof this name (e.g. "temporal" to run pipes through the Temporal worker runtime).Any other value (or None) leaves execution in-process. Core names no orchestrator;diff --git a/pipelex/providers/linkup/linkup_extract_worker.py b/pipelex/providers/linkup/linkup_extract_worker.pyindex 82ed0da6b..ca981f318 100644--- a/pipelex/providers/linkup/linkup_extract_worker.py+++ b/pipelex/providers/linkup/linkup_extract_worker.py@@ -25,7 +25,6 @@ from pipelex.cogt.inference.error_render import InferenceErrorFamily, render_inffrom pipelex.cogt.model_backends.model_spec import InferenceModelSpecfrom pipelex.cogt.usage.token_category import TokenCategoryfrom pipelex.reporting.reporting_protocol import ReportingProtocol-from pipelex.runtime_hub import get_secrets_providerclass LinkupExtractWorker(ExtractWorkerAbstract):@@ -33,6 +32,7 @@ class LinkupExtractWorker(ExtractWorkerAbstract):self,extra_config: dict[str, Any],inference_model: InferenceModelSpec,+ api_key: str,reporting_delegate: ReportingProtocol | None = None,) -> None:ExtractWorkerAbstract.__init__(@@ -41,7 +41,6 @@ class LinkupExtractWorker(ExtractWorkerAbstract):inference_model=inference_model,reporting_delegate=reporting_delegate,)- api_key = get_secrets_provider().get_secret(secret_id="LINKUP_API_KEY")self._linkup_client = LinkupClient(api_key=api_key)@overridediff --git a/pipelex/providers/linkup/linkup_plugin.py b/pipelex/providers/linkup/linkup_plugin.pyindex 8f40a9bbd..103a5d292 100644--- a/pipelex/providers/linkup/linkup_plugin.py+++ b/pipelex/providers/linkup/linkup_plugin.py@@ -5,12 +5,21 @@ from pipelex.plugins.contract import PLUGIN_API_VERSIONfrom pipelex.plugins.inference_backend_registry import InferenceFamily, require_sdkfrom pipelex.plugins.registrar import PluginRegistrarfrom pipelex.plugins.sdk_client_registry import SdkClientRegistry+from pipelex.providers.linkup.linkup_exceptions import LinkupErrorfrom pipelex.reporting.reporting_protocol import ReportingProtocol_LINKUP_MISSING_MSG = "The linkup SDK is required in order to use Linkup Fetch extraction models."_LINKUP_SEARCH_MISSING_MSG = "The linkup SDK is required in order to use Linkup search models."+def _required_linkup_api_key(*, backend: InferenceBackend) -> str:+ """The backend's own key, like every other provider's: whichever variable its configuration names."""+ if not backend.api_key:+ msg = f"Inference backend '{backend.name}' has no API key configured, so Linkup cannot be called"+ raise LinkupError(msg)+ return backend.api_key++def _make_linkup_extract_worker(*,inference_model: InferenceModelSpec,@@ -25,6 +34,7 @@ def _make_linkup_extract_worker(return LinkupExtractWorker(extra_config=backend.extra_config,inference_model=inference_model,+ api_key=_required_linkup_api_key(backend=backend),reporting_delegate=reporting_delegate,)@@ -32,7 +42,7 @@ def _make_linkup_extract_worker(def _make_linkup_search_worker(*,inference_model: InferenceModelSpec,- backend: InferenceBackend, # ruff: ignore[unused-function-argument] - uniform MakeWorkerFn signature; the search worker builds its own client+ backend: InferenceBackend,sdk_clients: SdkClientRegistry, # ruff: ignore[unused-function-argument] - stateless worker, no SDK-client cachingreporting_delegate: ReportingProtocol | None,) -> InferenceWorkerAbstract:@@ -42,6 +52,7 @@ def _make_linkup_search_worker(return LinkupSearchWorker(inference_model=inference_model,+ api_key=_required_linkup_api_key(backend=backend),reporting_delegate=reporting_delegate,)diff --git a/pipelex/providers/linkup/linkup_search_worker.py b/pipelex/providers/linkup/linkup_search_worker.pyindex 4515d9e2e..847e05c13 100644--- a/pipelex/providers/linkup/linkup_search_worker.py+++ b/pipelex/providers/linkup/linkup_search_worker.py@@ -29,7 +29,6 @@ from pipelex.core.stuffs.document_content import DocumentContentfrom pipelex.core.stuffs.search_result_content import SearchResultContentfrom pipelex.providers.linkup.linkup_exceptions import LinkupSearchEmptyResultError, LinkupSearchResponseErrorfrom pipelex.reporting.reporting_protocol import ReportingProtocol-from pipelex.runtime_hub import get_secrets_providerfrom pipelex.tools.typing.pydantic_utils import BaseModelTypeVar@@ -37,10 +36,10 @@ class LinkupSearchWorker(SearchWorkerAbstract):def __init__(self,inference_model: InferenceModelSpec,+ api_key: str,reporting_delegate: ReportingProtocol | None = None,) -> None:SearchWorkerAbstract.__init__(self, inference_model=inference_model, reporting_delegate=reporting_delegate)- api_key = get_secrets_provider().get_secret(secret_id="LINKUP_API_KEY")self._linkup_client = LinkupClient(api_key=api_key)def _parse_date(self, date_str: str | None) -> date | None:diff --git a/pipelex/tools/secrets/secrets_utils.py b/pipelex/tools/secrets/secrets_utils.pyindex a49243bf9..cd0acc4d6 100644--- a/pipelex/tools/secrets/secrets_utils.py+++ b/pipelex/tools/secrets/secrets_utils.py@@ -90,9 +90,43 @@ def substitute_vars(return VAR_PLACEHOLDER_PATTERN.sub(replace_var, content)+def placeholder_var_names(*, content: str) -> list[str]:+ """The names of the variables the placeholders in `content` reference, in order and without repeats.++ Resolves nothing: `${VAR}`, `${env:VAR}`, `${secret:VAR}` and every candidate of a fallback+ pattern such as `${env:VAR|secret:OTHER}` each contribute their name. A prefix this module does+ not know is refused as `substitute_vars` refuses it, so a file that names its variables without+ resolving them gets the same verdict on its syntax as one that resolves them.++ Raises:+ UnknownVarPrefixError: If a placeholder carries a prefix other than `env` or `secret`.+ """+ var_names: list[str] = []+ for match in VAR_PLACEHOLDER_PATTERN.finditer(content):+ for part in match.group(1).split("|"):+ var_name = part+ if ":" in part:+ prefix_str, var_name = part.split(":", 1)+ prefix_str = prefix_str.strip()+ try:+ VarPrefix(prefix_str)+ except ValueError as exc:+ raise UnknownVarPrefixError(var_name=var_name.strip(), message=f"Unknown variable prefix: '{prefix_str}'") from exc+ var_name = var_name.strip()+ if var_name not in var_names:+ var_names.append(var_name)+ return var_names++def _handle_fallback_pattern(var_spec: str, *, secrets_provider: SecretsProviderAbstract) -> str:- """Handle fallback pattern like 'env:VAR|secret:VAR'."""+ """Handle fallback pattern like 'env:VAR|secret:VAR'.++ Every candidate's prefix is checked before any is resolved, so an unknown one is refused whether or+ not an earlier candidate resolves: the verdict on a file's syntax never depends on which variables+ the machine holds, and `placeholder_var_names` gives the same one without resolving anything.+ """parts = [part.strip() for part in var_spec.split("|")]+ placeholder_var_names(content=f"${{{var_spec}}}")for part in parts:if ":" in part:diff --git a/subject_grants.toml b/subject_grants.tomlindex 891d452ec..0411976b6 100644--- a/subject_grants.toml+++ b/subject_grants.toml@@ -1972,6 +1972,10 @@ rationale = "Factory from source: builds the result from the name; single operanparam = "backend_name"rationale = "Loads model specs for the named backend; single operand."+["pipelex/cogt/model_backends/backend_library.py::InferenceBackendLibrary._record_placeholder_var_names"]+param = "content"+rationale = "A string transform: apply_to_strings_recursive calls transform_func with the string positionally, as it calls substitute_vars on a load that resolves credentials."+["pipelex/cogt/model_backends/backend_library.py::InferenceBackendLibrary.get_inference_backend"]param = "backend_name"rationale = "Keyed accessor by the backend_name; single operand."diff --git a/tests/e2e/agent_cli/conftest.py b/tests/e2e/agent_cli/conftest.pyindex 857566a9a..06829c4a4 100644--- a/tests/e2e/agent_cli/conftest.py+++ b/tests/e2e/agent_cli/conftest.py@@ -82,21 +82,20 @@ def offline_subprocess_env(hermetic_home: Path) -> dict[str, str]:"""Base subprocess env that points the CLI at the hermetic HOME.Tests extend this dict before passing it to ``subprocess.run``. Dummy credentials are- populated for every backend that the kit's ``backends.toml`` references so the dry-run- setup doesn't fail with ``InferenceBackendCredentialsError`` for backends we don't care- about — under ``needs_inference=False`` Pipelex is lenient on credential validation, but- only at the resolution layer; the env-var substitution itself still requires the var to- exist.+ populated for every backend that the kit's ``backends.toml`` references. A dry run or a+ validation boots without inference and resolves none of them, so it needs none; they are here+ for the commands that check credentials, ``pipelex doctor`` above all, whose report and prompts+ must not depend on which keys the developer's shell happens to hold."""env: dict[str, str] = {"HOME": str(hermetic_home),"PATH": "/usr/bin:/bin:/usr/local/bin",- # Force CI test mode so vertexai is skipped.+ # Force CI test mode, so a boot that resolves credentials (the doctor's) skips vertexai,+ # whose token it would otherwise mint over the network."RUN_MODE": "ci_test",- # Dummy credentials — the test never makes a real provider call (dry-run only) and- # ``lenient=True`` (set by ``--dry-run``) skips backends whose env vars are missing- # rather than raising. We populate every key so backend loading is deterministic- # regardless of the developer's shell environment.+ # Dummy credentials — no test makes a real provider call. A keyless boot (a dry run, a+ # validation) reads none of them; the doctor does, and with a key missing it would prompt+ # for it before anything else."ANTHROPIC_API_KEY": "dummy-anthropic-key","AWS_REGION": "us-east-1","AZURE_API_BASE": "https://example.invalid",diff --git a/tests/helpers/backend_library_loading.py b/tests/helpers/backend_library_loading.pynew file mode 100644index 000000000..de8f2098a--- /dev/null+++ b/tests/helpers/backend_library_loading.py@@ -0,0 +1,52 @@+"""Load an inference backend library from a backends table and one backend's file, both written to a temporary directory."""++from pathlib import Path++from pipelex.cogt.model_backends.backend import InferenceBackend+from pipelex.cogt.model_backends.backend_library import InferenceBackendLibrary+from pipelex.cogt.model_backends.credential_resolution import CredentialResolution+from pipelex.tools.secrets.env_secrets_provider import EnvSecretsProvider+from pipelex.tools.secrets.secrets_provider_abstract import SecretsProviderAbstract++BOTH_MODES = [CredentialResolution.REQUIRE, CredentialResolution.SKIP]+++def write_config(tmp_path: Path, *, backends_toml: str, model_specs_toml: str | None, backend_name: str = "acme") -> tuple[Path, str]:+ backends_dir = tmp_path / "backends"+ backends_dir.mkdir()+ backends_library_path = tmp_path / "backends.toml"+ backends_library_path.write_text(backends_toml)+ if model_specs_toml is not None:+ (backends_dir / f"{backend_name}.toml").write_text(model_specs_toml)+ return backends_library_path, str(backends_dir)+++def load_library(+ tmp_path: Path,+ *,+ backends_toml: str,+ model_specs_toml: str | None,+ credentials: CredentialResolution,+ secrets_provider: SecretsProviderAbstract | None = None,+ backend_name: str = "acme",+) -> InferenceBackendLibrary:+ backends_library_path, backends_dir_path = write_config(+ tmp_path,+ backends_toml=backends_toml,+ model_specs_toml=model_specs_toml,+ backend_name=backend_name,+ )+ library = InferenceBackendLibrary.make_empty()+ library.load(+ secrets_provider=secrets_provider or EnvSecretsProvider(),+ backends_library_paths=[backends_library_path],+ backends_dir_path=backends_dir_path,+ credentials=credentials,+ )+ return library+++def required_backend(library: InferenceBackendLibrary, backend_name: str = "acme") -> InferenceBackend:+ backend = library.get_inference_backend(backend_name=backend_name)+ assert backend is not None, f"backend '{backend_name}' is missing from {library.list_backend_names()}"+ return backenddiff --git a/tests/helpers/recording_secrets_provider.py b/tests/helpers/recording_secrets_provider.pynew file mode 100644index 000000000..ff56fc4c7--- /dev/null+++ b/tests/helpers/recording_secrets_provider.py@@ -0,0 +1,53 @@+"""A secrets provider that answers every lookup the same way and records them.++The keyless-boot tests vary exactly one thing, whether credentials are present, so the result does+not depend on which keys the developer or the CI runner happens to hold. The same double plays the+three parts those tests need: built with no value it holds no secret at all, built with a value it+holds every secret, and in both cases `looked_up` says what the boot asked it, in order.+"""++from typing_extensions import override++from pipelex.tools.secrets.exceptions import SecretNotFoundError+from pipelex.tools.secrets.secrets_provider_abstract import SecretsProviderAbstract+++class RecordingSecretsProvider(SecretsProviderAbstract):+ def __init__(self, *, value: str | None) -> None:+ self._value = value+ self.looked_up: list[str] = []++ @classmethod+ def make_empty(cls) -> "RecordingSecretsProvider":+ """Holds no secret: every lookup raises `SecretNotFoundError`."""+ return cls(value=None)++ @classmethod+ def make_credentialed(cls) -> "RecordingSecretsProvider":+ """Holds every secret, each one `"fake-key"`."""+ return cls(value="fake-key")++ @override+ def get_required_secret(self, secret_id: str) -> str:+ self.looked_up.append(secret_id)+ if self._value is None:+ msg = f"No secret '{secret_id}' in this test provider"+ raise SecretNotFoundError(msg)+ return self._value++ @override+ def get_optional_secret(self, secret_id: str) -> str | None:+ self.looked_up.append(secret_id)+ return self._value++ @override+ def get_required_secret_specific_version(self, secret_id: str, *, version_id: str) -> str:+ return self.get_required_secret(secret_id=secret_id)++ @override+ def get_optional_secret_specific_version(self, secret_id: str, *, version_id: str) -> str | None:+ return self.get_optional_secret(secret_id=secret_id)++ @override+ def set_secret_as_env_var(self, secret_id: str, *, version_id: str = "latest") -> None:+ raise NotImplementedErrordiff --git a/tests/integration/pipelex/system/test_keyless_boot_forced_dry.py b/tests/integration/pipelex/system/test_keyless_boot_forced_dry.pyindex c619aa5cf..82824c5c1 100644--- a/tests/integration/pipelex/system/test_keyless_boot_forced_dry.py+++ b/tests/integration/pipelex/system/test_keyless_boot_forced_dry.py@@ -124,7 +124,7 @@ class TestKeylessBootForcedDry:Pipelex.teardown_if_needed()def test_keyless_boot_needs_no_key_for_an_enabled_judgment_backend(self, monkeypatch: pytest.MonkeyPatch) -> None:- """An enabled judgment backend whose key is unset is skipped by a keyless boot, as Linkup's is.+ """A keyless boot resolves no key, so an enabled judgment backend whose key is unset still boots.The kit ships `[typesafe]` enabled like every other bring-your-own-key backend, so a machinewithout `TYPESAFE_API_KEY` must still validate and dry-run. The keyed boot is the one that@@ -144,12 +144,11 @@ class TestKeylessBootForcedDry:Pipelex.teardown_if_needed()@pytest.mark.asyncio- async def test_keyless_boot_validates_a_judge_whose_model_backend_it_skipped(self, monkeypatch: pytest.MonkeyPatch) -> None:- """A PipeJudge naming the TypeSafe model still loads and dry-runs when the keyless boot skipped TypeSafe.+ async def test_keyless_boot_validates_a_judge_whose_model_backend_has_no_key(self, monkeypatch: pytest.MonkeyPatch) -> None:+ """A PipeJudge naming the TypeSafe model loads and dry-runs on a keyless boot without `TYPESAFE_API_KEY`.- The deck still names the alias, so the pipe names a model the deck knows; what the keyless boot- cannot read is the spec of a model whose backend it skipped, so it leaves what that model reads- to the keyed boot that runs the step.+ The keyless boot keeps the TypeSafe backend and its model's spec without resolving its key, so it+ validates the judge exactly as a keyed boot would."""monkeypatch.delenv("TYPESAFE_API_KEY", raising=False)bundle_path = Path("pipelex/test_extras/mthds_corpus/entries/operator_judge_urgent_message/bundle.mthds")diff --git a/tests/integration/pipelex/system/test_keyless_boot_model_metadata.py b/tests/integration/pipelex/system/test_keyless_boot_model_metadata.pynew file mode 100644index 000000000..81be86b04--- /dev/null+++ b/tests/integration/pipelex/system/test_keyless_boot_model_metadata.py@@ -0,0 +1,187 @@+"""A keyless boot knows every model a keyed boot knows, and resolves no credential.++Each test varies exactly one thing, whether credentials are present, by injecting a secrets provider+that holds no secret or one that holds every secret. So the verdicts do not depend on which keys the+developer or the CI runner happens to hold, which is the very dependency this module guards against:+a validation, which never calls a provider, used to fail on a machine without a backend's key and+pass on one with it.++The home configuration directory is moved to an empty one for every test, so the developer's own+overrides (a backend switched on or off, another routing profile) cannot change what is compared.+"""++from collections.abc import Generator+from pathlib import Path+from typing import cast++import pytest++from pipelex.base_exceptions import PipelexSetupError+from pipelex.cogt.exceptions import InferenceBackendCredentialsError+from pipelex.cogt.model_backends.backend import PipelexBackend+from pipelex.cogt.models.model_deck import ModelDeck+from pipelex.cogt.models.model_manager import ModelManager+from pipelex.pipelex import Pipelex+from pipelex.pipeline.validate_bundle import validate_bundle+from pipelex.runtime_hub import get_model_deck, get_models_manager+from pipelex.system.environment import PIPELEX_HOME_ENV_KEY+from pipelex.system.runtime import IntegrationMode, runtime_manager+from tests.helpers.recording_secrets_provider import RecordingSecretsProvider++SEARCH_PRESETS_BUNDLE = """+domain = "keyless_search"+description = "PipeSearch through the deck's search presets and its default"++[pipe.search_with_the_standard_preset]+type = "PipeSearch"+description = "Search with the standard preset"+inputs = { topic = "Text" }+output = "SearchResult"+model = "$standard"+prompt = "What is $topic?"++[pipe.search_with_the_deep_preset]+type = "PipeSearch"+description = "Search with the deep preset"+inputs = { topic = "Text" }+output = "SearchResult"+model = "$deep"+prompt = "What are the main details about $topic?"++[pipe.search_with_the_default_model]+type = "PipeSearch"+description = "Search with the deck's default model"+inputs = { topic = "Text" }+output = "SearchResult"+prompt = "Who makes $topic?"+"""++BARE_HANDLE_BUNDLE = """+domain = "keyless_bare_handle"+description = "A PipeLLM pinning a model by its bare handle"++[pipe.summarize_with_a_pinned_model]+type = "PipeLLM"+description = "Summarize with a model named by its handle"+inputs = { text = "Text" }+output = "Text"+model = "claude-4-sonnet"+prompt = "Summarize: $text"+"""+++def _test_integration_mode() -> IntegrationMode:+ """CI mode on CI runners (no terms acceptance), PYTEST locally — mirrors the global conftest boot."""+ return IntegrationMode.CI if runtime_manager.is_ci_testing else IntegrationMode.PYTEST++[email protected](scope="module", autouse=True)+def reset_pipelex_config_fixture() -> Generator[None, None, None]:+ """Override the global module fixture: this module boots and tears down per test."""+ yield+ Pipelex.teardown_if_needed()+++def pipelex_home(tmp_path: Path) -> Path:+ return tmp_path / "pipelex_home"++[email protected](autouse=True)+def empty_pipelex_home(pipelex_home: Path, monkeypatch: pytest.MonkeyPatch) -> Generator[None, None, None]:+ monkeypatch.setenv(PIPELEX_HOME_ENV_KEY, str(pipelex_home))+ Pipelex.teardown_if_needed()+ yield+ Pipelex.teardown_if_needed()+++def _boot(*, needs_inference: bool, secrets_provider: RecordingSecretsProvider) -> None:+ Pipelex.make(+ integration_mode=_test_integration_mode(),+ needs_inference=needs_inference,+ secrets_provider=secrets_provider,+ )+++def _model_manager() -> ModelManager:+ return cast("ModelManager", get_models_manager())+++def _deck_models_with_their_constraints(model_deck: ModelDeck) -> dict[str, tuple[str, object, object]]:+ return {+ name: (spec.backend_name, sorted(spec.listed_constraints), sorted(spec.valued_constraints.items()))+ for name, spec in model_deck.inference_models.items()+ }+++class TestKeylessBootModelMetadata:+ def test_a_keyless_boot_without_keys_knows_what_a_keyed_boot_with_every_key_knows(self) -> None:+ keyless_provider = RecordingSecretsProvider.make_empty()+ _boot(needs_inference=False, secrets_provider=keyless_provider)+ keyless_library = _model_manager().inference_backend_library+ keyless_backends = sorted(keyless_library.list_backend_names())+ backend_var_names = {var_name for backend in keyless_library.root.values() for var_name in backend.unresolved_credential_vars}+ keyless_models = _deck_models_with_their_constraints(get_model_deck())+ Pipelex.teardown_if_needed()++ _boot(needs_inference=True, secrets_provider=RecordingSecretsProvider.make_credentialed())+ keyed_backends = sorted(_model_manager().inference_backend_library.list_backend_names())+ keyed_models = _deck_models_with_their_constraints(get_model_deck())++ assert keyless_backends == keyed_backends+ assert keyless_models == keyed_models+ # The boot reads other secrets, telemetry's among them; none of the backends' own was asked for.+ assert backend_var_names+ assert backend_var_names.isdisjoint(keyless_provider.looked_up)++ @pytest.mark.asyncio+ @pytest.mark.parametrize(+ "bundle_content",+ [+ pytest.param(SEARCH_PRESETS_BUNDLE, id="search_presets"),+ pytest.param(BARE_HANDLE_BUNDLE, id="bare_handle"),+ ],+ )+ async def test_a_keyless_boot_without_keys_validates_a_bundle_naming_keyed_models(self, tmp_path: Path, bundle_content: str) -> None:+ bundle_path = tmp_path / "bundle.mthds"+ bundle_path.write_text(bundle_content)+ _boot(needs_inference=False, secrets_provider=RecordingSecretsProvider.make_empty())++ result = await validate_bundle(mthds_file_path=bundle_path)++ assert [pipe.code for pipe in result.pipes]++ def test_a_keyless_boot_refuses_to_hand_out_a_backend_it_did_not_credential(self) -> None:+ """Reached only by a keyless process executing live work for another one, as a Temporal worker can."""+ _boot(needs_inference=False, secrets_provider=RecordingSecretsProvider.make_empty())+ models_manager = _model_manager()+ library = models_manager.inference_backend_library+ uncredentialed = [backend for backend in library.root.values() if backend.unresolved_credential_vars]+ assert uncredentialed, "the project configuration enables no backend that needs a key"+ backend = uncredentialed[0]++ with pytest.raises(InferenceBackendCredentialsError) as exc_info:+ models_manager.get_required_inference_backend(backend.name)++ assert exc_info.value.backend_name == backend.name+ assert exc_info.value.key_name in backend.unresolved_credential_vars+ for var_name in backend.unresolved_credential_vars:+ assert var_name in str(exc_info.value)+ assert "needs_inference" in str(exc_info.value)+ # The control: a backend that needs no credential is handed out as before.+ assert models_manager.get_required_inference_backend(PipelexBackend.INTERNAL).name == PipelexBackend.INTERNAL++ def test_a_boot_that_needs_inference_still_refuses_to_start_without_a_key(self) -> None:+ """R1: only the keyless boot changed; the boot that needs inference stays fail-fast."""+ with pytest.raises(PipelexSetupError, match="Could not get credentials for inference backend"):+ _boot(needs_inference=True, secrets_provider=RecordingSecretsProvider.make_empty())++ @pytest.mark.parametrize("needs_inference", [True, False])+ def test_a_routing_profile_naming_a_disabled_backend_is_refused_on_both_boots(self, pipelex_home: Path, needs_inference: bool) -> None:+ """R3: once the keyless boot keeps every enabled backend, a profile it cannot route is a configuration error there too."""+ override_path = pipelex_home / "inference" / "routing_profiles_override.toml"+ override_path.parent.mkdir(parents=True)+ override_path.write_text('active = "all_vertexai"\n')++ with pytest.raises(PipelexSetupError, match=r"'vertexai'.*is not enabled"):+ _boot(needs_inference=needs_inference, secrets_provider=RecordingSecretsProvider.make_credentialed())diff --git a/tests/unit/pipelex/cli/test_doctor_backend_checks.py b/tests/unit/pipelex/cli/test_doctor_backend_checks.pyindex 705b689a2..81bb1b260 100644--- a/tests/unit/pipelex/cli/test_doctor_backend_checks.py+++ b/tests/unit/pipelex/cli/test_doctor_backend_checks.py@@ -244,8 +244,8 @@ class TestDoctorBackendChecks:assert reportsassert all(report.is_valid for report in reports.values())- def test_backend_files_malformed_file_still_caught_under_leniency(self, tmp_path: Path) -> None:- """Leniency skips a backend whose credentials are missing, never a malformed file."""+ def test_backend_files_malformed_file_still_caught_without_resolving_credentials(self, tmp_path: Path) -> None:+ """The probe resolves no credential, yet still refuses a malformed file."""backends_dir = self._copy_kit_inference(tmp_path)anthropic_file = backends_dir / "anthropic.toml"anthropic_file.write_text(anthropic_file.read_text(encoding="utf-8") + '\n[bogus_key_table]\nfoo = "bar"\n', encoding="utf-8")diff --git a/tests/unit/pipelex/cli/test_show_cmd.py b/tests/unit/pipelex/cli/test_show_cmd.pyindex c37bf0e8c..002fc097e 100644--- a/tests/unit/pipelex/cli/test_show_cmd.py+++ b/tests/unit/pipelex/cli/test_show_cmd.py@@ -15,6 +15,7 @@ from rich.console import Consolefrom pipelex.base_exceptions import PipelexConfigErrorfrom pipelex.cli.commands.show_cmd import do_list_pipes, do_show_backends, do_show_config, do_show_pipefrom pipelex.cli.exceptions import PipelexCLIError+from pipelex.cogt.model_backends.credential_resolution import CredentialResolutionfrom pipelex.tools.misc.exceptions import TomlErrorif TYPE_CHECKING:@@ -23,12 +24,21 @@ if TYPE_CHECKING:from pytest_mock import MockerFixture-def _make_backend(name: str, enabled: bool, endpoint: str | None = None, model_count: int = 0) -> SimpleNamespace:+def _make_backend(+ name: str,+ enabled: bool,+ endpoint: str | None = None,+ model_count: int = 0,+ unresolved_credentials: dict[str, list[str]] | None = None,+) -> SimpleNamespace:+ unresolved = unresolved_credentials or {}return SimpleNamespace(name=name,enabled=enabled,endpoint=endpoint,model_specs={f"model_{model_index}": object() for model_index in range(model_count)},+ unresolved_credentials=unresolved,+ unresolved_credential_vars=sorted({var_name for var_names in unresolved.values() for var_name in var_names}),)@@ -146,9 +156,52 @@ class TestShowCmd:_, call_kwargs = telemetry.track_event.call_argsassert call_kwargs["properties"] == {"nb_backends": 2}+ @pytest.mark.usefixtures("telemetry")+ def test_do_show_backends_lists_a_backend_whose_credentials_this_boot_did_not_resolve(self, mocker: MockerFixture, console: Console) -> None:+ """The command boots keyless, which keeps every backend: one whose key is unset is listed with its variables."""+ backends = [+ _make_backend(+ "azure_openai",+ enabled=True,+ model_count=3,+ unresolved_credentials={"endpoint": ["AZURE_API_BASE"], "api_key": ["AZURE_API_KEY"]},+ ),+ _make_backend("groq", enabled=True, endpoint="https://api.groq.com", model_count=1, unresolved_credentials={"api_key": ["GROQ_API_KEY"]}),+ _make_backend("ollama", enabled=True, endpoint="http://localhost:11434", model_count=1),+ ]+ self._mock_backend_setup(mocker, backends=backends, routing_profile=_make_routing_profile())++ do_show_backends(show_all=False)++ output = console.export_text()+ rows = {line.split()[1]: line for line in output.splitlines() if line.startswith("│") and len(line.split()) > 1}+ assert "Credential variables" in output+ assert "not resolved" in rows["azure_openai"]+ assert "AZURE_API_BASE" in rows["azure_openai"]+ assert "AZURE_API_KEY" in rows["azure_openai"]+ assert "https://api.groq.com" in rows["groq"]+ assert "not resolved" not in rows["groq"]+ assert "GROQ_API_KEY" in rows["groq"]+ assert "http://localhost:11434" in rows["ollama"]+ assert "none" in rows["ollama"]+ assert "does not resolve credentials" in output++ def test_do_show_backends_prints_a_bracketed_variable_name_as_written(self, mocker: MockerFixture, console: Console) -> None:+ """The placeholder syntax allows brackets in a name, which Rich would otherwise read as markup."""+ backends = [+ _make_backend("acme", enabled=True, model_count=1, unresolved_credentials={"endpoint": ["ACME[/x]"], "api_key": ["KEY[bold]X"]}),+ ]+ self._mock_backend_setup(mocker, backends=backends, routing_profile=_make_routing_profile())++ do_show_backends(show_all=False)++ output = console.export_text()+ assert "not resolved (ACME[/x])" in output+ assert "KEY[bold]X" in output+@pytest.mark.usefixtures("telemetry")def test_do_show_backends_show_all_includes_status_column(self, mocker: MockerFixture, console: Console, tmp_path: Path) -> None:- """--all loads the library leniently and shows Enabled/Disabled status."""+ """--all loads the library keyless, disabled backends included, and shows Enabled/Disabled status."""backends = [_make_backend("openai", enabled=True, model_count=1),_make_backend("anthropic", enabled=False, model_count=1),@@ -162,15 +215,15 @@ class TestShowCmd:mocked_config_manager = mocker.patch("pipelex.cli.commands.show_cmd.config_manager")mocked_config_manager.backends_file_paths.return_value = [tmp_path / "backends.toml"]mocked_config_manager.backends_dir_path = tmp_path / "backends"- lenient_library = SimpleNamespace(root={backend.name: backend for backend in backends}, load=mocker.Mock())- library_class_mock = mocker.patch("pipelex.cli.commands.show_cmd.InferenceBackendLibrary", return_value=lenient_library)+ keyless_library = SimpleNamespace(root={backend.name: backend for backend in backends}, load=mocker.Mock())+ library_class_mock = mocker.patch("pipelex.cli.commands.show_cmd.InferenceBackendLibrary", return_value=keyless_library)do_show_backends(show_all=True)library_class_mock.assert_called_once()- load_kwargs = lenient_library.load.call_args.kwargs+ load_kwargs = keyless_library.load.call_args.kwargsassert load_kwargs["include_disabled"] is True- assert load_kwargs["lenient"] is True+ assert load_kwargs["credentials"] is CredentialResolution.SKIPoutput = console.export_text()assert "All Configured Backends" in outputassert "Status" in outputdiff --git a/tests/unit/pipelex/cogt/model_backends/test_backend_boot_tolerance.py b/tests/unit/pipelex/cogt/model_backends/test_backend_boot_tolerance.pyindex 8afbfb711..7df3447c5 100644--- a/tests/unit/pipelex/cogt/model_backends/test_backend_boot_tolerance.py+++ b/tests/unit/pipelex/cogt/model_backends/test_backend_boot_tolerance.py@@ -5,13 +5,13 @@ This is the fourth loader to join boot tolerance, and it is the one the tolerancexisting file, so the key survives in `inference/backends/*.toml` on every machine that was set upbefore the change — where it is fatal twice over. In `[defaults]` it is copied wholesale into everymodel of the file and fails all of them with `extra_forbidden`; on one model it is rejected by name-as `NOT_HEADER_SHAPED`, which has been fatal in lenient mode too since the rogue-headers guard.+as `NOT_HEADER_SHAPED`, which has been fatal on a keyless load too since the rogue-headers guard.The two standing properties are the same as for the other three surfaces, and most of what followsholds one of them:- **Only what the ledger explains is tolerated.** A key the user chose to have still stops the boot,- in both lenient modes, with exactly the error it produced before. Tolerance widens what starts, it+ in both credential modes, with exactly the error it produced before. Tolerance widens what starts, itnever widens what is accepted.- **Boot never writes.** Only `pipelex migrate` does, which is why the warning keeps coming backuntil it is run.@@ -33,6 +33,7 @@ import pytestfrom pipelex.cogt.exceptions import InferenceBackendLibraryError, InferenceBackendLibraryValidationErrorfrom pipelex.cogt.model_backends.backend_library import InferenceBackendLibrary+from pipelex.cogt.model_backends.credential_resolution import CredentialResolutionfrom pipelex.cogt.model_routing.routing_profile_loader import load_active_routing_profilefrom pipelex.kit.paths import get_kit_configs_dirfrom pipelex.system.configuration.config_loader import (@@ -148,44 +149,44 @@ class TestAStaleBackendDirectory:plant_on_model(path=portkey_file, table_header='["gemini-2.5-pro"]')return openai_file, portkey_file- def _load(self, machine: Path, *, lenient: bool) -> InferenceBackendLibrary:+ def _load(self, machine: Path, *, credentials: CredentialResolution) -> InferenceBackendLibrary:library_path = self._write_library(machine)library = InferenceBackendLibrary.make_empty()library.load(secrets_provider=EnvSecretsProvider(),backends_library_paths=[library_path],backends_dir_path=str(self._backends_dir(machine)),- lenient=lenient,+ credentials=credentials,)return library- @pytest.mark.parametrize("lenient", [True, False])- def test_a_healthy_directory_loads_and_says_nothing(self, machine: Path, lenient: bool) -> None:+ @pytest.mark.parametrize("credentials", [CredentialResolution.SKIP, CredentialResolution.REQUIRE])+ def test_a_healthy_directory_loads_and_says_nothing(self, machine: Path, credentials: CredentialResolution) -> None:"""The control. Without it every case below would pass on a library that loaded nothing."""- library = self._load(machine, lenient=lenient)+ library = self._load(machine, credentials=credentials)assert set(library.root) == {"openai", "portkey"}assert library.take_stale_configuration_warning() is None- @pytest.mark.parametrize("lenient", [True, False])- def test_a_stale_directory_loads_the_same_models_the_current_files_would(self, machine: Path, lenient: bool) -> None:+ @pytest.mark.parametrize("credentials", [CredentialResolution.SKIP, CredentialResolution.REQUIRE])+ def test_a_stale_directory_loads_the_same_models_the_current_files_would(self, machine: Path, credentials: CredentialResolution) -> None:"""The whole point: what boots is the migrated configuration, not a degraded one.Comparing against the library the untouched kit files produce is what makes "everything elseintact" a real claim — every model, every cost, every request header, from both files."""- pristine = self._load(machine, lenient=lenient)+ pristine = self._load(machine, credentials=credentials)self._make_stale(machine)- recovered = self._load(machine, lenient=lenient)+ recovered = self._load(machine, credentials=credentials)assert recovered.root == pristine.root- @pytest.mark.parametrize("lenient", [True, False])- def test_it_parks_one_warning_naming_every_stale_file_and_the_remedy(self, machine: Path, lenient: bool) -> None:+ @pytest.mark.parametrize("credentials", [CredentialResolution.SKIP, CredentialResolution.REQUIRE])+ def test_it_parks_one_warning_naming_every_stale_file_and_the_remedy(self, machine: Path, credentials: CredentialResolution) -> None:openai_file, portkey_file = self._make_stale(machine)- library = self._load(machine, lenient=lenient)+ library = self._load(machine, credentials=credentials)warning = library.take_stale_configuration_warning()assert warning is not None@@ -200,7 +201,7 @@ class TestAStaleBackendDirectory:"""Ledger text only, the same rule the migration report obeys."""self._make_stale(machine)- library = self._load(machine, lenient=False)+ library = self._load(machine, credentials=CredentialResolution.REQUIRE)warning = library.take_stale_configuration_warning()assert warning is not None@@ -213,22 +214,24 @@ class TestAStaleBackendDirectory:backends_dir = self._backends_dir(machine)before = {path.name: path.read_bytes() for path in sorted(backends_dir.iterdir())}- self._load(machine, lenient=False)+ self._load(machine, credentials=CredentialResolution.REQUIRE)assert {path.name: path.read_bytes() for path in sorted(backends_dir.iterdir())} == before- @pytest.mark.parametrize("lenient", [True, False])- def test_a_key_the_user_chose_to_have_is_still_fatal(self, machine: Path, lenient: bool) -> None:- """Tolerance is not leniency. The ledger explains what *we* removed and nothing else."""+ @pytest.mark.parametrize("credentials", [CredentialResolution.SKIP, CredentialResolution.REQUIRE])+ def test_a_key_the_user_chose_to_have_is_still_fatal(self, machine: Path, credentials: CredentialResolution) -> None:+ """Tolerance is not a pass for any key: the ledger explains what *we* removed and nothing else."""plant_on_model(path=self._backends_dir(machine) / "openai.toml", table_header="[gpt-4o]", key="foo", value="1")with pytest.raises(InferenceBackendLibraryError) as exc_info:- self._load(machine, lenient=lenient)+ self._load(machine, credentials=credentials)assert "'foo'" in str(exc_info.value)- @pytest.mark.parametrize("lenient", [True, False])- def test_a_file_the_ledger_only_half_explains_raises_the_users_own_error(self, machine: Path, lenient: bool, mocker: MockerFixture) -> None:+ @pytest.mark.parametrize("credentials", [CredentialResolution.SKIP, CredentialResolution.REQUIRE])+ def test_a_file_the_ledger_only_half_explains_raises_the_users_own_error(+ self, machine: Path, credentials: CredentialResolution, mocker: MockerFixture+ ) -> None:"""The branch where the replay does real work and still does not get there.This file carries both the key the ledger removes and one it has never heard of, and the@@ -243,7 +246,7 @@ class TestAStaleBackendDirectory:retry = mocker.spy(InferenceBackendLibrary, "_local_model_specs_the_ledger_can_explain")with pytest.raises(InferenceBackendLibraryError) as exc_info:- self._load(machine, lenient=lenient)+ self._load(machine, credentials=credentials)assert "'foo'" in str(exc_info.value)assert retry.call_count == 1, "the retry was attempted"@@ -253,7 +256,7 @@ class TestAStaleBackendDirectory:"""The retry runs on the failure path only, so a current machine pays nothing for it."""retry = mocker.spy(InferenceBackendLibrary, "_local_model_specs_the_ledger_can_explain")- self._load(machine, lenient=False)+ self._load(machine, credentials=CredentialResolution.REQUIRE)assert retry.call_count == 0@@ -299,23 +302,23 @@ class TestThePreviousReleaseKit:monkeypatch.delenv(var_name, raising=False)@pytest.mark.usefixtures("environment")- @pytest.mark.parametrize("lenient", [True, False])- def test_as_left_its_enabled_gateway_serving_no_model_is_refused(self, inference_dir: Path, lenient: bool) -> None:+ @pytest.mark.parametrize("credentials", [CredentialResolution.SKIP, CredentialResolution.REQUIRE])+ def test_as_left_its_enabled_gateway_serving_no_model_is_refused(self, inference_dir: Path, credentials: CredentialResolution) -> None:library = InferenceBackendLibrary.make_empty()with pytest.raises(InferenceBackendLibraryValidationError) as refused:library.load(secrets_provider=EnvSecretsProvider(),backends_library_paths=[inference_dir / BACKENDS_FILE_NAME],backends_dir_path=str(inference_dir / BACKENDS_DIR_NAME),- lenient=lenient,+ credentials=credentials,)assert refused.value.backend_name == PREVIOUS_RELEASE_EMPTY_ENABLED_BACKENDassert "declares no model" in str(refused.value)@pytest.mark.usefixtures("environment")- @pytest.mark.parametrize("lenient", [True, False])- def test_its_backends_and_active_routing_profile_load_once_remedied(self, inference_dir: Path, lenient: bool) -> None:+ @pytest.mark.parametrize("credentials", [CredentialResolution.SKIP, CredentialResolution.REQUIRE])+ def test_its_backends_and_active_routing_profile_load_once_remedied(self, inference_dir: Path, credentials: CredentialResolution) -> None:replace_once(path=inference_dir / BACKENDS_FILE_NAME, old=PREVIOUS_RELEASE_GATEWAY_ENABLED_LINE, new="enabled = false")replace_once(path=inference_dir / ROUTING_PROFILES_FILE_NAME, old='active = "all_pipelex_gateway"', new='active = "all_openai"')library = InferenceBackendLibrary.make_empty()@@ -323,7 +326,7 @@ class TestThePreviousReleaseKit:secrets_provider=EnvSecretsProvider(),backends_library_paths=[inference_dir / BACKENDS_FILE_NAME],backends_dir_path=str(inference_dir / BACKENDS_DIR_NAME),- lenient=lenient,+ credentials=credentials,)enabled_backends = library.all_enabled_backends()@@ -334,7 +337,6 @@ class TestThePreviousReleaseKit:routing_profile = load_active_routing_profile(routing_profile_library_paths=[inference_dir / ROUTING_PROFILES_FILE_NAME],enabled_backends=enabled_backends,- lenient=lenient,)assert routing_profile.default in enabled_backendsdiff --git a/tests/unit/pipelex/cogt/model_backends/test_backend_library_leniency.py b/tests/unit/pipelex/cogt/model_backends/test_backend_library_leniency.pydeleted file mode 100644index df74c40a1..000000000--- a/tests/unit/pipelex/cogt/model_backends/test_backend_library_leniency.py+++ /dev/null@@ -1,334 +0,0 @@-"""`load(lenient=True)` tolerates missing credentials — and nothing else.--The distinction matters because the lenient boot is the one commands like `validate`, `show` and-`--dry-run` use: a config error swallowed there deletes a whole backend from the library, and every-handle it served then fails much later with a far more confusing "model not found".-"""--from pathlib import Path--import pytest--from pipelex.cogt.exceptions import InferenceBackendCredentialsError, InferenceBackendCredentialsErrorType, InferenceBackendLibraryError-from pipelex.cogt.model_backends.backend_library import InferenceBackendLibrary-from pipelex.tools.secrets.env_secrets_provider import EnvSecretsProvider--ABSENT_VAR = "PIPELEX_TEST_ABSENT_VAR_FOR_LENIENCY"--BACKENDS_TOML = """-[acme]-enabled = true-api_key = "sk-not-a-real-key"-"""--BACKENDS_TOML_WITH_MISSING_CREDENTIAL = f"""-[acme]-enabled = true-api_key = "${{{ABSENT_VAR}}}"-"""--MODEL_SPECS_TOML = """-[defaults]-model_type = "llm"-sdk = "openai_responses"--["acme-one"]-model_id = "acme-one"-"""--MODEL_SPECS_TOML_WITH_UNKNOWN_DEFAULT = """-[defaults]-model_type = "llm"-sdk = "openai_responses"-a_field_we_removed = "openai"--["acme-one"]-model_id = "acme-one"-"""--MODEL_SPECS_TOML_WITH_UNKNOWN_PER_MODEL_KEY = """-[defaults]-model_type = "llm"-sdk = "openai_responses"--["acme-one"]-model_id = "acme-one"-max_tokns = 4096-"""--MODEL_SPECS_TOML_WITH_NEAR_MISS_PER_MODEL_KEY = """-[defaults]-model_type = "llm"-sdk = "openai_responses"--["acme-one"]-model_id = "acme-one"-max-tokens = 4096-"""--MODEL_SPECS_TOML_WITH_HEADER_KEY = """-[defaults]-model_type = "llm"-sdk = "openai_responses"--["acme-one"]-model_id = "acme-one"-x-portkey-provider = "@openai"-"""--MODEL_SPECS_TOML_WITH_NON_STRING_HEADER_VALUE = """-[defaults]-model_type = "llm"-sdk = "openai_responses"--["acme-one"]-model_id = "acme-one"-x-foo = 3-"""--MODEL_SPECS_TOML_WITH_ILLEGAL_HEADER_NAME = """-[defaults]-model_type = "llm"-sdk = "openai_responses"--["acme-one"]-model_id = "acme-one"-"x-foo bar" = "value"-"""--MODEL_SPECS_TOML_WITH_ILLEGAL_HEADER_VALUE = """-[defaults]-model_type = "llm"-sdk = "openai_responses"--["acme-one"]-model_id = "acme-one"-x-foo = "trailing "-"""--MODEL_SPECS_TOML_WITH_MISSING_CREDENTIAL = f"""-[defaults]-model_type = "llm"-sdk = "openai_responses"--["acme-one"]-model_id = "${{{ABSENT_VAR}}}"-"""--MODEL_SPECS_TOML_WITH_MISSING_FALLBACK_PATTERN = f"""-[defaults]-model_type = "llm"-sdk = "openai_responses"--["acme-one"]-model_id = "${{env:{ABSENT_VAR}_A|env:{ABSENT_VAR}_B}}"-"""---class TestBackendLibraryLeniency:- def _write_config(self, tmp_path: Path, *, backends_toml: str, model_specs_toml: str | None) -> tuple[str, str]:- backends_dir = tmp_path / "backends"- backends_dir.mkdir()- backends_library_path = tmp_path / "backends.toml"- backends_library_path.write_text(backends_toml)- if model_specs_toml is not None:- (backends_dir / "acme.toml").write_text(model_specs_toml)- return str(backends_library_path), str(backends_dir)-- def _load(self, tmp_path: Path, *, backends_toml: str, model_specs_toml: str | None, lenient: bool) -> InferenceBackendLibrary:- backends_library_path, backends_dir_path = self._write_config(- tmp_path,- backends_toml=backends_toml,- model_specs_toml=model_specs_toml,- )- library = InferenceBackendLibrary.make_empty()- library.load(- secrets_provider=EnvSecretsProvider(),- backends_library_paths=[Path(backends_library_path)],- backends_dir_path=backends_dir_path,- lenient=lenient,- )- return library-- def test_a_well_formed_backend_loads(self, tmp_path: Path) -> None:- """The control: without this the failure cases below would prove nothing."""- library = self._load(tmp_path, backends_toml=BACKENDS_TOML, model_specs_toml=MODEL_SPECS_TOML, lenient=True)-- assert "acme" in library.root-- @pytest.mark.parametrize("lenient", [True, False])- def test_an_unknown_key_in_a_local_backend_is_fatal_in_both_modes(self, tmp_path: Path, lenient: bool) -> None:- """A stale local TOML — the shape an upgrade leaves behind, since init never overwrites an existing file."""- with pytest.raises(InferenceBackendLibraryError, match="a_field_we_removed"):- self._load(- tmp_path,- backends_toml=BACKENDS_TOML,- model_specs_toml=MODEL_SPECS_TOML_WITH_UNKNOWN_DEFAULT,- lenient=lenient,- )-- @pytest.mark.parametrize("lenient", [True, False])- def test_an_unknown_per_model_key_in_a_local_backend_is_fatal_in_both_modes(self, tmp_path: Path, lenient: bool) -> None:- """A per-model typo used to be sent to the provider as a request header, silently, while the- real setting stayed unset. It is now a boot error that names the key, the model and the file.- """- with pytest.raises(InferenceBackendLibraryError) as exc_info:- self._load(- tmp_path,- backends_toml=BACKENDS_TOML,- model_specs_toml=MODEL_SPECS_TOML_WITH_UNKNOWN_PER_MODEL_KEY,- lenient=lenient,- )-- message = str(exc_info.value)- assert "'max_tokns'" in message- assert "'acme-one'" in message- assert "acme.toml" in message- assert "hyphen" in message-- def test_a_hyphenated_spelling_of_a_known_field_is_fatal_and_names_the_field(self, tmp_path: Path) -> None:- with pytest.raises(InferenceBackendLibraryError, match=r"'max-tokens'.*'max_tokens'"):- self._load(- tmp_path,- backends_toml=BACKENDS_TOML,- model_specs_toml=MODEL_SPECS_TOML_WITH_NEAR_MISS_PER_MODEL_KEY,- lenient=False,- )-- @pytest.mark.parametrize("lenient", [True, False])- def test_a_header_shaped_key_with_a_non_string_value_is_fatal_in_both_modes(self, tmp_path: Path, lenient: bool) -> None:- """`x-foo = 3` is an unquoted value, not a header to stringify. The message is the rule's, not pydantic's:- it names the key, the model and the file, and says the value must be a quoted string.- """- with pytest.raises(InferenceBackendLibraryError) as exc_info:- self._load(- tmp_path,- backends_toml=BACKENDS_TOML,- model_specs_toml=MODEL_SPECS_TOML_WITH_NON_STRING_HEADER_VALUE,- lenient=lenient,- )-- message = str(exc_info.value)- assert "'x-foo'" in message- assert "'acme-one'" in message- assert "acme.toml" in message- assert "must be a quoted string" in message- assert "string_type" not in message-- @pytest.mark.parametrize("lenient", [True, False])- def test_a_header_shaped_key_the_wire_cannot_carry_is_fatal_in_both_modes(self, tmp_path: Path, lenient: bool) -> None:- """A quoted TOML key can hold a character no header field name may carry. Such a key used to load- fine and raise `LocalProtocolError: Illegal header name` on the first inference call instead.- """- with pytest.raises(InferenceBackendLibraryError) as exc_info:- self._load(- tmp_path,- backends_toml=BACKENDS_TOML,- model_specs_toml=MODEL_SPECS_TOML_WITH_ILLEGAL_HEADER_NAME,- lenient=lenient,- )-- message = str(exc_info.value)- assert "'x-foo bar'" in message- assert "'acme-one'" in message- assert "acme.toml" in message- assert "' '" in message-- @pytest.mark.parametrize("lenient", [True, False])- def test_a_header_value_the_wire_cannot_carry_is_fatal_in_both_modes(self, tmp_path: Path, lenient: bool) -> None:- """`x-foo = "trailing "` is valid TOML and the mistake is invisible in the file, which is exactly- why the error must name it — the HTTP stack otherwise reports it much later, mid-run.- """- with pytest.raises(InferenceBackendLibraryError) as exc_info:- self._load(- tmp_path,- backends_toml=BACKENDS_TOML,- model_specs_toml=MODEL_SPECS_TOML_WITH_ILLEGAL_HEADER_VALUE,- lenient=lenient,- )-- message = str(exc_info.value)- assert "'x-foo'" in message- assert "'acme-one'" in message- assert "acme.toml" in message- assert "no leading or trailing whitespace" in message-- def test_a_header_shaped_per_model_key_still_becomes_a_request_header(self, tmp_path: Path) -> None:- """The regression that matters: `x-portkey-provider` in the local portkey.toml keeps working."""- library = self._load(tmp_path, backends_toml=BACKENDS_TOML, model_specs_toml=MODEL_SPECS_TOML_WITH_HEADER_KEY, lenient=False)-- backend = library.get_inference_backend(backend_name="acme")- assert backend is not None- model_spec = backend.model_specs["acme-one"]- assert model_spec.extra_headers == {"x-portkey-provider": "@openai"}- assert model_spec.model_id == "acme-one"-- @pytest.mark.parametrize("lenient", [True, False])- def test_a_missing_per_backend_toml_is_fatal_in_both_modes(self, tmp_path: Path, lenient: bool) -> None:- with pytest.raises(InferenceBackendLibraryError, match=r"acme\.toml"):- self._load(tmp_path, backends_toml=BACKENDS_TOML, model_specs_toml=None, lenient=lenient)-- def test_a_missing_backend_credential_is_skipped_leniently(self, tmp_path: Path) -> None:- library = self._load(- tmp_path,- backends_toml=BACKENDS_TOML_WITH_MISSING_CREDENTIAL,- model_specs_toml=MODEL_SPECS_TOML,- lenient=True,- )-- assert library.root == {}-- def test_a_missing_model_spec_credential_is_skipped_leniently(self, tmp_path: Path) -> None:- """The placeholder lives in the per-backend TOML, not in backends.toml — same tolerance."""- library = self._load(- tmp_path,- backends_toml=BACKENDS_TOML,- model_specs_toml=MODEL_SPECS_TOML_WITH_MISSING_CREDENTIAL,- lenient=True,- )-- assert library.root == {}-- def test_an_unresolvable_model_spec_fallback_pattern_is_skipped_leniently(self, tmp_path: Path) -> None:- """A fallback pattern whose every candidate is absent is still just a missing credential."""- library = self._load(- tmp_path,- backends_toml=BACKENDS_TOML,- model_specs_toml=MODEL_SPECS_TOML_WITH_MISSING_FALLBACK_PATTERN,- lenient=True,- )-- assert library.root == {}-- def test_an_unresolvable_model_spec_fallback_pattern_raises_a_credentials_error_when_strict(self, tmp_path: Path) -> None:- """No single variable name is right when several were tried, but the error still names the backend."""- with pytest.raises(InferenceBackendCredentialsError) as exc_info:- self._load(- tmp_path,- backends_toml=BACKENDS_TOML,- model_specs_toml=MODEL_SPECS_TOML_WITH_MISSING_FALLBACK_PATTERN,- lenient=False,- )-- assert exc_info.value.credentials_error_type is InferenceBackendCredentialsErrorType.VAR_FALLBACK_PATTERN- assert exc_info.value.backend_name == "acme"-- @pytest.mark.parametrize(- ("backends_toml", "model_specs_toml"),- [- (BACKENDS_TOML_WITH_MISSING_CREDENTIAL, MODEL_SPECS_TOML),- (BACKENDS_TOML, MODEL_SPECS_TOML_WITH_MISSING_CREDENTIAL),- ],- )- def test_a_missing_credential_raises_a_credentials_error_when_strict(- self,- tmp_path: Path,- backends_toml: str,- model_specs_toml: str,- ) -> None:- """Strictly, both placements name the variable — that is what the boot turns into 'set this key'."""- with pytest.raises(InferenceBackendCredentialsError) as exc_info:- self._load(tmp_path, backends_toml=backends_toml, model_specs_toml=model_specs_toml, lenient=False)-- assert exc_info.value.key_name == ABSENT_VAR- assert exc_info.value.backend_name == "acme"diff --git a/tests/unit/pipelex/cogt/model_backends/test_backend_library_malformed_configuration.py b/tests/unit/pipelex/cogt/model_backends/test_backend_library_malformed_configuration.pynew file mode 100644index 000000000..2530585a5--- /dev/null+++ b/tests/unit/pipelex/cogt/model_backends/test_backend_library_malformed_configuration.py@@ -0,0 +1,252 @@+"""A malformed backend configuration is fatal whether the load resolves credentials or not.++A config error swallowed by the keyless boot would delete a whole backend from the library, and every+handle it served would then fail much later with a far more confusing "model not found". A placeholder+in a field that describes the model is malformed in the same way: the keyless boot could not resolve+it, so a load that resolved it would give a verdict the keyless one cannot.+"""++from pathlib import Path++import pytest++from pipelex.cogt.exceptions import (+ InferenceBackendCredentialsError,+ InferenceBackendCredentialsErrorType,+ InferenceBackendLibraryError,+ InferenceBackendLibraryValidationError,+)+from pipelex.cogt.model_backends.credential_resolution import CredentialResolution+from tests.helpers.backend_library_loading import BOTH_MODES, load_library, required_backend+from tests.helpers.recording_secrets_provider import RecordingSecretsProvider+from tests.unit.pipelex.cogt.model_backends.test_data import LITERAL_FIELD_VAR, BackendLibraryTomls+++class TestMalformedConfigurationIsFatalInBothModes:+ def test_a_well_formed_backend_loads(self, tmp_path: Path) -> None:+ """The control: without this the failure cases below would prove nothing."""+ library = load_library(+ tmp_path,+ backends_toml=BackendLibraryTomls.BACKENDS_TOML,+ model_specs_toml=BackendLibraryTomls.MODEL_SPECS_TOML,+ credentials=CredentialResolution.SKIP,+ )++ assert "acme" in library.root++ @pytest.mark.parametrize("credentials", BOTH_MODES)+ def test_an_unknown_key_in_a_local_backend_is_fatal_in_both_modes(self, tmp_path: Path, credentials: CredentialResolution) -> None:+ """A stale local TOML — the shape an upgrade leaves behind, since init never overwrites an existing file."""+ with pytest.raises(InferenceBackendLibraryError, match="a_field_we_removed"):+ load_library(+ tmp_path,+ backends_toml=BackendLibraryTomls.BACKENDS_TOML,+ model_specs_toml=BackendLibraryTomls.MODEL_SPECS_TOML_WITH_UNKNOWN_DEFAULT,+ credentials=credentials,+ )++ @pytest.mark.parametrize("credentials", BOTH_MODES)+ def test_an_unknown_per_model_key_in_a_local_backend_is_fatal_in_both_modes(self, tmp_path: Path, credentials: CredentialResolution) -> None:+ """A per-model typo used to be sent to the provider as a request header, silently, while the+ real setting stayed unset. It is now a boot error that names the key, the model and the file.+ """+ with pytest.raises(InferenceBackendLibraryError) as exc_info:+ load_library(+ tmp_path,+ backends_toml=BackendLibraryTomls.BACKENDS_TOML,+ model_specs_toml=BackendLibraryTomls.MODEL_SPECS_TOML_WITH_UNKNOWN_PER_MODEL_KEY,+ credentials=credentials,+ )++ message = str(exc_info.value)+ assert "'max_tokns'" in message+ assert "'acme-one'" in message+ assert "acme.toml" in message+ assert "hyphen" in message++ def test_a_hyphenated_spelling_of_a_known_field_is_fatal_and_names_the_field(self, tmp_path: Path) -> None:+ with pytest.raises(InferenceBackendLibraryError, match=r"'max-tokens'.*'max_tokens'"):+ load_library(+ tmp_path,+ backends_toml=BackendLibraryTomls.BACKENDS_TOML,+ model_specs_toml=BackendLibraryTomls.MODEL_SPECS_TOML_WITH_NEAR_MISS_PER_MODEL_KEY,+ credentials=CredentialResolution.REQUIRE,+ )++ @pytest.mark.parametrize("credentials", BOTH_MODES)+ def test_a_header_shaped_key_with_a_non_string_value_is_fatal_in_both_modes(self, tmp_path: Path, credentials: CredentialResolution) -> None:+ """`x-foo = 3` is an unquoted value, not a header to stringify. The message is the rule's, not pydantic's:+ it names the key, the model and the file, and says the value must be a quoted string.+ """+ with pytest.raises(InferenceBackendLibraryError) as exc_info:+ load_library(+ tmp_path,+ backends_toml=BackendLibraryTomls.BACKENDS_TOML,+ model_specs_toml=BackendLibraryTomls.MODEL_SPECS_TOML_WITH_NON_STRING_HEADER_VALUE,+ credentials=credentials,+ )++ message = str(exc_info.value)+ assert "'x-foo'" in message+ assert "'acme-one'" in message+ assert "acme.toml" in message+ assert "must be a quoted string" in message+ assert "string_type" not in message++ @pytest.mark.parametrize("credentials", BOTH_MODES)+ def test_a_header_shaped_key_the_wire_cannot_carry_is_fatal_in_both_modes(self, tmp_path: Path, credentials: CredentialResolution) -> None:+ """A quoted TOML key can hold a character no header field name may carry. Such a key used to load+ fine and raise `LocalProtocolError: Illegal header name` on the first inference call instead.+ """+ with pytest.raises(InferenceBackendLibraryError) as exc_info:+ load_library(+ tmp_path,+ backends_toml=BackendLibraryTomls.BACKENDS_TOML,+ model_specs_toml=BackendLibraryTomls.MODEL_SPECS_TOML_WITH_ILLEGAL_HEADER_NAME,+ credentials=credentials,+ )++ message = str(exc_info.value)+ assert "'x-foo bar'" in message+ assert "'acme-one'" in message+ assert "acme.toml" in message+ assert "' '" in message++ @pytest.mark.parametrize("credentials", BOTH_MODES)+ def test_a_header_value_the_wire_cannot_carry_is_fatal_in_both_modes(self, tmp_path: Path, credentials: CredentialResolution) -> None:+ """`x-foo = "trailing "` is valid TOML and the mistake is invisible in the file, which is exactly+ why the error must name it — the HTTP stack otherwise reports it much later, mid-run.+ """+ with pytest.raises(InferenceBackendLibraryError) as exc_info:+ load_library(+ tmp_path,+ backends_toml=BackendLibraryTomls.BACKENDS_TOML,+ model_specs_toml=BackendLibraryTomls.MODEL_SPECS_TOML_WITH_ILLEGAL_HEADER_VALUE,+ credentials=credentials,+ )++ message = str(exc_info.value)+ assert "'x-foo'" in message+ assert "'acme-one'" in message+ assert "acme.toml" in message+ assert "no leading or trailing whitespace" in message++ def test_a_header_shaped_per_model_key_still_becomes_a_request_header(self, tmp_path: Path) -> None:+ """The regression that matters: `x-portkey-provider` in the local portkey.toml keeps working."""+ library = load_library(+ tmp_path,+ backends_toml=BackendLibraryTomls.BACKENDS_TOML,+ model_specs_toml=BackendLibraryTomls.MODEL_SPECS_TOML_WITH_HEADER_KEY,+ credentials=CredentialResolution.REQUIRE,+ )++ model_spec = required_backend(library).model_specs["acme-one"]+ assert model_spec.extra_headers == {"x-portkey-provider": "@openai"}+ assert model_spec.model_id == "acme-one"++ @pytest.mark.parametrize("credentials", BOTH_MODES)+ def test_a_missing_per_backend_toml_is_fatal_in_both_modes(self, tmp_path: Path, credentials: CredentialResolution) -> None:+ with pytest.raises(InferenceBackendLibraryError, match=r"acme\.toml"):+ load_library(tmp_path, backends_toml=BackendLibraryTomls.BACKENDS_TOML, model_specs_toml=None, credentials=credentials)++ @pytest.mark.parametrize("credentials", BOTH_MODES)+ @pytest.mark.parametrize(+ ("backends_toml", "model_specs_toml", "field_name", "valid_value"),+ [+ pytest.param(+ BackendLibraryTomls.BACKENDS_TOML,+ BackendLibraryTomls.MODEL_SPECS_TOML_WITH_A_TEMPLATED_MODEL_TYPE,+ "model_type",+ "llm",+ id="model_type_in_defaults",+ ),+ pytest.param(+ BackendLibraryTomls.BACKENDS_TOML,+ BackendLibraryTomls.MODEL_SPECS_TOML_WITH_A_TEMPLATED_THINKING_MODE,+ "thinking_mode",+ "none",+ id="thinking_mode_on_a_model",+ ),+ pytest.param(+ BackendLibraryTomls.BACKENDS_TOML_WITH_A_TEMPLATED_CONSTRAINT,+ BackendLibraryTomls.MODEL_SPECS_TOML,+ "listed_constraints",+ "temperature_unsupported",+ id="listed_constraints_on_a_backend",+ ),+ ],+ )+ def test_a_placeholder_in_a_field_describing_the_model_is_fatal_in_both_modes(+ self,+ tmp_path: Path,+ monkeypatch: pytest.MonkeyPatch,+ credentials: CredentialResolution,+ backends_toml: str,+ model_specs_toml: str,+ field_name: str,+ valid_value: str,+ ) -> None:+ """The variable resolves to a valid value, so only the rule refuses it, on the load that could resolve it too."""+ monkeypatch.setenv(LITERAL_FIELD_VAR, valid_value)++ with pytest.raises(InferenceBackendLibraryValidationError) as exc_info:+ load_library(tmp_path, backends_toml=backends_toml, model_specs_toml=model_specs_toml, credentials=credentials)++ message = str(exc_info.value)+ assert f"'{field_name}' references {LITERAL_FIELD_VAR}" in message+ assert "write it literally" in message++ @pytest.mark.parametrize("credentials", BOTH_MODES)+ @pytest.mark.parametrize(+ ("backends_toml", "field_name"),+ [+ pytest.param(BackendLibraryTomls.BACKENDS_TOML_WITH_A_TEMPLATED_KEY_IN_A_LIST, "api_key", id="api_key_in_a_list"),+ pytest.param(BackendLibraryTomls.BACKENDS_TOML_WITH_A_TEMPLATED_EXTRA_CONFIG_TABLE, "extra_config", id="extra_config_as_a_string"),+ ],+ )+ def test_a_templated_field_of_the_wrong_type_is_fatal_in_both_modes(+ self, tmp_path: Path, monkeypatch: pytest.MonkeyPatch, credentials: CredentialResolution, backends_toml: str, field_name: str+ ) -> None:+ """A keyless load strips a templated field, but not before its type is checked, so stripping hides no malformed field."""+ monkeypatch.setenv(LITERAL_FIELD_VAR, "sk-not-a-real-key")++ with pytest.raises(InferenceBackendLibraryValidationError) as exc_info:+ load_library(tmp_path, backends_toml=backends_toml, model_specs_toml=BackendLibraryTomls.MODEL_SPECS_TOML, credentials=credentials)++ message = str(exc_info.value)+ assert "Invalid inference backend 'acme'" in message+ assert field_name in message++ @pytest.mark.parametrize("credentials", BOTH_MODES)+ @pytest.mark.parametrize(+ ("backends_toml", "model_specs_toml", "var_name"),+ [+ pytest.param(+ BackendLibraryTomls.BACKENDS_TOML_WITH_AN_UNKNOWN_PREFIX, BackendLibraryTomls.MODEL_SPECS_TOML, "ACME_API_KEY", id="backend_table"+ ),+ pytest.param(+ BackendLibraryTomls.BACKENDS_TOML, BackendLibraryTomls.MODEL_SPECS_TOML_WITH_AN_UNKNOWN_PREFIX, "ACME_MODEL", id="model_spec"+ ),+ pytest.param(+ BackendLibraryTomls.BACKENDS_TOML,+ BackendLibraryTomls.MODEL_SPECS_TOML_WITH_AN_UNKNOWN_PREFIX_IN_A_LITERAL_FIELD,+ "ACME_SDK",+ id="model_spec_literal_field",+ ),+ ],+ )+ def test_an_unknown_placeholder_prefix_is_fatal_in_both_modes(+ self, tmp_path: Path, credentials: CredentialResolution, backends_toml: str, model_specs_toml: str, var_name: str+ ) -> None:+ """A load that only names its variables refuses a mistyped prefix as the load that resolves them does."""+ with pytest.raises(InferenceBackendCredentialsError) as exc_info:+ load_library(+ tmp_path,+ backends_toml=backends_toml,+ model_specs_toml=model_specs_toml,+ credentials=credentials,+ secrets_provider=RecordingSecretsProvider.make_credentialed(),+ )++ assert exc_info.value.credentials_error_type is InferenceBackendCredentialsErrorType.UNKNOWN_VAR_PREFIX+ assert exc_info.value.key_name == var_namediff --git a/tests/unit/pipelex/cogt/model_backends/test_backend_library_overrides.py b/tests/unit/pipelex/cogt/model_backends/test_backend_library_overrides.pyindex a2c51de7a..06da87db5 100644--- a/tests/unit/pipelex/cogt/model_backends/test_backend_library_overrides.py+++ b/tests/unit/pipelex/cogt/model_backends/test_backend_library_overrides.py@@ -7,6 +7,7 @@ from pytest_mock import MockerFixturefrom pipelex.cogt.exceptions import InferenceBackendLibraryNotFoundError, InferenceBackendLibraryValidationErrorfrom pipelex.cogt.model_backends.backend_library import InferenceBackendLibrary+from pipelex.cogt.model_backends.credential_resolution import CredentialResolutionfrom pipelex.tools.secrets.env_secrets_provider import EnvSecretsProviderBACKENDS_TOML = """@@ -142,8 +143,8 @@ class TestBackendLibraryOverrides:logged = " ".join(str(call.args[0]) for call in logger.info.call_args_list)assert str(override_path) in logged- @pytest.mark.parametrize("lenient", [False, True])- def test_a_scalar_where_a_table_was_meant_is_refused_in_both_modes(self, tmp_path: Path, lenient: bool) -> None:+ @pytest.mark.parametrize("credentials", [CredentialResolution.REQUIRE, CredentialResolution.SKIP])+ def test_a_scalar_where_a_table_was_meant_is_refused_in_both_modes(self, tmp_path: Path, credentials: CredentialResolution) -> None:"""`acme = false` is the likeliest half-written override; the merge replaces the table whole and the loader must say so."""base_path, backends_dir = self._write_base(tmp_path)override_path = tmp_path / "backends_override.toml"@@ -155,7 +156,7 @@ class TestBackendLibraryOverrides:secrets_provider=EnvSecretsProvider(),backends_library_paths=[base_path, override_path],backends_dir_path=str(backends_dir),- lenient=lenient,+ credentials=credentials,)message = str(refused.value)diff --git a/tests/unit/pipelex/cogt/model_backends/test_backend_library_require_credentials.py b/tests/unit/pipelex/cogt/model_backends/test_backend_library_require_credentials.pynew file mode 100644index 000000000..ca12695d5--- /dev/null+++ b/tests/unit/pipelex/cogt/model_backends/test_backend_library_require_credentials.py@@ -0,0 +1,77 @@+"""A load that resolves credentials resolves every one of them, or names the variable it could not.++`CredentialResolution.REQUIRE` is the boot that needs inference: every placeholder is resolved, and a+missing credential is an error naming the variable, which the boot turns into "set this key".+"""++from pathlib import Path++import pytest++from pipelex.cogt.exceptions import InferenceBackendCredentialsError, InferenceBackendCredentialsErrorType+from pipelex.cogt.model_backends.credential_resolution import CredentialResolution+from tests.helpers.backend_library_loading import load_library, required_backend+from tests.helpers.recording_secrets_provider import RecordingSecretsProvider+from tests.unit.pipelex.cogt.model_backends.test_data import ABSENT_VAR, BackendLibraryTomls+++class TestRequireResolvesEveryCredential:+ @pytest.mark.parametrize(+ ("backends_toml", "model_specs_toml"),+ [+ (BackendLibraryTomls.BACKENDS_TOML_WITH_MISSING_CREDENTIAL, BackendLibraryTomls.MODEL_SPECS_TOML),+ (BackendLibraryTomls.BACKENDS_TOML, BackendLibraryTomls.MODEL_SPECS_TOML_WITH_MISSING_CREDENTIAL),+ ],+ )+ def test_a_missing_credential_raises_a_credentials_error(+ self,+ tmp_path: Path,+ backends_toml: str,+ model_specs_toml: str,+ ) -> None:+ """Both placements name the variable — that is what the boot turns into 'set this key'."""+ with pytest.raises(InferenceBackendCredentialsError) as exc_info:+ load_library(tmp_path, backends_toml=backends_toml, model_specs_toml=model_specs_toml, credentials=CredentialResolution.REQUIRE)++ assert exc_info.value.key_name == ABSENT_VAR+ assert exc_info.value.backend_name == "acme"++ def test_an_unresolvable_model_spec_fallback_pattern_raises_a_credentials_error(self, tmp_path: Path) -> None:+ """No single variable name is right when several were tried, but the error still names the backend."""+ with pytest.raises(InferenceBackendCredentialsError) as exc_info:+ load_library(+ tmp_path,+ backends_toml=BackendLibraryTomls.BACKENDS_TOML,+ model_specs_toml=BackendLibraryTomls.MODEL_SPECS_TOML_WITH_MISSING_FALLBACK_PATTERN,+ credentials=CredentialResolution.REQUIRE,+ )++ assert exc_info.value.credentials_error_type is InferenceBackendCredentialsErrorType.VAR_FALLBACK_PATTERN+ assert exc_info.value.backend_name == "acme"++ def test_an_empty_provider_refuses_the_backend(self, tmp_path: Path) -> None:+ with pytest.raises(InferenceBackendCredentialsError) as exc_info:+ load_library(+ tmp_path,+ backends_toml=BackendLibraryTomls.BACKENDS_TOML_WITH_A_LITERAL_ENDPOINT,+ model_specs_toml=BackendLibraryTomls.MODEL_SPECS_TOML,+ credentials=CredentialResolution.REQUIRE,+ secrets_provider=RecordingSecretsProvider.make_empty(),+ )++ assert exc_info.value.key_name == "ACME_API_KEY"++ def test_a_credentialed_provider_gives_the_substituted_key_and_leaves_nothing_unresolved(self, tmp_path: Path) -> None:+ library = load_library(+ tmp_path,+ backends_toml=BackendLibraryTomls.BACKENDS_TOML_WITH_A_LITERAL_ENDPOINT,+ model_specs_toml=BackendLibraryTomls.MODEL_SPECS_TOML,+ credentials=CredentialResolution.REQUIRE,+ secrets_provider=RecordingSecretsProvider.make_credentialed(),+ )++ backend = required_backend(library)+ assert backend.api_key == "fake-key"+ assert backend.endpoint == "https://api.acme.example/v1"+ assert backend.unresolved_credentials == {}+ assert backend.unresolved_credential_vars == []diff --git a/tests/unit/pipelex/cogt/model_backends/test_backend_library_skip_credentials.py b/tests/unit/pipelex/cogt/model_backends/test_backend_library_skip_credentials.pynew file mode 100644index 000000000..c6733f14b--- /dev/null+++ b/tests/unit/pipelex/cogt/model_backends/test_backend_library_skip_credentials.py@@ -0,0 +1,135 @@+"""A keyless load keeps every enabled backend and resolves none of its credentials.++`CredentialResolution.SKIP` is the keyless boot (validate, show, dry runs): it resolves nothing and+asks the secrets provider nothing, but keeps every enabled backend with its models and constraints, so+a validation gives the same verdict on a machine with no key as on one with all of them. What it+records instead is what it left unresolved, which is what refuses a call to that backend later.+"""++from pathlib import Path++import pytest+from pytest_mock import MockerFixture++from pipelex.cogt.model_backends.constraints import ListedConstraint, ValuedConstraint+from pipelex.cogt.model_backends.credential_resolution import CredentialResolution+from pipelex.providers.openai.vertexai_factory import VertexAIFactory+from tests.helpers.backend_library_loading import load_library, required_backend+from tests.helpers.recording_secrets_provider import RecordingSecretsProvider+from tests.unit.pipelex.cogt.model_backends.test_data import ABSENT_VAR, BackendLibraryTomls+++class TestSkipKeepsEveryBackendAndResolvesNothing:+ @pytest.mark.parametrize("secrets_provider", [RecordingSecretsProvider.make_empty(), RecordingSecretsProvider.make_credentialed()])+ def test_it_keeps_the_backend_its_models_and_its_constraints_and_asks_nothing(+ self, tmp_path: Path, secrets_provider: RecordingSecretsProvider+ ) -> None:+ """Whether the provider holds the key or not, the keyless load is the same and never consults it."""+ library = load_library(+ tmp_path,+ backends_toml=BackendLibraryTomls.BACKENDS_TOML_WITH_EVERY_CREDENTIAL_SHAPE,+ model_specs_toml=BackendLibraryTomls.MODEL_SPECS_TOML,+ credentials=CredentialResolution.SKIP,+ secrets_provider=secrets_provider,+ )++ backend = required_backend(library)+ assert list(backend.model_specs) == ["acme-one"]+ assert backend.listed_constraints == [ListedConstraint.TEMPERATURE_UNSUPPORTED]+ assert backend.valued_constraints == {ValuedConstraint.FIXED_TEMPERATURE: 1}+ assert secrets_provider.looked_up == []++ def test_it_leaves_every_templated_field_unset_and_names_its_variables(self, tmp_path: Path) -> None:+ library = load_library(+ tmp_path,+ backends_toml=BackendLibraryTomls.BACKENDS_TOML_WITH_EVERY_CREDENTIAL_SHAPE,+ model_specs_toml=BackendLibraryTomls.MODEL_SPECS_TOML,+ credentials=CredentialResolution.SKIP,+ )++ backend = required_backend(library)+ assert backend.endpoint is None+ assert backend.api_key is None+ assert "region" not in backend.extra_config+ assert backend.extra_config == {"debug": True}+ assert backend.unresolved_credentials == {+ "endpoint": ["ACME_ENDPOINT"],+ "api_key": ["ACME_API_KEY"],+ "region": ["ACME_REGION"],+ }+ assert backend.unresolved_credential_vars == ["ACME_API_KEY", "ACME_ENDPOINT", "ACME_REGION"]++ def test_it_keeps_a_literal_endpoint(self, tmp_path: Path) -> None:+ library = load_library(+ tmp_path,+ backends_toml=BackendLibraryTomls.BACKENDS_TOML_WITH_A_LITERAL_ENDPOINT,+ model_specs_toml=BackendLibraryTomls.MODEL_SPECS_TOML,+ credentials=CredentialResolution.SKIP,+ )++ backend = required_backend(library)+ assert backend.endpoint == "https://api.acme.example/v1"+ assert backend.unresolved_credentials == {"api_key": ["ACME_API_KEY"]}++ def test_a_backend_that_references_no_variable_has_nothing_unresolved(self, tmp_path: Path) -> None:+ """Ollama's shape: nothing was skipped, so nothing will refuse a call to it."""+ library = load_library(+ tmp_path,+ backends_toml=BackendLibraryTomls.BACKENDS_TOML_WITH_NO_CREDENTIAL,+ model_specs_toml=BackendLibraryTomls.MODEL_SPECS_TOML,+ credentials=CredentialResolution.SKIP,+ )++ backend = required_backend(library)+ assert backend.endpoint == "http://localhost:11434/v1"+ assert backend.unresolved_credentials == {}++ @pytest.mark.parametrize(+ ("model_specs_toml", "expected_vars"),+ [+ (BackendLibraryTomls.MODEL_SPECS_TOML_WITH_MISSING_CREDENTIAL, [ABSENT_VAR]),+ (BackendLibraryTomls.MODEL_SPECS_TOML_WITH_MISSING_FALLBACK_PATTERN, [f"{ABSENT_VAR}_A", f"{ABSENT_VAR}_B"]),+ ],+ )+ def test_a_templated_model_spec_keeps_its_text_and_names_its_variables(+ self, tmp_path: Path, model_specs_toml: str, expected_vars: list[str]+ ) -> None:+ """The spec must still validate, so its text is kept; the variables still refuse a call to the backend."""+ library = load_library(+ tmp_path, backends_toml=BackendLibraryTomls.BACKENDS_TOML, model_specs_toml=model_specs_toml, credentials=CredentialResolution.SKIP+ )++ backend = required_backend(library)+ assert backend.model_specs["acme-one"].model_id.startswith("${")+ assert backend.unresolved_credentials == {"model_specs": expected_vars}++ def test_a_missing_backend_credential_keeps_the_backend(self, tmp_path: Path) -> None:+ """The keyless boot used to drop this backend, and every model it served with it."""+ library = load_library(+ tmp_path,+ backends_toml=BackendLibraryTomls.BACKENDS_TOML_WITH_MISSING_CREDENTIAL,+ model_specs_toml=BackendLibraryTomls.MODEL_SPECS_TOML,+ credentials=CredentialResolution.SKIP,+ )++ assert required_backend(library).unresolved_credential_vars == [ABSENT_VAR]++ def test_an_enabled_vertexai_backend_mints_no_token_and_touches_no_file(self, tmp_path: Path, mocker: MockerFixture) -> None:+ """Minting the access token is the credential resolution this mode does not do, network call included."""+ make_endpoint_and_api_key = mocker.spy(VertexAIFactory, "make_endpoint_and_api_key")++ library = load_library(+ tmp_path,+ backends_toml=BackendLibraryTomls.VERTEXAI_BACKENDS_TOML,+ model_specs_toml=BackendLibraryTomls.VERTEXAI_MODEL_SPECS_TOML,+ credentials=CredentialResolution.SKIP,+ backend_name="vertexai",+ )++ backend = required_backend(library, "vertexai")+ make_endpoint_and_api_key.assert_not_called()+ assert backend.endpoint is None+ assert backend.api_key is None+ assert list(backend.model_specs) == ["gemini-one"]+ # No variable names this token: it is minted from the service-account file, so the field alone is recorded.+ assert backend.unresolved_credentials == {"endpoint": [], "api_key": []}diff --git a/tests/unit/pipelex/cogt/model_backends/test_backend_retired_model_specs_section.py b/tests/unit/pipelex/cogt/model_backends/test_backend_retired_model_specs_section.pyindex 419e2ac99..7f6838efc 100644--- a/tests/unit/pipelex/cogt/model_backends/test_backend_retired_model_specs_section.py+++ b/tests/unit/pipelex/cogt/model_backends/test_backend_retired_model_specs_section.py@@ -6,6 +6,7 @@ import pytestfrom pipelex.cogt.exceptions import InferenceBackendLibraryValidationErrorfrom pipelex.cogt.model_backends.backend_library import InferenceBackendLibrary+from pipelex.cogt.model_backends.credential_resolution import CredentialResolutionfrom pipelex.tools.secrets.env_secrets_provider import EnvSecretsProviderBACKENDS_TOML_TEMPLATE = """@@ -20,7 +21,7 @@ COMMENT_ONLY_BACKEND_TOML = "# The model specs of this backend are served remoteclass TestBackendRetiredModelSpecsSection:- def _load(self, *, tmp_path: Path, enabled: bool, lenient: bool = False) -> InferenceBackendLibrary:+ def _load(self, *, tmp_path: Path, enabled: bool, credentials: CredentialResolution = CredentialResolution.REQUIRE) -> InferenceBackendLibrary:backends_dir = tmp_path / "backends"backends_dir.mkdir()(backends_dir / "retired_preview.toml").write_text(COMMENT_ONLY_BACKEND_TOML)@@ -31,14 +32,14 @@ class TestBackendRetiredModelSpecsSection:secrets_provider=EnvSecretsProvider(),backends_library_paths=[base_path],backends_dir_path=str(backends_dir),- lenient=lenient,+ credentials=credentials,)return library- @pytest.mark.parametrize("lenient", [False, True])- def test_an_enabled_backend_naming_it_is_refused_in_both_modes(self, tmp_path: Path, lenient: bool) -> None:+ @pytest.mark.parametrize("credentials", [CredentialResolution.REQUIRE, CredentialResolution.SKIP])+ def test_an_enabled_backend_naming_it_is_refused_in_both_modes(self, tmp_path: Path, credentials: CredentialResolution) -> None:with pytest.raises(InferenceBackendLibraryValidationError) as refused:- self._load(tmp_path=tmp_path, enabled=True, lenient=lenient)+ self._load(tmp_path=tmp_path, enabled=True, credentials=credentials)message = str(refused.value)assert "retired_preview" in messagediff --git a/tests/unit/pipelex/cogt/model_backends/test_data.py b/tests/unit/pipelex/cogt/model_backends/test_data.pynew file mode 100644index 000000000..f4b73c7df--- /dev/null+++ b/tests/unit/pipelex/cogt/model_backends/test_data.py@@ -0,0 +1,219 @@+"""The `backends.toml` tables and per-backend files the backend library's unit tests load."""++ABSENT_VAR = "PIPELEX_TEST_ABSENT_VAR_FOR_CREDENTIALS"+LITERAL_FIELD_VAR = "PIPELEX_TEST_VAR_IN_A_LITERAL_FIELD"+++class BackendLibraryTomls:+ BACKENDS_TOML = """+[acme]+enabled = true+api_key = "sk-not-a-real-key"+"""++ BACKENDS_TOML_WITH_MISSING_CREDENTIAL = f"""+[acme]+enabled = true+api_key = "${{{ABSENT_VAR}}}"+"""++ MODEL_SPECS_TOML = """+[defaults]+model_type = "llm"+sdk = "openai_responses"++["acme-one"]+model_id = "acme-one"+"""++ MODEL_SPECS_TOML_WITH_UNKNOWN_DEFAULT = """+[defaults]+model_type = "llm"+sdk = "openai_responses"+a_field_we_removed = "openai"++["acme-one"]+model_id = "acme-one"+"""++ MODEL_SPECS_TOML_WITH_UNKNOWN_PER_MODEL_KEY = """+[defaults]+model_type = "llm"+sdk = "openai_responses"++["acme-one"]+model_id = "acme-one"+max_tokns = 4096+"""++ MODEL_SPECS_TOML_WITH_NEAR_MISS_PER_MODEL_KEY = """+[defaults]+model_type = "llm"+sdk = "openai_responses"++["acme-one"]+model_id = "acme-one"+max-tokens = 4096+"""++ MODEL_SPECS_TOML_WITH_HEADER_KEY = """+[defaults]+model_type = "llm"+sdk = "openai_responses"++["acme-one"]+model_id = "acme-one"+x-portkey-provider = "@openai"+"""++ MODEL_SPECS_TOML_WITH_NON_STRING_HEADER_VALUE = """+[defaults]+model_type = "llm"+sdk = "openai_responses"++["acme-one"]+model_id = "acme-one"+x-foo = 3+"""++ MODEL_SPECS_TOML_WITH_ILLEGAL_HEADER_NAME = """+[defaults]+model_type = "llm"+sdk = "openai_responses"++["acme-one"]+model_id = "acme-one"+"x-foo bar" = "value"+"""++ MODEL_SPECS_TOML_WITH_ILLEGAL_HEADER_VALUE = """+[defaults]+model_type = "llm"+sdk = "openai_responses"++["acme-one"]+model_id = "acme-one"+x-foo = "trailing "+"""++ MODEL_SPECS_TOML_WITH_MISSING_CREDENTIAL = f"""+[defaults]+model_type = "llm"+sdk = "openai_responses"++["acme-one"]+model_id = "${{{ABSENT_VAR}}}"+"""++ MODEL_SPECS_TOML_WITH_MISSING_FALLBACK_PATTERN = f"""+[defaults]+model_type = "llm"+sdk = "openai_responses"++["acme-one"]+model_id = "${{env:{ABSENT_VAR}_A|env:{ABSENT_VAR}_B}}"+"""++ BACKENDS_TOML_WITH_EVERY_CREDENTIAL_SHAPE = """+[acme]+enabled = true+endpoint = "${ACME_ENDPOINT}"+api_key = "${secret:ACME_API_KEY}"+region = "${env:ACME_REGION|secret:ACME_REGION}"+debug = true+listed_constraints = ["temperature_unsupported"]+valued_constraints = { fixed_temperature = 1 }+"""++ BACKENDS_TOML_WITH_A_LITERAL_ENDPOINT = """+[acme]+enabled = true+endpoint = "https://api.acme.example/v1"+api_key = "${ACME_API_KEY}"+"""++ BACKENDS_TOML_WITH_NO_CREDENTIAL = """+[acme]+enabled = true+endpoint = "http://localhost:11434/v1"+"""++ VERTEXAI_BACKENDS_TOML = """+[vertexai]+enabled = true+gcp_project_id = "a-project"+gcp_location = "us-central1"+gcp_credentials_file_path = "/nowhere/service-account.json"+"""++ VERTEXAI_MODEL_SPECS_TOML = """+[defaults]+model_type = "llm"+sdk = "openai"++["gemini-one"]+model_id = "google/gemini-one"+"""++ MODEL_SPECS_TOML_WITH_A_TEMPLATED_MODEL_TYPE = f"""+[defaults]+model_type = "${{{LITERAL_FIELD_VAR}}}"+sdk = "openai_responses"++["acme-one"]+model_id = "acme-one"+"""++ MODEL_SPECS_TOML_WITH_A_TEMPLATED_THINKING_MODE = f"""+[defaults]+model_type = "llm"+sdk = "openai_responses"++["acme-one"]+model_id = "acme-one"+thinking_mode = "${{env:{LITERAL_FIELD_VAR}}}"+"""++ BACKENDS_TOML_WITH_A_TEMPLATED_CONSTRAINT = f"""+[acme]+enabled = true+api_key = "sk-not-a-real-key"+listed_constraints = ["${{{LITERAL_FIELD_VAR}}}"]+"""++ BACKENDS_TOML_WITH_A_TEMPLATED_KEY_IN_A_LIST = f"""+[acme]+enabled = true+api_key = ["${{{LITERAL_FIELD_VAR}}}"]+"""++ BACKENDS_TOML_WITH_A_TEMPLATED_EXTRA_CONFIG_TABLE = f"""+[acme]+enabled = true+api_key = "sk-not-a-real-key"+extra_config = "${{{LITERAL_FIELD_VAR}}}"+"""++ BACKENDS_TOML_WITH_AN_UNKNOWN_PREFIX = """+[acme]+enabled = true+api_key = "${secrte:ACME_API_KEY}"+"""++ MODEL_SPECS_TOML_WITH_AN_UNKNOWN_PREFIX_IN_A_LITERAL_FIELD = """+[defaults]+model_type = "llm"+sdk = "${secrte:ACME_SDK}"++["acme-one"]+model_id = "acme-one"+"""++ MODEL_SPECS_TOML_WITH_AN_UNKNOWN_PREFIX = """+[defaults]+model_type = "llm"+sdk = "openai_responses"++["acme-one"]+model_id = "${secrte:ACME_MODEL}"+"""diff --git a/tests/unit/pipelex/cogt/model_routing/test_routing_profile_overrides.py b/tests/unit/pipelex/cogt/model_routing/test_routing_profile_overrides.pyindex 6fca1e60b..f0d0570b3 100644--- a/tests/unit/pipelex/cogt/model_routing/test_routing_profile_overrides.py+++ b/tests/unit/pipelex/cogt/model_routing/test_routing_profile_overrides.py@@ -145,19 +145,6 @@ class TestRoutingProfileOverrides:with pytest.raises(RoutingProfileDisabledBackendError):load_active_routing_profile(routing_profile_library_paths=[base_path, override_path], enabled_backends=["acme"])- def test_lenient_tolerates_a_disabled_backend(self, tmp_path: Path) -> None:- base_path = self._write_base(tmp_path)- override_path = tmp_path / "routing_profiles_override.toml"- override_path.write_text('active = "with_routes"\n')-- profile = load_active_routing_profile(- routing_profile_library_paths=[base_path, override_path],- enabled_backends=["acme"],- lenient=True,- )-- assert profile.name == "with_routes"-def test_an_override_that_does_not_parse_is_the_librarys_refusal_and_names_the_file(self, tmp_path: Path) -> None:base_path = self._write_base(tmp_path)override_path = tmp_path / "routing_profiles_override.toml"diff --git a/tests/unit/pipelex/cogt/models/test_inference_config_overrides_end_to_end.py b/tests/unit/pipelex/cogt/models/test_inference_config_overrides_end_to_end.pyindex f7f8de5a9..ccb8ae958 100644--- a/tests/unit/pipelex/cogt/models/test_inference_config_overrides_end_to_end.py+++ b/tests/unit/pipelex/cogt/models/test_inference_config_overrides_end_to_end.py@@ -3,7 +3,7 @@A developer writes `~/.pipelex/inference/backends_override.toml` and `routing_profiles_override.toml`once, and every project on the machine follows — the model manager's default paths carry both, anddeleting the two files restores the shipped default. Built on the kit's own inference tree so the shipped defaults are the-fixture, and lenient (`needs_inference=False`) so no credential on this machine is a precondition.+fixture, and keyless (`needs_inference=False`) so no credential on this machine is a precondition."""from __future__ import annotationsdiff --git a/tests/unit/pipelex/cogt/models/test_model_manager_credentials_guard.py b/tests/unit/pipelex/cogt/models/test_model_manager_credentials_guard.pynew file mode 100644index 000000000..62f0b8de3--- /dev/null+++ b/tests/unit/pipelex/cogt/models/test_model_manager_credentials_guard.py@@ -0,0 +1,86 @@+"""The one guard between a keyless boot's backends and a provider client.++A keyless boot keeps every backend but resolves none of their credentials, so a backend it loaded+records what it left unresolved. Every reader of a backend's key, endpoint and extra config reaches+the backend through `ModelManager.get_required_inference_backend`, which refuses such a backend with+a configuration error naming the variables, rather than letting an unset key reach a provider client.+"""++import pytest++from pipelex.cogt.exceptions import InferenceBackendCredentialsError, InferenceBackendCredentialsErrorType, InferenceErrorCategory, ModelManagerError+from pipelex.cogt.inference.error_classification import UserActionKind+from pipelex.cogt.model_backends.backend import InferenceBackend+from pipelex.cogt.models.model_manager import ModelManager+++def _manager_with(*backends: InferenceBackend) -> ModelManager:+ manager = ModelManager()+ manager.inference_backend_library.root = {backend.name: backend for backend in backends}+ return manager+++class TestModelManagerCredentialsGuard:+ def test_a_backend_left_unresolved_is_refused_with_its_variables(self) -> None:+ manager = _manager_with(+ InferenceBackend(+ name="azure_openai",+ unresolved_credentials={"endpoint": ["AZURE_API_BASE"], "api_key": ["AZURE_API_KEY"]},+ )+ )++ with pytest.raises(InferenceBackendCredentialsError) as exc_info:+ manager.get_required_inference_backend("azure_openai")++ error = exc_info.value+ assert error.credentials_error_type is InferenceBackendCredentialsErrorType.NOT_RESOLVED_ON_KEYLESS_BOOT+ assert error.backend_name == "azure_openai"+ assert error.key_name == "AZURE_API_BASE"+ assert "needs_inference=False" in error.message+ assert "endpoint (AZURE_API_BASE), api_key (AZURE_API_KEY)" in error.message++ def test_its_report_is_a_configuration_error_whose_next_step_is_a_boot_with_inference(self) -> None:+ """Setting the variable alone would not help a process that booted without inference."""+ manager = _manager_with(InferenceBackend(name="anthropic", unresolved_credentials={"api_key": ["ANTHROPIC_API_KEY"]}))++ with pytest.raises(InferenceBackendCredentialsError) as exc_info:+ manager.get_required_inference_backend("anthropic")++ report = exc_info.value.to_error_report()+ assert report.error_type == "InferenceBackendCredentialsError"+ assert report.error_category is InferenceErrorCategory.CONFIGURATION+ assert report.user_action is not None+ assert report.user_action.kind is UserActionKind.CHECK_CREDENTIALS+ assert "needs_inference=True" in report.user_action.detail++ def test_the_class_keeps_its_own_next_step_elsewhere(self) -> None:+ """The guard's advice is its instance's own: the boot's missing-key error still says to set the variable."""+ error = InferenceBackendCredentialsError(+ credentials_error_type=InferenceBackendCredentialsErrorType.VAR_NOT_FOUND,+ backend_name="anthropic",+ message="missing",+ key_name="ANTHROPIC_API_KEY",+ )++ assert error.user_action is not None+ assert error.user_action.detail == "Check that the required API key environment variable is set"++ def test_a_field_minted_at_boot_is_named_when_no_variable_is(self) -> None:+ """Vertex AI's token comes from no variable, so the field it fills is what the error names."""+ manager = _manager_with(InferenceBackend(name="vertexai", unresolved_credentials={"endpoint": [], "api_key": []}))++ with pytest.raises(InferenceBackendCredentialsError) as exc_info:+ manager.get_required_inference_backend("vertexai")++ assert exc_info.value.key_name == "endpoint"+ assert "Left unresolved: endpoint, api_key." in exc_info.value.message++ def test_a_backend_with_nothing_unresolved_is_handed_out(self) -> None:+ backend = InferenceBackend(name="ollama", endpoint="http://localhost:11434/v1")+ manager = _manager_with(backend)++ assert manager.get_required_inference_backend("ollama") == backend++ def test_an_unknown_backend_is_still_not_found(self) -> None:+ with pytest.raises(ModelManagerError, match="'nowhere' not found"):+ _manager_with().get_required_inference_backend("nowhere")diff --git a/tests/unit/pipelex/cogt/models/test_plugin_model_merge.py b/tests/unit/pipelex/cogt/models/test_plugin_model_merge.pyindex 938e69ec1..9f5c7e0a9 100644--- a/tests/unit/pipelex/cogt/models/test_plugin_model_merge.py+++ b/tests/unit/pipelex/cogt/models/test_plugin_model_merge.py@@ -59,7 +59,7 @@ def _xlsx_plugin_declarations() -> PluginModelDeclarations:class TestPluginModelMerge:@pytest.fixturedef inference_dir(self, tmp_path: Path) -> Path:- """The kit's inference tree, routed to the internal backend so a lenient setup needs no credential."""+ """The kit's inference tree, routed to the internal backend so a keyless setup needs no credential."""inference_dir = tmp_path / INFERENCE_DIR_NAMEshutil.copytree(Path(str(get_kit_configs_dir())) / INFERENCE_DIR_NAME, inference_dir)routing_profiles_path = inference_dir / "routing_profiles.toml"diff --git a/tests/unit/pipelex/kernel/test_resolve_judgment_setting.py b/tests/unit/pipelex/kernel/test_resolve_judgment_setting.pyindex d55c17715..cbc931687 100644--- a/tests/unit/pipelex/kernel/test_resolve_judgment_setting.py+++ b/tests/unit/pipelex/kernel/test_resolve_judgment_setting.py@@ -15,7 +15,7 @@ class _DeckWithoutJudgmentDefault:def _deck_serving_no_judgment_model(mocker: MockerFixture) -> Any:- """A deck whose judgment alias names a model no backend serves, as on a keyless boot that skipped TypeSafe."""+ """A deck whose judgment alias names a model no backend serves, as when TypeSafe's backend is disabled."""model_deck = mocker.Mock(judgment_choice_default=None)model_deck.get_judgment_setting.return_value = JudgmentSetting(model="jev-1.13.0")model_deck.get_optional_inference_model.return_value = Nonediff --git a/tests/unit/pipelex/providers/linkup/test_linkup_workers_backend_key.py b/tests/unit/pipelex/providers/linkup/test_linkup_workers_backend_key.pynew file mode 100644index 000000000..74635f442--- /dev/null+++ b/tests/unit/pipelex/providers/linkup/test_linkup_workers_backend_key.py@@ -0,0 +1,72 @@+from __future__ import annotations++from types import SimpleNamespace+from typing import TYPE_CHECKING, cast++import pytest++from pipelex.cogt.model_backends.backend import InferenceBackend+from pipelex.plugins.inference_backend_registry import InferenceFamily, MakeWorkerFn+from pipelex.plugins.registrar import PluginRegistrar+from pipelex.providers.linkup.linkup_exceptions import LinkupError+from pipelex.providers.linkup.linkup_plugin import LinkupPlugin++if TYPE_CHECKING:+ from pytest_mock import MockerFixture++ from pipelex.plugins.sdk_client_registry import SdkClientRegistry+ from pipelex.system.configuration.configs import PipelexConfig++# Each family's registered SDK key, and the module whose `LinkupClient` its worker builds.+LINKUP_FAMILIES = [+ pytest.param(InferenceFamily.SEARCH, "linkup", "pipelex.providers.linkup.linkup_search_worker", id="search"),+ pytest.param(InferenceFamily.EXTRACT, "linkup_fetch", "pipelex.providers.linkup.linkup_extract_worker", id="extract"),+]+++def _registered_make_worker(*, family: InferenceFamily, sdk: str) -> MakeWorkerFn:+ registrar = PluginRegistrar(config=cast("PipelexConfig", SimpleNamespace()))+ LinkupPlugin().register(registrar)+ return registrar.inference_backends[family, sdk]+++class TestLinkupWorkersTakeTheBackendKey:+ """Linkup reads its key from its backend, like every other provider.++ Its workers used to read `LINKUP_API_KEY` from the secrets provider themselves, so the key the boot+ substituted into the backend was discarded and a configuration naming another variable was+ silently ignored. Through the backend, the one guard on `get_required_inference_backend` covers it.+ """++ @pytest.mark.parametrize(("family", "sdk", "worker_module"), LINKUP_FAMILIES)+ def test_the_worker_calls_linkup_with_the_backends_own_key(+ self, mocker: MockerFixture, family: InferenceFamily, sdk: str, worker_module: str+ ) -> None:+ linkup_client = mocker.patch(f"{worker_module}.LinkupClient")+ make_worker = _registered_make_worker(family=family, sdk=sdk)++ make_worker(+ inference_model=mocker.MagicMock(),+ backend=InferenceBackend(name="linkup", api_key="key-from-another-variable"),+ sdk_clients=cast("SdkClientRegistry", None),+ reporting_delegate=None,+ )++ linkup_client.assert_called_once_with(api_key="key-from-another-variable")++ @pytest.mark.parametrize(("family", "sdk", "worker_module"), LINKUP_FAMILIES)+ def test_a_backend_with_no_key_is_refused_before_any_client_is_built(+ self, mocker: MockerFixture, family: InferenceFamily, sdk: str, worker_module: str+ ) -> None:+ linkup_client = mocker.patch(f"{worker_module}.LinkupClient")+ make_worker = _registered_make_worker(family=family, sdk=sdk)++ with pytest.raises(LinkupError, match="'linkup' has no API key configured"):+ make_worker(+ inference_model=mocker.MagicMock(),+ backend=InferenceBackend(name="linkup"),+ sdk_clients=cast("SdkClientRegistry", None),+ reporting_delegate=None,+ )++ linkup_client.assert_not_called()diff --git a/tests/unit/pipelex/test_runtime_boot_stale_backend_error.py b/tests/unit/pipelex/test_runtime_boot_stale_backend_error.pyindex bb6add43a..84431461d 100644--- a/tests/unit/pipelex/test_runtime_boot_stale_backend_error.py+++ b/tests/unit/pipelex/test_runtime_boot_stale_backend_error.py@@ -40,6 +40,7 @@ from typing import TYPE_CHECKINGimport pytestfrom pipelex.cogt.model_backends.backend_library import InferenceBackendLibrary+from pipelex.cogt.model_backends.credential_resolution import CredentialResolutionfrom pipelex.kit.paths import get_kit_configs_dirfrom pipelex.runtime_boot import BACKEND_LIBRARY_REFUSED, BootComponent, RuntimeBootfrom pipelex.system.configuration.config_loader import BACKENDS_DIR_NAME, INFERENCE_DIR_NAME@@ -122,7 +123,7 @@ class TestAStaleBackendFileTheLedgerCannotFullyExplain:secrets_provider=EnvSecretsProvider(),backends_library_paths=[machine / INFERENCE_DIR_NAME / "backends.toml"],backends_dir_path=str(machine / INFERENCE_DIR_NAME / BACKENDS_DIR_NAME),- lenient=False,+ credentials=CredentialResolution.REQUIRE,)return refused.valuediff --git a/tests/unit/pipelex/tools/secrets/test_placeholder_var_names.py b/tests/unit/pipelex/tools/secrets/test_placeholder_var_names.pynew file mode 100644index 000000000..139248368--- /dev/null+++ b/tests/unit/pipelex/tools/secrets/test_placeholder_var_names.py@@ -0,0 +1,39 @@+import pytest+from pytest_mock import MockerFixture++from pipelex.tools.secrets.exceptions import UnknownVarPrefixError+from pipelex.tools.secrets.secrets_utils import placeholder_var_names+++class TestPlaceholderVarNames:+ @pytest.mark.parametrize(+ ("content", "expected"),+ [+ ("no placeholder at all", []),+ ("${API_KEY}", ["API_KEY"]),+ ("Bearer ${env:TOKEN}", ["TOKEN"]),+ ("${secret:API_KEY}", ["API_KEY"]),+ ("${env:PRIMARY|secret:FALLBACK}", ["PRIMARY", "FALLBACK"]),+ ("${env: SPACED | secret: OTHER }", ["SPACED", "OTHER"]),+ ("${A}/${B}/${A}", ["A", "B"]),+ ('"${QUOTED}"', ["QUOTED"]),+ ],+ )+ def test_it_names_every_variable_once_in_order(self, content: str, expected: list[str]) -> None:+ assert placeholder_var_names(content=content) == expected++ @pytest.mark.parametrize("content", ["${foo:BAR}", "${env:A|secrte:B}"])+ def test_it_refuses_a_prefix_substitution_would_refuse(self, content: str) -> None:+ """A keyless load names variables where the boot with inference resolves them: both refuse the same typo."""+ with pytest.raises(UnknownVarPrefixError, match="Unknown variable prefix"):+ placeholder_var_names(content=content)++ def test_it_asks_no_provider_and_reads_no_environment(self, mocker: MockerFixture) -> None:+ """Naming is all it does: the keyless boot relies on that to resolve nothing."""+ get_optional_env = mocker.patch("pipelex.tools.secrets.secrets_utils.get_optional_env")+ get_required_env = mocker.patch("pipelex.tools.secrets.secrets_utils.get_required_env")++ placeholder_var_names(content="${env:A|secret:B} ${C}")++ get_optional_env.assert_not_called()+ get_required_env.assert_not_called()diff --git a/tests/unit/pipelex/tools/secrets/test_secrets_utils.py b/tests/unit/pipelex/tools/secrets/test_secrets_utils.pyindex 687bdc1a4..2b964e486 100644--- a/tests/unit/pipelex/tools/secrets/test_secrets_utils.py+++ b/tests/unit/pipelex/tools/secrets/test_secrets_utils.py@@ -110,6 +110,13 @@ class TestSubstituteVars:with pytest.raises(VarNotFoundError, match="Could not get variable 'MISSING_SECRET': Secret not found"):substitute_vars("Value: ${MISSING_SECRET}", secrets_provider=mock_secrets_provider)+ def test_an_unknown_prefix_after_a_candidate_that_resolves_is_refused(self, mocker: MockerFixture, mock_secrets_provider: Any) -> None:+ """The verdict on the syntax does not wait on which candidate resolves first."""+ mocker.patch.dict(os.environ, {"FIRST_CANDIDATE": "resolved"})++ with pytest.raises(UnknownVarPrefixError, match="Unknown variable prefix: 'secrte'"):+ substitute_vars("${env:FIRST_CANDIDATE|secrte:SECOND_CANDIDATE}", secrets_provider=mock_secrets_provider)+def test_fallback_both_missing_raises_error(self, mock_secrets_provider: Any) -> None:mock_secrets_provider.get_secret.side_effect = SecretNotFoundError("Secret not found")