feat(resource): add --clone-into to container-instance and fix devcontainer-instance sandbox strategy #8304

Merged
HAL9000 merged 11 commits from feat/m6/devcontainer-clone-into-sandbox into master 2026-06-03 00:57:15 +00:00

11 Commits

Author SHA1 Message Date
HAL9000 93f6cc703c fix(tests): use valid ULID and classification in clone-into step fixture
CI / push-validation (pull_request) Successful in 29s
CI / helm (pull_request) Successful in 42s
CI / lint (pull_request) Successful in 50s
CI / build (pull_request) Successful in 52s
CI / quality (pull_request) Successful in 53s
CI / typecheck (pull_request) Successful in 58s
CI / security (pull_request) Successful in 1m32s
CI / unit_tests (pull_request) Successful in 6m15s
CI / docker (pull_request) Successful in 1m38s
CI / integration_tests (pull_request) Successful in 10m5s
CI / coverage (pull_request) Successful in 12m43s
CI / status-check (pull_request) Successful in 3s
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
2026-06-02 20:37:35 -04:00
HAL9000 d384cebc9d fix(resource): update stale DETECTED→DISCOVERED scenario title in protocol methods
The devcontainer_handler_protocol_methods.feature file and its step
definitions still referenced the old ContainerLifecycleState.DETECTED
terminology. Update to DISCOVERED for consistency with specification.

ISSUES CLOSED: #7555
2026-06-02 20:37:35 -04:00
HAL9000 fa215f86c6 fix(resource): move inline imports to top and remove redundant import
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.
2026-06-02 20:37:35 -04:00
HAL9000 750148360e ci: retrigger CI after infrastructure failure (attempt 2) 2026-06-02 20:37:35 -04:00
HAL9000 473c1442eb ci: retrigger CI after infrastructure failure 2026-06-02 20:37:35 -04:00
HAL9000 c11ddc9bbf fix(resource): fix ruff format violations in container_clone_into_steps.py
Move inline imports to top-level in container_clone_into_steps.py and fix ruff format violations that were causing CI lint failures.
2026-06-02 20:37:35 -04:00
HAL9000 24026d26ea fix(resource): wire --clone-into into DevcontainerHandler.resolve() runtime path
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
2026-06-02 20:37:35 -04:00
HAL9000 811ef70e8f fix(db): add missing session.commit() in CheckpointRepository.prune()
The prune method was calling session.flush() but never committing the
transaction, causing the deleted checkpoints to not be persisted to the
database. This fix adds the missing session.commit() call to ensure
changes are properly committed.
2026-06-02 20:37:35 -04:00
HAL9000 592ea175da fix(resource): update validate_clone_into_url to raise ValueError for invalid URLs
- 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
2026-06-02 20:37:35 -04:00
HAL9000 2ea588f395 fix(resource): align DETECTED->DISCOVERED rename and remove build artifacts
- Remove committed build artifacts (test_reports/summary.txt,
  test_reports/test_results.json) and add test_reports/ to .gitignore
- Fix CLI resource.py: update lifecycle state condition and warning
  banner from 'detected (not built)' to 'discovered (not built)' and
  'Devcontainer detected' to 'Devcontainer discovered' to align with
  ContainerLifecycleState.DISCOVERED rename
- Fix BDD feature file: update resource_list_lifecycle_state.feature
  scenario title and assertion from 'Devcontainer detected' to
  'Devcontainer discovered'
- Fix robot/helper_devcontainer_lifecycle.py: update enum value check
  from 'detected' to 'discovered' in cmd_enum_values()
- Fix robot/helper_devcontainer_handler.py: update strategy check
  assertion from 'none' to 'snapshot' to match PR #8304 change
- Update CONTRIBUTORS.md with HAL 9000 feature contribution entry

Closes #7555 (via PR #8304)

Fixes: CI unit_tests and integration_tests failures from PR #8304
2026-06-02 20:37:35 -04:00
HAL9000 619e8eff36 feat(resource): add --clone-into to container-instance and fix devcontainer-instance sandbox strategy
- 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
2026-06-02 20:37:35 -04:00