# robson-execution-workflow

Docker orchestration and Claude AI integration for running task implementations inside containers.

## Modules

### Docker

- Crate: `robson-connector-docker` (`DockerSession`, `parse_docker_compose()`, `connect_docker()`, `ContainerConfig`, `run_claude_in_container()` — uses `robson_connector_claude::resolve_claude_executable` for the in-container CLI path)
- This plugin depends on it and re-exports the same symbols at the crate root for convenience

### Claude integration

- Crate: `robson-connector-claude` (prompt builders, `evaluate_task()`, `implement_in_repo()`, `resolve_claude_executable`, JSON parsing)
- This plugin depends on it and re-exports the same symbols at the crate root for convenience

## Public Types

```rust
pub struct DockerSession { /* container IDs, network name, volumes */ }
pub struct ContainerConfig { cpu_limit, memory_limit, always_pull, docker_host }
pub struct DockerComposeInfo { services: Vec<ServiceConfig>, project_name: String }
pub struct ServiceConfig { image, environment, ports, volumes, depends_on, command, entrypoint, healthcheck }
pub struct ContainerOutput { exit_code: i64, stdout: String, stderr: String }
```

## Key Details

- Docker via `bollard` crate (Unix socket; configurable via `container.docker_host`)
- Project name format: `robson{task_id}{8-char-uuid}` — alphanumeric only, no hyphens
- Network: `{project_name}_default` — auto-created
- Support services start in topological order (respecting `depends_on`)
- Healthcheck: waits up to `interval × retries + start_period` ms
- Image pull: skipped if present locally unless `always_pull = true`
- Fallback: if no `docker-compose.yml` or `dev = true`, runs Claude directly without Docker
- `evaluate_task()` parses Claude output to detect pass/fail
- `ContainerConfig` implements `Default`

## Dependencies

- `robson-connector-docker` (bollard, compose parsing, `ContainerConfig`)
- `robson-connector-claude` (CLI prompts and host/container binary resolution)

## Tests

- `crates/robson-connector-docker/tests/docker_tests.rs` — parse_docker_compose, generate_project_name (no Docker daemon required)
- `crates/robson-connector-claude/tests/claude_tests.rs` — prompt composition and evaluation logic
- `tests/validation_tests.rs` — scan_for_misplaced_tests and compose_test_correction_prompt

## Testing Rules — MANDATORY

**Tests must only be placed in `tests/`.**

- Never write `#[test]` or `#[cfg(test)]` inside `src/` files
- The only valid location is `crates/robson-implementation-workflow/tests/*.rs`
