Implemented removal of the type: ignore in SandboxManager strategy assignment by introducing a proper typing.cast usage and added tests to cover the new path.
- What was implemented
- Added from typing import cast to src/cleveragents/infrastructure/sandbox/manager.py.
- Replaced strategy = boundary_resource.sandbox_strategy # type: ignore[assignment] with strategy = cast("SandboxStrategyStr", boundary_resource.sandbox_strategy) at line 618 in get_or_create_sandbox_for_resource.
- The cast is semantically correct: SandboxStrategy (StrEnum) values are exactly the same string set as SandboxStrategyStr (Literal), so the cast is a truthful type assertion with zero runtime overhead.
- Added features/sandbox_manager_strategy_cast.feature with 2 Behave scenarios exercising the cast conversion path.
- Added features/steps/sandbox_manager_strategy_cast_steps.py with step definitions.
- Key design decisions
- Used cast() from typing rather than SandboxStrategyStr(...) constructor call, because SandboxStrategyStr is a Literal type alias (not a callable), so calling it as a constructor would fail at runtime.
- Used string form "SandboxStrategyStr" in the cast call because the file uses from __future__ import annotations.
- Mocked the boundary cache in tests to avoid DAG traversal, following the pattern established in sandbox_manager_coverage_r3_steps.py.
- Affected modules/components
- src/cleveragents/infrastructure/sandbox/manager.py
- features/sandbox_manager_strategy_cast.feature
- features/steps/sandbox_manager_strategy_cast_steps.py
- Testing considerations
- The new Behave scenarios exercise the cast path in isolation, reducing DAG traversal concerns and aligning with existing testing patterns.
ISSUES CLOSED: #2828