051ee7c290
CI / benchmark-publish (pull_request) Has been skipped
CI / lint (pull_request) Successful in 21s
CI / quality (pull_request) Successful in 31s
CI / typecheck (pull_request) Successful in 47s
CI / security (pull_request) Successful in 52s
CI / build (pull_request) Successful in 56s
CI / e2e_tests (pull_request) Successful in 5m1s
CI / integration_tests (pull_request) Successful in 5m30s
CI / unit_tests (pull_request) Successful in 5m42s
CI / docker (pull_request) Successful in 58s
CI / coverage (pull_request) Successful in 7m35s
CI / build (push) Successful in 21s
CI / docker (push) Has been skipped
CI / benchmark-regression (pull_request) Failing after 49m24s
CI / lint (push) Successful in 22s
CI / quality (push) Successful in 39s
CI / security (push) Successful in 48s
CI / typecheck (push) Successful in 1m26s
CI / benchmark-regression (push) Has been skipped
CI / e2e_tests (push) Successful in 5m53s
CI / coverage (push) Successful in 9m4s
CI / benchmark-publish (push) Successful in 19m10s
CI / integration_tests (push) Failing after 19m18s
CI / unit_tests (push) Failing after 19m20s
Added 52 new .feature files and corresponding _steps.py files targeting previously uncovered code paths in the following areas: - TUI layer: app, commands, persona (state/schema/registry), widgets, input (shell_exec, reference_parser) - Application services: plan lifecycle/service/executor, session, project, repo indexing, correction, checkpoint, actor, llm_actors, strategy coordinator, resource file watcher, service retry wiring - CLI commands: session, resource, repl, plan, db, automation_profile - Domain models: retry_policy, resource_type, cost_budget, docker_compose_analyzer, detail_level, _sql_string_aware, _postgresql_helpers - Core: circuit_breaker, retry_service_patterns - Infrastructure: repositories, transaction_sandbox, strategy_registry, plugins/loader, container - Config: settings - Agents: plan_generation, context_analysis, auto_debug - A2A: facade All new tests follow the Behave/Gherkin BDD standard. Resolved step definition collisions with unique prefixes. Fixed Alembic fileConfig logger disabling issue (disable_existing_loggers=False). ISSUES CLOSED: #1068
147 lines
7.6 KiB
Gherkin
147 lines
7.6 KiB
Gherkin
Feature: Container executor coverage boost
|
|
Additional scenarios that exercise previously uncovered code paths
|
|
in container_executor.py (lines 184-185, 536-545, 555-570, and helpers).
|
|
|
|
Background:
|
|
Given the container executor coverage module is imported
|
|
|
|
# =========================================================================
|
|
# Symlink default sandbox path rejection (lines 184-185)
|
|
# =========================================================================
|
|
|
|
Scenario: ContainerToolExecutor rejects symlink default sandbox path
|
|
Given the default sandbox path is a symlink
|
|
When I try to create a ContainerToolExecutor with empty host_sandbox_path
|
|
Then a ContainerExecutionError should be raised about symlink default sandbox
|
|
|
|
# =========================================================================
|
|
# Real subprocess.TimeoutExpired handling in _run_command (lines 536-545)
|
|
# =========================================================================
|
|
|
|
Scenario: _run_command handles subprocess.TimeoutExpired by killing the process
|
|
Given I have a container executor with a Popen mock that raises TimeoutExpired on wait
|
|
When I invoke _run_command with the timeout-raising command
|
|
Then the exec result should indicate timed_out true
|
|
And the exec result stderr should mention "timed out"
|
|
And the exec result exit_code should be -1
|
|
And the mock process should have been killed
|
|
|
|
# =========================================================================
|
|
# stdout truncation defense-in-depth (lines 555-562)
|
|
# =========================================================================
|
|
|
|
Scenario: _run_command truncates oversized stdout from _read_bounded
|
|
Given I have a container executor with _read_bounded returning oversized stdout
|
|
When I invoke _run_command for the oversized stdout scenario
|
|
Then the exec result stdout length in bytes should not exceed MAX_OUTPUT_BYTES
|
|
|
|
# =========================================================================
|
|
# stderr truncation defense-in-depth (lines 563-570)
|
|
# =========================================================================
|
|
|
|
Scenario: _run_command truncates oversized stderr from _read_bounded
|
|
Given I have a container executor with _read_bounded returning oversized stderr
|
|
When I invoke _run_command for the oversized stderr scenario
|
|
Then the exec result stderr length in bytes should not exceed MAX_OUTPUT_BYTES
|
|
|
|
# =========================================================================
|
|
# _read_bounded helper edge cases (lines 736-740)
|
|
# =========================================================================
|
|
|
|
Scenario: _read_bounded drains stream beyond the byte cap without keeping data
|
|
Given I have a stream with data exceeding the byte cap
|
|
When I call _read_bounded with a small max_bytes limit
|
|
Then the returned bytes should be exactly max_bytes long
|
|
And the stream should have been fully consumed
|
|
|
|
Scenario: _read_bounded slices a partial chunk when crossing the byte boundary
|
|
Given I have a stream where a chunk crosses the max_bytes boundary
|
|
When I call _read_bounded with a boundary-crossing limit
|
|
Then the returned bytes should be exactly the boundary limit
|
|
|
|
# =========================================================================
|
|
# _looks_like_path branch coverage for \r and \t (line 759)
|
|
# =========================================================================
|
|
|
|
Scenario: _looks_like_path rejects strings with carriage return
|
|
When I check whether a string with carriage return looks like a path
|
|
Then the path check result should be false
|
|
|
|
Scenario: _looks_like_path rejects strings with tab characters
|
|
When I check whether a string with tab character looks like a path
|
|
Then the path check result should be false
|
|
|
|
Scenario: _looks_like_path rejects non-absolute paths
|
|
When I check whether a relative string looks like a path
|
|
Then the path check result should be false
|
|
|
|
# =========================================================================
|
|
# _parse_output RecursionError / MemoryError fallback (line 712)
|
|
# =========================================================================
|
|
|
|
Scenario: _parse_output falls back to raw_output on RecursionError from json.loads
|
|
Given json.loads is patched to raise RecursionError
|
|
When I call _parse_output with a non-empty string
|
|
Then the parsed result should contain raw_output with the stripped string
|
|
|
|
Scenario: _parse_output falls back to raw_output on MemoryError from json.loads
|
|
Given json.loads is patched to raise MemoryError
|
|
When I call _parse_output with a non-empty JSON-like string
|
|
Then the parsed result should contain raw_output with the stripped string
|
|
|
|
# =========================================================================
|
|
# _run_command OSError branch at Popen level (line 582-590)
|
|
# =========================================================================
|
|
|
|
Scenario: _run_command catches OSError when Popen itself fails
|
|
Given I have a container executor with Popen raising OSError
|
|
When I invoke _run_command for the OSError scenario
|
|
Then the exec result should indicate failure with OSError message
|
|
And the exec result timed_out should be false
|
|
|
|
# =========================================================================
|
|
# _map_value_host_to_container with non-path strings (line 624)
|
|
# =========================================================================
|
|
|
|
Scenario: _map_value_host_to_container returns non-path strings unchanged
|
|
Given I have a coverage boost container executor with path mapping
|
|
When I map an input dict containing non-path string values
|
|
Then non-path string values should remain unchanged
|
|
|
|
# =========================================================================
|
|
# _map_value_container_to_host with non-path strings
|
|
# =========================================================================
|
|
|
|
Scenario: _map_value_container_to_host returns non-path strings unchanged
|
|
Given I have a coverage boost container executor with path mapping
|
|
When I map an output dict containing non-path string values
|
|
Then non-path output string values should remain unchanged
|
|
|
|
# =========================================================================
|
|
# _run_command stdin_data piping via Popen (lines 524-528)
|
|
# =========================================================================
|
|
|
|
Scenario: _run_command pipes stdin_data to the subprocess
|
|
Given I have a container executor with a Popen mock that accepts stdin
|
|
When I invoke _run_command with stdin_data provided
|
|
Then stdin should have been written with the encoded data
|
|
And stdin should have been closed after writing
|
|
|
|
# =========================================================================
|
|
# _build_exec_command with low timeout producing container_timeout=1
|
|
# =========================================================================
|
|
|
|
Scenario: _build_exec_command clamps container-side timeout to minimum of 1
|
|
Given I have a coverage boost container executor with devcontainer binary
|
|
When I build an exec command with timeout value 3
|
|
Then the container-side timeout in the command should be 1 or greater
|
|
|
|
# =========================================================================
|
|
# _run_command with process streams still open in finally block
|
|
# =========================================================================
|
|
|
|
Scenario: _run_command closes all process streams in finally block
|
|
Given I have a container executor with a Popen mock with open streams
|
|
When I invoke _run_command for the stream cleanup scenario
|
|
Then all process streams should have been closed
|