Resource Pydantic model requires resource_id to match the ULID pattern
^[0-9A-HJKMNP-TV-Z]{26}$ and classification to be 'physical' or
'virtual'. The test fixture used '01HANDLER0000000000000001' (invalid
ULID) and 'tool' (invalid enum), causing a ValidationError during
scenario setup that Behave reported as a traceback outside scenario.
Fixes the errored scenario in features/container_clone_into.feature:88.
ISSUES CLOSED: #7555
Addresses remaining CI review feedback from HAL9001 on PR #8304:
1. Moved all cleveragents imports from inside function bodies to module-level
in features/steps/container_clone_into_steps.py (5 functions fixed)
2. Moved BUILTIN_TYPES import from inside step_look_up_in_builtin_types()
to module level in features/steps/devcontainer_sandbox_strategy_steps.py
3. Removed redundant inline import of EMPTY_CONTENT_HASH and BaseResourceHandler
inside diff() method of devcontainer.py (already available at module level)
4. Fixed stale docstring referencing old 'detected' terminology in
robot/helper_devcontainer_lifecycle.py cmd_transition_valid()
All files pass ruff format and ruff check.
The --clone-into CLI argument was registered and the helper
clone_repo_into_container() was implemented, but DevcontainerHandler.resolve()
never read the clone_into property or called the helper. This meant that
agents resource add container-instance --clone-into <url> silently ignored
the flag at runtime (acceptance criterion #2 from issue #7555 was unmet).
Wire the clone step into DevcontainerHandler.resolve(): after
activate_container() returns and the lifecycle tracker has a container_id,
validate the URL and call clone_repo_into_container(). Also add an
end-to-end BDD scenario that exercises the full handler to clone path via
mocks.
ISSUES CLOSED: #7555
- Change validate_clone_into_url() return type from bool to None
- Raise ValueError for empty or invalid git repository URLs
- Update BDD steps to catch ValueError and set clone_url_valid accordingly
- Aligns with contract requirement from PR #8304 review feedback
- Adds a --clone-into option to the container-instance command to clone repository contents into a specified path during container setup.
- Fixes the devcontainer-instance sandbox strategy to ensure proper isolation, correct mount permissions, and deterministic behavior across environments.
- Updates related validation and error handling to reflect the new option and sandbox changes.
ISSUES CLOSED: #7555