From e201aa07c9fde8753a011e0a5ce86e112274de3f Mon Sep 17 00:00:00 2001 From: Jeffrey Phillips Freeman Date: Mon, 6 Apr 2026 06:53:57 +0000 Subject: [PATCH] fix(resource): add overlay to ResourceTypeConfigSchema._VALID_STRATEGIES Implemented test coverage and documentation updates to ensure overlay is properly recognized and communicated across the sandbox strategy validation surface. - Verification: Confirmed that overlay already exists in the _VALID_STRATEGIES frozenset within src/cleveragents/resource/schema.py (introduced in a prior commit that closed issue #2827). - Comprehensive audit: Audited strategy validation points to ensure consistency: - _VALID_STRATEGIES in schema.py - _IMPLEMENTED_STRATEGIES and _SUPPORTED_STRATEGIES in factory.py - SandboxStrategy enum definitions in both resource.py and resource_type.py All include overlay as an allowed strategy. - Tests: Added a new BDD scenario titled: "Invalid sandbox_strategy error message lists overlay as allowed" to features/consolidated_resource.feature. This asserts that validation errors explicitly list overlay among the allowed values when an invalid strategy is used. - Documentation: Updated docstring in src/cleveragents/infrastructure/sandbox/strategy_registry.py to reflect that the built-in SandboxFactory handles six strategies, including snapshot and overlay. - Design considerations: The fix itself was already applied in a previous commit (dbf3b8d7) addressing #2827. Issue #3614, raised by the UAT bot, required additional test coverage and accurate documentation of the available strategies. - Impact: No behavioral changes beyond ensuring test coverage and documentation are aligned with the existing implementation. The added test guarantees that error messages remain accurate and comprehensive as strategies evolve. - Affected areas: resource/schema.py, factory.py, resource.py, resource_type.py, features/consolidated_resource.feature, strategy_registry.py. ISSUES CLOSED: #3614 --- features/consolidated_resource.feature | 6 ++++++ .../infrastructure/sandbox/strategy_registry.py | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/features/consolidated_resource.feature b/features/consolidated_resource.feature index c70e04727..b0a6e6908 100644 --- a/features/consolidated_resource.feature +++ b/features/consolidated_resource.feature @@ -895,3 +895,9 @@ Feature: Consolidated Resource 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" + + + Scenario: Invalid sandbox_strategy error message lists overlay as allowed + Given a resource type YAML with invalid sandbox_strategy + When I try to load the resource type via from_yaml + Then the schema loader should fail with "overlay" diff --git a/src/cleveragents/infrastructure/sandbox/strategy_registry.py b/src/cleveragents/infrastructure/sandbox/strategy_registry.py index 5d7335f7a..79e598326 100644 --- a/src/cleveragents/infrastructure/sandbox/strategy_registry.py +++ b/src/cleveragents/infrastructure/sandbox/strategy_registry.py @@ -81,8 +81,8 @@ class SandboxStrategyRegistry: :class:`SandboxStrategyProtocol` at registration time. Built-in strategies (``none``, ``git_worktree``, ``copy_on_write``, - ``transaction_rollback``) are not managed by this registry; they - are handled by :class:`SandboxFactory`. + ``transaction_rollback``, ``snapshot``, ``overlay``) are not managed + by this registry; they are handled by :class:`SandboxFactory`. Usage:: -- 2.52.0