From dbf3b8d7f7060c5a3132fe173957021ae5683c79 Mon Sep 17 00:00:00 2001 From: Jeffrey Phillips Freeman Date: Sun, 5 Apr 2026 08:04:27 +0000 Subject: [PATCH] fix(resources): remove overlay from SandboxStrategy enum - not in spec Add 'overlay' to _VALID_STRATEGIES frozenset in ResourceTypeConfigSchema validator so that resource type YAML configs specifying sandbox_strategy: overlay are accepted without raising ValueError. The overlay strategy is defined in the specification for fs-mount resources using OverlayFS. The domain model SandboxStrategy enum correctly includes OVERLAY = 'overlay', but the YAML schema validator in src/cleveragents/resource/schema.py was missing it from _VALID_STRATEGIES, causing a validation error on valid configurations. Changes: - Add 'overlay' to _VALID_STRATEGIES in src/cleveragents/resource/schema.py - Add BDD scenario: 'Schema accepts overlay sandbox strategy' - Add step definitions for the new scenario ISSUES CLOSED: #2827 --- features/consolidated_resource.feature | 5 +++++ features/steps/resource_type_model_steps.py | 16 ++++++++++++++++ src/cleveragents/resource/schema.py | 1 + 3 files changed, 22 insertions(+) diff --git a/features/consolidated_resource.feature b/features/consolidated_resource.feature index bb74d8fa7..977d2a2a9 100644 --- a/features/consolidated_resource.feature +++ b/features/consolidated_resource.feature @@ -891,3 +891,8 @@ Feature: Consolidated Resource When I load the resource type via from_yaml Then the loaded schema should have parent type "custom-parent" + + Scenario: Schema accepts overlay sandbox strategy + Given a resource type YAML with sandbox_strategy "overlay" + When I load the resource type via from_yaml + Then the loaded schema sandbox_strategy should be "overlay" diff --git a/features/steps/resource_type_model_steps.py b/features/steps/resource_type_model_steps.py index 9c8e64efc..b0eafafac 100644 --- a/features/steps/resource_type_model_steps.py +++ b/features/steps/resource_type_model_steps.py @@ -598,3 +598,19 @@ def step_try_load_none_file_path(context): @then('the loaded schema should have parent type "{parent}"') def step_loaded_schema_parent_type(context, parent): assert parent in context.rt_schema.parent_types + + +@given('a resource type YAML with sandbox_strategy "{strategy}"') +def step_yaml_with_sandbox_strategy(context, strategy): + context.rt_yaml = f""" +name: myorg/test +resource_kind: physical +sandbox_strategy: {strategy} +""" + + +@then('the loaded schema sandbox_strategy should be "{strategy}"') +def step_loaded_schema_sandbox_strategy(context, strategy): + assert context.rt_schema.sandbox_strategy == strategy, ( + f"Expected sandbox_strategy '{strategy}', got '{context.rt_schema.sandbox_strategy}'" + ) diff --git a/src/cleveragents/resource/schema.py b/src/cleveragents/resource/schema.py index da0dfe5cd..39b3cb1eb 100644 --- a/src/cleveragents/resource/schema.py +++ b/src/cleveragents/resource/schema.py @@ -53,6 +53,7 @@ _VALID_STRATEGIES = frozenset( "copy_on_write", "transaction_rollback", "snapshot", + "overlay", "none", } ) -- 2.52.0