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