From 4978e3c9b044ec088538db18d25ff798d75f37d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20Fu=C3=9Fberger?= Date: Fri, 18 Sep 2026 07:40:47 +0200 Subject: [PATCH] Make fallback_run_target mandatory --- .../config_schema/launch_manager.schema.json | 3 ++- scripts/config_mapping/integration_tests.py | 2 -- scripts/config_mapping/lifecycle_config.py | 6 ------ .../input/lm_config.json | 5 ++++- scripts/config_mapping/unit_tests.py | 18 +++++++++++------- 5 files changed, 17 insertions(+), 17 deletions(-) diff --git a/score/launch_manager/src/daemon/src/configuration/config_schema/launch_manager.schema.json b/score/launch_manager/src/daemon/src/configuration/config_schema/launch_manager.schema.json index 858d6ab447..2fcac9a4ef 100644 --- a/score/launch_manager/src/daemon/src/configuration/config_schema/launch_manager.schema.json +++ b/score/launch_manager/src/daemon/src/configuration/config_schema/launch_manager.schema.json @@ -533,7 +533,8 @@ }, "required": [ "schema_version", - "initial_run_target" + "initial_run_target", + "fallback_run_target" ], "additionalProperties": false } diff --git a/scripts/config_mapping/integration_tests.py b/scripts/config_mapping/integration_tests.py index 076134da18..f9a9786d9f 100644 --- a/scripts/config_mapping/integration_tests.py +++ b/scripts/config_mapping/integration_tests.py @@ -170,7 +170,6 @@ def test_custom_validation_failures(schema_file): Test that custom validation checks implemented in lifecycle_config.py are correctly identifying invalid configurations. The input configuration contains the following issues: * The run target "Minimal" has a recovery action that switches to a run target "Fallback" instead of "fallback_run_target" - * The mandatory "fallback_run_target" is missing from the configuration * Reserved name "fallback_run_target" is used for a RunTarget name which is not allowed """ test_name = "custom_validation_failures_test" @@ -188,7 +187,6 @@ def test_custom_validation_failures(schema_file): expected_errors = [ 'recovery RunTarget must be set to "fallback_run_target"', - "fallback_run_target is a mandatory configuration", 'RunTarget name "fallback_run_target" is reserved', ] actual_error_output = e.stderr diff --git a/scripts/config_mapping/lifecycle_config.py b/scripts/config_mapping/lifecycle_config.py index 4be32df4a3..308164e3db 100644 --- a/scripts/config_mapping/lifecycle_config.py +++ b/scripts/config_mapping/lifecycle_config.py @@ -572,12 +572,6 @@ def custom_validations(config): ) success = False - if "fallback_run_target" not in config: - report_error( - "fallback_run_target is a mandatory configuration but was not found in the config." - ) - success = False - try: check_cyclic_dependencies(config) except ValueError as e: diff --git a/scripts/config_mapping/tests/custom_validation_failures_test/input/lm_config.json b/scripts/config_mapping/tests/custom_validation_failures_test/input/lm_config.json index eea99d69b5..1094bd5337 100644 --- a/scripts/config_mapping/tests/custom_validation_failures_test/input/lm_config.json +++ b/scripts/config_mapping/tests/custom_validation_failures_test/input/lm_config.json @@ -42,5 +42,8 @@ } } }, - "initial_run_target": "Minimal" + "initial_run_target": "Minimal", + "fallback_run_target": { + "depends_on": [] + } } \ No newline at end of file diff --git a/scripts/config_mapping/unit_tests.py b/scripts/config_mapping/unit_tests.py index b717ecf442..556ed726b3 100644 --- a/scripts/config_mapping/unit_tests.py +++ b/scripts/config_mapping/unit_tests.py @@ -744,12 +744,6 @@ def test_custom_validations_ready_condition_both_states(full_valid_config): assert custom_validations(full_valid_config) is False -def test_custom_validations_missing_fallback_run_target(full_valid_config): - """fallback_run_target is mandatory.""" - del full_valid_config["fallback_run_target"] - assert custom_validations(full_valid_config) is False - - def test_custom_validations_cyclic_deps_fails(full_valid_config): """Cyclic dependencies from check_cyclic_dependencies should be caught.""" full_valid_config["components"]["c1"] = { @@ -766,7 +760,6 @@ def test_custom_validations_multiple_errors(full_valid_config): """When multiple validations fail all errors are reported and result is False.""" full_valid_config["run_targets"]["fallback_run_target"] = {"depends_on": []} full_valid_config["run_targets"]["app1"] = {"depends_on": []} - del full_valid_config["fallback_run_target"] assert custom_validations(full_valid_config) is False @@ -1406,3 +1399,14 @@ def test_schema_validation_rejects_out_of_range_ms_field(schema_file): schema_validation(_minimal_config_with_ready_timeout_ms(4294967296), schema) is False ) + + +def test_schema_validation_requires_fallback_run_target(schema_file): + """fallback_run_target is a mandatory top-level property in the schema.""" + schema = load_json_file(schema_file) + + config = _minimal_config_with_ready_timeout_ms(500) + assert schema_validation(config, schema) is True + + del config["fallback_run_target"] + assert schema_validation(config, schema) is False